comparison src/http/ngx_http_core_module.c @ 662:e5fa0a4a7d27 NGINX_1_1_15

nginx 1.1.15 *) Feature: the "disable_symlinks" directive. *) Feature: the "proxy_cookie_domain" and "proxy_cookie_path" directives. *) Bugfix: nginx might log incorrect error "upstream prematurely closed connection" instead of correct "upstream sent too big header" one. Thanks to Feibo Li. *) Bugfix: nginx could not be built with the ngx_http_perl_module if the --with-openssl option was used. *) Bugfix: internal redirects to named locations were not limited. *) Bugfix: calling $r->flush() multiple times might cause errors in the ngx_http_gzip_filter_module. *) Bugfix: temporary files might be not removed if the "proxy_store" directive were used with SSI includes. *) Bugfix: in some cases non-cacheable variables (such as the $args variable) returned old empty cached value. *) Bugfix: a segmentation fault might occur in a worker process if too many SSI subrequests were issued simultaneously; the bug had appeared in 0.7.25.
author Igor Sysoev <http://sysoev.ru>
date Wed, 15 Feb 2012 00:00:00 +0400
parents d0f7a625f27c
children f5b859b2f097
comparison
equal deleted inserted replaced
661:b49c1751031c 662:e5fa0a4a7d27
185 static ngx_str_t ngx_http_gzip_private = ngx_string("private"); 185 static ngx_str_t ngx_http_gzip_private = ngx_string("private");
186 186
187 #endif 187 #endif
188 188
189 189
190 #if (NGX_HAVE_OPENAT)
191
192 static ngx_conf_enum_t ngx_http_core_disable_symlinks[] = {
193 { ngx_string("off"), NGX_DISABLE_SYMLINKS_OFF },
194 { ngx_string("if_not_owner"), NGX_DISABLE_SYMLINKS_NOTOWNER },
195 { ngx_string("on"), NGX_DISABLE_SYMLINKS_ON },
196 { ngx_null_string, 0 }
197 };
198
199 #endif
200
201
190 static ngx_command_t ngx_http_core_commands[] = { 202 static ngx_command_t ngx_http_core_commands[] = {
191 203
192 { ngx_string("variables_hash_max_size"), 204 { ngx_string("variables_hash_max_size"),
193 NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE1, 205 NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE1,
194 ngx_conf_set_num_slot, 206 ngx_conf_set_num_slot,
759 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE, 771 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE,
760 ngx_http_gzip_disable, 772 ngx_http_gzip_disable,
761 NGX_HTTP_LOC_CONF_OFFSET, 773 NGX_HTTP_LOC_CONF_OFFSET,
762 0, 774 0,
763 NULL }, 775 NULL },
776
777 #endif
778
779 #if (NGX_HAVE_OPENAT)
780
781 { ngx_string("disable_symlinks"),
782 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
783 ngx_conf_set_enum_slot,
784 NGX_HTTP_LOC_CONF_OFFSET,
785 offsetof(ngx_http_core_loc_conf_t, disable_symlinks),
786 &ngx_http_core_disable_symlinks },
764 787
765 #endif 788 #endif
766 789
767 ngx_null_command 790 ngx_null_command
768 }; 791 };
1295 of.valid = clcf->open_file_cache_valid; 1318 of.valid = clcf->open_file_cache_valid;
1296 of.min_uses = clcf->open_file_cache_min_uses; 1319 of.min_uses = clcf->open_file_cache_min_uses;
1297 of.test_only = 1; 1320 of.test_only = 1;
1298 of.errors = clcf->open_file_cache_errors; 1321 of.errors = clcf->open_file_cache_errors;
1299 of.events = clcf->open_file_cache_events; 1322 of.events = clcf->open_file_cache_events;
1323 #if (NGX_HAVE_OPENAT)
1324 of.disable_symlinks = clcf->disable_symlinks;
1325 #endif
1300 1326
1301 if (ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool) 1327 if (ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool)
1302 != NGX_OK) 1328 != NGX_OK)
1303 { 1329 {
1304 if (of.err != NGX_ENOENT 1330 if (of.err != NGX_ENOENT
2451 2477
2452 tp = ngx_timeofday(); 2478 tp = ngx_timeofday();
2453 sr->start_sec = tp->sec; 2479 sr->start_sec = tp->sec;
2454 sr->start_msec = tp->msec; 2480 sr->start_msec = tp->msec;
2455 2481
2456 r->main->subrequests++;
2457 r->main->count++; 2482 r->main->count++;
2458 2483
2459 *psr = sr; 2484 *psr = sr;
2460 2485
2461 return ngx_http_post_request(sr, NULL); 2486 return ngx_http_post_request(sr, NULL);
2523 ngx_http_core_srv_conf_t *cscf; 2548 ngx_http_core_srv_conf_t *cscf;
2524 ngx_http_core_loc_conf_t **clcfp; 2549 ngx_http_core_loc_conf_t **clcfp;
2525 ngx_http_core_main_conf_t *cmcf; 2550 ngx_http_core_main_conf_t *cmcf;
2526 2551
2527 r->main->count++; 2552 r->main->count++;
2553 r->uri_changes--;
2554
2555 if (r->uri_changes == 0) {
2556 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
2557 "rewrite or internal redirection cycle "
2558 "while redirect to named location \"%V\"", name);
2559
2560 ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
2561 return NGX_DONE;
2562 }
2528 2563
2529 cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module); 2564 cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module);
2530 2565
2531 if (cscf->named_locations) { 2566 if (cscf->named_locations) {
2532 2567
3333 #if (NGX_HTTP_DEGRADATION) 3368 #if (NGX_HTTP_DEGRADATION)
3334 clcf->gzip_disable_degradation = 3; 3369 clcf->gzip_disable_degradation = 3;
3335 #endif 3370 #endif
3336 #endif 3371 #endif
3337 3372
3373 #if (NGX_HAVE_OPENAT)
3374 clcf->disable_symlinks = NGX_CONF_UNSET_UINT;
3375 #endif
3376
3338 return clcf; 3377 return clcf;
3339 } 3378 }
3340 3379
3341 3380
3342 static ngx_str_t ngx_http_core_text_html_type = ngx_string("text/html"); 3381 static ngx_str_t ngx_http_core_text_html_type = ngx_string("text/html");
3612 } 3651 }
3613 3652
3614 #endif 3653 #endif
3615 #endif 3654 #endif
3616 3655
3656 #if (NGX_HAVE_OPENAT)
3657 ngx_conf_merge_uint_value(conf->disable_symlinks, prev->disable_symlinks,
3658 NGX_DISABLE_SYMLINKS_OFF);
3659 #endif
3660
3617 return NGX_CONF_OK; 3661 return NGX_CONF_OK;
3618 } 3662 }
3619 3663
3620 3664
3621 static char * 3665 static char *
3842 3886
3843 if (p > s.data) { 3887 if (p > s.data) {
3844 s.len = p - s.data; 3888 s.len = p - s.data;
3845 3889
3846 lsopt.tcp_keepidle = ngx_parse_time(&s, 1); 3890 lsopt.tcp_keepidle = ngx_parse_time(&s, 1);
3847 if (lsopt.tcp_keepidle == NGX_ERROR) { 3891 if (lsopt.tcp_keepidle == (time_t) NGX_ERROR) {
3848 goto invalid_so_keepalive; 3892 goto invalid_so_keepalive;
3849 } 3893 }
3850 } 3894 }
3851 3895
3852 s.data = (p < end) ? (p + 1) : end; 3896 s.data = (p < end) ? (p + 1) : end;
3858 3902
3859 if (p > s.data) { 3903 if (p > s.data) {
3860 s.len = p - s.data; 3904 s.len = p - s.data;
3861 3905
3862 lsopt.tcp_keepintvl = ngx_parse_time(&s, 1); 3906 lsopt.tcp_keepintvl = ngx_parse_time(&s, 1);
3863 if (lsopt.tcp_keepintvl == NGX_ERROR) { 3907 if (lsopt.tcp_keepintvl == (time_t) NGX_ERROR) {
3864 goto invalid_so_keepalive; 3908 goto invalid_so_keepalive;
3865 } 3909 }
3866 } 3910 }
3867 3911
3868 s.data = (p < end) ? (p + 1) : end; 3912 s.data = (p < end) ? (p + 1) : end;
4505 4549
4506 s.len = value[i].len - 9; 4550 s.len = value[i].len - 9;
4507 s.data = value[i].data + 9; 4551 s.data = value[i].data + 9;
4508 4552
4509 inactive = ngx_parse_time(&s, 1); 4553 inactive = ngx_parse_time(&s, 1);
4510 if (inactive < 0) { 4554 if (inactive == (time_t) NGX_ERROR) {
4511 goto failed; 4555 goto failed;
4512 } 4556 }
4513 4557
4514 continue; 4558 continue;
4515 } 4559 }
4592 4636
4593 if (clcf->keepalive_timeout == (ngx_msec_t) NGX_ERROR) { 4637 if (clcf->keepalive_timeout == (ngx_msec_t) NGX_ERROR) {
4594 return "invalid value"; 4638 return "invalid value";
4595 } 4639 }
4596 4640
4597 if (clcf->keepalive_timeout == (ngx_msec_t) NGX_PARSE_LARGE_TIME) {
4598 return "value must be less than 597 hours";
4599 }
4600
4601 if (cf->args->nelts == 2) { 4641 if (cf->args->nelts == 2) {
4602 return NGX_CONF_OK; 4642 return NGX_CONF_OK;
4603 } 4643 }
4604 4644
4605 clcf->keepalive_header = ngx_parse_time(&value[2], 1); 4645 clcf->keepalive_header = ngx_parse_time(&value[2], 1);
4606 4646
4607 if (clcf->keepalive_header == NGX_ERROR) { 4647 if (clcf->keepalive_header == (time_t) NGX_ERROR) {
4608 return "invalid value"; 4648 return "invalid value";
4609 }
4610
4611 if (clcf->keepalive_header == NGX_PARSE_LARGE_TIME) {
4612 return "value must be less than 68 years";
4613 } 4649 }
4614 4650
4615 return NGX_CONF_OK; 4651 return NGX_CONF_OK;
4616 } 4652 }
4617 4653