fixed the upstream_timeout_fields patch for nginx.

This commit is contained in:
Yichun Zhang (agentzh) 2017-08-05 15:17:30 -07:00
parent 3c114dbe46
commit 45a8fb27e4
1 changed files with 25 additions and 24 deletions

View File

@ -1,7 +1,8 @@
diff -r 13070ecfda67 src/http/ngx_http_upstream.c
--- a/src/http/ngx_http_upstream.c Tue Apr 19 19:02:37 2016 +0300
+++ b/src/http/ngx_http_upstream.c Fri Jul 01 12:14:53 2016 -0700
@@ -481,12 +481,19 @@ void
diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c
index c394b291..e10df0ab 100644
--- a/src/http/ngx_http_upstream.c
+++ b/src/http/ngx_http_upstream.c
@@ -502,12 +502,19 @@ void
ngx_http_upstream_init(ngx_http_request_t *r)
{
ngx_connection_t *c;
@ -21,7 +22,7 @@ diff -r 13070ecfda67 src/http/ngx_http_upstream.c
#if (NGX_HTTP_V2)
if (r->stream) {
ngx_http_upstream_init_request(r);
@@ -1451,7 +1458,7 @@ ngx_http_upstream_connect(ngx_http_reque
@@ -1590,7 +1597,7 @@ ngx_http_upstream_connect(ngx_http_request_t *r, ngx_http_upstream_t *u)
u->request_body_sent = 0;
if (rc == NGX_AGAIN) {
@ -30,7 +31,7 @@ diff -r 13070ecfda67 src/http/ngx_http_upstream.c
return;
}
@@ -1540,7 +1547,7 @@ ngx_http_upstream_ssl_init_connection(ng
@@ -1666,7 +1673,7 @@ ngx_http_upstream_ssl_init_connection(ngx_http_request_t *r,
if (rc == NGX_AGAIN) {
if (!c->write->timer_set) {
@ -38,8 +39,8 @@ diff -r 13070ecfda67 src/http/ngx_http_upstream.c
+ ngx_add_timer(c->write, u->connect_timeout);
}
c->ssl->handler = ngx_http_upstream_ssl_handshake;
@@ -1816,7 +1823,7 @@ ngx_http_upstream_send_request(ngx_http_
c->ssl->handler = ngx_http_upstream_ssl_handshake_handler;
@@ -1960,7 +1967,7 @@ ngx_http_upstream_send_request(ngx_http_request_t *r, ngx_http_upstream_t *u,
if (rc == NGX_AGAIN) {
if (!c->write->ready) {
@ -48,7 +49,7 @@ diff -r 13070ecfda67 src/http/ngx_http_upstream.c
} else if (c->write->timer_set) {
ngx_del_timer(c->write);
@@ -1859,7 +1866,7 @@ ngx_http_upstream_send_request(ngx_http_
@@ -2003,7 +2010,7 @@ ngx_http_upstream_send_request(ngx_http_request_t *r, ngx_http_upstream_t *u,
return;
}
@ -57,7 +58,7 @@ diff -r 13070ecfda67 src/http/ngx_http_upstream.c
if (c->read->ready) {
ngx_http_upstream_process_header(r, u);
@@ -2658,7 +2665,7 @@ ngx_http_upstream_process_body_in_memory
@@ -2800,7 +2807,7 @@ ngx_http_upstream_process_body_in_memory(ngx_http_request_t *r,
}
if (rev->active) {
@ -66,7 +67,7 @@ diff -r 13070ecfda67 src/http/ngx_http_upstream.c
} else if (rev->timer_set) {
ngx_del_timer(rev);
@@ -2982,7 +2989,7 @@ ngx_http_upstream_send_response(ngx_http
@@ -3129,7 +3136,7 @@ ngx_http_upstream_send_response(ngx_http_request_t *r, ngx_http_upstream_t *u)
p->cyclic_temp_file = 0;
}
@ -75,7 +76,7 @@ diff -r 13070ecfda67 src/http/ngx_http_upstream.c
p->send_timeout = clcf->send_timeout;
p->send_lowat = clcf->send_lowat;
@@ -3239,7 +3246,7 @@ ngx_http_upstream_process_upgraded(ngx_h
@@ -3367,7 +3374,7 @@ ngx_http_upstream_process_upgraded(ngx_http_request_t *r,
}
if (upstream->write->active && !upstream->write->ready) {
@ -84,7 +85,7 @@ diff -r 13070ecfda67 src/http/ngx_http_upstream.c
} else if (upstream->write->timer_set) {
ngx_del_timer(upstream->write);
@@ -3251,7 +3258,7 @@ ngx_http_upstream_process_upgraded(ngx_h
@@ -3379,7 +3386,7 @@ ngx_http_upstream_process_upgraded(ngx_http_request_t *r,
}
if (upstream->read->active && !upstream->read->ready) {
@ -93,7 +94,7 @@ diff -r 13070ecfda67 src/http/ngx_http_upstream.c
} else if (upstream->read->timer_set) {
ngx_del_timer(upstream->read);
@@ -3444,7 +3451,7 @@ ngx_http_upstream_process_non_buffered_r
@@ -3573,7 +3580,7 @@ ngx_http_upstream_process_non_buffered_request(ngx_http_request_t *r,
}
if (upstream->read->active && !upstream->read->ready) {
@ -102,19 +103,19 @@ diff -r 13070ecfda67 src/http/ngx_http_upstream.c
} else if (upstream->read->timer_set) {
ngx_del_timer(upstream->read);
diff -r 13070ecfda67 src/http/ngx_http_upstream.h
--- a/src/http/ngx_http_upstream.h Tue Apr 19 19:02:37 2016 +0300
+++ b/src/http/ngx_http_upstream.h Fri Jul 01 12:14:53 2016 -0700
@@ -309,6 +309,12 @@ struct ngx_http_upstream_s {
ngx_chain_writer_ctx_t writer;
diff --git a/src/http/ngx_http_upstream.h b/src/http/ngx_http_upstream.h
index c552ac0c..40b69d0a 100644
--- a/src/http/ngx_http_upstream.h
+++ b/src/http/ngx_http_upstream.h
@@ -329,6 +329,11 @@ struct ngx_http_upstream_s {
ngx_array_t *caches;
#endif
ngx_http_upstream_conf_t *conf;
+
+#define HAVE_NGX_UPSTREAM_TIMEOUT_FIELDS 1
+ ngx_msec_t connect_timeout;
+ ngx_msec_t send_timeout;
+ ngx_msec_t read_timeout;
+
#if (NGX_HTTP_CACHE)
ngx_array_t *caches;
#endif
ngx_http_upstream_headers_in_t headers_in;
ngx_http_upstream_resolved_t *resolved;