Commit b9a9a23b authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

nghttpx: Close connection when error_reply is used for HTTP/1 upstream

parent 8059380f
...@@ -463,6 +463,7 @@ int HttpsUpstream::downstream_read(DownstreamConnection *dconn) { ...@@ -463,6 +463,7 @@ int HttpsUpstream::downstream_read(DownstreamConnection *dconn) {
} }
if (downstream->get_response_state() == Downstream::MSG_BAD_HEADER) { if (downstream->get_response_state() == Downstream::MSG_BAD_HEADER) {
handler_->set_should_close_after_write(true);
if (error_reply(502) != 0) { if (error_reply(502) != 0) {
return -1; return -1;
} }
...@@ -531,6 +532,7 @@ int HttpsUpstream::downstream_eof(DownstreamConnection *dconn) { ...@@ -531,6 +532,7 @@ int HttpsUpstream::downstream_eof(DownstreamConnection *dconn) {
if (LOG_ENABLED(INFO)) { if (LOG_ENABLED(INFO)) {
DCLOG(INFO, dconn) << "Return error reply"; DCLOG(INFO, dconn) << "Return error reply";
} }
handler_->set_should_close_after_write(true);
if (error_reply(502) != 0) { if (error_reply(502) != 0) {
return -1; return -1;
} }
...@@ -801,6 +803,7 @@ int HttpsUpstream::on_downstream_body_complete(Downstream *downstream) { ...@@ -801,6 +803,7 @@ int HttpsUpstream::on_downstream_body_complete(Downstream *downstream) {
int HttpsUpstream::on_downstream_abort_request(Downstream *downstream, int HttpsUpstream::on_downstream_abort_request(Downstream *downstream,
unsigned int status_code) { unsigned int status_code) {
handler_->set_should_close_after_write(true);
return error_reply(status_code); return error_reply(status_code);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment