diff --git a/lib/nghttp2_session.c b/lib/nghttp2_session.c index 95377c53..0f7fd853 100644 --- a/lib/nghttp2_session.c +++ b/lib/nghttp2_session.c @@ -6906,6 +6906,14 @@ int nghttp2_session_pack_data(nghttp2_session *session, nghttp2_bufs *bufs, 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; }