diff options
author | Igor Sysoev <igor@sysoev.ru> | 2006-10-25 15:36:11 +0000 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2006-10-25 15:36:11 +0000 |
commit | 711dd6f79a18974d99e6e0703f2127b550714d96 (patch) | |
tree | 00cfb215fd15fcb404c5c99c729d1d28494d6c06 /src | |
parent | 297f2bb4b97e055d50a86e2e4107e396fafe7cfe (diff) | |
download | nginx-711dd6f79a18974d99e6e0703f2127b550714d96.tar.gz nginx-711dd6f79a18974d99e6e0703f2127b550714d96.zip |
fix alias without trailing slash
Diffstat (limited to 'src')
-rw-r--r-- | src/http/modules/ngx_http_index_module.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/http/modules/ngx_http_index_module.c b/src/http/modules/ngx_http_index_module.c index 3af802663..4df57f9ce 100644 --- a/src/http/modules/ngx_http_index_module.c +++ b/src/http/modules/ngx_http_index_module.c @@ -315,10 +315,14 @@ ngx_http_index_handler(ngx_http_request_t *r) static ngx_int_t ngx_http_index_test_dir(ngx_http_request_t *r, ngx_http_index_ctx_t *ctx) { + u_char c; + ngx_uint_t i; ngx_err_t err; ngx_file_info_t fi; - *(ctx->index.data - 1) = '\0'; + c = *(ctx->index.data - 1); + i = (c == '/') ? 1 : 0; + *(ctx->index.data - i) = '\0'; ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "http index check dir: \"%s\"", ctx->path.data); @@ -328,7 +332,7 @@ ngx_http_index_test_dir(ngx_http_request_t *r, ngx_http_index_ctx_t *ctx) err = ngx_errno; if (err == NGX_ENOENT) { - *(ctx->index.data - 1) = '/'; + *(ctx->index.data - i) = c; return ngx_http_index_error(r, ctx, err); } @@ -338,7 +342,7 @@ ngx_http_index_test_dir(ngx_http_request_t *r, ngx_http_index_ctx_t *ctx) return NGX_HTTP_INTERNAL_SERVER_ERROR; } - *(ctx->index.data - 1) = '/'; + *(ctx->index.data - i) = c; if (ngx_is_dir(&fi)) { return NGX_OK; |