nghttpx: Fix bug that h3 stream ends prematurely

This commit is contained in:
Tatsuhiro Tsujikawa 2022-02-18 23:08:47 +09:00
parent a6537cb9ce
commit f3d4b4f846

View File

@ -1202,9 +1202,8 @@ nghttp3_ssize downstream_read_data_callback(nghttp3_conn *conn,
assert(body); assert(body);
if (downstream->get_response_state() == DownstreamState::MSG_COMPLETE) { if (downstream->get_response_state() != DownstreamState::MSG_COMPLETE &&
*pflags |= NGHTTP3_DATA_FLAG_EOF; body->rleft_mark() == 0) {
} else if (body->rleft_mark() == 0) {
downstream->disable_upstream_wtimer(); downstream->disable_upstream_wtimer();
return NGHTTP3_ERR_WOULDBLOCK; return NGHTTP3_ERR_WOULDBLOCK;
} }
@ -1213,6 +1212,11 @@ nghttp3_ssize downstream_read_data_callback(nghttp3_conn *conn,
veccnt = body->riovec_mark(reinterpret_cast<struct iovec *>(vec), veccnt); veccnt = body->riovec_mark(reinterpret_cast<struct iovec *>(vec), veccnt);
if (downstream->get_response_state() == DownstreamState::MSG_COMPLETE &&
body->rleft_mark() == 0) {
*pflags |= NGHTTP3_DATA_FLAG_EOF;
}
assert((*pflags & NGHTTP3_DATA_FLAG_EOF) || veccnt); assert((*pflags & NGHTTP3_DATA_FLAG_EOF) || veccnt);
downstream->response_sent_body_length += nghttp3_vec_len(vec, veccnt); downstream->response_sent_body_length += nghttp3_vec_len(vec, veccnt);