Avoid 0-length DATA if NGHTTP2_DATA_FLAG_NO_END_STREAM is set

This commit is contained in:
Tatsuhiro Tsujikawa 2016-04-27 22:57:19 +09:00
parent 2d2b72d4eb
commit dba0f35ee1
1 changed files with 8 additions and 0 deletions

View File

@ -6906,6 +6906,14 @@ int nghttp2_session_pack_data(nghttp2_session *session, nghttp2_bufs *bufs,
reschedule_stream(stream); reschedule_stream(stream);
if (frame->hd.length == 0 && (data_flags & NGHTTP2_DATA_FLAG_EOF) &&
(data_flags & NGHTTP2_DATA_FLAG_NO_END_STREAM)) {
/* DATA payload length is 0, and DATA frame does not bear
END_STREAM. In this case, there is no point to send 0 length
DATA frame. */
return NGHTTP2_ERR_CANCEL;
}
return 0; return 0;
} }