Commit 393fdb44 authored by jan.koester's avatar jan.koester
Browse files

status fixed

parent 5e5336f1
Loading
Loading
Loading
Loading
+7 −6
Changes for src/http.cpp: 7 added lines, 6 removed lines.
Original line number Diff line number Diff line
@@ -1045,9 +1045,10 @@ libhttppp::HttpResponse libhttppp::HttpClient::GetStream(libhttppp::HttpRequest
                        auto decoded = qpack::Decoder::decode(_streamH3Raw.data() + pos, frame_len);
                        for (const auto &h : decoded) {
                            if (h.name == ":status") {
                                try {
                                    res.setState(std::string("HTTP/3 ") + h.value);
                                } catch (...) {}
                                // parseH3, not setState: setState only stores the
                                // reason text, leaving getStatusCode() at its default
                                // 200 -- a proxied 307/404 then went out as 200.
                                res.parseH3({h});
                            } else if (h.name == "content-length") {
                                try {
                                    res.setContentLength(static_cast<size_t>(std::stoul(h.value)));
@@ -1160,9 +1161,9 @@ libhttppp::HttpResponse libhttppp::HttpClient::GetStream(libhttppp::HttpRequest
                            auto headers = _h2Decoder->decode(payload, frame_len);
                            for (const auto &h : headers) {
                                if (h.name == ":status") {
                                    try {
                                        res.setState(std::string("HTTP/2 ") + h.value);
                                    } catch (...) {}
                                    // See the H3 branch above: parseH2 sets the
                                    // numeric status code, setState did not.
                                    res.parseH2({h});
                                } else if (h.name == "content-length") {
                                    try {
                                        res.setContentLength(static_cast<size_t>(std::stoul(h.value)));