diff options
-rw-r--r-- | src/http/ngx_http_core_module.c | 2 | ||||
-rw-r--r-- | src/os/unix/ngx_files.h | 12 | ||||
-rw-r--r-- | src/os/win32/ngx_files.h | 3 |
3 files changed, 16 insertions, 1 deletions
diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c index 20aba8653..0ddfc04d1 100644 --- a/src/http/ngx_http_core_module.c +++ b/src/http/ngx_http_core_module.c @@ -1204,7 +1204,7 @@ ngx_http_core_find_static_location(ngx_http_request_t *r, n = (len <= (size_t) node->len) ? len : node->len; - rc = ngx_memcmp(uri, node->name, n); + rc = ngx_filename_cmp(uri, node->name, n); if (rc != 0) { node = (rc < 0) ? node->left : node->right; diff --git a/src/os/unix/ngx_files.h b/src/os/unix/ngx_files.h index a223b34e8..0c080c494 100644 --- a/src/os/unix/ngx_files.h +++ b/src/os/unix/ngx_files.h @@ -19,6 +19,8 @@ #ifdef __CYGWIN__ +#define NGX_HAVE_CASELESS_FILESYSTEM 1 + #define ngx_open_file(name, mode, create, access) \ open((const char *) name, mode|create|O_BINARY, access) @@ -103,6 +105,16 @@ ngx_int_t ngx_set_file_time(u_char *name, ngx_fd_t fd, time_t s); #define ngx_file_uniq(sb) (sb)->st_ino +#if (NGX_HAVE_CASELESS_FILESYSTEM) + +#define ngx_filename_cmp(s1, s2, n) strncasecmp((char *) s1, (char *) s2, n) + +#else + +#define ngx_filename_cmp ngx_memcmp + +#endif + #define ngx_getcwd(buf, size) (getcwd(buf, size) != NULL) #define ngx_getcwd_n "getcwd()" diff --git a/src/os/win32/ngx_files.h b/src/os/win32/ngx_files.h index 5f926417c..0c4e14fa3 100644 --- a/src/os/win32/ngx_files.h +++ b/src/os/win32/ngx_files.h @@ -123,6 +123,9 @@ ngx_int_t ngx_file_info(u_char *filename, ngx_file_info_t *fi); - 116444736000000000) / 10000000) +#define ngx_filename_cmp(s1, s2, n) strnicmp((char *) s1, (char *) s2, n) + + #define ngx_getcwd(buf, size) GetCurrentDirectory(size, buf) #define ngx_getcwd_n "GetCurrentDirectory()" #define NGX_MAX_PATH MAX_PATH |