Mercurial > hg > nginx-vendor-1-0
diff src/http/ngx_http_core_module.c @ 604:428c6e58046a NGINX_0_9_0
nginx 0.9.0
*) Feature: the "keepalive_disable" directive.
*) Feature: the "map" directive supports variables as value of a
defined variable.
*) Feature: the "map" directive supports empty strings as value of the
first parameter.
*) Feature: the "map" directive supports expressions as the first
parameter.
*) Feature: nginx(8) manual page.
Thanks to Sergey Osokin.
*) Feature: Linux accept4() support.
Thanks to Simon Liu.
*) Workaround: elimination of Linux linker warning about "sys_errlist"
and "sys_nerr"; the warning had appeared in 0.8.35.
*) Bugfix: a segmentation fault might occur in a worker process, if the
"auth_basic" directive was used.
Thanks to Michail Laletin.
*) Bugfix: compatibility with ngx_http_eval_module; the bug had
appeared in 0.8.42.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Mon, 29 Nov 2010 00:00:00 +0300 |
parents | c5122335e41d |
children | 9ad199846233 |
line wrap: on
line diff
--- a/src/http/ngx_http_core_module.c +++ b/src/http/ngx_http_core_module.c @@ -133,6 +133,14 @@ static ngx_conf_enum_t ngx_http_core_if }; +static ngx_conf_enum_t ngx_http_core_keepalive_disable[] = { + { ngx_string("none"), NGX_HTTP_KEEPALIVE_DISABLE_NONE }, + { ngx_string("msie6"), NGX_HTTP_KEEPALIVE_DISABLE_MSIE6 }, + { ngx_string("safari"), NGX_HTTP_KEEPALIVE_DISABLE_SAFARI }, + { ngx_null_string, 0 } +}; + + static ngx_path_init_t ngx_http_client_temp_path = { ngx_string(NGX_HTTP_CLIENT_TEMP_PATH), { 0, 0, 0 } }; @@ -494,6 +502,13 @@ static ngx_command_t ngx_http_core_comm offsetof(ngx_http_core_loc_conf_t, keepalive_requests), NULL }, + { ngx_string("keepalive_disable"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, + ngx_conf_set_enum_slot, + NGX_HTTP_LOC_CONF_OFFSET, + offsetof(ngx_http_core_loc_conf_t, keepalive_disable), + &ngx_http_core_keepalive_disable }, + { ngx_string("satisfy"), NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, ngx_conf_set_enum_slot, @@ -790,26 +805,6 @@ ngx_http_handler(ngx_http_request_t *r) break; } - if (r->keepalive) { - - if (r->headers_in.msie6) { - if (r->method == NGX_HTTP_POST) { - /* - * MSIE may wait for some time if an response for - * a POST request was sent over a keepalive connection - */ - r->keepalive = 0; - } - - } else if (r->headers_in.safari) { - /* - * Safari may send a POST request to a closed keepalive - * connection and stalls for some time - */ - r->keepalive = 0; - } - } - if (r->headers_in.content_length_n > 0) { r->lingering_close = 1; @@ -905,12 +900,21 @@ ngx_http_core_rewrite_phase(ngx_http_req rc = ph->handler(r); + if (rc == NGX_OK) { + r->phase_handler = ph->next; + return NGX_AGAIN; + } + if (rc == NGX_DECLINED) { r->phase_handler++; return NGX_AGAIN; } - /* rc == NGX_OK || rc == NGX_ERROR || rc == NGX_HTTP_... */ + if (rc == NGX_DONE) { + return NGX_OK; + } + + /* NGX_AGAIN || rc == NGX_ERROR || rc == NGX_HTTP_... */ ngx_http_finalize_request(r, rc); @@ -1432,6 +1436,28 @@ ngx_http_update_location_config(ngx_http } else if (r->connection->requests >= clcf->keepalive_requests) { r->keepalive = 0; + + } else if (r->headers_in.msie6 + && r->method == NGX_HTTP_POST + && (clcf->keepalive_disable + & NGX_HTTP_KEEPALIVE_DISABLE_MSIE6)) + { + /* + * MSIE may wait for some time if an response for + * a POST request was sent over a keepalive connection + */ + r->keepalive = 0; + + } else if (r->headers_in.safari + && (clcf->keepalive_disable + & NGX_HTTP_KEEPALIVE_DISABLE_SAFARI)) + { + /* + * Safari may send a POST request to a closed keepalive + * connection and may stall for some time, see + * https://bugs.webkit.org/show_bug.cgi?id=5760 + */ + r->keepalive = 0; } } @@ -3061,6 +3087,7 @@ ngx_http_core_create_loc_conf(ngx_conf_t clcf->client_max_body_size = NGX_CONF_UNSET; clcf->client_body_buffer_size = NGX_CONF_UNSET_SIZE; clcf->client_body_timeout = NGX_CONF_UNSET_MSEC; + clcf->keepalive_disable = NGX_CONF_UNSET_UINT; clcf->satisfy = NGX_CONF_UNSET_UINT; clcf->if_modified_since = NGX_CONF_UNSET_UINT; clcf->client_body_in_file_only = NGX_CONF_UNSET_UINT; @@ -3261,6 +3288,9 @@ ngx_http_core_merge_loc_conf(ngx_conf_t ngx_conf_merge_msec_value(conf->client_body_timeout, prev->client_body_timeout, 60000); + ngx_conf_merge_uint_value(conf->keepalive_disable, prev->keepalive_disable, + NGX_HTTP_KEEPALIVE_DISABLE_MSIE6 + |NGX_HTTP_KEEPALIVE_DISABLE_SAFARI); ngx_conf_merge_uint_value(conf->satisfy, prev->satisfy, NGX_HTTP_SATISFY_ALL); ngx_conf_merge_uint_value(conf->if_modified_since, prev->if_modified_since,