Commit dfe552e6 authored by jan.koester's avatar jan.koester
Browse files

test

parent fc197cb5
Loading
Loading
Loading
Loading
+9 −0
Changes for src/http/HttpProxyServer.cpp: 9 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -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);