Commit 380fc212 authored by jan.koester's avatar jan.koester
Browse files

test

parent bdcd921d
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -629,9 +629,10 @@ std::vector<char> libhttppp::HttpClient::_h1ReadResponse(const std::string &labe
            break;

        netplus::buffer buf(CHUNKSIZE);
        // Short timeout for initial server response — if the server doesn't
        // start responding within 10s, the connection is likely dead.
        size_t n = _recvBlocking(buf, 10);
        // Honor setTimeout() (_recvTimeoutSec) instead of a fixed 10s: a slow
        // backend (cold model load/swap) can take much longer than 10s to
        // send back even the first byte of the response.
        size_t n = _recvBlocking(buf);
        if (n == 0) {
            netplus::NetException ne;
            ne[netplus::NetException::Error] << "HTTP " << label << ": EOF while reading header";
@@ -1222,8 +1223,11 @@ libhttppp::HttpResponse libhttppp::HttpClient::GetStream(libhttppp::HttpRequest

        // Single deadline for the whole header, not one per chunk — a peer
        // trickling a byte every few seconds must not be able to hold this
        // loop (and the calling thread) open indefinitely.
        auto header_deadline = std::chrono::steady_clock::now() + std::chrono::seconds(10);
        // loop (and the calling thread) open indefinitely. Honors setTimeout()
        // (_recvTimeoutSec) instead of a fixed 10s: a slow backend (cold model
        // load/swap) can take much longer than 10s to send back even the
        // response headers.
        auto header_deadline = std::chrono::steady_clock::now() + std::chrono::seconds(_recvTimeoutSec);

        for (;;) {
            if (raw.size() >= 4) {