comparison src/http/ngx_http_core_module.c @ 634:23ef0645ea57 NGINX_1_1_1

nginx 1.1.1 *) Change: now cache loader processes either as many files as specified by "loader_files" parameter or works no more than time specified by "loader_threshold" parameter during each iteration. *) Change: now SIGWINCH signal works only in deamon mode. *) Feature: now shared zones and caches use POSIX semaphores on Solaris. Thanks to Den Ivanov. *) Feature: accept filters are now supported on NetBSD. *) Bugfix: nginx could not be build on Linux 3.0. *) Bugfix: nginx did not use gzipping in some cases; the bug had appeared in 1.1.0. *) Bugfix: request body might be incorrectly processed if client used pipelining. *) Bugfix: in the "request_body_in_single_buf" directive. *) Bugfix: in "proxy_set_body" and "proxy_pass_request_body" directives if SSL connection to backend was used. *) Bugfix: nginx hogged CPU if all servers in an upstream were marked as "down". *) Bugfix: a segmentation fault might occur during reconfiguration if ssl_session_cache was defined but not used in a previous configuration. *) Bugfix: a segmentation fault might occur in a worker process if many backup servers were used in an upstream. *) Bugfix: a segmentation fault might occur in a worker process if "fastcgi/scgi/uwsgi_param" directives were used with values starting with "HTTP_"; the bug had appeared in 0.8.40.
author Igor Sysoev <http://sysoev.ru>
date Mon, 22 Aug 2011 00:00:00 +0400
parents 5b73504dd4ba
children 943566b4d82e
comparison
equal deleted inserted replaced
633:561a37709f6d 634:23ef0645ea57
69 void *conf); 69 void *conf);
70 static char *ngx_http_core_resolver(ngx_conf_t *cf, ngx_command_t *cmd, 70 static char *ngx_http_core_resolver(ngx_conf_t *cf, ngx_command_t *cmd,
71 void *conf); 71 void *conf);
72 #if (NGX_HTTP_GZIP) 72 #if (NGX_HTTP_GZIP)
73 static ngx_int_t ngx_http_gzip_accept_encoding(ngx_str_t *ae); 73 static ngx_int_t ngx_http_gzip_accept_encoding(ngx_str_t *ae);
74 static ngx_uint_t ngx_http_gzip_quantity(u_char *p, u_char *last);
74 static char *ngx_http_gzip_disable(ngx_conf_t *cf, ngx_command_t *cmd, 75 static char *ngx_http_gzip_disable(ngx_conf_t *cf, ngx_command_t *cmd,
75 void *conf); 76 void *conf);
76 #endif 77 #endif
77 78
78 static char *ngx_http_core_lowat_check(ngx_conf_t *cf, void *post, void *data); 79 static char *ngx_http_core_lowat_check(ngx_conf_t *cf, void *post, void *data);
2187 } 2188 }
2188 2189
2189 2190
2190 /* 2191 /*
2191 * gzip is enabled for the following quantities: 2192 * gzip is enabled for the following quantities:
2192 * "gzip; q=0.001" ... "gzip; q=0.999", "gzip; q=1" 2193 * "gzip; q=0.001" ... "gzip; q=1.000"
2193 * gzip is disabled for the following quantities: 2194 * gzip is disabled for the following quantities:
2194 * "gzip; q=0" ... "gzip; q=0.000", and for any invalid cases 2195 * "gzip; q=0" ... "gzip; q=0.000", and for any invalid cases
2195 */ 2196 */
2196 2197
2197 static ngx_int_t 2198 static ngx_int_t
2198 ngx_http_gzip_accept_encoding(ngx_str_t *ae) 2199 ngx_http_gzip_accept_encoding(ngx_str_t *ae)
2199 { 2200 {
2200 u_char c, *p, *start, *last; 2201 u_char *p, *start, *last;
2201 ngx_uint_t n, q;
2202 2202
2203 start = ae->data; 2203 start = ae->data;
2204 last = start + ae->len; 2204 last = start + ae->len;
2205 2205
2206 for ( ;; ) { 2206 for ( ;; ) {
2253 2253
2254 if (p + 2 > last || *p++ != '=') { 2254 if (p + 2 > last || *p++ != '=') {
2255 return NGX_DECLINED; 2255 return NGX_DECLINED;
2256 } 2256 }
2257 2257
2258 if (ngx_http_gzip_quantity(p, last) == 0) {
2259 return NGX_DECLINED;
2260 }
2261
2262 return NGX_OK;
2263 }
2264
2265
2266 ngx_uint_t
2267 ngx_http_gzip_quantity(u_char *p, u_char *last)
2268 {
2269 u_char c;
2270 ngx_uint_t n, q;
2271
2258 c = *p++; 2272 c = *p++;
2259 2273
2260 if (c == '1') { 2274 if (c != '0' && c != '1') {
2261 if (p == last || *p == ',' || *p == ' ') { 2275 return 0;
2262 return NGX_OK; 2276 }
2263 } 2277
2264 return NGX_DECLINED; 2278 q = (c - '0') * 100;
2265 }
2266
2267 if (c != '0') {
2268 return NGX_DECLINED;
2269 }
2270 2279
2271 if (p == last) { 2280 if (p == last) {
2272 return NGX_DECLINED; 2281 return q;
2273 } 2282 }
2274 2283
2275 if (*p++ != '.') { 2284 c = *p++;
2276 return NGX_DECLINED; 2285
2286 if (c == ',' || c == ' ') {
2287 return q;
2288 }
2289
2290 if (c != '.') {
2291 return 0;
2277 } 2292 }
2278 2293
2279 n = 0; 2294 n = 0;
2280 q = 0;
2281 2295
2282 while (p < last) { 2296 while (p < last) {
2283 c = *p++; 2297 c = *p++;
2284 2298
2285 if (c == ',') { 2299 if (c == ',' || c == ' ') {
2286 break; 2300 break;
2287 } 2301 }
2288 2302
2289 if (c >= '1' && c <= '9') { 2303 if (c >= '0' && c <= '9') {
2290 n++; 2304 q += c - '0';
2291 q++;
2292 continue;
2293 }
2294
2295 if (c == '0') {
2296 n++; 2305 n++;
2297 continue; 2306 continue;
2298 } 2307 }
2299 2308
2300 return NGX_DECLINED; 2309 return 0;
2301 } 2310 }
2302 2311
2303 if (n < 4 && q != 0) { 2312 if (q > 100 || n > 3) {
2304 return NGX_OK; 2313 return 0;
2305 } 2314 }
2306 2315
2307 return NGX_DECLINED; 2316 return q;
2308 } 2317 }
2309 2318
2310 #endif 2319 #endif
2311 2320
2312 2321
3480 prev->keepalive_timeout, 75000); 3489 prev->keepalive_timeout, 75000);
3481 ngx_conf_merge_sec_value(conf->keepalive_header, 3490 ngx_conf_merge_sec_value(conf->keepalive_header,
3482 prev->keepalive_header, 0); 3491 prev->keepalive_header, 0);
3483 ngx_conf_merge_uint_value(conf->keepalive_requests, 3492 ngx_conf_merge_uint_value(conf->keepalive_requests,
3484 prev->keepalive_requests, 100); 3493 prev->keepalive_requests, 100);
3485 ngx_conf_merge_msec_value(conf->lingering_close, 3494 ngx_conf_merge_uint_value(conf->lingering_close,
3486 prev->lingering_close, NGX_HTTP_LINGERING_ON); 3495 prev->lingering_close, NGX_HTTP_LINGERING_ON);
3487 ngx_conf_merge_msec_value(conf->lingering_time, 3496 ngx_conf_merge_msec_value(conf->lingering_time,
3488 prev->lingering_time, 30000); 3497 prev->lingering_time, 30000);
3489 ngx_conf_merge_msec_value(conf->lingering_timeout, 3498 ngx_conf_merge_msec_value(conf->lingering_timeout,
3490 prev->lingering_timeout, 5000); 3499 prev->lingering_timeout, 5000);