File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -2184,6 +2184,17 @@ ssize_t Http2Stream::Provider::Stream::OnRead(nghttp2_session* handle,
21842184
21852185 size_t amount = 0 ; // amount of data being sent in this data frame.
21862186
2187+ // Remove all empty chunks from the head of the queue.
2188+ // This is done here so that .write('', cb) is still a meaningful way to
2189+ // find out when the HTTP2 stream wants to consume data, and because the
2190+ // StreamBase API allows empty input chunks.
2191+ while (!stream->queue_ .empty () && stream->queue_ .front ().buf .len == 0 ) {
2192+ WriteWrap* finished = stream->queue_ .front ().req_wrap ;
2193+ stream->queue_ .pop ();
2194+ if (finished != nullptr )
2195+ finished->Done (0 );
2196+ }
2197+
21872198 if (!stream->queue_ .empty ()) {
21882199 DEBUG_HTTP2SESSION2 (session, " stream %d has pending outbound data" , id);
21892200 amount = std::min (stream->available_outbound_length_ , length);
@@ -2197,7 +2208,8 @@ ssize_t Http2Stream::Provider::Stream::OnRead(nghttp2_session* handle,
21972208 }
21982209 }
21992210
2200- if (amount == 0 && stream->IsWritable () && stream->queue_ .empty ()) {
2211+ if (amount == 0 && stream->IsWritable ()) {
2212+ CHECK (stream->queue_ .empty ());
22012213 DEBUG_HTTP2SESSION2 (session, " deferring stream %d" , id);
22022214 return NGHTTP2_ERR_DEFERRED;
22032215 }
You can’t perform that action at this time.
0 commit comments