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 @@ -2184,6 +2184,17 @@ ssize_t Http2Stream::Provider::Stream::OnRead(nghttp2_session* handle,
2184
2184
2185
2185
size_t amount = 0 ; // amount of data being sent in this data frame.
2186
2186
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
+
2187
2198
if (!stream->queue_ .empty ()) {
2188
2199
DEBUG_HTTP2SESSION2 (session, " stream %d has pending outbound data" , id);
2189
2200
amount = std::min (stream->available_outbound_length_ , length);
@@ -2197,7 +2208,8 @@ ssize_t Http2Stream::Provider::Stream::OnRead(nghttp2_session* handle,
2197
2208
}
2198
2209
}
2199
2210
2200
- if (amount == 0 && stream->IsWritable () && stream->queue_ .empty ()) {
2211
+ if (amount == 0 && stream->IsWritable ()) {
2212
+ CHECK (stream->queue_ .empty ());
2201
2213
DEBUG_HTTP2SESSION2 (session, " deferring stream %d" , id);
2202
2214
return NGHTTP2_ERR_DEFERRED;
2203
2215
}
You can’t perform that action at this time.
0 commit comments