File tree 1 file changed +13
-1
lines changed
1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -2209,6 +2209,17 @@ ssize_t Http2Stream::Provider::Stream::OnRead(nghttp2_session* handle,
2209
2209
2210
2210
size_t amount = 0 ; // amount of data being sent in this data frame.
2211
2211
2212
+ // Remove all empty chunks from the head of the queue.
2213
+ // This is done here so that .write('', cb) is still a meaningful way to
2214
+ // find out when the HTTP2 stream wants to consume data, and because the
2215
+ // StreamBase API allows empty input chunks.
2216
+ while (!stream->queue_ .empty () && stream->queue_ .front ().buf .len == 0 ) {
2217
+ WriteWrap* finished = stream->queue_ .front ().req_wrap ;
2218
+ stream->queue_ .pop ();
2219
+ if (finished != nullptr )
2220
+ finished->Done (0 );
2221
+ }
2222
+
2212
2223
if (!stream->queue_ .empty ()) {
2213
2224
DEBUG_HTTP2SESSION2 (session, " stream %d has pending outbound data" , id);
2214
2225
amount = std::min (stream->available_outbound_length_ , length);
@@ -2222,7 +2233,8 @@ ssize_t Http2Stream::Provider::Stream::OnRead(nghttp2_session* handle,
2222
2233
}
2223
2234
}
2224
2235
2225
- if (amount == 0 && stream->IsWritable () && stream->queue_ .empty ()) {
2236
+ if (amount == 0 && stream->IsWritable ()) {
2237
+ CHECK (stream->queue_ .empty ());
2226
2238
DEBUG_HTTP2SESSION2 (session, " deferring stream %d" , id);
2227
2239
return NGHTTP2_ERR_DEFERRED;
2228
2240
}
You can’t perform that action at this time.
0 commit comments