Loading src/http.cpp +13 −3 Original line number Original line Diff line number Diff line Loading @@ -1078,7 +1078,9 @@ const std::vector<char> libhttppp::HttpClient::_h2Request( std::string location; std::string location; auto last_data = std::chrono::steady_clock::now(); auto last_data = std::chrono::steady_clock::now(); auto last_activity = last_data; const auto idle_timeout = std::chrono::seconds(15); const auto idle_timeout = std::chrono::seconds(15); const auto response_timeout = std::chrono::seconds(60); for (;;) { for (;;) { uint8_t buf[4096]; uint8_t buf[4096]; Loading @@ -1086,6 +1088,7 @@ const std::vector<char> libhttppp::HttpClient::_h2Request( if (n > 0) { if (n > 0) { raw.insert(raw.end(), buf, buf + n); raw.insert(raw.end(), buf, buf + n); last_data = std::chrono::steady_clock::now(); last_data = std::chrono::steady_clock::now(); last_activity = last_data; } else { } else { // Pump the UDP socket: drain ALL available datagrams and process // Pump the UDP socket: drain ALL available datagrams and process // QUIC packets. For large responses the server sends many datagrams; // QUIC packets. For large responses the server sends many datagrams; Loading @@ -1104,9 +1107,10 @@ const std::vector<char> libhttppp::HttpClient::_h2Request( break; // EAGAIN — no more datagrams available break; // EAGAIN — no more datagrams available } } } } // Any pumped packet (including PING) means the connection is alive // Any pumped packet (including PING) keeps the connection alive // but does NOT reset the response data timeout if (pumped_any) { if (pumped_any) { last_data = std::chrono::steady_clock::now(); last_activity = std::chrono::steady_clock::now(); continue; continue; } } } } Loading Loading @@ -1159,7 +1163,13 @@ const std::vector<char> libhttppp::HttpClient::_h2Request( break; break; } } if (std::chrono::steady_clock::now() - last_data > idle_timeout) { auto now = std::chrono::steady_clock::now(); if (now - last_activity > idle_timeout) { HTTPException ee; ee[HTTPException::Error] << "HTTP/3 connection idle timeout"; throw ee; } if (now - last_data > response_timeout) { HTTPException ee; HTTPException ee; ee[HTTPException::Error] << "HTTP/3 response timeout"; ee[HTTPException::Error] << "HTTP/3 response timeout"; throw ee; throw ee; Loading Loading
src/http.cpp +13 −3 Original line number Original line Diff line number Diff line Loading @@ -1078,7 +1078,9 @@ const std::vector<char> libhttppp::HttpClient::_h2Request( std::string location; std::string location; auto last_data = std::chrono::steady_clock::now(); auto last_data = std::chrono::steady_clock::now(); auto last_activity = last_data; const auto idle_timeout = std::chrono::seconds(15); const auto idle_timeout = std::chrono::seconds(15); const auto response_timeout = std::chrono::seconds(60); for (;;) { for (;;) { uint8_t buf[4096]; uint8_t buf[4096]; Loading @@ -1086,6 +1088,7 @@ const std::vector<char> libhttppp::HttpClient::_h2Request( if (n > 0) { if (n > 0) { raw.insert(raw.end(), buf, buf + n); raw.insert(raw.end(), buf, buf + n); last_data = std::chrono::steady_clock::now(); last_data = std::chrono::steady_clock::now(); last_activity = last_data; } else { } else { // Pump the UDP socket: drain ALL available datagrams and process // Pump the UDP socket: drain ALL available datagrams and process // QUIC packets. For large responses the server sends many datagrams; // QUIC packets. For large responses the server sends many datagrams; Loading @@ -1104,9 +1107,10 @@ const std::vector<char> libhttppp::HttpClient::_h2Request( break; // EAGAIN — no more datagrams available break; // EAGAIN — no more datagrams available } } } } // Any pumped packet (including PING) means the connection is alive // Any pumped packet (including PING) keeps the connection alive // but does NOT reset the response data timeout if (pumped_any) { if (pumped_any) { last_data = std::chrono::steady_clock::now(); last_activity = std::chrono::steady_clock::now(); continue; continue; } } } } Loading Loading @@ -1159,7 +1163,13 @@ const std::vector<char> libhttppp::HttpClient::_h2Request( break; break; } } if (std::chrono::steady_clock::now() - last_data > idle_timeout) { auto now = std::chrono::steady_clock::now(); if (now - last_activity > idle_timeout) { HTTPException ee; ee[HTTPException::Error] << "HTTP/3 connection idle timeout"; throw ee; } if (now - last_data > response_timeout) { HTTPException ee; HTTPException ee; ee[HTTPException::Error] << "HTTP/3 response timeout"; ee[HTTPException::Error] << "HTTP/3 response timeout"; throw ee; throw ee; Loading