yhirose/cpp-httplib

Client is throwing `READ` error when requesting healthy HTTP endpoints.

RobinQu opened this issue · 4 comments

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

image

Screenshot 2

image

Screenshot 3

image

It looks like I am not alone.
#1379

OK. If you think it's the same as #1379, I'll close it.

This seems to be different from #1379. So I reopen this and add 'bug' label.

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.