Loading src/http/HttpProxyServer.cpp +9 −2 Changes for src/http/HttpProxyServer.cpp: 9 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -227,9 +227,16 @@ void HttpProxyController::RequestEvent(libhttppp::HttpRequest &curreq, const int libhttppp::HttpResponse curres; int status = 200; if (auto *last = client.lastResponse()) { curres.setState(last->getState()); curres.setContentType(last->getContentType()); status = last->getStatusCode(); // HttpResponse::parseH2/parseH3 clear the reason phrase entirely (H2/H3 // responses only carry a numeric ":status" pseudo-header) -- setState() // throws on an empty string, and an HTTP/1.1 upstream's reason phrase alone // (e.g. "OK", see HttpResponse::parse) would drop the code from our own // status line, so always lead with the numeric code ourselves. std::string reason = last->getState(); curres.setState(reason.empty() ? std::to_string(status) : std::to_string(status) + " " + reason); curres.setContentType(last->getContentType()); } else { curres.setState(HTTP200); } Loading Loading
src/http/HttpProxyServer.cpp +9 −2 Changes for src/http/HttpProxyServer.cpp: 9 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -227,9 +227,16 @@ void HttpProxyController::RequestEvent(libhttppp::HttpRequest &curreq, const int libhttppp::HttpResponse curres; int status = 200; if (auto *last = client.lastResponse()) { curres.setState(last->getState()); curres.setContentType(last->getContentType()); status = last->getStatusCode(); // HttpResponse::parseH2/parseH3 clear the reason phrase entirely (H2/H3 // responses only carry a numeric ":status" pseudo-header) -- setState() // throws on an empty string, and an HTTP/1.1 upstream's reason phrase alone // (e.g. "OK", see HttpResponse::parse) would drop the code from our own // status line, so always lead with the numeric code ourselves. std::string reason = last->getState(); curres.setState(reason.empty() ? std::to_string(status) : std::to_string(status) + " " + reason); curres.setContentType(last->getContentType()); } else { curres.setState(HTTP200); } Loading