shrpx: Don't return chunked response for pre-HTTP/1.1 request
This commit is contained in:
parent
817f35f3e4
commit
964c0d1005
|
@ -591,9 +591,18 @@ void on_ctrl_recv_callback
|
|||
status = downstream->get_response_http_status();
|
||||
if(!((100 <= status && status <= 199) || status == 204 ||
|
||||
status == 304)) {
|
||||
// In SPDY, we are supporsed not to receive
|
||||
// transfer-encoding.
|
||||
downstream->add_response_header("transfer-encoding", "chunked");
|
||||
// Here we have response body but Content-Length is not known
|
||||
// in advance.
|
||||
if(downstream->get_request_major() <= 0 ||
|
||||
downstream->get_request_minor() <= 0) {
|
||||
// We simply close connection for pre-HTTP/1.1 in this case.
|
||||
downstream->set_response_connection_close(true);
|
||||
} else {
|
||||
// Otherwise, use chunked encoding to keep upstream
|
||||
// connection open. In SPDY, we are supporsed not to
|
||||
// receive transfer-encoding.
|
||||
downstream->add_response_header("transfer-encoding", "chunked");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue