nghttpx: Robust HTTP/1 backend CL and TE handling
We should ignore Content-Length and Transfer-Encoding for upgraded response, and reset content-length if this is a non-final response.
This commit is contained in:
parent
308738025c
commit
095bc178f3
|
@ -520,6 +520,9 @@ int htp_hdrs_completecb(http_parser *htp) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (downstream->get_non_final_response()) {
|
if (downstream->get_non_final_response()) {
|
||||||
|
// Reset content-length because we reuse same Downstream for the
|
||||||
|
// next response.
|
||||||
|
downstream->set_response_content_length(-1);
|
||||||
// For non-final response code, we just call
|
// For non-final response code, we just call
|
||||||
// on_downstream_header_complete() without changing response
|
// on_downstream_header_complete() without changing response
|
||||||
// state.
|
// state.
|
||||||
|
@ -537,7 +540,11 @@ int htp_hdrs_completecb(http_parser *htp) {
|
||||||
downstream->inspect_http1_response();
|
downstream->inspect_http1_response();
|
||||||
downstream->check_upgrade_fulfilled();
|
downstream->check_upgrade_fulfilled();
|
||||||
if (downstream->get_upgraded()) {
|
if (downstream->get_upgraded()) {
|
||||||
|
// content-length must be ignored for upgraded connection.
|
||||||
|
downstream->set_response_content_length(-1);
|
||||||
downstream->set_response_connection_close(true);
|
downstream->set_response_connection_close(true);
|
||||||
|
// transfer-encoding not applied to upgraded connection
|
||||||
|
downstream->set_chunked_response(false);
|
||||||
}
|
}
|
||||||
if (upstream->on_downstream_header_complete(downstream) != 0) {
|
if (upstream->on_downstream_header_complete(downstream) != 0) {
|
||||||
return -1;
|
return -1;
|
||||||
|
|
Loading…
Reference in New Issue