diff options
author | Igor Sysoev <igor@sysoev.ru> | 2009-04-11 11:02:36 +0000 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2009-04-11 11:02:36 +0000 |
commit | ecd822809da990698d0bb48848cf8232d7170b04 (patch) | |
tree | ee5a24e4c81e550d3455c8248957c42173a007a0 /src/http/ngx_http_core_module.c | |
parent | 9ce893b13b9cfa2038a1ad13975bb6af69bd809d (diff) | |
download | nginx-ecd822809da990698d0bb48848cf8232d7170b04.tar.gz nginx-ecd822809da990698d0bb48848cf8232d7170b04.zip |
try_files status code
Diffstat (limited to 'src/http/ngx_http_core_module.c')
-rw-r--r-- | src/http/ngx_http_core_module.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c index b6f4b11e1..ca1fbead0 100644 --- a/src/http/ngx_http_core_module.c +++ b/src/http/ngx_http_core_module.c @@ -1144,6 +1144,11 @@ ngx_http_core_try_files_phase(ngx_http_request_t *r, if (tf->lengths == NULL && tf->name.len == 0) { + if (tf->code) { + ngx_http_finalize_request(r, tf->code); + return NGX_OK; + } + path.len -= root; path.data += root; @@ -3939,6 +3944,7 @@ ngx_http_core_try_files(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) ngx_http_core_loc_conf_t *clcf = conf; ngx_str_t *value; + ngx_int_t code; ngx_uint_t i, n; ngx_http_try_file_t *tf; ngx_http_script_compile_t sc; @@ -3994,6 +4000,20 @@ ngx_http_core_try_files(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) } } + if (tf[i - 1].name.data[0] == '=') { + + code = ngx_atoi(tf[i - 1].name.data + 1, tf[i - 1].name.len - 2); + + if (code == NGX_ERROR) { + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, + "invalid code \"%*s\"", + tf[i - 1].name.len - 1, tf[i - 1].name.data); + return NGX_CONF_ERROR; + } + + tf[i].code = code; + } + return NGX_CONF_OK; } |