From 56284b1e15a37168296ad39725bb1d20aba0868e Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Thu, 15 Sep 2016 22:03:04 +0900 Subject: [PATCH] nghttpx: Fix regression introduced in f267e400fa43cec27dc1e400ad661cbc27fc3d10 --- src/shrpx_http2_session.cc | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/shrpx_http2_session.cc b/src/shrpx_http2_session.cc index 9a8eee91..c81bdeda 100644 --- a/src/shrpx_http2_session.cc +++ b/src/shrpx_http2_session.cc @@ -665,6 +665,7 @@ int Http2Session::submit_request(Http2DownstreamConnection *dconn, } dconn->attach_stream_data(sd.get()); + dconn->get_downstream()->set_downstream_stream_id(stream_id); streams_.append(sd.release()); return 0; @@ -1382,10 +1383,6 @@ int on_frame_send_callback(nghttp2_session *session, const nghttp2_frame *frame, auto http2session = static_cast(user_data); if (frame->hd.type == NGHTTP2_DATA || frame->hd.type == NGHTTP2_HEADERS) { - if ((frame->hd.flags & NGHTTP2_FLAG_END_STREAM) == 0) { - return 0; - } - auto sd = static_cast( nghttp2_session_get_stream_user_data(session, frame->hd.stream_id)); @@ -1395,17 +1392,17 @@ int on_frame_send_callback(nghttp2_session *session, const nghttp2_frame *frame, auto downstream = sd->dconn->get_downstream(); - if (!downstream) { + if (!downstream || + downstream->get_downstream_stream_id() != frame->hd.stream_id) { return 0; } if (frame->hd.type == NGHTTP2_HEADERS && frame->headers.cat == NGHTTP2_HCAT_REQUEST) { - assert(downstream->get_downstream_stream_id() == -1); - - downstream->set_downstream_stream_id(frame->hd.stream_id); downstream->set_request_header_sent(true); - } else if (downstream->get_downstream_stream_id() != frame->hd.stream_id) { + } + + if ((frame->hd.flags & NGHTTP2_FLAG_END_STREAM) == 0) { return 0; }