nghttpx: Return 503 when h1 backend connect attempt failed

This commit is contained in:
Tatsuhiro Tsujikawa 2015-01-21 23:08:13 +09:00
parent cee22df073
commit 2f788aa214
2 changed files with 3 additions and 3 deletions

View File

@ -89,7 +89,7 @@ func TestH1H1ConnectFailure(t *testing.T) {
if err != nil {
t.Fatalf("Error st.http1() = %v", err)
}
want := 502
want := 503
if got := res.status; got != want {
t.Errorf("status: %v; want %v", got, want)
}
@ -366,7 +366,7 @@ func TestH2H1ConnectFailure(t *testing.T) {
if err != nil {
t.Fatalf("Error st.http2() = %v", err)
}
want := 502
want := 503
if got := res.status; got != want {
t.Errorf("status: %v; want %v", got, want)
}

View File

@ -95,7 +95,7 @@ void connectcb(struct ev_loop *loop, ev_io *w, int revents) {
auto upstream = downstream->get_upstream();
auto handler = upstream->get_client_handler();
if (dconn->on_connect() != 0) {
if (upstream->downstream_error(dconn, Downstream::EVENT_ERROR) != 0) {
if (upstream->on_downstream_abort_request(downstream, 503) != 0) {
delete handler;
}
return;