nghttpx: Call signal_write in HttpsUpstream::on_downstream_abort_request

This commit is contained in:
Tatsuhiro Tsujikawa 2015-01-21 22:45:52 +09:00
parent 041d9863c2
commit c0fc726955
2 changed files with 25 additions and 1 deletions

View File

@ -95,6 +95,28 @@ func TestH1H1ConnectFailure(t *testing.T) {
}
}
func TestH1H2NoHost(t *testing.T) {
st := newServerTester([]string{"--http2-bridge"}, t, func(w http.ResponseWriter, r *http.Request) {
t.Errorf("server should not forward bad request")
})
defer st.Close()
// without Host header field, we expect 400 response
if _, err := io.WriteString(st.conn, "GET / HTTP/1.1\r\nTest-Case: TestH1H2NoHost\r\n\r\n"); err != nil {
t.Fatalf("Error io.WriteString() = %v", err)
}
resp, err := http.ReadResponse(bufio.NewReader(st.conn), nil)
if err != nil {
t.Fatalf("Error http.ReadResponse() = %v", err)
}
want := 400
if got := resp.StatusCode; got != want {
t.Errorf("status: %v; want %v", got, want)
}
}
func TestH2H1PlainGET(t *testing.T) {
st := newServerTester(nil, t, noopHandler)
defer st.Close()

View File

@ -810,7 +810,9 @@ int HttpsUpstream::on_downstream_body_complete(Downstream *downstream) {
int HttpsUpstream::on_downstream_abort_request(Downstream *downstream,
unsigned int status_code) {
handler_->set_should_close_after_write(true);
return error_reply(status_code);
error_reply(status_code);
handler_->signal_write();
return 0;
}
void HttpsUpstream::log_response_headers(const std::string &hdrs) const {