Mercurial > hg > nginx
comparison src/http/ngx_http_core_module.c @ 3793:279083731ec6
keepalive_disable
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Fri, 26 Nov 2010 12:40:56 +0000 |
parents | 173a45374a97 |
children | 96f17c930a9e |
comparison
equal
deleted
inserted
replaced
3792:164a7f8df979 | 3793:279083731ec6 |
---|---|
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; |
1429 if (r->keepalive) { | 1424 if (r->keepalive) { |
1430 if (clcf->keepalive_timeout == 0) { | 1425 if (clcf->keepalive_timeout == 0) { |
1431 r->keepalive = 0; | 1426 r->keepalive = 0; |
1432 | 1427 |
1433 } else if (r->connection->requests >= clcf->keepalive_requests) { | 1428 } else if (r->connection->requests >= clcf->keepalive_requests) { |
1429 r->keepalive = 0; | |
1430 | |
1431 } else if (r->headers_in.msie6 | |
1432 && r->method == NGX_HTTP_POST | |
1433 && (clcf->keepalive_disable | |
1434 & NGX_HTTP_KEEPALIVE_DISABLE_MSIE6)) | |
1435 { | |
1436 /* | |
1437 * MSIE may wait for some time if an response for | |
1438 * a POST request was sent over a keepalive connection | |
1439 */ | |
1440 r->keepalive = 0; | |
1441 | |
1442 } else if (r->headers_in.safari | |
1443 && (clcf->keepalive_disable | |
1444 & NGX_HTTP_KEEPALIVE_DISABLE_SAFARI)) | |
1445 { | |
1446 /* | |
1447 * Safari may send a POST request to a closed keepalive | |
1448 * connection and may stall for some time, see | |
1449 * https://bugs.webkit.org/show_bug.cgi?id=5760 | |
1450 */ | |
1434 r->keepalive = 0; | 1451 r->keepalive = 0; |
1435 } | 1452 } |
1436 } | 1453 } |
1437 | 1454 |
1438 if (!clcf->tcp_nopush) { | 1455 if (!clcf->tcp_nopush) { |
3059 */ | 3076 */ |
3060 | 3077 |
3061 clcf->client_max_body_size = NGX_CONF_UNSET; | 3078 clcf->client_max_body_size = NGX_CONF_UNSET; |
3062 clcf->client_body_buffer_size = NGX_CONF_UNSET_SIZE; | 3079 clcf->client_body_buffer_size = NGX_CONF_UNSET_SIZE; |
3063 clcf->client_body_timeout = NGX_CONF_UNSET_MSEC; | 3080 clcf->client_body_timeout = NGX_CONF_UNSET_MSEC; |
3081 clcf->keepalive_disable = NGX_CONF_UNSET_UINT; | |
3064 clcf->satisfy = NGX_CONF_UNSET_UINT; | 3082 clcf->satisfy = NGX_CONF_UNSET_UINT; |
3065 clcf->if_modified_since = NGX_CONF_UNSET_UINT; | 3083 clcf->if_modified_since = NGX_CONF_UNSET_UINT; |
3066 clcf->client_body_in_file_only = NGX_CONF_UNSET_UINT; | 3084 clcf->client_body_in_file_only = NGX_CONF_UNSET_UINT; |
3067 clcf->client_body_in_single_buffer = NGX_CONF_UNSET; | 3085 clcf->client_body_in_single_buffer = NGX_CONF_UNSET; |
3068 clcf->internal = NGX_CONF_UNSET; | 3086 clcf->internal = NGX_CONF_UNSET; |
3259 prev->client_body_buffer_size, | 3277 prev->client_body_buffer_size, |
3260 (size_t) 2 * ngx_pagesize); | 3278 (size_t) 2 * ngx_pagesize); |
3261 ngx_conf_merge_msec_value(conf->client_body_timeout, | 3279 ngx_conf_merge_msec_value(conf->client_body_timeout, |
3262 prev->client_body_timeout, 60000); | 3280 prev->client_body_timeout, 60000); |
3263 | 3281 |
3282 ngx_conf_merge_uint_value(conf->keepalive_disable, prev->keepalive_disable, | |
3283 NGX_HTTP_KEEPALIVE_DISABLE_MSIE6 | |
3284 |NGX_HTTP_KEEPALIVE_DISABLE_SAFARI); | |
3264 ngx_conf_merge_uint_value(conf->satisfy, prev->satisfy, | 3285 ngx_conf_merge_uint_value(conf->satisfy, prev->satisfy, |
3265 NGX_HTTP_SATISFY_ALL); | 3286 NGX_HTTP_SATISFY_ALL); |
3266 ngx_conf_merge_uint_value(conf->if_modified_since, prev->if_modified_since, | 3287 ngx_conf_merge_uint_value(conf->if_modified_since, prev->if_modified_since, |
3267 NGX_HTTP_IMS_EXACT); | 3288 NGX_HTTP_IMS_EXACT); |
3268 ngx_conf_merge_uint_value(conf->client_body_in_file_only, | 3289 ngx_conf_merge_uint_value(conf->client_body_in_file_only, |