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

test

parent adc4f0c5
Loading
Loading
Loading
Loading
+28 −2
Original line number Diff line number Diff line
@@ -691,7 +691,21 @@ void libhttppp::HttpEvent::_resumeH2Streams(HttpRequest &cureq,
                      << " emptyCount=" << ss->emptyCount
                      << " ext=" << ss->tempreq->extension.get()
                      << std::endl;
            try {
                ResponseEvent(*ss->tempreq, ss->tid, ss->args);
            } catch (std::exception &) {
                // Application signalled a genuine error (e.g. upstream
                // failed mid-stream) by throwing instead of returning.
                // Abort just this stream rather than letting the exception
                // propagate up and tear down the whole (possibly
                // multiplexed) connection.
                uint8_t rst[4] = {0, 0, 0, 0x02}; // INTERNAL_ERROR
                out += h2BuildFrame(H2_FRAME_RST_STREAM, 0, sid,
                    std::string(reinterpret_cast<char*>(rst), 4));
                cureq.h2state().peerStreamWindows.erase(sid);
                streams.erase(it);
                break;
            }
            size_t sa = ss->tempreq->SendData.size();

            if (sa > 0) {
@@ -1368,7 +1382,19 @@ void libhttppp::HttpEvent::Http3StreamEvent(netplus::socket *sock,
                    // control responsive for large transfers.
                    q->pumpIncoming();

                    try {
                        ResponseEvent(*tr, h3tid, 0);
                    } catch (...) {
                        // This runs on a detached background thread with no
                        // other exception handler above it — letting an
                        // application error (e.g. upstream failed
                        // mid-stream) escape here would call
                        // std::terminate() and crash the whole process.
                        // Stop the loop; the trailing "sent < content_length"
                        // check below will reset the stream instead of
                        // sending a false END_STREAM.
                        break;
                    }
                    size_t sa = tr->SendData.size();

                    if (sa > 0) {