req.path,
req.headers,
req.body,
- req.should_stop);
+ req.should_stop,
+ base_params.timeout_read,
+ base_params.timeout_write
+ );
return proxy;
}
const std::string & path,
const std::map<std::string, std::string> & headers,
const std::string & body,
- const std::function<bool()> should_stop) {
+ const std::function<bool()> should_stop,
+ int32_t timeout_read,
+ int32_t timeout_write
+ ) {
// shared between reader and writer threads
auto cli = std::make_shared<httplib::Client>(host, port);
auto pipe = std::make_shared<pipe_t<msg_t>>();
// setup Client
cli->set_connection_timeout(0, 200000); // 200 milliseconds
+ cli->set_write_timeout(timeout_read, 0); // reversed for cli (client) vs srv (server)
+ cli->set_read_timeout(timeout_write, 0);
this->status = 500; // to be overwritten upon response
this->cleanup = [pipe]() {
pipe->close_read();
const std::string & path,
const std::map<std::string, std::string> & headers,
const std::string & body,
- const std::function<bool()> should_stop);
+ const std::function<bool()> should_stop,
+ int32_t timeout_read,
+ int32_t timeout_write
+ );
~server_http_proxy() {
if (cleanup) {
cleanup();