nghttpx: Don't reset stream if we have already received response

This commit is contained in:
Tatsuhiro Tsujikawa 2016-12-24 22:54:22 +09:00
parent a0ce5ea9ab
commit cd83d70e7b
3 changed files with 22 additions and 2 deletions

View File

@ -1854,6 +1854,11 @@ int Http2Upstream::on_downstream_reset(Downstream *downstream, bool no_retry) {
}
if (!downstream->request_submission_ready()) {
if (downstream->get_response_state() == Downstream::MSG_COMPLETE) {
// We have got all response body already. Send it off.
downstream->pop_downstream_connection();
return 0;
}
// pushed stream is handled here
rst_stream(downstream, NGHTTP2_INTERNAL_ERROR);
downstream->pop_downstream_connection();

View File

@ -1223,13 +1223,23 @@ int HttpsUpstream::on_downstream_reset(Downstream *downstream, bool no_retry) {
assert(downstream == downstream_.get());
downstream_->pop_downstream_connection();
if (!downstream_->request_submission_ready()) {
switch (downstream_->get_response_state()) {
case Downstream::MSG_COMPLETE:
// We have got all response body already. Send it off.
return 0;
case Downstream::INITIAL:
if (on_downstream_abort_request(downstream_.get(), 503) != 0) {
return -1;
}
return 0;
}
// Return error so that caller can delete handler
return -1;
}
downstream_->pop_downstream_connection();
downstream_->add_retry();
if (no_retry || downstream_->no_more_retry()) {

View File

@ -1314,6 +1314,11 @@ int SpdyUpstream::on_downstream_reset(Downstream *downstream, bool no_retry) {
}
if (!downstream->request_submission_ready()) {
if (downstream->get_response_state() == Downstream::MSG_COMPLETE) {
// We have got all response body already. Send it off.
downstream->pop_downstream_connection();
return 0;
}
rst_stream(downstream, SPDYLAY_INTERNAL_ERROR);
downstream->pop_downstream_connection();