mirror of
https://github.com/nginx/nginx.git
synced 2024-12-23 07:33:29 -06:00
Upstream: don't keep connections on early responses (ticket #669).
This commit is contained in:
parent
9973e36944
commit
fda7d021ca
@ -302,6 +302,10 @@ ngx_http_upstream_free_keepalive_peer(ngx_peer_connection_t *pc, void *data,
|
|||||||
goto invalid;
|
goto invalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!u->request_body_sent) {
|
||||||
|
goto invalid;
|
||||||
|
}
|
||||||
|
|
||||||
if (ngx_terminate || ngx_exiting) {
|
if (ngx_terminate || ngx_exiting) {
|
||||||
goto invalid;
|
goto invalid;
|
||||||
}
|
}
|
||||||
|
@ -1441,6 +1441,7 @@ ngx_http_upstream_connect(ngx_http_request_t *r, ngx_http_upstream_t *u)
|
|||||||
}
|
}
|
||||||
|
|
||||||
u->request_sent = 0;
|
u->request_sent = 0;
|
||||||
|
u->request_body_sent = 0;
|
||||||
|
|
||||||
if (rc == NGX_AGAIN) {
|
if (rc == NGX_AGAIN) {
|
||||||
ngx_add_timer(c->write, u->conf->connect_timeout);
|
ngx_add_timer(c->write, u->conf->connect_timeout);
|
||||||
@ -1825,6 +1826,8 @@ ngx_http_upstream_send_request(ngx_http_request_t *r, ngx_http_upstream_t *u,
|
|||||||
|
|
||||||
/* rc == NGX_OK */
|
/* rc == NGX_OK */
|
||||||
|
|
||||||
|
u->request_body_sent = 1;
|
||||||
|
|
||||||
if (c->write->timer_set) {
|
if (c->write->timer_set) {
|
||||||
ngx_del_timer(c->write);
|
ngx_del_timer(c->write);
|
||||||
}
|
}
|
||||||
|
@ -370,6 +370,7 @@ struct ngx_http_upstream_s {
|
|||||||
unsigned upgrade:1;
|
unsigned upgrade:1;
|
||||||
|
|
||||||
unsigned request_sent:1;
|
unsigned request_sent:1;
|
||||||
|
unsigned request_body_sent:1;
|
||||||
unsigned header_sent:1;
|
unsigned header_sent:1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user