Mercurial > hg > nginx
comparison src/os/unix/ngx_files.h @ 5389:72e31d88defa
Added ngx_filename_cmp() with "/" sorted to the left.
This patch fixes incorrect handling of auto redirect in configurations
like:
location /0 { }
location /a- { }
location /a/ { proxy_pass ... }
With previously used sorting, this resulted in the following locations
tree (as "-" is less than "/"):
"/a-"
"/0" "/a/"
and a request to "/a" didn't match "/a/" with auto_redirect, as it
didn't traverse relevant tree node during lookup (it tested "/a-",
then "/0", and then falled back to null location).
To preserve locale use for non-ASCII characters on case-insensetive
systems, libc's tolower() used.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Mon, 23 Sep 2013 19:37:13 +0400 |
parents | acd51b0f6fd4 |
children | f1dfe7ff4511 |
comparison
equal
deleted
inserted
replaced
5388:fbaae7d1c033 | 5389:72e31d88defa |
---|---|
190 | 190 |
191 ngx_int_t ngx_create_file_mapping(ngx_file_mapping_t *fm); | 191 ngx_int_t ngx_create_file_mapping(ngx_file_mapping_t *fm); |
192 void ngx_close_file_mapping(ngx_file_mapping_t *fm); | 192 void ngx_close_file_mapping(ngx_file_mapping_t *fm); |
193 | 193 |
194 | 194 |
195 #if (NGX_HAVE_CASELESS_FILESYSTEM) | |
196 | |
197 #define ngx_filename_cmp(s1, s2, n) strncasecmp((char *) s1, (char *) s2, n) | |
198 | |
199 #else | |
200 | |
201 #define ngx_filename_cmp ngx_memcmp | |
202 | |
203 #endif | |
204 | |
205 | |
206 #define ngx_realpath(p, r) (u_char *) realpath((char *) p, (char *) r) | 195 #define ngx_realpath(p, r) (u_char *) realpath((char *) p, (char *) r) |
207 #define ngx_realpath_n "realpath()" | 196 #define ngx_realpath_n "realpath()" |
208 #define ngx_getcwd(buf, size) (getcwd((char *) buf, size) != NULL) | 197 #define ngx_getcwd(buf, size) (getcwd((char *) buf, size) != NULL) |
209 #define ngx_getcwd_n "getcwd()" | 198 #define ngx_getcwd_n "getcwd()" |
210 #define ngx_path_separator(c) ((c) == '/') | 199 #define ngx_path_separator(c) ((c) == '/') |