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

bugix h1 dispatch

parent a7fbea30
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -617,6 +617,17 @@ void libhttppp::HttpEvent::_dispatchH1Request(HttpRequest &cureq, size_t consume
                        // The blocking work this whole detach/reattach dance exists to keep
                        // off the shared epoll/kqueue workers.
                        RequestEvent(cureq2, tid, args);
                        if (!cureq2.slots[0].csock) {
                            // RequestEvent itself took over this connection's socket for
                            // something outside the normal request/response cycle -- e.g. a
                            // WebSocket upgrade handing it to a raw relay thread via its own
                            // detachConnection() call (see proxyplus's WebSocketProxy.cpp).
                            // Mirrors IoEventHandler's identical check right after its own
                            // RequestEvent(con&,...) call: nothing left here to finish,
                            // flush, or reattach -- that other path owns this connection's
                            // fate now.
                            return;
                        }
                        if (consumeBodyBytes > 0) {
                            cureq2.RecvData.erase(cureq2.RecvData.begin(),
                                                  cureq2.RecvData.begin() + consumeBodyBytes);
@@ -632,7 +643,8 @@ void libhttppp::HttpEvent::_dispatchH1Request(HttpRequest &cureq, size_t consume
                        }
                    } catch (const std::exception &) {
                        // Either RequestEvent or the flush hit a hard error (peer reset,
                        // socket-level failure) -- nothing to reattach.
                        // socket-level failure) -- nothing to reattach. csock can't have gone
                        // null here without an intervening return above, so this is safe.
                        cureq2.slots[0].csock->close();
                        return;
                    }