mirror of
https://github.com/nginx/nginx.git
synced 2024-12-20 09:07:50 +08:00
Merge of r3964, r3977, r3978:
Proxy related fixes: *) finalizing with rc == 0 in unbuffered proxy mode caused nginx to wait for another send_timeout before actually closing client's connection if client timed out while still talking to upstream server *) update r3945 with more descriptive error message *) test length of proxy_pass with variables; patch by Lanshun Zhou
This commit is contained in:
parent
1c95e6c305
commit
8f8839f98d
@ -2003,6 +2003,8 @@ ngx_http_fastcgi_create_loc_conf(ngx_conf_t *cf)
|
|||||||
|
|
||||||
conf->catch_stderr = NGX_CONF_UNSET_PTR;
|
conf->catch_stderr = NGX_CONF_UNSET_PTR;
|
||||||
|
|
||||||
|
ngx_str_set(&conf->upstream.module, "fastcgi");
|
||||||
|
|
||||||
return conf;
|
return conf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -642,15 +642,17 @@ ngx_http_proxy_eval(ngx_http_request_t *r, ngx_http_proxy_ctx_t *ctx,
|
|||||||
return NGX_ERROR;
|
return NGX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ngx_strncasecmp(proxy.data, (u_char *) "http://", 7) == 0) {
|
if (proxy.len > 7
|
||||||
|
&& ngx_strncasecmp(proxy.data, (u_char *) "http://", 7) == 0)
|
||||||
|
{
|
||||||
add = 7;
|
add = 7;
|
||||||
port = 80;
|
port = 80;
|
||||||
|
|
||||||
#if (NGX_HTTP_SSL)
|
#if (NGX_HTTP_SSL)
|
||||||
|
|
||||||
} else if (ngx_strncasecmp(proxy.data, (u_char *) "https://", 8) == 0) {
|
} else if (proxy.len > 8
|
||||||
|
&& ngx_strncasecmp(proxy.data, (u_char *) "https://", 8) == 0)
|
||||||
|
{
|
||||||
add = 8;
|
add = 8;
|
||||||
port = 443;
|
port = 443;
|
||||||
r->upstream->ssl = 1;
|
r->upstream->ssl = 1;
|
||||||
@ -1707,6 +1709,8 @@ ngx_http_proxy_create_loc_conf(ngx_conf_t *cf)
|
|||||||
conf->headers_hash_max_size = NGX_CONF_UNSET_UINT;
|
conf->headers_hash_max_size = NGX_CONF_UNSET_UINT;
|
||||||
conf->headers_hash_bucket_size = NGX_CONF_UNSET_UINT;
|
conf->headers_hash_bucket_size = NGX_CONF_UNSET_UINT;
|
||||||
|
|
||||||
|
ngx_str_set(&conf->upstream.module, "proxy");
|
||||||
|
|
||||||
return conf;
|
return conf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1030,6 +1030,8 @@ ngx_http_scgi_create_loc_conf(ngx_conf_t *cf)
|
|||||||
/* "scgi_cyclic_temp_file" is disabled */
|
/* "scgi_cyclic_temp_file" is disabled */
|
||||||
conf->upstream.cyclic_temp_file = 0;
|
conf->upstream.cyclic_temp_file = 0;
|
||||||
|
|
||||||
|
ngx_str_set(&conf->upstream.module, "scgi");
|
||||||
|
|
||||||
return conf;
|
return conf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1083,6 +1083,8 @@ ngx_http_uwsgi_create_loc_conf(ngx_conf_t *cf)
|
|||||||
/* "uwsgi_cyclic_temp_file" is disabled */
|
/* "uwsgi_cyclic_temp_file" is disabled */
|
||||||
conf->upstream.cyclic_temp_file = 0;
|
conf->upstream.cyclic_temp_file = 0;
|
||||||
|
|
||||||
|
ngx_str_set(&conf->upstream.module, "uwsgi");
|
||||||
|
|
||||||
return conf;
|
return conf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -661,10 +661,12 @@ ngx_http_upstream_cache(ngx_http_request_t *r, ngx_http_upstream_t *u)
|
|||||||
|
|
||||||
ngx_http_file_cache_create_key(r);
|
ngx_http_file_cache_create_key(r);
|
||||||
|
|
||||||
if (r->cache->header_start >= u->conf->buffer_size) {
|
if (r->cache->header_start + 256 >= u->conf->buffer_size) {
|
||||||
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
|
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
|
||||||
"cache key too large, increase upstream buffer size %uz",
|
"%V_buffer_size %uz is not enough for cache key, "
|
||||||
u->conf->buffer_size);
|
"it should increased at least to %uz",
|
||||||
|
&u->conf->module, u->conf->buffer_size,
|
||||||
|
ngx_align(r->cache->header_start + 256, 1024));
|
||||||
|
|
||||||
r->cache = NULL;
|
r->cache = NULL;
|
||||||
return NGX_DECLINED;
|
return NGX_DECLINED;
|
||||||
@ -2317,7 +2319,7 @@ ngx_http_upstream_process_non_buffered_downstream(ngx_http_request_t *r)
|
|||||||
if (wev->timedout) {
|
if (wev->timedout) {
|
||||||
c->timedout = 1;
|
c->timedout = 1;
|
||||||
ngx_connection_error(c, NGX_ETIMEDOUT, "client timed out");
|
ngx_connection_error(c, NGX_ETIMEDOUT, "client timed out");
|
||||||
ngx_http_upstream_finalize_request(r, u, 0);
|
ngx_http_upstream_finalize_request(r, u, NGX_HTTP_REQUEST_TIME_OUT);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3013,6 +3015,7 @@ ngx_http_upstream_finalize_request(ngx_http_request_t *r,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (u->header_sent
|
if (u->header_sent
|
||||||
|
&& rc != NGX_HTTP_REQUEST_TIME_OUT
|
||||||
&& (rc == NGX_ERROR || rc >= NGX_HTTP_SPECIAL_RESPONSE))
|
&& (rc == NGX_ERROR || rc >= NGX_HTTP_SPECIAL_RESPONSE))
|
||||||
{
|
{
|
||||||
rc = 0;
|
rc = 0;
|
||||||
|
@ -179,6 +179,7 @@ typedef struct {
|
|||||||
ngx_flag_t ssl_session_reuse;
|
ngx_flag_t ssl_session_reuse;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
ngx_str_t module;
|
||||||
} ngx_http_upstream_conf_t;
|
} ngx_http_upstream_conf_t;
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user