Loading src/http/HttpProxyServer.cpp +9 −0 Changes for src/http/HttpProxyServer.cpp: 9 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -220,6 +220,15 @@ void HttpProxyController::RequestEvent(libhttppp::HttpRequest &curreq, const int std::vector<char> body; if (method == "POST" || method == "PUT") { outreq.setRequestType(method == "POST" ? POSTREQUEST : PUTREQUEST); // Without this, the upstream receives a body with no Content-Type at all -- // anything parsing it as a form (see libhttppp::HttpForm::parse()) rejects it // outright ("Http Form Parse Error: content type") since it requires the // header, not just a guessable body shape. if (auto *ctype = curreq.getHeaderData("content-type")) { if (auto *v = ctype->getfirstValue()) { outreq.setHeaderData("content-type")->push_back(v->getvalue()); } } std::vector<char> requestBody(curreq.RecvData.begin(), curreq.RecvData.end()); body = (method == "POST") ? client.Post(outreq, requestBody) : client.Put(outreq, requestBody); Loading Loading
src/http/HttpProxyServer.cpp +9 −0 Changes for src/http/HttpProxyServer.cpp: 9 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -220,6 +220,15 @@ void HttpProxyController::RequestEvent(libhttppp::HttpRequest &curreq, const int std::vector<char> body; if (method == "POST" || method == "PUT") { outreq.setRequestType(method == "POST" ? POSTREQUEST : PUTREQUEST); // Without this, the upstream receives a body with no Content-Type at all -- // anything parsing it as a form (see libhttppp::HttpForm::parse()) rejects it // outright ("Http Form Parse Error: content type") since it requires the // header, not just a guessable body shape. if (auto *ctype = curreq.getHeaderData("content-type")) { if (auto *v = ctype->getfirstValue()) { outreq.setHeaderData("content-type")->push_back(v->getvalue()); } } std::vector<char> requestBody(curreq.RecvData.begin(), curreq.RecvData.end()); body = (method == "POST") ? client.Post(outreq, requestBody) : client.Put(outreq, requestBody); Loading