Mercurial > hg > nginx-vendor-1-0
comparison src/http/ngx_http_core_module.c @ 478:f2c6a7373274 NGINX_0_7_51
nginx 0.7.51
*) Feature: the "try_files" directive supports a response code in the
fallback parameter.
*) Feature: now any response code can be used in the "return" directive.
*) Bugfix: the "error_page" directive made an external redirect without
query string; the bug had appeared in 0.7.44.
*) Bugfix: if servers listened on several defined explicitly addresses,
then virtual servers might not work; the bug had appeared in 0.7.39.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Sun, 12 Apr 2009 00:00:00 +0400 |
parents | 56baf312c1b5 |
children | 549994537f15 |
comparison
equal
deleted
inserted
replaced
477:ba2ea8c4d60f | 478:f2c6a7373274 |
---|---|
1141 | 1141 |
1142 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | 1142 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
1143 "try to use file: \"%s\" \"%s\"", name, path.data); | 1143 "try to use file: \"%s\" \"%s\"", name, path.data); |
1144 | 1144 |
1145 if (tf->lengths == NULL && tf->name.len == 0) { | 1145 if (tf->lengths == NULL && tf->name.len == 0) { |
1146 | |
1147 if (tf->code) { | |
1148 ngx_http_finalize_request(r, tf->code); | |
1149 return NGX_OK; | |
1150 } | |
1146 | 1151 |
1147 path.len -= root; | 1152 path.len -= root; |
1148 path.data += root; | 1153 path.data += root; |
1149 | 1154 |
1150 if (path.data[0] == '@') { | 1155 if (path.data[0] == '@') { |
3873 } | 3878 } |
3874 | 3879 |
3875 args.len = 0; | 3880 args.len = 0; |
3876 args.data = NULL; | 3881 args.data = NULL; |
3877 | 3882 |
3878 if (cv.lengths == NULL) { | 3883 if (cv.lengths == NULL && uri.data[0] == '/') { |
3879 p = (u_char *) ngx_strchr(uri.data, '?'); | 3884 p = (u_char *) ngx_strchr(uri.data, '?'); |
3880 | 3885 |
3881 if (p) { | 3886 if (p) { |
3882 cv.value.len = p - uri.data; | 3887 cv.value.len = p - uri.data; |
3883 cv.value.data = uri.data; | 3888 cv.value.data = uri.data; |
3937 ngx_http_core_try_files(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | 3942 ngx_http_core_try_files(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
3938 { | 3943 { |
3939 ngx_http_core_loc_conf_t *clcf = conf; | 3944 ngx_http_core_loc_conf_t *clcf = conf; |
3940 | 3945 |
3941 ngx_str_t *value; | 3946 ngx_str_t *value; |
3947 ngx_int_t code; | |
3942 ngx_uint_t i, n; | 3948 ngx_uint_t i, n; |
3943 ngx_http_try_file_t *tf; | 3949 ngx_http_try_file_t *tf; |
3944 ngx_http_script_compile_t sc; | 3950 ngx_http_script_compile_t sc; |
3945 ngx_http_core_main_conf_t *cmcf; | 3951 ngx_http_core_main_conf_t *cmcf; |
3946 | 3952 |
3992 /* add trailing '\0' to length */ | 3998 /* add trailing '\0' to length */ |
3993 tf[i].name.len++; | 3999 tf[i].name.len++; |
3994 } | 4000 } |
3995 } | 4001 } |
3996 | 4002 |
4003 if (tf[i - 1].name.data[0] == '=') { | |
4004 | |
4005 code = ngx_atoi(tf[i - 1].name.data + 1, tf[i - 1].name.len - 2); | |
4006 | |
4007 if (code == NGX_ERROR) { | |
4008 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
4009 "invalid code \"%*s\"", | |
4010 tf[i - 1].name.len - 1, tf[i - 1].name.data); | |
4011 return NGX_CONF_ERROR; | |
4012 } | |
4013 | |
4014 tf[i].code = code; | |
4015 } | |
4016 | |
3997 return NGX_CONF_OK; | 4017 return NGX_CONF_OK; |
3998 } | 4018 } |
3999 | 4019 |
4000 | 4020 |
4001 static char * | 4021 static char * |