http: Remove timeoutless requests.

Let's always have timeouts.  This timeout is reset even when a single byte
is sent, so it's pretty generous.
This commit is contained in:
Unknown W. Brackets committed 2021-05-01 11:20:05 -07:00
1 parent 1e22966984
commit af5618705c
7 files changed
+23 -56

No files matched your search

+4 -7
View File
@@ -337,17 +337,14 @@ int Client::ReadResponseHeaders(net::Buffer *readbuf, std::vector<std::string> &
// Snarf all the data we can into RAM. A little unsafe but hey.
static constexpr float CANCEL_INTERVAL = 0.25f;
bool ready = false;
double leftTimeout = dataTimeout_;
double endTimeout = time_now_d() + dataTimeout_;
while (!ready) {
if (cancelled && *cancelled)
return -1;
ready = fd_util::WaitUntilReady(sock(), CANCEL_INTERVAL, false);
if (!ready && leftTimeout >= 0.0) {
leftTimeout -= CANCEL_INTERVAL;
if (leftTimeout < 0) {
ERROR_LOG(IO, "HTTP headers timed out");
return -1;
}
if (!ready && time_now_d() > endTimeout) {
ERROR_LOG(IO, "HTTP headers timed out");
return -1;
}
};
// Let's hope all the headers are available in a single packet...