Update auf Nginx 1.13.4
This commit is contained in:
@@ -182,7 +182,9 @@ static char *ngx_http_upstream_init_main_conf(ngx_conf_t *cf, void *conf);
|
||||
#if (NGX_HTTP_SSL)
|
||||
static void ngx_http_upstream_ssl_init_connection(ngx_http_request_t *,
|
||||
ngx_http_upstream_t *u, ngx_connection_t *c);
|
||||
static void ngx_http_upstream_ssl_handshake(ngx_connection_t *c);
|
||||
static void ngx_http_upstream_ssl_handshake_handler(ngx_connection_t *c);
|
||||
static void ngx_http_upstream_ssl_handshake(ngx_http_request_t *,
|
||||
ngx_http_upstream_t *u, ngx_connection_t *c);
|
||||
static ngx_int_t ngx_http_upstream_ssl_name(ngx_http_request_t *r,
|
||||
ngx_http_upstream_t *u, ngx_connection_t *c);
|
||||
#endif
|
||||
@@ -425,7 +427,7 @@ static ngx_http_variable_t ngx_http_upstream_vars[] = {
|
||||
{ ngx_string("upstream_cookie_"), NULL, ngx_http_upstream_cookie_variable,
|
||||
0, NGX_HTTP_VAR_NOCACHEABLE|NGX_HTTP_VAR_PREFIX, 0 },
|
||||
|
||||
{ ngx_null_string, NULL, NULL, 0, 0, 0 }
|
||||
ngx_http_null_variable
|
||||
};
|
||||
|
||||
|
||||
@@ -1075,6 +1077,10 @@ ngx_http_upstream_cache_background_update(ngx_http_request_t *r,
|
||||
return NGX_OK;
|
||||
}
|
||||
|
||||
if (r == r->main) {
|
||||
r->preserve_body = 1;
|
||||
}
|
||||
|
||||
if (ngx_http_subrequest(r, &r->uri, &r->args, &sr, NULL,
|
||||
NGX_HTTP_SUBREQUEST_CLONE
|
||||
|NGX_HTTP_SUBREQUEST_BACKGROUND)
|
||||
@@ -1143,11 +1149,14 @@ ngx_http_upstream_cache_check_range(ngx_http_request_t *r,
|
||||
static void
|
||||
ngx_http_upstream_resolve_handler(ngx_resolver_ctx_t *ctx)
|
||||
{
|
||||
ngx_uint_t run_posted;
|
||||
ngx_connection_t *c;
|
||||
ngx_http_request_t *r;
|
||||
ngx_http_upstream_t *u;
|
||||
ngx_http_upstream_resolved_t *ur;
|
||||
|
||||
run_posted = ctx->async;
|
||||
|
||||
r = ctx->data;
|
||||
c = r->connection;
|
||||
|
||||
@@ -1211,7 +1220,9 @@ ngx_http_upstream_resolve_handler(ngx_resolver_ctx_t *ctx)
|
||||
|
||||
failed:
|
||||
|
||||
ngx_http_run_posted_requests(c);
|
||||
if (run_posted) {
|
||||
ngx_http_run_posted_requests(c);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1662,26 +1673,43 @@ ngx_http_upstream_ssl_init_connection(ngx_http_request_t *r,
|
||||
ngx_add_timer(c->write, u->conf->connect_timeout);
|
||||
}
|
||||
|
||||
c->ssl->handler = ngx_http_upstream_ssl_handshake;
|
||||
c->ssl->handler = ngx_http_upstream_ssl_handshake_handler;
|
||||
return;
|
||||
}
|
||||
|
||||
ngx_http_upstream_ssl_handshake(c);
|
||||
ngx_http_upstream_ssl_handshake(r, u, c);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
ngx_http_upstream_ssl_handshake(ngx_connection_t *c)
|
||||
ngx_http_upstream_ssl_handshake_handler(ngx_connection_t *c)
|
||||
{
|
||||
long rc;
|
||||
ngx_http_request_t *r;
|
||||
ngx_http_upstream_t *u;
|
||||
|
||||
r = c->data;
|
||||
|
||||
u = r->upstream;
|
||||
c = r->connection;
|
||||
|
||||
ngx_http_set_log_request(c->log, r);
|
||||
|
||||
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0,
|
||||
"http upstream ssl handshake: \"%V?%V\"",
|
||||
&r->uri, &r->args);
|
||||
|
||||
ngx_http_upstream_ssl_handshake(r, u, u->peer.connection);
|
||||
|
||||
ngx_http_run_posted_requests(c);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
ngx_http_upstream_ssl_handshake(ngx_http_request_t *r, ngx_http_upstream_t *u,
|
||||
ngx_connection_t *c)
|
||||
{
|
||||
long rc;
|
||||
|
||||
if (c->ssl->handshaked) {
|
||||
|
||||
if (u->conf->ssl_verify) {
|
||||
@@ -1709,28 +1737,19 @@ ngx_http_upstream_ssl_handshake(ngx_connection_t *c)
|
||||
c->write->handler = ngx_http_upstream_handler;
|
||||
c->read->handler = ngx_http_upstream_handler;
|
||||
|
||||
c = r->connection;
|
||||
|
||||
ngx_http_upstream_send_request(r, u, 1);
|
||||
|
||||
ngx_http_run_posted_requests(c);
|
||||
return;
|
||||
}
|
||||
|
||||
if (c->write->timedout) {
|
||||
c = r->connection;
|
||||
ngx_http_upstream_next(r, u, NGX_HTTP_UPSTREAM_FT_TIMEOUT);
|
||||
ngx_http_run_posted_requests(c);
|
||||
return;
|
||||
}
|
||||
|
||||
failed:
|
||||
|
||||
c = r->connection;
|
||||
|
||||
ngx_http_upstream_next(r, u, NGX_HTTP_UPSTREAM_FT_ERROR);
|
||||
|
||||
ngx_http_run_posted_requests(c);
|
||||
}
|
||||
|
||||
|
||||
@@ -2729,7 +2748,7 @@ ngx_http_upstream_process_body_in_memory(ngx_http_request_t *r,
|
||||
rev = c->read;
|
||||
|
||||
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0,
|
||||
"http upstream process body on memory");
|
||||
"http upstream process body in memory");
|
||||
|
||||
if (rev->timedout) {
|
||||
ngx_connection_error(c, NGX_ETIMEDOUT, "upstream timed out");
|
||||
@@ -2842,7 +2861,9 @@ ngx_http_upstream_send_response(ngx_http_request_t *r, ngx_http_upstream_t *u)
|
||||
u->pipe->downstream_error = 1;
|
||||
}
|
||||
|
||||
if (r->request_body && r->request_body->temp_file) {
|
||||
if (r->request_body && r->request_body->temp_file
|
||||
&& r == r->main && !r->preserve_body)
|
||||
{
|
||||
ngx_pool_run_cleanup_file(r->pool, r->request_body->temp_file->file.fd);
|
||||
r->request_body->temp_file->file.fd = NGX_INVALID_FILE;
|
||||
}
|
||||
@@ -4488,7 +4509,7 @@ ngx_http_upstream_process_cache_control(ngx_http_request_t *r,
|
||||
}
|
||||
|
||||
if (*p >= '0' && *p <= '9') {
|
||||
n = n * 10 + *p - '0';
|
||||
n = n * 10 + (*p - '0');
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -4516,7 +4537,7 @@ ngx_http_upstream_process_cache_control(ngx_http_request_t *r,
|
||||
}
|
||||
|
||||
if (*p >= '0' && *p <= '9') {
|
||||
n = n * 10 + *p - '0';
|
||||
n = n * 10 + (*p - '0');
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -4539,7 +4560,7 @@ ngx_http_upstream_process_cache_control(ngx_http_request_t *r,
|
||||
}
|
||||
|
||||
if (*p >= '0' && *p <= '9') {
|
||||
n = n * 10 + *p - '0';
|
||||
n = n * 10 + (*p - '0');
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user