Loading src/http/HttpProxyServer.cpp +20 −0 Changes for src/http/HttpProxyServer.cpp: 20 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -429,6 +429,26 @@ void HttpProxyController::RequestEvent(libhttppp::HttpRequest &curreq, const int : std::to_string(status) + " " + reason); curres.setContentType(last->getContentType()); // Forward every upstream response header to the client except hop-by-hop // ones and the handful applyResponseCompression() owns exclusively below -- // without this, Set-Cookie, Location, Cache-Control, WWW-Authenticate, and // any application-specific header were silently dropped (only status/ // content-type/content-encoding ever reached the client), breaking e.g. any // upstream that sets a session cookie. Mirrors kHopByHop on the // request-forwarding side above. static const std::set<std::string> kResponseSkip = { "content-type", "content-length", "content-encoding", "vary", "connection", "transfer-encoding", "keep-alive", "upgrade", "trailer", }; for (auto *hd = last->getfirstHeaderData(); hd; hd = hd->nextHeaderData()) { const std::string &key = hd->getkey(); if (key.empty() || key[0] == ':' || kResponseSkip.count(key)) continue; auto *out = curres.setHeaderData(key); for (auto *v = hd->getfirstValue(); v; v = v->nextvalue()) { out->push_back(v->getvalue()); } } std::string upstreamEncoding; if (auto *hd = last->getHeaderData("content-encoding")) { if (auto *v = hd->getfirstValue()) upstreamEncoding = v->getvalue(); Loading Loading
src/http/HttpProxyServer.cpp +20 −0 Changes for src/http/HttpProxyServer.cpp: 20 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -429,6 +429,26 @@ void HttpProxyController::RequestEvent(libhttppp::HttpRequest &curreq, const int : std::to_string(status) + " " + reason); curres.setContentType(last->getContentType()); // Forward every upstream response header to the client except hop-by-hop // ones and the handful applyResponseCompression() owns exclusively below -- // without this, Set-Cookie, Location, Cache-Control, WWW-Authenticate, and // any application-specific header were silently dropped (only status/ // content-type/content-encoding ever reached the client), breaking e.g. any // upstream that sets a session cookie. Mirrors kHopByHop on the // request-forwarding side above. static const std::set<std::string> kResponseSkip = { "content-type", "content-length", "content-encoding", "vary", "connection", "transfer-encoding", "keep-alive", "upgrade", "trailer", }; for (auto *hd = last->getfirstHeaderData(); hd; hd = hd->nextHeaderData()) { const std::string &key = hd->getkey(); if (key.empty() || key[0] == ':' || kResponseSkip.count(key)) continue; auto *out = curres.setHeaderData(key); for (auto *v = hd->getfirstValue(); v; v = v->nextvalue()) { out->push_back(v->getvalue()); } } std::string upstreamEncoding; if (auto *hd = last->getHeaderData("content-encoding")) { if (auto *v = hd->getfirstValue()) upstreamEncoding = v->getvalue(); Loading