Mercurial > hg > nginx-quic
comparison src/http/ngx_http_core_module.c @ 4246:d3568507db51 stable-1.0
Merging r4132, r4134, r4143, r4183, r4191, r4199:
Various fixes related to error messages:
*) Removed old warning that suggested to use "server_name_in_redirect off"
(now the default) in place of no longer supported "server_name *".
*) Fixing directive name in error message if types hash size is not enough.
*) Replaced "can not" with "cannot" and "could not" in a bunch of places.
Fixed nearby grammar errors.
*) Overhauled error messages.
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Tue, 01 Nov 2011 13:24:50 +0000 |
parents | 6afb20bf2ad5 |
children | b79dbadb3d5e |
comparison
equal
deleted
inserted
replaced
4245:8d39230df833 | 4246:d3568507db51 |
---|---|
1257 test_dir = tf->test_dir; | 1257 test_dir = tf->test_dir; |
1258 | 1258 |
1259 tf++; | 1259 tf++; |
1260 | 1260 |
1261 ngx_log_debug3(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | 1261 ngx_log_debug3(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
1262 "try to use %s: \"%s\" \"%s\"", | 1262 "trying to use %s: \"%s\" \"%s\"", |
1263 test_dir ? "dir" : "file", name, path.data); | 1263 test_dir ? "dir" : "file", name, path.data); |
1264 | 1264 |
1265 if (tf->lengths == NULL && tf->name.len == 0) { | 1265 if (tf->lengths == NULL && tf->name.len == 0) { |
1266 | 1266 |
1267 if (tf->code) { | 1267 if (tf->code) { |
1895 | 1895 |
1896 alias = clcf->alias; | 1896 alias = clcf->alias; |
1897 | 1897 |
1898 if (alias && !r->valid_location) { | 1898 if (alias && !r->valid_location) { |
1899 ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0, | 1899 ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0, |
1900 "\"alias\" could not be used in location \"%V\" " | 1900 "\"alias\" cannot be used in location \"%V\" " |
1901 "where URI was rewritten", &clcf->name); | 1901 "where URI was rewritten", &clcf->name); |
1902 return NULL; | 1902 return NULL; |
1903 } | 1903 } |
1904 | 1904 |
1905 if (clcf->root_lengths == NULL) { | 1905 if (clcf->root_lengths == NULL) { |
2466 r->uri_changes--; | 2466 r->uri_changes--; |
2467 | 2467 |
2468 if (r->uri_changes == 0) { | 2468 if (r->uri_changes == 0) { |
2469 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, | 2469 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, |
2470 "rewrite or internal redirection cycle " | 2470 "rewrite or internal redirection cycle " |
2471 "while internal redirect to \"%V\"", uri); | 2471 "while internally redirecting to \"%V\"", uri); |
2472 | 2472 |
2473 r->main->count++; | 2473 r->main->count++; |
2474 ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); | 2474 ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); |
2475 return NGX_DONE; | 2475 return NGX_DONE; |
2476 } | 2476 } |
2860 clcf->prev_location = pclcf; | 2860 clcf->prev_location = pclcf; |
2861 #endif | 2861 #endif |
2862 | 2862 |
2863 if (pclcf->exact_match) { | 2863 if (pclcf->exact_match) { |
2864 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | 2864 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
2865 "location \"%V\" could not be inside " | 2865 "location \"%V\" cannot be inside " |
2866 "the exact location \"%V\"", | 2866 "the exact location \"%V\"", |
2867 &clcf->name, &pclcf->name); | 2867 &clcf->name, &pclcf->name); |
2868 return NGX_CONF_ERROR; | 2868 return NGX_CONF_ERROR; |
2869 } | 2869 } |
2870 | 2870 |
2871 if (pclcf->named) { | 2871 if (pclcf->named) { |
2872 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | 2872 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
2873 "location \"%V\" could not be inside " | 2873 "location \"%V\" cannot be inside " |
2874 "the named location \"%V\"", | 2874 "the named location \"%V\"", |
2875 &clcf->name, &pclcf->name); | 2875 &clcf->name, &pclcf->name); |
2876 return NGX_CONF_ERROR; | 2876 return NGX_CONF_ERROR; |
2877 } | 2877 } |
2878 | 2878 |
2879 if (clcf->named) { | 2879 if (clcf->named) { |
2880 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | 2880 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
2881 "named location \"%V\" must be " | 2881 "named location \"%V\" can be " |
2882 "on server level only", | 2882 "on the server level only", |
2883 &clcf->name); | 2883 &clcf->name); |
2884 return NGX_CONF_ERROR; | 2884 return NGX_CONF_ERROR; |
2885 } | 2885 } |
2886 | 2886 |
2887 len = pclcf->name.len; | 2887 len = pclcf->name.len; |
2946 return NGX_OK; | 2946 return NGX_OK; |
2947 | 2947 |
2948 #else | 2948 #else |
2949 | 2949 |
2950 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | 2950 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
2951 "the using of the regex \"%V\" requires PCRE library", | 2951 "using regex \"%V\" requires PCRE library", |
2952 regex); | 2952 regex); |
2953 return NGX_ERROR; | 2953 return NGX_ERROR; |
2954 | 2954 |
2955 #endif | 2955 #endif |
2956 } | 2956 } |
3028 if (ngx_strcmp(value[i].data, type[n].key.data) == 0) { | 3028 if (ngx_strcmp(value[i].data, type[n].key.data) == 0) { |
3029 old = type[n].value; | 3029 old = type[n].value; |
3030 type[n].value = content_type; | 3030 type[n].value = content_type; |
3031 | 3031 |
3032 ngx_conf_log_error(NGX_LOG_WARN, cf, 0, | 3032 ngx_conf_log_error(NGX_LOG_WARN, cf, 0, |
3033 "duplicate extention \"%V\", " | 3033 "duplicate extension \"%V\", " |
3034 "content type: \"%V\", " | 3034 "content type: \"%V\", " |
3035 "old content type: \"%V\"", | 3035 "previous content type: \"%V\"", |
3036 &value[i], content_type, old); | 3036 &value[i], content_type, old); |
3037 goto next; | 3037 goto next; |
3038 } | 3038 } |
3039 } | 3039 } |
3040 | 3040 |
3185 4, 8192); | 3185 4, 8192); |
3186 | 3186 |
3187 if (conf->large_client_header_buffers.size < conf->connection_pool_size) { | 3187 if (conf->large_client_header_buffers.size < conf->connection_pool_size) { |
3188 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | 3188 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
3189 "the \"large_client_header_buffers\" size must be " | 3189 "the \"large_client_header_buffers\" size must be " |
3190 "equal to or bigger than \"connection_pool_size\""); | 3190 "equal to or greater than \"connection_pool_size\""); |
3191 return NGX_CONF_ERROR; | 3191 return NGX_CONF_ERROR; |
3192 } | 3192 } |
3193 | 3193 |
3194 ngx_conf_merge_value(conf->ignore_invalid_headers, | 3194 ngx_conf_merge_value(conf->ignore_invalid_headers, |
3195 prev->ignore_invalid_headers, 1); | 3195 prev->ignore_invalid_headers, 1); |
3198 | 3198 |
3199 ngx_conf_merge_value(conf->underscores_in_headers, | 3199 ngx_conf_merge_value(conf->underscores_in_headers, |
3200 prev->underscores_in_headers, 0); | 3200 prev->underscores_in_headers, 0); |
3201 | 3201 |
3202 if (conf->server_names.nelts == 0) { | 3202 if (conf->server_names.nelts == 0) { |
3203 /* the array has 4 empty preallocated elements, so push can not fail */ | 3203 /* the array has 4 empty preallocated elements, so push cannot fail */ |
3204 sn = ngx_array_push(&conf->server_names); | 3204 sn = ngx_array_push(&conf->server_names); |
3205 #if (NGX_PCRE) | 3205 #if (NGX_PCRE) |
3206 sn->regex = NULL; | 3206 sn->regex = NULL; |
3207 #endif | 3207 #endif |
3208 sn->server = conf; | 3208 sn->server = conf; |
3433 | 3433 |
3434 types_hash.hash = &conf->types_hash; | 3434 types_hash.hash = &conf->types_hash; |
3435 types_hash.key = ngx_hash_key_lc; | 3435 types_hash.key = ngx_hash_key_lc; |
3436 types_hash.max_size = conf->types_hash_max_size; | 3436 types_hash.max_size = conf->types_hash_max_size; |
3437 types_hash.bucket_size = conf->types_hash_bucket_size; | 3437 types_hash.bucket_size = conf->types_hash_bucket_size; |
3438 types_hash.name = "mime_types_hash"; | 3438 types_hash.name = "types_hash"; |
3439 types_hash.pool = cf->pool; | 3439 types_hash.pool = cf->pool; |
3440 types_hash.temp_pool = NULL; | 3440 types_hash.temp_pool = NULL; |
3441 | 3441 |
3442 if (ngx_hash_init(&types_hash, conf->types->elts, conf->types->nelts) | 3442 if (ngx_hash_init(&types_hash, conf->types->elts, conf->types->nelts) |
3443 != NGX_OK) | 3443 != NGX_OK) |
3787 } | 3787 } |
3788 | 3788 |
3789 continue; | 3789 continue; |
3790 #else | 3790 #else |
3791 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | 3791 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
3792 "bind ipv6only is not supported " | 3792 "ipv6only is not supported " |
3793 "on this platform"); | 3793 "on this platform"); |
3794 return NGX_CONF_ERROR; | 3794 return NGX_CONF_ERROR; |
3795 #endif | 3795 #endif |
3796 } | 3796 } |
3797 | 3797 |
3806 return NGX_CONF_ERROR; | 3806 return NGX_CONF_ERROR; |
3807 #endif | 3807 #endif |
3808 } | 3808 } |
3809 | 3809 |
3810 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | 3810 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
3811 "the invalid \"%V\" parameter", &value[n]); | 3811 "invalid parameter \"%V\"", &value[n]); |
3812 return NGX_CONF_ERROR; | 3812 return NGX_CONF_ERROR; |
3813 } | 3813 } |
3814 | 3814 |
3815 if (ngx_http_add_listen(cf, cscf, &lsopt) == NGX_OK) { | 3815 if (ngx_http_add_listen(cf, cscf, &lsopt) == NGX_OK) { |
3816 return NGX_CONF_OK; | 3816 return NGX_CONF_OK; |
3844 return NGX_CONF_ERROR; | 3844 return NGX_CONF_ERROR; |
3845 } | 3845 } |
3846 | 3846 |
3847 if (ngx_strchr(value[i].data, '/')) { | 3847 if (ngx_strchr(value[i].data, '/')) { |
3848 ngx_conf_log_error(NGX_LOG_WARN, cf, 0, | 3848 ngx_conf_log_error(NGX_LOG_WARN, cf, 0, |
3849 "server name \"%V\" has strange symbols", | 3849 "server name \"%V\" has suspicious symbols", |
3850 &value[i]); | 3850 &value[i]); |
3851 } | |
3852 | |
3853 if (value[i].len == 1 && ch == '*') { | |
3854 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
3855 "\"server_name *\" is unsupported, use " | |
3856 "\"server_name_in_redirect off\" instead"); | |
3857 return NGX_CONF_ERROR; | |
3858 } | 3851 } |
3859 | 3852 |
3860 sn = ngx_array_push(&cscf->server_names); | 3853 sn = ngx_array_push(&cscf->server_names); |
3861 if (sn == NULL) { | 3854 if (sn == NULL) { |
3862 return NGX_CONF_ERROR; | 3855 return NGX_CONF_ERROR; |
3915 sn->name = value[i]; | 3908 sn->name = value[i]; |
3916 cscf->captures = (rc.captures > 0); | 3909 cscf->captures = (rc.captures > 0); |
3917 } | 3910 } |
3918 #else | 3911 #else |
3919 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | 3912 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
3920 "the using of the regex \"%V\" " | 3913 "using regex \"%V\" " |
3921 "requires PCRE library", &value[i]); | 3914 "requires PCRE library", &value[i]); |
3922 | 3915 |
3923 return NGX_CONF_ERROR; | 3916 return NGX_CONF_ERROR; |
3924 #endif | 3917 #endif |
3925 } | 3918 } |
3947 "\"%V\" directive is duplicate", | 3940 "\"%V\" directive is duplicate", |
3948 &cmd->name); | 3941 &cmd->name); |
3949 } else { | 3942 } else { |
3950 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | 3943 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
3951 "\"%V\" directive is duplicate, " | 3944 "\"%V\" directive is duplicate, " |
3952 "\"%s\" directive is specified before", | 3945 "\"%s\" directive was specified earlier", |
3953 &cmd->name, clcf->alias ? "alias" : "root"); | 3946 &cmd->name, clcf->alias ? "alias" : "root"); |
3954 } | 3947 } |
3955 | 3948 |
3956 return NGX_CONF_ERROR; | 3949 return NGX_CONF_ERROR; |
3957 } | 3950 } |
3958 | 3951 |
3959 if (clcf->named && alias) { | 3952 if (clcf->named && alias) { |
3960 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | 3953 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
3961 "the \"alias\" directive may not be used " | 3954 "the \"alias\" directive cannot be used " |
3962 "inside named location"); | 3955 "inside the named location"); |
3963 | 3956 |
3964 return NGX_CONF_ERROR; | 3957 return NGX_CONF_ERROR; |
3965 } | 3958 } |
3966 | 3959 |
3967 value = cf->args->elts; | 3960 value = cf->args->elts; |
3968 | 3961 |
3969 if (ngx_strstr(value[1].data, "$document_root") | 3962 if (ngx_strstr(value[1].data, "$document_root") |
3970 || ngx_strstr(value[1].data, "${document_root}")) | 3963 || ngx_strstr(value[1].data, "${document_root}")) |
3971 { | 3964 { |
3972 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | 3965 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
3973 "the $document_root variable may not be used " | 3966 "the $document_root variable cannot be used " |
3974 "in the \"%V\" directive", | 3967 "in the \"%V\" directive", |
3975 &cmd->name); | 3968 &cmd->name); |
3976 | 3969 |
3977 return NGX_CONF_ERROR; | 3970 return NGX_CONF_ERROR; |
3978 } | 3971 } |
3979 | 3972 |
3980 if (ngx_strstr(value[1].data, "$realpath_root") | 3973 if (ngx_strstr(value[1].data, "$realpath_root") |
3981 || ngx_strstr(value[1].data, "${realpath_root}")) | 3974 || ngx_strstr(value[1].data, "${realpath_root}")) |
3982 { | 3975 { |
3983 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | 3976 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
3984 "the $realpath_root variable may not be used " | 3977 "the $realpath_root variable cannot be used " |
3985 "in the \"%V\" directive", | 3978 "in the \"%V\" directive", |
3986 &cmd->name); | 3979 &cmd->name); |
3987 | 3980 |
3988 return NGX_CONF_ERROR; | 3981 return NGX_CONF_ERROR; |
3989 } | 3982 } |
4438 return NGX_CONF_OK; | 4431 return NGX_CONF_OK; |
4439 } | 4432 } |
4440 | 4433 |
4441 if (max == 0) { | 4434 if (max == 0) { |
4442 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | 4435 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
4443 "\"open_file_cache\" must have \"max\" parameter"); | 4436 "\"open_file_cache\" must have the \"max\" parameter"); |
4444 return NGX_CONF_ERROR; | 4437 return NGX_CONF_ERROR; |
4445 } | 4438 } |
4446 | 4439 |
4447 clcf->open_file_cache = ngx_open_file_cache_init(cf->pool, max, inactive); | 4440 clcf->open_file_cache = ngx_open_file_cache_init(cf->pool, max, inactive); |
4448 if (clcf->open_file_cache) { | 4441 if (clcf->open_file_cache) { |