Klaus Demo nginx / 2505587
lingering_close "off|on|always" patch by Maxim Dounin Igor Sysoev 10 years ago
3 changed file(s) with 31 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
125125 };
126126
127127
128 static ngx_conf_enum_t ngx_http_core_lingering_close[] = {
129 { ngx_string("off"), NGX_HTTP_LINGERING_OFF },
130 { ngx_string("on"), NGX_HTTP_LINGERING_ON },
131 { ngx_string("always"), NGX_HTTP_LINGERING_ALWAYS },
132 { ngx_null_string, 0 }
133 };
134
135
128136 static ngx_conf_enum_t ngx_http_core_if_modified_since[] = {
129137 { ngx_string("off"), NGX_HTTP_IMS_OFF },
130138 { ngx_string("exact"), NGX_HTTP_IMS_EXACT },
529537 NGX_HTTP_LOC_CONF_OFFSET,
530538 0,
531539 NULL },
540
541 { ngx_string("lingering_close"),
542 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
543 ngx_conf_set_enum_slot,
544 NGX_HTTP_LOC_CONF_OFFSET,
545 offsetof(ngx_http_core_loc_conf_t, lingering_close),
546 &ngx_http_core_lingering_close },
532547
533548 { ngx_string("lingering_time"),
534549 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
32493264 clcf->keepalive_timeout = NGX_CONF_UNSET_MSEC;
32503265 clcf->keepalive_header = NGX_CONF_UNSET;
32513266 clcf->keepalive_requests = NGX_CONF_UNSET_UINT;
3267 clcf->lingering_close = NGX_CONF_UNSET_UINT;
32523268 clcf->lingering_time = NGX_CONF_UNSET_MSEC;
32533269 clcf->lingering_timeout = NGX_CONF_UNSET_MSEC;
32543270 clcf->resolver_timeout = NGX_CONF_UNSET_MSEC;
34653481 prev->keepalive_header, 0);
34663482 ngx_conf_merge_uint_value(conf->keepalive_requests,
34673483 prev->keepalive_requests, 100);
3484 ngx_conf_merge_msec_value(conf->lingering_close,
3485 prev->lingering_close, NGX_HTTP_LINGERING_ON);
34683486 ngx_conf_merge_msec_value(conf->lingering_time,
34693487 prev->lingering_time, 30000);
34703488 ngx_conf_merge_msec_value(conf->lingering_timeout,
3232 #define NGX_HTTP_SATISFY_ANY 1
3333
3434
35 #define NGX_HTTP_LINGERING_OFF 0
36 #define NGX_HTTP_LINGERING_ON 1
37 #define NGX_HTTP_LINGERING_ALWAYS 2
38
39
3540 #define NGX_HTTP_IMS_OFF 0
3641 #define NGX_HTTP_IMS_EXACT 1
3742 #define NGX_HTTP_IMS_BEFORE 2
355360 ngx_uint_t keepalive_requests; /* keepalive_requests */
356361 ngx_uint_t keepalive_disable; /* keepalive_disable */
357362 ngx_uint_t satisfy; /* satisfy */
363 ngx_uint_t lingering_close; /* lingering_close */
358364 ngx_uint_t if_modified_since; /* if_modified_since */
359365 ngx_uint_t client_body_in_file_only; /* client_body_in_file_only */
360366
21412141 {
21422142 ngx_http_set_keepalive(r);
21432143 return;
2144
2145 } else if (clcf->lingering_timeout > 0
2146 && (r->lingering_close
2147 || r->header_in->pos < r->header_in->last
2148 || r->connection->read->ready))
2144 }
2145
2146 if (clcf->lingering_close == NGX_HTTP_LINGERING_ALWAYS
2147 || (clcf->lingering_close == NGX_HTTP_LINGERING_ON
2148 && (r->lingering_close
2149 || r->header_in->pos < r->header_in->last
2150 || r->connection->read->ready)))
21492151 {
21502152 ngx_http_set_lingering_close(r);
21512153 return;