Commit a506797c authored by jan.koester's avatar jan.koester
Browse files

test

parent 6b9d162e
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -1355,14 +1355,18 @@ libhttppp::HttpResponse libhttppp::HttpClient::PostStream(libhttppp::HttpRequest
            _sendAll(combined.data(), combined.size());
        }

        // Read until we have full response header (\r\n\r\n) -- identical to
        // GetStream's HTTP/1.x header-read + streaming-mode detection below.
        // Read until we have full response header (\r\n\r\n) -- same structure
        // as GetStream's HTTP/1.x header-read, except the deadline honors
        // setTimeout() (_recvTimeoutSec) instead of a fixed 10s: a slow AI
        // backend (cold model load/swap) can take much longer than 10s to
        // send back even the response headers, well before any body/stream
        // data starts flowing.
        std::vector<char> raw;
        raw.reserve(16384);
        size_t header_end = std::string::npos;
        size_t search_from = 0;

        auto header_deadline = std::chrono::steady_clock::now() + std::chrono::seconds(10);
        auto header_deadline = std::chrono::steady_clock::now() + std::chrono::seconds(_recvTimeoutSec);

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