nghttpx: Use 502 as server error code
This commit is contained in:
parent
b12c2a13c0
commit
e17a6b29b6
|
@ -449,7 +449,7 @@ void Http2Upstream::initiate_downstream(Downstream *downstream) {
|
||||||
if (rv == SHRPX_ERR_TLS_REQUIRED) {
|
if (rv == SHRPX_ERR_TLS_REQUIRED) {
|
||||||
rv = redirect_to_https(downstream);
|
rv = redirect_to_https(downstream);
|
||||||
} else {
|
} else {
|
||||||
rv = error_reply(downstream, 503);
|
rv = error_reply(downstream, 502);
|
||||||
}
|
}
|
||||||
if (rv != 0) {
|
if (rv != 0) {
|
||||||
rst_stream(downstream, NGHTTP2_INTERNAL_ERROR);
|
rst_stream(downstream, NGHTTP2_INTERNAL_ERROR);
|
||||||
|
@ -464,7 +464,7 @@ void Http2Upstream::initiate_downstream(Downstream *downstream) {
|
||||||
rv = downstream->attach_downstream_connection(std::move(dconn));
|
rv = downstream->attach_downstream_connection(std::move(dconn));
|
||||||
if (rv != 0) {
|
if (rv != 0) {
|
||||||
// downstream connection fails, send error page
|
// downstream connection fails, send error page
|
||||||
if (error_reply(downstream, 503) != 0) {
|
if (error_reply(downstream, 502) != 0) {
|
||||||
rst_stream(downstream, NGHTTP2_INTERNAL_ERROR);
|
rst_stream(downstream, NGHTTP2_INTERNAL_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -477,7 +477,7 @@ void Http2Upstream::initiate_downstream(Downstream *downstream) {
|
||||||
rv = downstream->push_request_headers();
|
rv = downstream->push_request_headers();
|
||||||
if (rv != 0) {
|
if (rv != 0) {
|
||||||
|
|
||||||
if (error_reply(downstream, 503) != 0) {
|
if (error_reply(downstream, 502) != 0) {
|
||||||
rst_stream(downstream, NGHTTP2_INTERNAL_ERROR);
|
rst_stream(downstream, NGHTTP2_INTERNAL_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2005,7 +2005,7 @@ fail:
|
||||||
if (rv == SHRPX_ERR_TLS_REQUIRED) {
|
if (rv == SHRPX_ERR_TLS_REQUIRED) {
|
||||||
rv = on_downstream_abort_request_with_https_redirect(downstream);
|
rv = on_downstream_abort_request_with_https_redirect(downstream);
|
||||||
} else {
|
} else {
|
||||||
rv = on_downstream_abort_request(downstream, 503);
|
rv = on_downstream_abort_request(downstream, 502);
|
||||||
}
|
}
|
||||||
if (rv != 0) {
|
if (rv != 0) {
|
||||||
rst_stream(downstream, NGHTTP2_INTERNAL_ERROR);
|
rst_stream(downstream, NGHTTP2_INTERNAL_ERROR);
|
||||||
|
|
|
@ -152,7 +152,7 @@ void backend_retry(Downstream *downstream) {
|
||||||
if (rv == SHRPX_ERR_TLS_REQUIRED) {
|
if (rv == SHRPX_ERR_TLS_REQUIRED) {
|
||||||
rv = upstream->on_downstream_abort_request_with_https_redirect(downstream);
|
rv = upstream->on_downstream_abort_request_with_https_redirect(downstream);
|
||||||
} else {
|
} else {
|
||||||
rv = upstream->on_downstream_abort_request(downstream, 503);
|
rv = upstream->on_downstream_abort_request(downstream, 502);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rv != 0) {
|
if (rv != 0) {
|
||||||
|
|
|
@ -631,7 +631,7 @@ int HttpsUpstream::on_read() {
|
||||||
status_code = downstream->response().http_status;
|
status_code = downstream->response().http_status;
|
||||||
if (status_code == 0) {
|
if (status_code == 0) {
|
||||||
if (downstream->get_request_state() == Downstream::CONNECT_FAIL) {
|
if (downstream->get_request_state() == Downstream::CONNECT_FAIL) {
|
||||||
status_code = 503;
|
status_code = 502;
|
||||||
} else if (downstream->get_request_state() ==
|
} else if (downstream->get_request_state() ==
|
||||||
Downstream::HTTP1_REQUEST_HEADER_TOO_LARGE) {
|
Downstream::HTTP1_REQUEST_HEADER_TOO_LARGE) {
|
||||||
status_code = 431;
|
status_code = 431;
|
||||||
|
@ -1310,7 +1310,7 @@ int HttpsUpstream::on_downstream_reset(Downstream *downstream, bool no_retry) {
|
||||||
// We have got all response body already. Send it off.
|
// We have got all response body already. Send it off.
|
||||||
return 0;
|
return 0;
|
||||||
case Downstream::INITIAL:
|
case Downstream::INITIAL:
|
||||||
if (on_downstream_abort_request(downstream_.get(), 503) != 0) {
|
if (on_downstream_abort_request(downstream_.get(), 502) != 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1348,7 +1348,7 @@ fail:
|
||||||
if (rv == SHRPX_ERR_TLS_REQUIRED) {
|
if (rv == SHRPX_ERR_TLS_REQUIRED) {
|
||||||
rv = on_downstream_abort_request_with_https_redirect(downstream);
|
rv = on_downstream_abort_request_with_https_redirect(downstream);
|
||||||
} else {
|
} else {
|
||||||
rv = on_downstream_abort_request(downstream_.get(), 503);
|
rv = on_downstream_abort_request(downstream_.get(), 502);
|
||||||
}
|
}
|
||||||
if (rv != 0) {
|
if (rv != 0) {
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -1382,7 +1382,7 @@ int SpdyUpstream::on_downstream_reset(Downstream *downstream, bool no_retry) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
if (on_downstream_abort_request(downstream, 503) != 0) {
|
if (on_downstream_abort_request(downstream, 502) != 0) {
|
||||||
rst_stream(downstream, SPDYLAY_INTERNAL_ERROR);
|
rst_stream(downstream, SPDYLAY_INTERNAL_ERROR);
|
||||||
}
|
}
|
||||||
downstream->pop_downstream_connection();
|
downstream->pop_downstream_connection();
|
||||||
|
|
Loading…
Reference in New Issue