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

test

parent fad8cccc
Loading
Loading
Loading
Loading
+7 −0
Changes for test/httpd_h1_deferred_stream_test.cpp: 7 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -140,6 +140,13 @@ void stopServer(RunningServer &rs) {
}

std::string doGet(netplus::tcp &sock, const std::string &path, std::chrono::seconds timeout) {
    // recvData() below blocks at the OS level with no timeout of its own --
    // without a socket-level bound, a server that never sends the promised
    // body (exactly the bug this test targets) hangs this call forever, and
    // the deadline check further down never gets a chance to run.
    sock.setTimeout(static_cast<int>(
        std::chrono::duration_cast<std::chrono::milliseconds>(timeout).count()));

    std::ostringstream req;
    req << "GET " << path << " HTTP/1.1\r\nHost: 127.0.0.1\r\nConnection: close\r\n\r\n";
    rawtcp::sendAllOrThrow(sock, req.str());