Loading src/http/HttpProxyServer.h +38 −0 Changes for src/http/HttpProxyServer.h: 38 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -55,6 +55,14 @@ public: void RequestEvent(libhttppp::HttpRequest &curreq, const int tid, ULONG_PTR args) override; // Drains the streaming upstream response set up by RequestEvent for a Range request (see // its doc comment above the GetStream()/canStreamRange branch) -- called by the normal // epoll/kqueue event loop on whatever worker owns this connection once it's writable, same // as any other deferred-body response in this codebase (compare blogi/bolli's own // ResponseEvent). A no-op for every other request (RequestEvent already sent the complete // response synchronously, so getExt(curreq) finds nothing to drain). void ResponseEvent(libhttppp::HttpRequest &curreq, const int tid, ULONG_PTR args) override; // Every route here does a real backend round-trip, and a WebSocket upgrade's initial // connect+handshake read (see WebSocketProxy.cpp's handleWebSocketUpgrade) is itself // dispatched through this same H1 Loading Loading @@ -104,6 +112,36 @@ private: std::vector<char> &body, libhttppp::HttpResponse &curres); // Backing state for a streamed (not fully buffered) proxied response -- see // RequestEvent's Range-request branch. Holds the checked-out upstream HttpClient across // however many ResponseEvent calls it takes to drain the body, plus what's needed to // return it to _connectionPool afterward (ScopedPoolRelease's own RAII can't be used here // since its release has to happen much later than RequestEvent's own return). struct ProxyStreamingState { std::unique_ptr<libhttppp::HttpClient> client; http::UpstreamConnectionPool *pool = nullptr; libhttppp::HttpUrl origin; size_t send_size = 0; size_t produced = 0; }; // Per-connection extension stored on curreq.extension -- mirrors blogi/bolli's identical // ConExt pattern (same author, same libhttppp/libnetplus base classes). struct ProxyConExt { ProxyStreamingState streaming; }; static ProxyConExt *getExt(libhttppp::HttpRequest &req) { return static_cast<ProxyConExt *>(req.extension.get()); } static ProxyConExt *ensureExt(libhttppp::HttpRequest &req) { if (!req.extension) { req.extension = {new ProxyConExt{}, +[](void *p) { delete static_cast<ProxyConExt *>(p); }}; } return getExt(req); } std::string _listenerLabel; bool _tlsActive; store::ConfigStore &_configStore; Loading Loading
src/http/HttpProxyServer.h +38 −0 Changes for src/http/HttpProxyServer.h: 38 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -55,6 +55,14 @@ public: void RequestEvent(libhttppp::HttpRequest &curreq, const int tid, ULONG_PTR args) override; // Drains the streaming upstream response set up by RequestEvent for a Range request (see // its doc comment above the GetStream()/canStreamRange branch) -- called by the normal // epoll/kqueue event loop on whatever worker owns this connection once it's writable, same // as any other deferred-body response in this codebase (compare blogi/bolli's own // ResponseEvent). A no-op for every other request (RequestEvent already sent the complete // response synchronously, so getExt(curreq) finds nothing to drain). void ResponseEvent(libhttppp::HttpRequest &curreq, const int tid, ULONG_PTR args) override; // Every route here does a real backend round-trip, and a WebSocket upgrade's initial // connect+handshake read (see WebSocketProxy.cpp's handleWebSocketUpgrade) is itself // dispatched through this same H1 Loading Loading @@ -104,6 +112,36 @@ private: std::vector<char> &body, libhttppp::HttpResponse &curres); // Backing state for a streamed (not fully buffered) proxied response -- see // RequestEvent's Range-request branch. Holds the checked-out upstream HttpClient across // however many ResponseEvent calls it takes to drain the body, plus what's needed to // return it to _connectionPool afterward (ScopedPoolRelease's own RAII can't be used here // since its release has to happen much later than RequestEvent's own return). struct ProxyStreamingState { std::unique_ptr<libhttppp::HttpClient> client; http::UpstreamConnectionPool *pool = nullptr; libhttppp::HttpUrl origin; size_t send_size = 0; size_t produced = 0; }; // Per-connection extension stored on curreq.extension -- mirrors blogi/bolli's identical // ConExt pattern (same author, same libhttppp/libnetplus base classes). struct ProxyConExt { ProxyStreamingState streaming; }; static ProxyConExt *getExt(libhttppp::HttpRequest &req) { return static_cast<ProxyConExt *>(req.extension.get()); } static ProxyConExt *ensureExt(libhttppp::HttpRequest &req) { if (!req.extension) { req.extension = {new ProxyConExt{}, +[](void *p) { delete static_cast<ProxyConExt *>(p); }}; } return getExt(req); } std::string _listenerLabel; bool _tlsActive; store::ConfigStore &_configStore; Loading