Commit 52fdd775 authored by jan.koester's avatar jan.koester
Browse files

test

parent b0be06a6
Loading
Loading
Loading
Loading
+15 −2
Original line number Diff line number Diff line
@@ -75,10 +75,23 @@ const char *kBrowserUA =

// GET /ua-echo -> echoes the number of Values and the joined value seen on
// the incoming User-Agent header back as x-ua-count/x-ua-echo.
//
// h1OffloadThreads > 0 (matching proxyplus's own HttpProxyController) runs every request
// through the H1 offload/detach-reattach path (see httpd.h's shouldOffloadH1Dispatch doc
// comment) instead of the fully-synchronous default -- this is what testKeepAliveDoesNot
// AccumulateHeaders below actually needs to exercise, since the header-accumulation bug this
// whole file guards against turned out to be specific to that path (the synchronous path
// already resets header state via HttpEvent::ResponseEvent(); the offloaded path's own
// cleanup never reaches that call, since it deliberately returns with a null csock so
// IoEventHandler stops touching the connection immediately -- see _dispatchH1Request's doc
// comment in httpd.h).
class UAEvent : public HttpEvent {
public:
    explicit UAEvent(std::vector<netplus::socket *> serversocket)
        : HttpEvent(serversocket) {}
    explicit UAEvent(std::vector<netplus::socket *> serversocket, size_t h1OffloadThreads = 4)
        : HttpEvent(serversocket, 1000, /*h2OffloadThreads=*/0, /*idleTimeoutSeconds=*/0,
                    h1OffloadThreads) {}

    bool shouldOffloadH1Dispatch(HttpRequest &) const override { return true; }

    void RequestEvent(HttpRequest &req, const int, ULONG_PTR) override {
        const std::string &url = req.getRequestURL();