Mercurial > hg > nginx
comparison src/http/ngx_http_core_module.c @ 4131:1b05b9bbcebf
Overhauled diagnostic messages.
author | Ruslan Ermilov <ru@nginx.com> |
---|---|
date | Mon, 19 Sep 2011 12:37:22 +0000 |
parents | 82738a316a54 |
children | cdc22824e22a |
comparison
equal
deleted
inserted
replaced
4130:04751572f900 | 4131:1b05b9bbcebf |
---|---|
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 } |
3022 if (ngx_strcmp(value[i].data, type[n].key.data) == 0) { | 3022 if (ngx_strcmp(value[i].data, type[n].key.data) == 0) { |
3023 old = type[n].value; | 3023 old = type[n].value; |
3024 type[n].value = content_type; | 3024 type[n].value = content_type; |
3025 | 3025 |
3026 ngx_conf_log_error(NGX_LOG_WARN, cf, 0, | 3026 ngx_conf_log_error(NGX_LOG_WARN, cf, 0, |
3027 "duplicate extention \"%V\", " | 3027 "duplicate extension \"%V\", " |
3028 "content type: \"%V\", " | 3028 "content type: \"%V\", " |
3029 "old content type: \"%V\"", | 3029 "previous content type: \"%V\"", |
3030 &value[i], content_type, old); | 3030 &value[i], content_type, old); |
3031 continue; | 3031 continue; |
3032 } | 3032 } |
3033 } | 3033 } |
3034 | 3034 |
3176 4, 8192); | 3176 4, 8192); |
3177 | 3177 |
3178 if (conf->large_client_header_buffers.size < conf->connection_pool_size) { | 3178 if (conf->large_client_header_buffers.size < conf->connection_pool_size) { |
3179 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | 3179 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
3180 "the \"large_client_header_buffers\" size must be " | 3180 "the \"large_client_header_buffers\" size must be " |
3181 "equal to or bigger than \"connection_pool_size\""); | 3181 "equal to or greater than \"connection_pool_size\""); |
3182 return NGX_CONF_ERROR; | 3182 return NGX_CONF_ERROR; |
3183 } | 3183 } |
3184 | 3184 |
3185 ngx_conf_merge_value(conf->ignore_invalid_headers, | 3185 ngx_conf_merge_value(conf->ignore_invalid_headers, |
3186 prev->ignore_invalid_headers, 1); | 3186 prev->ignore_invalid_headers, 1); |
3777 } | 3777 } |
3778 | 3778 |
3779 continue; | 3779 continue; |
3780 #else | 3780 #else |
3781 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | 3781 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
3782 "bind ipv6only is not supported " | 3782 "ipv6only is not supported " |
3783 "on this platform"); | 3783 "on this platform"); |
3784 return NGX_CONF_ERROR; | 3784 return NGX_CONF_ERROR; |
3785 #endif | 3785 #endif |
3786 } | 3786 } |
3787 | 3787 |
3796 return NGX_CONF_ERROR; | 3796 return NGX_CONF_ERROR; |
3797 #endif | 3797 #endif |
3798 } | 3798 } |
3799 | 3799 |
3800 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | 3800 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
3801 "the invalid \"%V\" parameter", &value[n]); | 3801 "invalid parameter \"%V\"", &value[n]); |
3802 return NGX_CONF_ERROR; | 3802 return NGX_CONF_ERROR; |
3803 } | 3803 } |
3804 | 3804 |
3805 if (ngx_http_add_listen(cf, cscf, &lsopt) == NGX_OK) { | 3805 if (ngx_http_add_listen(cf, cscf, &lsopt) == NGX_OK) { |
3806 return NGX_CONF_OK; | 3806 return NGX_CONF_OK; |
3834 return NGX_CONF_ERROR; | 3834 return NGX_CONF_ERROR; |
3835 } | 3835 } |
3836 | 3836 |
3837 if (ngx_strchr(value[i].data, '/')) { | 3837 if (ngx_strchr(value[i].data, '/')) { |
3838 ngx_conf_log_error(NGX_LOG_WARN, cf, 0, | 3838 ngx_conf_log_error(NGX_LOG_WARN, cf, 0, |
3839 "server name \"%V\" has strange symbols", | 3839 "server name \"%V\" has suspicious symbols", |
3840 &value[i]); | 3840 &value[i]); |
3841 } | 3841 } |
3842 | 3842 |
3843 if (value[i].len == 1 && ch == '*') { | 3843 if (value[i].len == 1 && ch == '*') { |
3844 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | 3844 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
3905 sn->name = value[i]; | 3905 sn->name = value[i]; |
3906 cscf->captures = (rc.captures > 0); | 3906 cscf->captures = (rc.captures > 0); |
3907 } | 3907 } |
3908 #else | 3908 #else |
3909 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | 3909 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
3910 "the using of the regex \"%V\" " | 3910 "using regex \"%V\" " |
3911 "requires PCRE library", &value[i]); | 3911 "requires PCRE library", &value[i]); |
3912 | 3912 |
3913 return NGX_CONF_ERROR; | 3913 return NGX_CONF_ERROR; |
3914 #endif | 3914 #endif |
3915 } | 3915 } |
3937 "\"%V\" directive is duplicate", | 3937 "\"%V\" directive is duplicate", |
3938 &cmd->name); | 3938 &cmd->name); |
3939 } else { | 3939 } else { |
3940 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | 3940 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
3941 "\"%V\" directive is duplicate, " | 3941 "\"%V\" directive is duplicate, " |
3942 "\"%s\" directive is specified before", | 3942 "\"%s\" directive was specified earlier", |
3943 &cmd->name, clcf->alias ? "alias" : "root"); | 3943 &cmd->name, clcf->alias ? "alias" : "root"); |
3944 } | 3944 } |
3945 | 3945 |
3946 return NGX_CONF_ERROR; | 3946 return NGX_CONF_ERROR; |
3947 } | 3947 } |
3948 | 3948 |
3949 if (clcf->named && alias) { | 3949 if (clcf->named && alias) { |
3950 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | 3950 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
3951 "the \"alias\" directive may not be used " | 3951 "the \"alias\" directive cannot be used " |
3952 "inside named location"); | 3952 "inside the named location"); |
3953 | 3953 |
3954 return NGX_CONF_ERROR; | 3954 return NGX_CONF_ERROR; |
3955 } | 3955 } |
3956 | 3956 |
3957 value = cf->args->elts; | 3957 value = cf->args->elts; |
3958 | 3958 |
3959 if (ngx_strstr(value[1].data, "$document_root") | 3959 if (ngx_strstr(value[1].data, "$document_root") |
3960 || ngx_strstr(value[1].data, "${document_root}")) | 3960 || ngx_strstr(value[1].data, "${document_root}")) |
3961 { | 3961 { |
3962 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | 3962 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
3963 "the $document_root variable may not be used " | 3963 "the $document_root variable cannot be used " |
3964 "in the \"%V\" directive", | 3964 "in the \"%V\" directive", |
3965 &cmd->name); | 3965 &cmd->name); |
3966 | 3966 |
3967 return NGX_CONF_ERROR; | 3967 return NGX_CONF_ERROR; |
3968 } | 3968 } |
3969 | 3969 |
3970 if (ngx_strstr(value[1].data, "$realpath_root") | 3970 if (ngx_strstr(value[1].data, "$realpath_root") |
3971 || ngx_strstr(value[1].data, "${realpath_root}")) | 3971 || ngx_strstr(value[1].data, "${realpath_root}")) |
3972 { | 3972 { |
3973 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | 3973 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
3974 "the $realpath_root variable may not be used " | 3974 "the $realpath_root variable cannot be used " |
3975 "in the \"%V\" directive", | 3975 "in the \"%V\" directive", |
3976 &cmd->name); | 3976 &cmd->name); |
3977 | 3977 |
3978 return NGX_CONF_ERROR; | 3978 return NGX_CONF_ERROR; |
3979 } | 3979 } |
4428 return NGX_CONF_OK; | 4428 return NGX_CONF_OK; |
4429 } | 4429 } |
4430 | 4430 |
4431 if (max == 0) { | 4431 if (max == 0) { |
4432 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | 4432 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
4433 "\"open_file_cache\" must have \"max\" parameter"); | 4433 "\"open_file_cache\" must have the \"max\" parameter"); |
4434 return NGX_CONF_ERROR; | 4434 return NGX_CONF_ERROR; |
4435 } | 4435 } |
4436 | 4436 |
4437 clcf->open_file_cache = ngx_open_file_cache_init(cf->pool, max, inactive); | 4437 clcf->open_file_cache = ngx_open_file_cache_init(cf->pool, max, inactive); |
4438 if (clcf->open_file_cache) { | 4438 if (clcf->open_file_cache) { |