Commit 5e5336f1 authored by jan.koester's avatar jan.koester
Browse files

bugfix

parent 46158096
Loading
Loading
Loading
Loading
+23 −0
Changes for src/httpd.cpp: 23 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -409,7 +409,16 @@ libhttppp::HttpEvent::HttpEvent(std::vector<netplus::socket*> serversocket, int
                                               uint64_t stream_id,
                                               const std::vector<uint8_t> &data,
                                               bool fin) {
                try {
                    this->Http3StreamEvent(s, stream_id, data, fin);
                } catch (netplus::NetException &) {
                    // A response that could not be fully sent (peer stopped
                    // granting flow control / connection died) must be
                    // aborted, not left open: an unfinished, un-reset stream
                    // makes the client wait on it forever.
                    if (auto *q = dynamic_cast<netplus::quic*>(s))
                        q->resetStream(stream_id, 0x0102); // H3_INTERNAL_ERROR
                }
            });

            // Extract the QUIC port so HTTP/2 responses can advertise Alt-Svc
@@ -2064,7 +2073,15 @@ void libhttppp::HttpEvent::Http3StreamEvent(netplus::socket *sock,
                        tr->SendData.clear();
                        sent += sa;
                        bool last = (sent >= content_length);
                        try {
                            q->sendStreamData(stream_id, data_frame, last);
                        } catch (netplus::NetException &) {
                            // Undelivered frame: the trailing
                            // "sent < content_length" check below resets
                            // the stream.
                            sent -= sa;
                            break;
                        }
                        empty_streak = 0;
                    } else {
                        q->pumpIncoming();
@@ -2468,7 +2485,13 @@ void libhttppp::HttpEvent::ConnectEvent(netplus::con &curcon,const int tid,ULONG
                                           uint64_t stream_id,
                                           const std::vector<uint8_t> &data,
                                           bool fin) {
            try {
                this->Http3StreamEvent(sock, stream_id, data, fin);
            } catch (netplus::NetException &) {
                // See the server-socket callback in the HttpEvent ctor.
                if (auto *q = dynamic_cast<netplus::quic*>(sock))
                    q->resetStream(stream_id, 0x0102); // H3_INTERNAL_ERROR
            }
        });
    }