cpp-httplib icon indicating copy to clipboard operation
cpp-httplib copied to clipboard

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

Open RobinQu opened this issue 1 year ago • 1 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

RobinQu avatar Mar 14 '24 12:03 RobinQu

It looks like I am not alone. https://github.com/yhirose/cpp-httplib/issues/1379

RobinQu avatar Mar 14 '24 12:03 RobinQu

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

yhirose avatar Aug 30 '24 02:08 yhirose

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

yhirose avatar Sep 07 '24 13:09 yhirose

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.

yhirose avatar Sep 07 '24 18:09 yhirose