nghttpx: Fix regression bug that frame with stream_id = 0 not handled

This commit is contained in:
Tatsuhiro Tsujikawa 2014-05-28 00:26:27 +09:00
parent d844b0acd0
commit 86ab9f33de
1 changed files with 12 additions and 5 deletions

View File

@ -355,20 +355,26 @@ int on_frame_recv_callback
verbose_on_frame_recv_callback(session, frame, user_data); verbose_on_frame_recv_callback(session, frame, user_data);
} }
auto upstream = static_cast<Http2Upstream*>(user_data); auto upstream = static_cast<Http2Upstream*>(user_data);
switch(frame->hd.type) {
case NGHTTP2_DATA: {
if(frame->hd.flags & NGHTTP2_FLAG_END_STREAM) {
auto downstream = upstream->find_downstream(frame->hd.stream_id); auto downstream = upstream->find_downstream(frame->hd.stream_id);
if(!downstream) { if(!downstream) {
return 0; return 0;
} }
switch(frame->hd.type) {
case NGHTTP2_DATA: {
if(frame->hd.flags & NGHTTP2_FLAG_END_STREAM) {
downstream->end_upload_data(); downstream->end_upload_data();
downstream->set_request_state(Downstream::MSG_COMPLETE); downstream->set_request_state(Downstream::MSG_COMPLETE);
} }
break; break;
} }
case NGHTTP2_HEADERS: case NGHTTP2_HEADERS: {
auto downstream = upstream->find_downstream(frame->hd.stream_id);
if(!downstream) {
return 0;
}
if(frame->headers.cat == NGHTTP2_HCAT_REQUEST) { if(frame->headers.cat == NGHTTP2_HCAT_REQUEST) {
return on_request_headers(upstream, downstream, session, frame); return on_request_headers(upstream, downstream, session, frame);
} }
@ -379,6 +385,7 @@ int on_frame_recv_callback
} }
break; break;
}
case NGHTTP2_PRIORITY: { case NGHTTP2_PRIORITY: {
// TODO comment out for now // TODO comment out for now
// rv = downstream->change_priority(frame->priority.pri); // rv = downstream->change_priority(frame->priority.pri);