changeset 3584:771d28b86077 stable-0.7

merge r3459, r3571: Win32 fixes: *) compare long file names in case-insensitive mode, the bug had been introduced in r3436 *) test default NTFS stream "::$DATA"
author Igor Sysoev <igor@sysoev.ru>
date Mon, 07 Jun 2010 10:14:11 +0000
parents d513f9d30208
children 3031b5931864
files src/http/ngx_http_request.c src/os/win32/ngx_files.c src/os/win32/ngx_win32_config.h src/os/win32/ngx_win32_init.c
diffstat 4 files changed, 25 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/http/ngx_http_request.c
+++ b/src/http/ngx_http_request.c
@@ -784,16 +784,31 @@ ngx_http_process_request_line(ngx_event_
 
             p = r->uri.data + r->uri.len - 1;
 
-            if (*p == '.' || *p == ' ') {
-
-                while (--p > r->uri.data && (*p == '.' || *p == ' ')) {
-                    /* void */
+            while (p > r->uri.data) {
+
+                if (*p == ' ') {
+                    p--;
+                    continue;
+                }
+
+                if (*p == '.') {
+                    p--;
+                    continue;
                 }
 
+                if (ngx_strncasecmp(p - 6, (u_char *) "::$data", 7) == 0) {
+                    p -= 7;
+                    continue;
+                }
+
+                break;
+            }
+
+            if (p != r->uri.data + r->uri.len - 1) {
                 r->uri.len = p + 1 - r->uri.data;
-
                 ngx_http_set_exten(r);
             }
+
             }
 #endif
 
--- a/src/os/win32/ngx_files.c
+++ b/src/os/win32/ngx_files.c
@@ -48,7 +48,7 @@ ngx_open_file(u_char *name, u_long mode,
             goto failed;
         }
 
-        if (n != len - 1 || ngx_memcmp(u, lu, n) != 0) {
+        if (n != len - 1 || _wcsicmp(u, lu) != 0) {
             ngx_set_errno(NGX_ENOENT);
             goto failed;
         }
--- a/src/os/win32/ngx_win32_config.h
+++ b/src/os/win32/ngx_win32_config.h
@@ -36,6 +36,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdarg.h>
+#include <locale.h>
 
 #ifdef __WATCOMC__
 #define _TIME_T_DEFINED
--- a/src/os/win32/ngx_win32_init.c
+++ b/src/os/win32/ngx_win32_init.c
@@ -114,6 +114,9 @@ ngx_os_init(ngx_log_t *log)
 
     for (n = ngx_pagesize; n >>= 1; ngx_pagesize_shift++) { /* void */ }
 
+    /* delete default "C" locale for _wcsicmp() */
+    setlocale(LC_ALL, "");
+
 
     /* init Winsock */