Mercurial > hg > nginx-vendor-1-0
comparison 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 |
comparison
equal
deleted
inserted
replaced
603:94ea26a3b3aa | 604:428c6e58046a |
---|---|
131 { ngx_string("before"), NGX_HTTP_IMS_BEFORE }, | 131 { ngx_string("before"), NGX_HTTP_IMS_BEFORE }, |
132 { ngx_null_string, 0 } | 132 { ngx_null_string, 0 } |
133 }; | 133 }; |
134 | 134 |
135 | 135 |
136 static ngx_conf_enum_t ngx_http_core_keepalive_disable[] = { | |
137 { ngx_string("none"), NGX_HTTP_KEEPALIVE_DISABLE_NONE }, | |
138 { ngx_string("msie6"), NGX_HTTP_KEEPALIVE_DISABLE_MSIE6 }, | |
139 { ngx_string("safari"), NGX_HTTP_KEEPALIVE_DISABLE_SAFARI }, | |
140 { ngx_null_string, 0 } | |
141 }; | |
142 | |
143 | |
136 static ngx_path_init_t ngx_http_client_temp_path = { | 144 static ngx_path_init_t ngx_http_client_temp_path = { |
137 ngx_string(NGX_HTTP_CLIENT_TEMP_PATH), { 0, 0, 0 } | 145 ngx_string(NGX_HTTP_CLIENT_TEMP_PATH), { 0, 0, 0 } |
138 }; | 146 }; |
139 | 147 |
140 | 148 |
491 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | 499 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
492 ngx_conf_set_num_slot, | 500 ngx_conf_set_num_slot, |
493 NGX_HTTP_LOC_CONF_OFFSET, | 501 NGX_HTTP_LOC_CONF_OFFSET, |
494 offsetof(ngx_http_core_loc_conf_t, keepalive_requests), | 502 offsetof(ngx_http_core_loc_conf_t, keepalive_requests), |
495 NULL }, | 503 NULL }, |
504 | |
505 { ngx_string("keepalive_disable"), | |
506 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | |
507 ngx_conf_set_enum_slot, | |
508 NGX_HTTP_LOC_CONF_OFFSET, | |
509 offsetof(ngx_http_core_loc_conf_t, keepalive_disable), | |
510 &ngx_http_core_keepalive_disable }, | |
496 | 511 |
497 { ngx_string("satisfy"), | 512 { ngx_string("satisfy"), |
498 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | 513 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
499 ngx_conf_set_enum_slot, | 514 ngx_conf_set_enum_slot, |
500 NGX_HTTP_LOC_CONF_OFFSET, | 515 NGX_HTTP_LOC_CONF_OFFSET, |
788 case NGX_HTTP_CONNECTION_KEEP_ALIVE: | 803 case NGX_HTTP_CONNECTION_KEEP_ALIVE: |
789 r->keepalive = 1; | 804 r->keepalive = 1; |
790 break; | 805 break; |
791 } | 806 } |
792 | 807 |
793 if (r->keepalive) { | |
794 | |
795 if (r->headers_in.msie6) { | |
796 if (r->method == NGX_HTTP_POST) { | |
797 /* | |
798 * MSIE may wait for some time if an response for | |
799 * a POST request was sent over a keepalive connection | |
800 */ | |
801 r->keepalive = 0; | |
802 } | |
803 | |
804 } else if (r->headers_in.safari) { | |
805 /* | |
806 * Safari may send a POST request to a closed keepalive | |
807 * connection and stalls for some time | |
808 */ | |
809 r->keepalive = 0; | |
810 } | |
811 } | |
812 | |
813 if (r->headers_in.content_length_n > 0) { | 808 if (r->headers_in.content_length_n > 0) { |
814 r->lingering_close = 1; | 809 r->lingering_close = 1; |
815 | 810 |
816 } else { | 811 } else { |
817 r->lingering_close = 0; | 812 r->lingering_close = 0; |
903 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | 898 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
904 "rewrite phase: %ui", r->phase_handler); | 899 "rewrite phase: %ui", r->phase_handler); |
905 | 900 |
906 rc = ph->handler(r); | 901 rc = ph->handler(r); |
907 | 902 |
903 if (rc == NGX_OK) { | |
904 r->phase_handler = ph->next; | |
905 return NGX_AGAIN; | |
906 } | |
907 | |
908 if (rc == NGX_DECLINED) { | 908 if (rc == NGX_DECLINED) { |
909 r->phase_handler++; | 909 r->phase_handler++; |
910 return NGX_AGAIN; | 910 return NGX_AGAIN; |
911 } | 911 } |
912 | 912 |
913 /* rc == NGX_OK || rc == NGX_ERROR || rc == NGX_HTTP_... */ | 913 if (rc == NGX_DONE) { |
914 return NGX_OK; | |
915 } | |
916 | |
917 /* NGX_AGAIN || rc == NGX_ERROR || rc == NGX_HTTP_... */ | |
914 | 918 |
915 ngx_http_finalize_request(r, rc); | 919 ngx_http_finalize_request(r, rc); |
916 | 920 |
917 return NGX_OK; | 921 return NGX_OK; |
918 } | 922 } |
1429 if (r->keepalive) { | 1433 if (r->keepalive) { |
1430 if (clcf->keepalive_timeout == 0) { | 1434 if (clcf->keepalive_timeout == 0) { |
1431 r->keepalive = 0; | 1435 r->keepalive = 0; |
1432 | 1436 |
1433 } else if (r->connection->requests >= clcf->keepalive_requests) { | 1437 } else if (r->connection->requests >= clcf->keepalive_requests) { |
1438 r->keepalive = 0; | |
1439 | |
1440 } else if (r->headers_in.msie6 | |
1441 && r->method == NGX_HTTP_POST | |
1442 && (clcf->keepalive_disable | |
1443 & NGX_HTTP_KEEPALIVE_DISABLE_MSIE6)) | |
1444 { | |
1445 /* | |
1446 * MSIE may wait for some time if an response for | |
1447 * a POST request was sent over a keepalive connection | |
1448 */ | |
1449 r->keepalive = 0; | |
1450 | |
1451 } else if (r->headers_in.safari | |
1452 && (clcf->keepalive_disable | |
1453 & NGX_HTTP_KEEPALIVE_DISABLE_SAFARI)) | |
1454 { | |
1455 /* | |
1456 * Safari may send a POST request to a closed keepalive | |
1457 * connection and may stall for some time, see | |
1458 * https://bugs.webkit.org/show_bug.cgi?id=5760 | |
1459 */ | |
1434 r->keepalive = 0; | 1460 r->keepalive = 0; |
1435 } | 1461 } |
1436 } | 1462 } |
1437 | 1463 |
1438 if (!clcf->tcp_nopush) { | 1464 if (!clcf->tcp_nopush) { |
3059 */ | 3085 */ |
3060 | 3086 |
3061 clcf->client_max_body_size = NGX_CONF_UNSET; | 3087 clcf->client_max_body_size = NGX_CONF_UNSET; |
3062 clcf->client_body_buffer_size = NGX_CONF_UNSET_SIZE; | 3088 clcf->client_body_buffer_size = NGX_CONF_UNSET_SIZE; |
3063 clcf->client_body_timeout = NGX_CONF_UNSET_MSEC; | 3089 clcf->client_body_timeout = NGX_CONF_UNSET_MSEC; |
3090 clcf->keepalive_disable = NGX_CONF_UNSET_UINT; | |
3064 clcf->satisfy = NGX_CONF_UNSET_UINT; | 3091 clcf->satisfy = NGX_CONF_UNSET_UINT; |
3065 clcf->if_modified_since = NGX_CONF_UNSET_UINT; | 3092 clcf->if_modified_since = NGX_CONF_UNSET_UINT; |
3066 clcf->client_body_in_file_only = NGX_CONF_UNSET_UINT; | 3093 clcf->client_body_in_file_only = NGX_CONF_UNSET_UINT; |
3067 clcf->client_body_in_single_buffer = NGX_CONF_UNSET; | 3094 clcf->client_body_in_single_buffer = NGX_CONF_UNSET; |
3068 clcf->internal = NGX_CONF_UNSET; | 3095 clcf->internal = NGX_CONF_UNSET; |
3259 prev->client_body_buffer_size, | 3286 prev->client_body_buffer_size, |
3260 (size_t) 2 * ngx_pagesize); | 3287 (size_t) 2 * ngx_pagesize); |
3261 ngx_conf_merge_msec_value(conf->client_body_timeout, | 3288 ngx_conf_merge_msec_value(conf->client_body_timeout, |
3262 prev->client_body_timeout, 60000); | 3289 prev->client_body_timeout, 60000); |
3263 | 3290 |
3291 ngx_conf_merge_uint_value(conf->keepalive_disable, prev->keepalive_disable, | |
3292 NGX_HTTP_KEEPALIVE_DISABLE_MSIE6 | |
3293 |NGX_HTTP_KEEPALIVE_DISABLE_SAFARI); | |
3264 ngx_conf_merge_uint_value(conf->satisfy, prev->satisfy, | 3294 ngx_conf_merge_uint_value(conf->satisfy, prev->satisfy, |
3265 NGX_HTTP_SATISFY_ALL); | 3295 NGX_HTTP_SATISFY_ALL); |
3266 ngx_conf_merge_uint_value(conf->if_modified_since, prev->if_modified_since, | 3296 ngx_conf_merge_uint_value(conf->if_modified_since, prev->if_modified_since, |
3267 NGX_HTTP_IMS_EXACT); | 3297 NGX_HTTP_IMS_EXACT); |
3268 ngx_conf_merge_uint_value(conf->client_body_in_file_only, | 3298 ngx_conf_merge_uint_value(conf->client_body_in_file_only, |