Skip to content

Client timeout #1733

@marcovc

Description

@marcovc

Hi,

I must be doing something wrong:

httplib::Client http_client(url);
auto timeout = std::chrono::milliseconds(200);
http_client.set_connection_timeout(timeout);
http_client.set_read_timeout(timeout);
http_client.set_write_timeout(timeout);

auto tic = std::chrono::system_clock::now();

http_client.Get(
  "endpoint", 
  params,
  headers
);

std::cout << std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now() -tic).count() << std::endl;

This prints 1861 (ms). I was expecting that it gives up waiting after 200 ms. What could be the issue?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions