diff src/http/modules/ngx_http_index_module.c @ 252:644510700914 NGINX_0_4_11

nginx 0.4.11 *) Feature: the POP3 proxy supports the AUTH LOGIN PLAIN and CRAM-MD5. *) Feature: the ngx_http_perl_module supports the $r->allow_ranges method. *) Bugfix: if the APOP was enabled in the POP3 proxy, then the USER/PASS commands might not work; bug appeared in 0.4.10.
author Igor Sysoev <http://sysoev.ru>
date Wed, 25 Oct 2006 00:00:00 +0400
parents acd2ec3541cb
children 29a6403156b0
line wrap: on
line diff
--- 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_
 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
         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
         return NGX_HTTP_INTERNAL_SERVER_ERROR;
     }
 
-    *(ctx->index.data - 1) = '/';
+    *(ctx->index.data - i) = c;
 
     if (ngx_is_dir(&fi)) {
         return NGX_OK;