comparison src/http/ngx_http_core_module.c @ 638:692f4d4d7f10 NGINX_1_0_9

nginx 1.0.9 *) Change: now the 0x7F-0x1F characters are escaped as \xXX in an access_log. *) Change: now SIGWINCH signal works only in daemon mode. *) Feature: "proxy/fastcgi/scgi/uwsgi_ignore_headers" directives support the following additional values: X-Accel-Limit-Rate, X-Accel-Buffering, X-Accel-Charset. *) Feature: decrease of memory consumption if SSL is used. *) Feature: accept filters are now supported on NetBSD. *) Feature: the "uwsgi_buffering" and "scgi_buffering" directives. Thanks to Peter Smit. *) Bugfix: a segmentation fault occurred on start or while reconfiguration if the "ssl" directive was used at http level and there was no "ssl_certificate" defined. *) Bugfix: some UTF-8 characters were processed incorrectly. Thanks to Alexey Kuts. *) Bugfix: the ngx_http_rewrite_module directives specified at "server" level were executed twice if no matching locations were defined. *) Bugfix: a socket leak might occurred if "aio sendfile" was used. *) Bugfix: connections with fast clients might be closed after send_timeout if file AIO was used. *) Bugfix: in the ngx_http_autoindex_module. *) Bugfix: the module ngx_http_mp4_module did not support seeking on 32-bit platforms. *) Bugfix: non-cacheable responses might be cached if "proxy_cache_bypass" directive was used. Thanks to John Ferlito. *) Bugfix: cached responses with an empty body were returned incorrectly; the bug had appeared in 0.8.31. *) Bugfix: 201 responses of the ngx_http_dav_module were incorrect; the bug had appeared in 0.8.32. *) Bugfix: in the "return" directive. *) Bugfix: the "ssl_verify_client", "ssl_verify_depth", and "ssl_prefer_server_ciphers" directives might work incorrectly if SNI was used.
author Igor Sysoev <http://sysoev.ru>
date Tue, 01 Nov 2011 00:00:00 +0400
parents 0d6525917227
children 1b80544421e8
comparison
equal deleted inserted replaced
637:ea7441793bba 638:692f4d4d7f10
400 offsetof(ngx_http_core_loc_conf_t, client_body_in_single_buffer), 400 offsetof(ngx_http_core_loc_conf_t, client_body_in_single_buffer),
401 NULL }, 401 NULL },
402 402
403 { ngx_string("sendfile"), 403 { ngx_string("sendfile"),
404 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF 404 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF
405 |NGX_CONF_TAKE1, 405 |NGX_CONF_FLAG,
406 ngx_conf_set_flag_slot, 406 ngx_conf_set_flag_slot,
407 NGX_HTTP_LOC_CONF_OFFSET, 407 NGX_HTTP_LOC_CONF_OFFSET,
408 offsetof(ngx_http_core_loc_conf_t, sendfile), 408 offsetof(ngx_http_core_loc_conf_t, sendfile),
409 NULL }, 409 NULL },
410 410
637 NGX_HTTP_LOC_CONF_OFFSET, 637 NGX_HTTP_LOC_CONF_OFFSET,
638 offsetof(ngx_http_core_loc_conf_t, max_ranges), 638 offsetof(ngx_http_core_loc_conf_t, max_ranges),
639 NULL }, 639 NULL },
640 640
641 { ngx_string("chunked_transfer_encoding"), 641 { ngx_string("chunked_transfer_encoding"),
642 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, 642 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
643 ngx_conf_set_flag_slot, 643 ngx_conf_set_flag_slot,
644 NGX_HTTP_LOC_CONF_OFFSET, 644 NGX_HTTP_LOC_CONF_OFFSET,
645 offsetof(ngx_http_core_loc_conf_t, chunked_transfer_encoding), 645 offsetof(ngx_http_core_loc_conf_t, chunked_transfer_encoding),
646 NULL }, 646 NULL },
647 647
981 ngx_http_finalize_request(r, NGX_HTTP_REQUEST_ENTITY_TOO_LARGE); 981 ngx_http_finalize_request(r, NGX_HTTP_REQUEST_ENTITY_TOO_LARGE);
982 return NGX_OK; 982 return NGX_OK;
983 } 983 }
984 984
985 if (rc == NGX_DONE) { 985 if (rc == NGX_DONE) {
986 ngx_http_clear_location(r);
987
986 r->headers_out.location = ngx_list_push(&r->headers_out.headers); 988 r->headers_out.location = ngx_list_push(&r->headers_out.headers);
987 if (r->headers_out.location == NULL) { 989 if (r->headers_out.location == NULL) {
988 ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); 990 ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
989 return NGX_OK; 991 return NGX_OK;
990 } 992 }
1257 test_dir = tf->test_dir; 1259 test_dir = tf->test_dir;
1258 1260
1259 tf++; 1261 tf++;
1260 1262
1261 ngx_log_debug3(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, 1263 ngx_log_debug3(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
1262 "try to use %s: \"%s\" \"%s\"", 1264 "trying to use %s: \"%s\" \"%s\"",
1263 test_dir ? "dir" : "file", name, path.data); 1265 test_dir ? "dir" : "file", name, path.data);
1264 1266
1265 if (tf->lengths == NULL && tf->name.len == 0) { 1267 if (tf->lengths == NULL && tf->name.len == 0) {
1266 1268
1267 if (tf->code) { 1269 if (tf->code) {
1782 ngx_int_t rc; 1784 ngx_int_t rc;
1783 ngx_str_t val; 1785 ngx_str_t val;
1784 ngx_buf_t *b; 1786 ngx_buf_t *b;
1785 ngx_chain_t out; 1787 ngx_chain_t out;
1786 1788
1789 if (ngx_http_discard_request_body(r) != NGX_OK) {
1790 return NGX_HTTP_INTERNAL_SERVER_ERROR;
1791 }
1792
1787 r->headers_out.status = status; 1793 r->headers_out.status = status;
1788
1789 if (status == NGX_HTTP_NO_CONTENT) {
1790 r->header_only = 1;
1791 return ngx_http_send_header(r);
1792 }
1793 1794
1794 if (ngx_http_complex_value(r, cv, &val) != NGX_OK) { 1795 if (ngx_http_complex_value(r, cv, &val) != NGX_OK) {
1795 return NGX_HTTP_INTERNAL_SERVER_ERROR; 1796 return NGX_HTTP_INTERNAL_SERVER_ERROR;
1796 } 1797 }
1797 1798
1798 if (status >= NGX_HTTP_MOVED_PERMANENTLY && status <= NGX_HTTP_SEE_OTHER) { 1799 if (status >= NGX_HTTP_MOVED_PERMANENTLY && status <= NGX_HTTP_SEE_OTHER) {
1800
1801 ngx_http_clear_location(r);
1799 1802
1800 r->headers_out.location = ngx_list_push(&r->headers_out.headers); 1803 r->headers_out.location = ngx_list_push(&r->headers_out.headers);
1801 if (r->headers_out.location == NULL) { 1804 if (r->headers_out.location == NULL) {
1802 return NGX_HTTP_INTERNAL_SERVER_ERROR; 1805 return NGX_HTTP_INTERNAL_SERVER_ERROR;
1803 } 1806 }
1895 1898
1896 alias = clcf->alias; 1899 alias = clcf->alias;
1897 1900
1898 if (alias && !r->valid_location) { 1901 if (alias && !r->valid_location) {
1899 ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0, 1902 ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,
1900 "\"alias\" could not be used in location \"%V\" " 1903 "\"alias\" cannot be used in location \"%V\" "
1901 "where URI was rewritten", &clcf->name); 1904 "where URI was rewritten", &clcf->name);
1902 return NULL; 1905 return NULL;
1903 } 1906 }
1904 1907
1905 if (clcf->root_lengths == NULL) { 1908 if (clcf->root_lengths == NULL) {
2466 r->uri_changes--; 2469 r->uri_changes--;
2467 2470
2468 if (r->uri_changes == 0) { 2471 if (r->uri_changes == 0) {
2469 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, 2472 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
2470 "rewrite or internal redirection cycle " 2473 "rewrite or internal redirection cycle "
2471 "while internal redirect to \"%V\"", uri); 2474 "while internally redirecting to \"%V\"", uri);
2472 2475
2473 r->main->count++; 2476 r->main->count++;
2474 ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); 2477 ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
2475 return NGX_DONE; 2478 return NGX_DONE;
2476 } 2479 }
2860 clcf->prev_location = pclcf; 2863 clcf->prev_location = pclcf;
2861 #endif 2864 #endif
2862 2865
2863 if (pclcf->exact_match) { 2866 if (pclcf->exact_match) {
2864 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, 2867 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
2865 "location \"%V\" could not be inside " 2868 "location \"%V\" cannot be inside "
2866 "the exact location \"%V\"", 2869 "the exact location \"%V\"",
2867 &clcf->name, &pclcf->name); 2870 &clcf->name, &pclcf->name);
2868 return NGX_CONF_ERROR; 2871 return NGX_CONF_ERROR;
2869 } 2872 }
2870 2873
2871 if (pclcf->named) { 2874 if (pclcf->named) {
2872 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, 2875 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
2873 "location \"%V\" could not be inside " 2876 "location \"%V\" cannot be inside "
2874 "the named location \"%V\"", 2877 "the named location \"%V\"",
2875 &clcf->name, &pclcf->name); 2878 &clcf->name, &pclcf->name);
2876 return NGX_CONF_ERROR; 2879 return NGX_CONF_ERROR;
2877 } 2880 }
2878 2881
2879 if (clcf->named) { 2882 if (clcf->named) {
2880 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, 2883 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
2881 "named location \"%V\" must be " 2884 "named location \"%V\" can be "
2882 "on server level only", 2885 "on the server level only",
2883 &clcf->name); 2886 &clcf->name);
2884 return NGX_CONF_ERROR; 2887 return NGX_CONF_ERROR;
2885 } 2888 }
2886 2889
2887 len = pclcf->name.len; 2890 len = pclcf->name.len;
2946 return NGX_OK; 2949 return NGX_OK;
2947 2950
2948 #else 2951 #else
2949 2952
2950 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, 2953 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
2951 "the using of the regex \"%V\" requires PCRE library", 2954 "using regex \"%V\" requires PCRE library",
2952 regex); 2955 regex);
2953 return NGX_ERROR; 2956 return NGX_ERROR;
2954 2957
2955 #endif 2958 #endif
2956 } 2959 }
2993 ngx_hash_key_t *type; 2996 ngx_hash_key_t *type;
2994 2997
2995 value = cf->args->elts; 2998 value = cf->args->elts;
2996 2999
2997 if (ngx_strcmp(value[0].data, "include") == 0) { 3000 if (ngx_strcmp(value[0].data, "include") == 0) {
3001 if (cf->args->nelts != 2) {
3002 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
3003 "invalid number of arguments"
3004 " in \"include\" directive");
3005 return NGX_CONF_ERROR;
3006 }
2998 file = value[1]; 3007 file = value[1];
2999 3008
3000 if (ngx_conf_full_name(cf->cycle, &file, 1) != NGX_OK) { 3009 if (ngx_conf_full_name(cf->cycle, &file, 1) != NGX_OK) {
3001 return NGX_CONF_ERROR; 3010 return NGX_CONF_ERROR;
3002 } 3011 }
3022 if (ngx_strcmp(value[i].data, type[n].key.data) == 0) { 3031 if (ngx_strcmp(value[i].data, type[n].key.data) == 0) {
3023 old = type[n].value; 3032 old = type[n].value;
3024 type[n].value = content_type; 3033 type[n].value = content_type;
3025 3034
3026 ngx_conf_log_error(NGX_LOG_WARN, cf, 0, 3035 ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
3027 "duplicate extention \"%V\", " 3036 "duplicate extension \"%V\", "
3028 "content type: \"%V\", " 3037 "content type: \"%V\", "
3029 "old content type: \"%V\"", 3038 "previous content type: \"%V\"",
3030 &value[i], content_type, old); 3039 &value[i], content_type, old);
3031 continue; 3040 goto next;
3032 } 3041 }
3033 } 3042 }
3034 3043
3035 3044
3036 type = ngx_array_push(clcf->types); 3045 type = ngx_array_push(clcf->types);
3039 } 3048 }
3040 3049
3041 type->key = value[i]; 3050 type->key = value[i];
3042 type->key_hash = hash; 3051 type->key_hash = hash;
3043 type->value = content_type; 3052 type->value = content_type;
3053
3054 next:
3055 continue;
3044 } 3056 }
3045 3057
3046 return NGX_CONF_OK; 3058 return NGX_CONF_OK;
3047 } 3059 }
3048 3060
3176 4, 8192); 3188 4, 8192);
3177 3189
3178 if (conf->large_client_header_buffers.size < conf->connection_pool_size) { 3190 if (conf->large_client_header_buffers.size < conf->connection_pool_size) {
3179 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, 3191 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
3180 "the \"large_client_header_buffers\" size must be " 3192 "the \"large_client_header_buffers\" size must be "
3181 "equal to or bigger than \"connection_pool_size\""); 3193 "equal to or greater than \"connection_pool_size\"");
3182 return NGX_CONF_ERROR; 3194 return NGX_CONF_ERROR;
3183 } 3195 }
3184 3196
3185 ngx_conf_merge_value(conf->ignore_invalid_headers, 3197 ngx_conf_merge_value(conf->ignore_invalid_headers,
3186 prev->ignore_invalid_headers, 1); 3198 prev->ignore_invalid_headers, 1);
3189 3201
3190 ngx_conf_merge_value(conf->underscores_in_headers, 3202 ngx_conf_merge_value(conf->underscores_in_headers,
3191 prev->underscores_in_headers, 0); 3203 prev->underscores_in_headers, 0);
3192 3204
3193 if (conf->server_names.nelts == 0) { 3205 if (conf->server_names.nelts == 0) {
3194 /* the array has 4 empty preallocated elements, so push can not fail */ 3206 /* the array has 4 empty preallocated elements, so push cannot fail */
3195 sn = ngx_array_push(&conf->server_names); 3207 sn = ngx_array_push(&conf->server_names);
3196 #if (NGX_PCRE) 3208 #if (NGX_PCRE)
3197 sn->regex = NULL; 3209 sn->regex = NULL;
3198 #endif 3210 #endif
3199 sn->server = conf; 3211 sn->server = conf;
3372 3384
3373 conf->types_hash_bucket_size = ngx_align(conf->types_hash_bucket_size, 3385 conf->types_hash_bucket_size = ngx_align(conf->types_hash_bucket_size,
3374 ngx_cacheline_size); 3386 ngx_cacheline_size);
3375 3387
3376 /* 3388 /*
3377 * the special handling the "types" directive in the "http" section 3389 * the special handling of the "types" directive in the "http" section
3378 * to inherit the http's conf->types_hash to all servers 3390 * to inherit the http's conf->types_hash to all servers
3379 */ 3391 */
3380 3392
3381 if (prev->types && prev->types_hash.buckets == NULL) { 3393 if (prev->types && prev->types_hash.buckets == NULL) {
3382 3394
3399 conf->types = prev->types; 3411 conf->types = prev->types;
3400 conf->types_hash = prev->types_hash; 3412 conf->types_hash = prev->types_hash;
3401 } 3413 }
3402 3414
3403 if (conf->types == NULL) { 3415 if (conf->types == NULL) {
3404 conf->types = ngx_array_create(cf->pool, 4, sizeof(ngx_hash_key_t)); 3416 conf->types = ngx_array_create(cf->pool, 3, sizeof(ngx_hash_key_t));
3405 if (conf->types == NULL) { 3417 if (conf->types == NULL) {
3406 return NGX_CONF_ERROR; 3418 return NGX_CONF_ERROR;
3407 } 3419 }
3408 3420
3409 for (i = 0; ngx_http_core_default_types[i].key.len; i++) { 3421 for (i = 0; ngx_http_core_default_types[i].key.len; i++) {
3424 3436
3425 types_hash.hash = &conf->types_hash; 3437 types_hash.hash = &conf->types_hash;
3426 types_hash.key = ngx_hash_key_lc; 3438 types_hash.key = ngx_hash_key_lc;
3427 types_hash.max_size = conf->types_hash_max_size; 3439 types_hash.max_size = conf->types_hash_max_size;
3428 types_hash.bucket_size = conf->types_hash_bucket_size; 3440 types_hash.bucket_size = conf->types_hash_bucket_size;
3429 types_hash.name = "mime_types_hash"; 3441 types_hash.name = "types_hash";
3430 types_hash.pool = cf->pool; 3442 types_hash.pool = cf->pool;
3431 types_hash.temp_pool = NULL; 3443 types_hash.temp_pool = NULL;
3432 3444
3433 if (ngx_hash_init(&types_hash, conf->types->elts, conf->types->nelts) 3445 if (ngx_hash_init(&types_hash, conf->types->elts, conf->types->nelts)
3434 != NGX_OK) 3446 != NGX_OK)
3466 ngx_conf_merge_uint_value(conf->satisfy, prev->satisfy, 3478 ngx_conf_merge_uint_value(conf->satisfy, prev->satisfy,
3467 NGX_HTTP_SATISFY_ALL); 3479 NGX_HTTP_SATISFY_ALL);
3468 ngx_conf_merge_uint_value(conf->if_modified_since, prev->if_modified_since, 3480 ngx_conf_merge_uint_value(conf->if_modified_since, prev->if_modified_since,
3469 NGX_HTTP_IMS_EXACT); 3481 NGX_HTTP_IMS_EXACT);
3470 ngx_conf_merge_uint_value(conf->max_ranges, prev->max_ranges, 3482 ngx_conf_merge_uint_value(conf->max_ranges, prev->max_ranges,
3471 0x7fffffff); 3483 NGX_MAX_INT32_VALUE);
3472 ngx_conf_merge_uint_value(conf->client_body_in_file_only, 3484 ngx_conf_merge_uint_value(conf->client_body_in_file_only,
3473 prev->client_body_in_file_only, 0); 3485 prev->client_body_in_file_only,
3486 NGX_HTTP_REQUEST_BODY_FILE_OFF);
3474 ngx_conf_merge_value(conf->client_body_in_single_buffer, 3487 ngx_conf_merge_value(conf->client_body_in_single_buffer,
3475 prev->client_body_in_single_buffer, 0); 3488 prev->client_body_in_single_buffer, 0);
3476 ngx_conf_merge_value(conf->internal, prev->internal, 0); 3489 ngx_conf_merge_value(conf->internal, prev->internal, 0);
3477 ngx_conf_merge_value(conf->sendfile, prev->sendfile, 0); 3490 ngx_conf_merge_value(conf->sendfile, prev->sendfile, 0);
3478 ngx_conf_merge_size_value(conf->sendfile_max_chunk, 3491 ngx_conf_merge_size_value(conf->sendfile_max_chunk,
3479 prev->sendfile_max_chunk, 0); 3492 prev->sendfile_max_chunk, 0);
3480 #if (NGX_HAVE_FILE_AIO) 3493 #if (NGX_HAVE_FILE_AIO)
3481 ngx_conf_merge_value(conf->aio, prev->aio, 0); 3494 ngx_conf_merge_value(conf->aio, prev->aio, NGX_HTTP_AIO_OFF);
3482 #endif 3495 #endif
3483 ngx_conf_merge_size_value(conf->read_ahead, prev->read_ahead, 0); 3496 ngx_conf_merge_size_value(conf->read_ahead, prev->read_ahead, 0);
3484 ngx_conf_merge_off_value(conf->directio, prev->directio, 3497 ngx_conf_merge_off_value(conf->directio, prev->directio,
3485 NGX_MAX_OFF_T_VALUE); 3498 NGX_OPEN_FILE_DIRECTIO_OFF);
3486 ngx_conf_merge_off_value(conf->directio_alignment, prev->directio_alignment, 3499 ngx_conf_merge_off_value(conf->directio_alignment, prev->directio_alignment,
3487 512); 3500 512);
3488 ngx_conf_merge_value(conf->tcp_nopush, prev->tcp_nopush, 0); 3501 ngx_conf_merge_value(conf->tcp_nopush, prev->tcp_nopush, 0);
3489 ngx_conf_merge_value(conf->tcp_nodelay, prev->tcp_nodelay, 1); 3502 ngx_conf_merge_value(conf->tcp_nodelay, prev->tcp_nodelay, 1);
3490 3503
3777 } 3790 }
3778 3791
3779 continue; 3792 continue;
3780 #else 3793 #else
3781 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, 3794 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
3782 "bind ipv6only is not supported " 3795 "ipv6only is not supported "
3783 "on this platform"); 3796 "on this platform");
3784 return NGX_CONF_ERROR; 3797 return NGX_CONF_ERROR;
3785 #endif 3798 #endif
3786 } 3799 }
3787 3800
3796 return NGX_CONF_ERROR; 3809 return NGX_CONF_ERROR;
3797 #endif 3810 #endif
3798 } 3811 }
3799 3812
3800 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, 3813 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
3801 "the invalid \"%V\" parameter", &value[n]); 3814 "invalid parameter \"%V\"", &value[n]);
3802 return NGX_CONF_ERROR; 3815 return NGX_CONF_ERROR;
3803 } 3816 }
3804 3817
3805 if (ngx_http_add_listen(cf, cscf, &lsopt) == NGX_OK) { 3818 if (ngx_http_add_listen(cf, cscf, &lsopt) == NGX_OK) {
3806 return NGX_CONF_OK; 3819 return NGX_CONF_OK;
3834 return NGX_CONF_ERROR; 3847 return NGX_CONF_ERROR;
3835 } 3848 }
3836 3849
3837 if (ngx_strchr(value[i].data, '/')) { 3850 if (ngx_strchr(value[i].data, '/')) {
3838 ngx_conf_log_error(NGX_LOG_WARN, cf, 0, 3851 ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
3839 "server name \"%V\" has strange symbols", 3852 "server name \"%V\" has suspicious symbols",
3840 &value[i]); 3853 &value[i]);
3841 }
3842
3843 if (value[i].len == 1 && ch == '*') {
3844 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
3845 "\"server_name *\" is unsupported, use "
3846 "\"server_name_in_redirect off\" instead");
3847 return NGX_CONF_ERROR;
3848 } 3854 }
3849 3855
3850 sn = ngx_array_push(&cscf->server_names); 3856 sn = ngx_array_push(&cscf->server_names);
3851 if (sn == NULL) { 3857 if (sn == NULL) {
3852 return NGX_CONF_ERROR; 3858 return NGX_CONF_ERROR;
3905 sn->name = value[i]; 3911 sn->name = value[i];
3906 cscf->captures = (rc.captures > 0); 3912 cscf->captures = (rc.captures > 0);
3907 } 3913 }
3908 #else 3914 #else
3909 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, 3915 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
3910 "the using of the regex \"%V\" " 3916 "using regex \"%V\" "
3911 "requires PCRE library", &value[i]); 3917 "requires PCRE library", &value[i]);
3912 3918
3913 return NGX_CONF_ERROR; 3919 return NGX_CONF_ERROR;
3914 #endif 3920 #endif
3915 } 3921 }
3937 "\"%V\" directive is duplicate", 3943 "\"%V\" directive is duplicate",
3938 &cmd->name); 3944 &cmd->name);
3939 } else { 3945 } else {
3940 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, 3946 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
3941 "\"%V\" directive is duplicate, " 3947 "\"%V\" directive is duplicate, "
3942 "\"%s\" directive is specified before", 3948 "\"%s\" directive was specified earlier",
3943 &cmd->name, clcf->alias ? "alias" : "root"); 3949 &cmd->name, clcf->alias ? "alias" : "root");
3944 } 3950 }
3945 3951
3946 return NGX_CONF_ERROR; 3952 return NGX_CONF_ERROR;
3947 } 3953 }
3948 3954
3949 if (clcf->named && alias) { 3955 if (clcf->named && alias) {
3950 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, 3956 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
3951 "the \"alias\" directive may not be used " 3957 "the \"alias\" directive cannot be used "
3952 "inside named location"); 3958 "inside the named location");
3953 3959
3954 return NGX_CONF_ERROR; 3960 return NGX_CONF_ERROR;
3955 } 3961 }
3956 3962
3957 value = cf->args->elts; 3963 value = cf->args->elts;
3958 3964
3959 if (ngx_strstr(value[1].data, "$document_root") 3965 if (ngx_strstr(value[1].data, "$document_root")
3960 || ngx_strstr(value[1].data, "${document_root}")) 3966 || ngx_strstr(value[1].data, "${document_root}"))
3961 { 3967 {
3962 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, 3968 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
3963 "the $document_root variable may not be used " 3969 "the $document_root variable cannot be used "
3964 "in the \"%V\" directive", 3970 "in the \"%V\" directive",
3965 &cmd->name); 3971 &cmd->name);
3966 3972
3967 return NGX_CONF_ERROR; 3973 return NGX_CONF_ERROR;
3968 } 3974 }
3969 3975
3970 if (ngx_strstr(value[1].data, "$realpath_root") 3976 if (ngx_strstr(value[1].data, "$realpath_root")
3971 || ngx_strstr(value[1].data, "${realpath_root}")) 3977 || ngx_strstr(value[1].data, "${realpath_root}"))
3972 { 3978 {
3973 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, 3979 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
3974 "the $realpath_root variable may not be used " 3980 "the $realpath_root variable cannot be used "
3975 "in the \"%V\" directive", 3981 "in the \"%V\" directive",
3976 &cmd->name); 3982 &cmd->name);
3977 3983
3978 return NGX_CONF_ERROR; 3984 return NGX_CONF_ERROR;
3979 } 3985 }
4428 return NGX_CONF_OK; 4434 return NGX_CONF_OK;
4429 } 4435 }
4430 4436
4431 if (max == 0) { 4437 if (max == 0) {
4432 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, 4438 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
4433 "\"open_file_cache\" must have \"max\" parameter"); 4439 "\"open_file_cache\" must have the \"max\" parameter");
4434 return NGX_CONF_ERROR; 4440 return NGX_CONF_ERROR;
4435 } 4441 }
4436 4442
4437 clcf->open_file_cache = ngx_open_file_cache_init(cf->pool, max, inactive); 4443 clcf->open_file_cache = ngx_open_file_cache_init(cf->pool, max, inactive);
4438 if (clcf->open_file_cache) { 4444 if (clcf->open_file_cache) {