Mercurial > hg > nginx
comparison src/http/ngx_http_core_module.c @ 2695:aa95c69c3068
try_files status code
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Sat, 11 Apr 2009 11:02:36 +0000 |
parents | 6c8a5165ed2a |
children | 756f73ca1e39 |
comparison
equal
deleted
inserted
replaced
2694:49a1382b249b | 2695:aa95c69c3068 |
---|---|
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] == '@') { |
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 * |