Client is throwing `READ` error when requesting healthy HTTP endpoints.
RobinQu opened this issue · 4 comments
RobinQu commented
I am having trouble to consume endpoints of Ollama.app, while curl and debug utilities like Postman are working just fine.
Envrionment
conan detected profile
arch=armv8
build_type=Release
compiler=apple-clang
compiler.cppstd=gnu17
compiler.libcxx=libc++
compiler.version=15
os=Macos
cpp-httplib @ 0.15.3
Ollama 0.1.28
Detailed informantion
- Repo to reproduce issue: https://github.com/RobinQu/httplib-test
- Screenshot of failed run: Screenshot 1 below.
- Successful run of curl: Screenshot 2 below.
- Seccsesful run of Apifox (a similiar tool to Postman): Screenshot 3 below.
Screentshot 1

Screenshot 2

Screenshot 3

yhirose commented
I found the reason why it fails. The default read timeout value (CPPHTTPLIB_READ_TIMEOUT_SECOND) is 5 seconds. Since some requests like "what is the sky blue?" takes longer than the read timeout, it fails. When I set the value to 60 (1 minute), it always returns a result.
client.set_read_timeout(60);
I am thinking to change the value of CPPHTTPLIB_READ_TIMEOUT_SECOND to something longer like 300 (5 mins).
Anyway, hope this information helps you.