diff --git a/proxy/http2/Http2Stream.cc b/proxy/http2/Http2Stream.cc index 75bf402c944..436f5857a5e 100644 --- a/proxy/http2/Http2Stream.cc +++ b/proxy/http2/Http2Stream.cc @@ -755,6 +755,7 @@ Http2Stream::destroy() chunked_handler.clear(); clear_timers(); clear_io_events(); + http_parser_clear(&http_parser); super::destroy(); THREAD_FREE(this, http2StreamAllocator, this_ethread()); diff --git a/proxy/http2/Http2Stream.h b/proxy/http2/Http2Stream.h index 895f8e1cab2..1e159da5089 100644 --- a/proxy/http2/Http2Stream.h +++ b/proxy/http2/Http2Stream.h @@ -41,8 +41,6 @@ class Http2Stream : public ProxyTransaction typedef ProxyTransaction super; ///< Parent type. Http2Stream(Http2StreamId sid = 0, ssize_t initial_rwnd = Http2::initial_window_size) : client_rwnd(initial_rwnd), _id(sid) { - http_parser_init(&http_parser); - SET_HANDLER(&Http2Stream::main_event_handler); } @@ -57,6 +55,7 @@ class Http2Stream : public ProxyTransaction // FIXME: Are you sure? every "stream" needs request_header? _req_header.create(HTTP_TYPE_REQUEST); response_header.create(HTTP_TYPE_RESPONSE); + http_parser_init(&http_parser); } int main_event_handler(int event, void *edata);