Commit c0fc7269 authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

nghttpx: Call signal_write in HttpsUpstream::on_downstream_abort_request

parent 041d9863
......@@ -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()
......
......@@ -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 {
......
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