Mercurial > hg > nginx
annotate src/os/win32/ngx_files.c @ 7142:b9d919b53593 stable-1.12
Stream: relaxed next upstream condition (ticket #1317).
When switching to a next upstream, some buffers could be stuck in the middle
of the filter chain. A condition existed that raised an error when this
happened. As it turned out, this condition prevented switching to a next
upstream if ssl preread was used with the TCP protocol (see the ticket).
In fact, the condition does not make sense for TCP, since after successful
connection to an upstream switching to another upstream never happens. As for
UDP, the issue with stuck buffers is unlikely to happen, but is still possible.
Specifically, if a filter delays sending data to upstream.
The condition can be relaxed to only check the "buffered" bitmask of the
upstream connection. The new condition is simpler and fixes the ticket issue
as well. Additionally, the upstream_out chain is now reset for UDP prior to
connecting to a new upstream to prevent repeating the client data twice.
author | Roman Arutyunyan <arut@nginx.com> |
---|---|
date | Mon, 11 Sep 2017 15:32:31 +0300 |
parents | fbdab7f38fd6 |
children | 577628e6b6a6 |
rev | line source |
---|---|
441
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
344
diff
changeset
|
1 |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
344
diff
changeset
|
2 /* |
444
42d11f017717
nginx-0.1.0-2004-09-29-20:00:49 import; remove years from copyright
Igor Sysoev <igor@sysoev.ru>
parents:
441
diff
changeset
|
3 * Copyright (C) Igor Sysoev |
4412 | 4 * Copyright (C) Nginx, Inc. |
441
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
344
diff
changeset
|
5 */ |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
344
diff
changeset
|
6 |
42
cd035a94e0b6
nginx-0.0.1-2002-12-27-10:27:47 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
7 |
cd035a94e0b6
nginx-0.0.1-2002-12-27-10:27:47 import
Igor Sysoev <igor@sysoev.ru>
parents:
35
diff
changeset
|
8 #include <ngx_config.h> |
100
7ebc8b7fb816
nginx-0.0.1-2003-06-03-19:42:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
42
diff
changeset
|
9 #include <ngx_core.h> |
8
708f8bb772ec
nginx-0.0.1-2002-09-02-18:48:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
10 |
708f8bb772ec
nginx-0.0.1-2002-09-02-18:48:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
11 |
2628
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
12 #define NGX_UTF16_BUFLEN 256 |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
13 |
4673
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
14 static ngx_int_t ngx_win32_check_filename(u_char *name, u_short *u, |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
15 size_t len); |
3417
15017418fd84
disable Win32 short file names
Igor Sysoev <igor@sysoev.ru>
parents:
3382
diff
changeset
|
16 static u_short *ngx_utf8_to_utf16(u_short *utf16, u_char *utf8, size_t *len); |
2628
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
17 |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
18 |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
19 /* FILE_FLAG_BACKUP_SEMANTICS allows to obtain a handle to a directory */ |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
20 |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
21 ngx_fd_t |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
22 ngx_open_file(u_char *name, u_long mode, u_long create, u_long access) |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
23 { |
3417
15017418fd84
disable Win32 short file names
Igor Sysoev <igor@sysoev.ru>
parents:
3382
diff
changeset
|
24 size_t len; |
4673
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
25 u_short *u; |
3137
179f6dfcb7fe
preserve errno while ngx_free()
Igor Sysoev <igor@sysoev.ru>
parents:
2974
diff
changeset
|
26 ngx_fd_t fd; |
179f6dfcb7fe
preserve errno while ngx_free()
Igor Sysoev <igor@sysoev.ru>
parents:
2974
diff
changeset
|
27 ngx_err_t err; |
179f6dfcb7fe
preserve errno while ngx_free()
Igor Sysoev <igor@sysoev.ru>
parents:
2974
diff
changeset
|
28 u_short utf16[NGX_UTF16_BUFLEN]; |
2628
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
29 |
3417
15017418fd84
disable Win32 short file names
Igor Sysoev <igor@sysoev.ru>
parents:
3382
diff
changeset
|
30 len = NGX_UTF16_BUFLEN; |
15017418fd84
disable Win32 short file names
Igor Sysoev <igor@sysoev.ru>
parents:
3382
diff
changeset
|
31 u = ngx_utf8_to_utf16(utf16, name, &len); |
2628
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
32 |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
33 if (u == NULL) { |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
34 return INVALID_HANDLE_VALUE; |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
35 } |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
36 |
3417
15017418fd84
disable Win32 short file names
Igor Sysoev <igor@sysoev.ru>
parents:
3382
diff
changeset
|
37 fd = INVALID_HANDLE_VALUE; |
15017418fd84
disable Win32 short file names
Igor Sysoev <igor@sysoev.ru>
parents:
3382
diff
changeset
|
38 |
4673
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
39 if (create == NGX_FILE_OPEN |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
40 && ngx_win32_check_filename(name, u, len) != NGX_OK) |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
41 { |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
42 goto failed; |
3417
15017418fd84
disable Win32 short file names
Igor Sysoev <igor@sysoev.ru>
parents:
3382
diff
changeset
|
43 } |
15017418fd84
disable Win32 short file names
Igor Sysoev <igor@sysoev.ru>
parents:
3382
diff
changeset
|
44 |
2628
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
45 fd = CreateFileW(u, mode, |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
46 FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
47 NULL, create, FILE_FLAG_BACKUP_SEMANTICS, NULL); |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
48 |
3417
15017418fd84
disable Win32 short file names
Igor Sysoev <igor@sysoev.ru>
parents:
3382
diff
changeset
|
49 failed: |
15017418fd84
disable Win32 short file names
Igor Sysoev <igor@sysoev.ru>
parents:
3382
diff
changeset
|
50 |
4673
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
51 if (u != utf16) { |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
52 err = ngx_errno; |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
53 ngx_free(u); |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
54 ngx_set_errno(err); |
3417
15017418fd84
disable Win32 short file names
Igor Sysoev <igor@sysoev.ru>
parents:
3382
diff
changeset
|
55 } |
15017418fd84
disable Win32 short file names
Igor Sysoev <igor@sysoev.ru>
parents:
3382
diff
changeset
|
56 |
2628
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
57 return fd; |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
58 } |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
59 |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
60 |
561 | 61 ssize_t |
62 ngx_read_file(ngx_file_t *file, u_char *buf, size_t size, off_t offset) | |
8
708f8bb772ec
nginx-0.0.1-2002-09-02-18:48:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
63 { |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
280
diff
changeset
|
64 u_long n; |
184
1bf718ce0dde
nginx-0.0.1-2003-11-14-10:20:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
65 ngx_err_t err; |
182
3c49eaf3f522
nginx-0.0.1-2003-11-13-09:14:05 import
Igor Sysoev <igor@sysoev.ru>
parents:
123
diff
changeset
|
66 OVERLAPPED ovlp, *povlp; |
8
708f8bb772ec
nginx-0.0.1-2002-09-02-18:48:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
67 |
3156 | 68 ovlp.Internal = 0; |
69 ovlp.InternalHigh = 0; | |
70 ovlp.Offset = (u_long) offset; | |
71 ovlp.OffsetHigh = (u_long) (offset >> 32); | |
72 ovlp.hEvent = NULL; | |
461 | 73 |
3156 | 74 povlp = &ovlp; |
184
1bf718ce0dde
nginx-0.0.1-2003-11-14-10:20:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
75 |
1bf718ce0dde
nginx-0.0.1-2003-11-14-10:20:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
76 if (ReadFile(file->fd, buf, size, &n, povlp) == 0) { |
2974
63f71723cd2a
handle Win32 ReadFile() EOF state in Unix way
Igor Sysoev <igor@sysoev.ru>
parents:
2901
diff
changeset
|
77 err = ngx_errno; |
63f71723cd2a
handle Win32 ReadFile() EOF state in Unix way
Igor Sysoev <igor@sysoev.ru>
parents:
2901
diff
changeset
|
78 |
63f71723cd2a
handle Win32 ReadFile() EOF state in Unix way
Igor Sysoev <igor@sysoev.ru>
parents:
2901
diff
changeset
|
79 if (err == ERROR_HANDLE_EOF) { |
63f71723cd2a
handle Win32 ReadFile() EOF state in Unix way
Igor Sysoev <igor@sysoev.ru>
parents:
2901
diff
changeset
|
80 return 0; |
63f71723cd2a
handle Win32 ReadFile() EOF state in Unix way
Igor Sysoev <igor@sysoev.ru>
parents:
2901
diff
changeset
|
81 } |
63f71723cd2a
handle Win32 ReadFile() EOF state in Unix way
Igor Sysoev <igor@sysoev.ru>
parents:
2901
diff
changeset
|
82 |
3157
a2c1b4f74ea7
log file name for read/write errors
Igor Sysoev <igor@sysoev.ru>
parents:
3156
diff
changeset
|
83 ngx_log_error(NGX_LOG_ERR, file->log, err, |
a2c1b4f74ea7
log file name for read/write errors
Igor Sysoev <igor@sysoev.ru>
parents:
3156
diff
changeset
|
84 "ReadFile() \"%s\" failed", file->name.data); |
184
1bf718ce0dde
nginx-0.0.1-2003-11-14-10:20:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
85 return NGX_ERROR; |
1bf718ce0dde
nginx-0.0.1-2003-11-14-10:20:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
86 } |
1bf718ce0dde
nginx-0.0.1-2003-11-14-10:20:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
87 |
1bf718ce0dde
nginx-0.0.1-2003-11-14-10:20:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
88 file->offset += n; |
1bf718ce0dde
nginx-0.0.1-2003-11-14-10:20:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
89 |
1bf718ce0dde
nginx-0.0.1-2003-11-14-10:20:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
90 return n; |
1bf718ce0dde
nginx-0.0.1-2003-11-14-10:20:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
91 } |
1bf718ce0dde
nginx-0.0.1-2003-11-14-10:20:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
92 |
1bf718ce0dde
nginx-0.0.1-2003-11-14-10:20:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
93 |
561 | 94 ssize_t |
95 ngx_write_file(ngx_file_t *file, u_char *buf, size_t size, off_t offset) | |
184
1bf718ce0dde
nginx-0.0.1-2003-11-14-10:20:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
96 { |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
280
diff
changeset
|
97 u_long n; |
184
1bf718ce0dde
nginx-0.0.1-2003-11-14-10:20:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
98 OVERLAPPED ovlp, *povlp; |
183
4c698194c56d
nginx-0.0.1-2003-11-13-19:16:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
182
diff
changeset
|
99 |
3156 | 100 ovlp.Internal = 0; |
101 ovlp.InternalHigh = 0; | |
102 ovlp.Offset = (u_long) offset; | |
103 ovlp.OffsetHigh = (u_long) (offset >> 32); | |
104 ovlp.hEvent = NULL; | |
183
4c698194c56d
nginx-0.0.1-2003-11-13-19:16:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
182
diff
changeset
|
105 |
3156 | 106 povlp = &ovlp; |
183
4c698194c56d
nginx-0.0.1-2003-11-13-19:16:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
182
diff
changeset
|
107 |
4c698194c56d
nginx-0.0.1-2003-11-13-19:16:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
182
diff
changeset
|
108 if (WriteFile(file->fd, buf, size, &n, povlp) == 0) { |
3157
a2c1b4f74ea7
log file name for read/write errors
Igor Sysoev <igor@sysoev.ru>
parents:
3156
diff
changeset
|
109 ngx_log_error(NGX_LOG_ERR, file->log, ngx_errno, |
a2c1b4f74ea7
log file name for read/write errors
Igor Sysoev <igor@sysoev.ru>
parents:
3156
diff
changeset
|
110 "WriteFile() \"%s\" failed", file->name.data); |
182
3c49eaf3f522
nginx-0.0.1-2003-11-13-09:14:05 import
Igor Sysoev <igor@sysoev.ru>
parents:
123
diff
changeset
|
111 return NGX_ERROR; |
3c49eaf3f522
nginx-0.0.1-2003-11-13-09:14:05 import
Igor Sysoev <igor@sysoev.ru>
parents:
123
diff
changeset
|
112 } |
3c49eaf3f522
nginx-0.0.1-2003-11-13-09:14:05 import
Igor Sysoev <igor@sysoev.ru>
parents:
123
diff
changeset
|
113 |
3158 | 114 if (n != size) { |
115 ngx_log_error(NGX_LOG_CRIT, file->log, 0, | |
116 "WriteFile() \"%s\" has written only %ul of %uz", | |
117 file->name.data, n, size); | |
118 return NGX_ERROR; | |
119 } | |
120 | |
182
3c49eaf3f522
nginx-0.0.1-2003-11-13-09:14:05 import
Igor Sysoev <igor@sysoev.ru>
parents:
123
diff
changeset
|
121 file->offset += n; |
3c49eaf3f522
nginx-0.0.1-2003-11-13-09:14:05 import
Igor Sysoev <igor@sysoev.ru>
parents:
123
diff
changeset
|
122 |
3c49eaf3f522
nginx-0.0.1-2003-11-13-09:14:05 import
Igor Sysoev <igor@sysoev.ru>
parents:
123
diff
changeset
|
123 return n; |
3c49eaf3f522
nginx-0.0.1-2003-11-13-09:14:05 import
Igor Sysoev <igor@sysoev.ru>
parents:
123
diff
changeset
|
124 } |
3c49eaf3f522
nginx-0.0.1-2003-11-13-09:14:05 import
Igor Sysoev <igor@sysoev.ru>
parents:
123
diff
changeset
|
125 |
3c49eaf3f522
nginx-0.0.1-2003-11-13-09:14:05 import
Igor Sysoev <igor@sysoev.ru>
parents:
123
diff
changeset
|
126 |
561 | 127 ssize_t |
128 ngx_write_chain_to_file(ngx_file_t *file, ngx_chain_t *cl, off_t offset, | |
129 ngx_pool_t *pool) | |
184
1bf718ce0dde
nginx-0.0.1-2003-11-14-10:20:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
130 { |
292
a472bfb778b3
nginx-0.0.3-2004-03-17-00:26:01 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
131 u_char *buf, *prev; |
184
1bf718ce0dde
nginx-0.0.1-2003-11-14-10:20:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
132 size_t size; |
1bf718ce0dde
nginx-0.0.1-2003-11-14-10:20:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
133 ssize_t total, n; |
1bf718ce0dde
nginx-0.0.1-2003-11-14-10:20:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
134 |
1bf718ce0dde
nginx-0.0.1-2003-11-14-10:20:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
135 total = 0; |
1bf718ce0dde
nginx-0.0.1-2003-11-14-10:20:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
136 |
1bf718ce0dde
nginx-0.0.1-2003-11-14-10:20:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
137 while (cl) { |
343
6bdf858bff8c
nginx-0.0.3-2004-05-28-19:49:23 import; rename ngx_hunk_t to ngx_buf_t
Igor Sysoev <igor@sysoev.ru>
parents:
292
diff
changeset
|
138 buf = cl->buf->pos; |
184
1bf718ce0dde
nginx-0.0.1-2003-11-14-10:20:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
139 prev = buf; |
1bf718ce0dde
nginx-0.0.1-2003-11-14-10:20:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
140 size = 0; |
1bf718ce0dde
nginx-0.0.1-2003-11-14-10:20:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
141 |
344
e366ba5db8f8
nginx-0.0.3-2004-06-01-10:04:46 import
Igor Sysoev <igor@sysoev.ru>
parents:
343
diff
changeset
|
142 /* coalesce the neighbouring bufs */ |
184
1bf718ce0dde
nginx-0.0.1-2003-11-14-10:20:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
143 |
343
6bdf858bff8c
nginx-0.0.3-2004-05-28-19:49:23 import; rename ngx_hunk_t to ngx_buf_t
Igor Sysoev <igor@sysoev.ru>
parents:
292
diff
changeset
|
144 while (cl && prev == cl->buf->pos) { |
6bdf858bff8c
nginx-0.0.3-2004-05-28-19:49:23 import; rename ngx_hunk_t to ngx_buf_t
Igor Sysoev <igor@sysoev.ru>
parents:
292
diff
changeset
|
145 size += cl->buf->last - cl->buf->pos; |
6bdf858bff8c
nginx-0.0.3-2004-05-28-19:49:23 import; rename ngx_hunk_t to ngx_buf_t
Igor Sysoev <igor@sysoev.ru>
parents:
292
diff
changeset
|
146 prev = cl->buf->last; |
184
1bf718ce0dde
nginx-0.0.1-2003-11-14-10:20:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
147 cl = cl->next; |
1bf718ce0dde
nginx-0.0.1-2003-11-14-10:20:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
148 } |
1bf718ce0dde
nginx-0.0.1-2003-11-14-10:20:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
149 |
1bf718ce0dde
nginx-0.0.1-2003-11-14-10:20:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
150 n = ngx_write_file(file, buf, size, offset); |
1bf718ce0dde
nginx-0.0.1-2003-11-14-10:20:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
151 |
1bf718ce0dde
nginx-0.0.1-2003-11-14-10:20:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
152 if (n == NGX_ERROR) { |
1bf718ce0dde
nginx-0.0.1-2003-11-14-10:20:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
153 return NGX_ERROR; |
1bf718ce0dde
nginx-0.0.1-2003-11-14-10:20:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
154 } |
1bf718ce0dde
nginx-0.0.1-2003-11-14-10:20:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
155 |
1bf718ce0dde
nginx-0.0.1-2003-11-14-10:20:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
156 total += n; |
1bf718ce0dde
nginx-0.0.1-2003-11-14-10:20:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
157 offset += n; |
1bf718ce0dde
nginx-0.0.1-2003-11-14-10:20:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
158 } |
1bf718ce0dde
nginx-0.0.1-2003-11-14-10:20:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
159 |
1bf718ce0dde
nginx-0.0.1-2003-11-14-10:20:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
160 return total; |
1bf718ce0dde
nginx-0.0.1-2003-11-14-10:20:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
161 } |
1bf718ce0dde
nginx-0.0.1-2003-11-14-10:20:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
162 |
1bf718ce0dde
nginx-0.0.1-2003-11-14-10:20:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
163 |
1634
d3cbb96818f1
fix win32 ngx_read_fd() and ngx_write_fd()
Igor Sysoev <igor@sysoev.ru>
parents:
1632
diff
changeset
|
164 ssize_t |
d3cbb96818f1
fix win32 ngx_read_fd() and ngx_write_fd()
Igor Sysoev <igor@sysoev.ru>
parents:
1632
diff
changeset
|
165 ngx_read_fd(ngx_fd_t fd, void *buf, size_t size) |
d3cbb96818f1
fix win32 ngx_read_fd() and ngx_write_fd()
Igor Sysoev <igor@sysoev.ru>
parents:
1632
diff
changeset
|
166 { |
d3cbb96818f1
fix win32 ngx_read_fd() and ngx_write_fd()
Igor Sysoev <igor@sysoev.ru>
parents:
1632
diff
changeset
|
167 u_long n; |
d3cbb96818f1
fix win32 ngx_read_fd() and ngx_write_fd()
Igor Sysoev <igor@sysoev.ru>
parents:
1632
diff
changeset
|
168 |
d3cbb96818f1
fix win32 ngx_read_fd() and ngx_write_fd()
Igor Sysoev <igor@sysoev.ru>
parents:
1632
diff
changeset
|
169 if (ReadFile(fd, buf, size, &n, NULL) != 0) { |
d3cbb96818f1
fix win32 ngx_read_fd() and ngx_write_fd()
Igor Sysoev <igor@sysoev.ru>
parents:
1632
diff
changeset
|
170 return (size_t) n; |
d3cbb96818f1
fix win32 ngx_read_fd() and ngx_write_fd()
Igor Sysoev <igor@sysoev.ru>
parents:
1632
diff
changeset
|
171 } |
d3cbb96818f1
fix win32 ngx_read_fd() and ngx_write_fd()
Igor Sysoev <igor@sysoev.ru>
parents:
1632
diff
changeset
|
172 |
d3cbb96818f1
fix win32 ngx_read_fd() and ngx_write_fd()
Igor Sysoev <igor@sysoev.ru>
parents:
1632
diff
changeset
|
173 return -1; |
d3cbb96818f1
fix win32 ngx_read_fd() and ngx_write_fd()
Igor Sysoev <igor@sysoev.ru>
parents:
1632
diff
changeset
|
174 } |
d3cbb96818f1
fix win32 ngx_read_fd() and ngx_write_fd()
Igor Sysoev <igor@sysoev.ru>
parents:
1632
diff
changeset
|
175 |
d3cbb96818f1
fix win32 ngx_read_fd() and ngx_write_fd()
Igor Sysoev <igor@sysoev.ru>
parents:
1632
diff
changeset
|
176 |
d3cbb96818f1
fix win32 ngx_read_fd() and ngx_write_fd()
Igor Sysoev <igor@sysoev.ru>
parents:
1632
diff
changeset
|
177 ssize_t |
d3cbb96818f1
fix win32 ngx_read_fd() and ngx_write_fd()
Igor Sysoev <igor@sysoev.ru>
parents:
1632
diff
changeset
|
178 ngx_write_fd(ngx_fd_t fd, void *buf, size_t size) |
d3cbb96818f1
fix win32 ngx_read_fd() and ngx_write_fd()
Igor Sysoev <igor@sysoev.ru>
parents:
1632
diff
changeset
|
179 { |
d3cbb96818f1
fix win32 ngx_read_fd() and ngx_write_fd()
Igor Sysoev <igor@sysoev.ru>
parents:
1632
diff
changeset
|
180 u_long n; |
d3cbb96818f1
fix win32 ngx_read_fd() and ngx_write_fd()
Igor Sysoev <igor@sysoev.ru>
parents:
1632
diff
changeset
|
181 |
d3cbb96818f1
fix win32 ngx_read_fd() and ngx_write_fd()
Igor Sysoev <igor@sysoev.ru>
parents:
1632
diff
changeset
|
182 if (WriteFile(fd, buf, size, &n, NULL) != 0) { |
d3cbb96818f1
fix win32 ngx_read_fd() and ngx_write_fd()
Igor Sysoev <igor@sysoev.ru>
parents:
1632
diff
changeset
|
183 return (size_t) n; |
d3cbb96818f1
fix win32 ngx_read_fd() and ngx_write_fd()
Igor Sysoev <igor@sysoev.ru>
parents:
1632
diff
changeset
|
184 } |
d3cbb96818f1
fix win32 ngx_read_fd() and ngx_write_fd()
Igor Sysoev <igor@sysoev.ru>
parents:
1632
diff
changeset
|
185 |
d3cbb96818f1
fix win32 ngx_read_fd() and ngx_write_fd()
Igor Sysoev <igor@sysoev.ru>
parents:
1632
diff
changeset
|
186 return -1; |
d3cbb96818f1
fix win32 ngx_read_fd() and ngx_write_fd()
Igor Sysoev <igor@sysoev.ru>
parents:
1632
diff
changeset
|
187 } |
d3cbb96818f1
fix win32 ngx_read_fd() and ngx_write_fd()
Igor Sysoev <igor@sysoev.ru>
parents:
1632
diff
changeset
|
188 |
d3cbb96818f1
fix win32 ngx_read_fd() and ngx_write_fd()
Igor Sysoev <igor@sysoev.ru>
parents:
1632
diff
changeset
|
189 |
2769
9d986c4e796f
introduce ngx_write_console() to support OEM code pages
Igor Sysoev <igor@sysoev.ru>
parents:
2687
diff
changeset
|
190 ssize_t |
9d986c4e796f
introduce ngx_write_console() to support OEM code pages
Igor Sysoev <igor@sysoev.ru>
parents:
2687
diff
changeset
|
191 ngx_write_console(ngx_fd_t fd, void *buf, size_t size) |
9d986c4e796f
introduce ngx_write_console() to support OEM code pages
Igor Sysoev <igor@sysoev.ru>
parents:
2687
diff
changeset
|
192 { |
9d986c4e796f
introduce ngx_write_console() to support OEM code pages
Igor Sysoev <igor@sysoev.ru>
parents:
2687
diff
changeset
|
193 u_long n; |
9d986c4e796f
introduce ngx_write_console() to support OEM code pages
Igor Sysoev <igor@sysoev.ru>
parents:
2687
diff
changeset
|
194 |
9d986c4e796f
introduce ngx_write_console() to support OEM code pages
Igor Sysoev <igor@sysoev.ru>
parents:
2687
diff
changeset
|
195 (void) CharToOemBuff(buf, buf, size); |
9d986c4e796f
introduce ngx_write_console() to support OEM code pages
Igor Sysoev <igor@sysoev.ru>
parents:
2687
diff
changeset
|
196 |
9d986c4e796f
introduce ngx_write_console() to support OEM code pages
Igor Sysoev <igor@sysoev.ru>
parents:
2687
diff
changeset
|
197 if (WriteFile(fd, buf, size, &n, NULL) != 0) { |
9d986c4e796f
introduce ngx_write_console() to support OEM code pages
Igor Sysoev <igor@sysoev.ru>
parents:
2687
diff
changeset
|
198 return (size_t) n; |
9d986c4e796f
introduce ngx_write_console() to support OEM code pages
Igor Sysoev <igor@sysoev.ru>
parents:
2687
diff
changeset
|
199 } |
9d986c4e796f
introduce ngx_write_console() to support OEM code pages
Igor Sysoev <igor@sysoev.ru>
parents:
2687
diff
changeset
|
200 |
9d986c4e796f
introduce ngx_write_console() to support OEM code pages
Igor Sysoev <igor@sysoev.ru>
parents:
2687
diff
changeset
|
201 return -1; |
9d986c4e796f
introduce ngx_write_console() to support OEM code pages
Igor Sysoev <igor@sysoev.ru>
parents:
2687
diff
changeset
|
202 } |
9d986c4e796f
introduce ngx_write_console() to support OEM code pages
Igor Sysoev <igor@sysoev.ru>
parents:
2687
diff
changeset
|
203 |
9d986c4e796f
introduce ngx_write_console() to support OEM code pages
Igor Sysoev <igor@sysoev.ru>
parents:
2687
diff
changeset
|
204 |
3382
6be1f25bae90
fix Win32 error messages when an temporary file replaces an existent file:
Igor Sysoev <igor@sysoev.ru>
parents:
3200
diff
changeset
|
205 ngx_err_t |
1693
f4eb04fd8579
use malloc() in ngx_win32_rename_file, set crit level instead of error
Igor Sysoev <igor@sysoev.ru>
parents:
1634
diff
changeset
|
206 ngx_win32_rename_file(ngx_str_t *from, ngx_str_t *to, ngx_log_t *log) |
184
1bf718ce0dde
nginx-0.0.1-2003-11-14-10:20:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
207 { |
499 | 208 u_char *name; |
3382
6be1f25bae90
fix Win32 error messages when an temporary file replaces an existent file:
Igor Sysoev <igor@sysoev.ru>
parents:
3200
diff
changeset
|
209 ngx_err_t err; |
499 | 210 ngx_uint_t collision; |
211 ngx_atomic_uint_t num; | |
184
1bf718ce0dde
nginx-0.0.1-2003-11-14-10:20:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
212 |
4017
4f4086cf1a07
Fix buffer overrun under Windows.
Maxim Dounin <mdounin@mdounin.ru>
parents:
3651
diff
changeset
|
213 name = ngx_alloc(to->len + 1 + NGX_ATOMIC_T_LEN + 1 + sizeof("DELETE"), |
4f4086cf1a07
Fix buffer overrun under Windows.
Maxim Dounin <mdounin@mdounin.ru>
parents:
3651
diff
changeset
|
214 log); |
501 | 215 if (name == NULL) { |
3382
6be1f25bae90
fix Win32 error messages when an temporary file replaces an existent file:
Igor Sysoev <igor@sysoev.ru>
parents:
3200
diff
changeset
|
216 return NGX_ENOMEM; |
186
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
217 } |
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
218 |
184
1bf718ce0dde
nginx-0.0.1-2003-11-14-10:20:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
219 ngx_memcpy(name, to->data, to->len); |
1bf718ce0dde
nginx-0.0.1-2003-11-14-10:20:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
220 |
1bf718ce0dde
nginx-0.0.1-2003-11-14-10:20:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
221 collision = 0; |
1bf718ce0dde
nginx-0.0.1-2003-11-14-10:20:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
222 |
1bf718ce0dde
nginx-0.0.1-2003-11-14-10:20:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
223 /* mutex_lock() (per cache or single ?) */ |
1bf718ce0dde
nginx-0.0.1-2003-11-14-10:20:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
224 |
499 | 225 for ( ;; ) { |
184
1bf718ce0dde
nginx-0.0.1-2003-11-14-10:20:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
226 num = ngx_next_temp_number(collision); |
1bf718ce0dde
nginx-0.0.1-2003-11-14-10:20:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
227 |
2900
812445a822e3
add trailing zero to a file name
Igor Sysoev <igor@sysoev.ru>
parents:
2782
diff
changeset
|
228 ngx_sprintf(name + to->len, ".%0muA.DELETE%Z", num); |
184
1bf718ce0dde
nginx-0.0.1-2003-11-14-10:20:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
229 |
499 | 230 if (MoveFile((const char *) to->data, (const char *) name) != 0) { |
231 break; | |
184
1bf718ce0dde
nginx-0.0.1-2003-11-14-10:20:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
232 } |
1bf718ce0dde
nginx-0.0.1-2003-11-14-10:20:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
233 |
499 | 234 collision = 1; |
235 | |
2901
17da2da3a8f5
fix logging in ngx_win32_rename_file()
Igor Sysoev <igor@sysoev.ru>
parents:
2900
diff
changeset
|
236 ngx_log_error(NGX_LOG_CRIT, log, ngx_errno, |
17da2da3a8f5
fix logging in ngx_win32_rename_file()
Igor Sysoev <igor@sysoev.ru>
parents:
2900
diff
changeset
|
237 "MoveFile() \"%s\" to \"%s\" failed", to->data, name); |
499 | 238 } |
184
1bf718ce0dde
nginx-0.0.1-2003-11-14-10:20:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
239 |
292
a472bfb778b3
nginx-0.0.3-2004-03-17-00:26:01 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
240 if (MoveFile((const char *) from->data, (const char *) to->data) == 0) { |
3382
6be1f25bae90
fix Win32 error messages when an temporary file replaces an existent file:
Igor Sysoev <igor@sysoev.ru>
parents:
3200
diff
changeset
|
241 err = ngx_errno; |
186
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
242 |
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
243 } else { |
3382
6be1f25bae90
fix Win32 error messages when an temporary file replaces an existent file:
Igor Sysoev <igor@sysoev.ru>
parents:
3200
diff
changeset
|
244 err = 0; |
186
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
245 } |
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
246 |
1051 | 247 if (DeleteFile((const char *) name) == 0) { |
2901
17da2da3a8f5
fix logging in ngx_win32_rename_file()
Igor Sysoev <igor@sysoev.ru>
parents:
2900
diff
changeset
|
248 ngx_log_error(NGX_LOG_CRIT, log, ngx_errno, |
17da2da3a8f5
fix logging in ngx_win32_rename_file()
Igor Sysoev <igor@sysoev.ru>
parents:
2900
diff
changeset
|
249 "DeleteFile() \"%s\" failed", name); |
184
1bf718ce0dde
nginx-0.0.1-2003-11-14-10:20:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
250 } |
1bf718ce0dde
nginx-0.0.1-2003-11-14-10:20:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
251 |
1bf718ce0dde
nginx-0.0.1-2003-11-14-10:20:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
252 /* mutex_unlock() */ |
1bf718ce0dde
nginx-0.0.1-2003-11-14-10:20:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
253 |
1693
f4eb04fd8579
use malloc() in ngx_win32_rename_file, set crit level instead of error
Igor Sysoev <igor@sysoev.ru>
parents:
1634
diff
changeset
|
254 ngx_free(name); |
f4eb04fd8579
use malloc() in ngx_win32_rename_file, set crit level instead of error
Igor Sysoev <igor@sysoev.ru>
parents:
1634
diff
changeset
|
255 |
3382
6be1f25bae90
fix Win32 error messages when an temporary file replaces an existent file:
Igor Sysoev <igor@sysoev.ru>
parents:
3200
diff
changeset
|
256 return err; |
184
1bf718ce0dde
nginx-0.0.1-2003-11-14-10:20:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
257 } |
1bf718ce0dde
nginx-0.0.1-2003-11-14-10:20:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
258 |
1bf718ce0dde
nginx-0.0.1-2003-11-14-10:20:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
183
diff
changeset
|
259 |
561 | 260 ngx_int_t |
2462
90d5ddfedbb1
use GetFileAttributesEx() instead of GetFileAttributes()
Igor Sysoev <igor@sysoev.ru>
parents:
2459
diff
changeset
|
261 ngx_file_info(u_char *file, ngx_file_info_t *sb) |
185
d5f50cefc322
nginx-0.0.1-2003-11-14-19:52:04 import
Igor Sysoev <igor@sysoev.ru>
parents:
184
diff
changeset
|
262 { |
3417
15017418fd84
disable Win32 short file names
Igor Sysoev <igor@sysoev.ru>
parents:
3382
diff
changeset
|
263 size_t len; |
3138
a2479937dbd8
win32 ngx_file_info() utf8 support
Igor Sysoev <igor@sysoev.ru>
parents:
3137
diff
changeset
|
264 long rc; |
a2479937dbd8
win32 ngx_file_info() utf8 support
Igor Sysoev <igor@sysoev.ru>
parents:
3137
diff
changeset
|
265 u_short *u; |
a2479937dbd8
win32 ngx_file_info() utf8 support
Igor Sysoev <igor@sysoev.ru>
parents:
3137
diff
changeset
|
266 ngx_err_t err; |
a2479937dbd8
win32 ngx_file_info() utf8 support
Igor Sysoev <igor@sysoev.ru>
parents:
3137
diff
changeset
|
267 WIN32_FILE_ATTRIBUTE_DATA fa; |
a2479937dbd8
win32 ngx_file_info() utf8 support
Igor Sysoev <igor@sysoev.ru>
parents:
3137
diff
changeset
|
268 u_short utf16[NGX_UTF16_BUFLEN]; |
a2479937dbd8
win32 ngx_file_info() utf8 support
Igor Sysoev <igor@sysoev.ru>
parents:
3137
diff
changeset
|
269 |
3417
15017418fd84
disable Win32 short file names
Igor Sysoev <igor@sysoev.ru>
parents:
3382
diff
changeset
|
270 len = NGX_UTF16_BUFLEN; |
15017418fd84
disable Win32 short file names
Igor Sysoev <igor@sysoev.ru>
parents:
3382
diff
changeset
|
271 |
15017418fd84
disable Win32 short file names
Igor Sysoev <igor@sysoev.ru>
parents:
3382
diff
changeset
|
272 u = ngx_utf8_to_utf16(utf16, file, &len); |
185
d5f50cefc322
nginx-0.0.1-2003-11-14-19:52:04 import
Igor Sysoev <igor@sysoev.ru>
parents:
184
diff
changeset
|
273 |
3138
a2479937dbd8
win32 ngx_file_info() utf8 support
Igor Sysoev <igor@sysoev.ru>
parents:
3137
diff
changeset
|
274 if (u == NULL) { |
a2479937dbd8
win32 ngx_file_info() utf8 support
Igor Sysoev <igor@sysoev.ru>
parents:
3137
diff
changeset
|
275 return NGX_FILE_ERROR; |
a2479937dbd8
win32 ngx_file_info() utf8 support
Igor Sysoev <igor@sysoev.ru>
parents:
3137
diff
changeset
|
276 } |
185
d5f50cefc322
nginx-0.0.1-2003-11-14-19:52:04 import
Igor Sysoev <igor@sysoev.ru>
parents:
184
diff
changeset
|
277 |
4673
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
278 rc = NGX_FILE_ERROR; |
3138
a2479937dbd8
win32 ngx_file_info() utf8 support
Igor Sysoev <igor@sysoev.ru>
parents:
3137
diff
changeset
|
279 |
4673
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
280 if (ngx_win32_check_filename(file, u, len) != NGX_OK) { |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
281 goto failed; |
185
d5f50cefc322
nginx-0.0.1-2003-11-14-19:52:04 import
Igor Sysoev <igor@sysoev.ru>
parents:
184
diff
changeset
|
282 } |
d5f50cefc322
nginx-0.0.1-2003-11-14-19:52:04 import
Igor Sysoev <igor@sysoev.ru>
parents:
184
diff
changeset
|
283 |
4673
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
284 rc = GetFileAttributesExW(u, GetFileExInfoStandard, &fa); |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
285 |
185
d5f50cefc322
nginx-0.0.1-2003-11-14-19:52:04 import
Igor Sysoev <igor@sysoev.ru>
parents:
184
diff
changeset
|
286 sb->dwFileAttributes = fa.dwFileAttributes; |
d5f50cefc322
nginx-0.0.1-2003-11-14-19:52:04 import
Igor Sysoev <igor@sysoev.ru>
parents:
184
diff
changeset
|
287 sb->ftCreationTime = fa.ftCreationTime; |
d5f50cefc322
nginx-0.0.1-2003-11-14-19:52:04 import
Igor Sysoev <igor@sysoev.ru>
parents:
184
diff
changeset
|
288 sb->ftLastAccessTime = fa.ftLastAccessTime; |
d5f50cefc322
nginx-0.0.1-2003-11-14-19:52:04 import
Igor Sysoev <igor@sysoev.ru>
parents:
184
diff
changeset
|
289 sb->ftLastWriteTime = fa.ftLastWriteTime; |
d5f50cefc322
nginx-0.0.1-2003-11-14-19:52:04 import
Igor Sysoev <igor@sysoev.ru>
parents:
184
diff
changeset
|
290 sb->nFileSizeHigh = fa.nFileSizeHigh; |
d5f50cefc322
nginx-0.0.1-2003-11-14-19:52:04 import
Igor Sysoev <igor@sysoev.ru>
parents:
184
diff
changeset
|
291 sb->nFileSizeLow = fa.nFileSizeLow; |
d5f50cefc322
nginx-0.0.1-2003-11-14-19:52:04 import
Igor Sysoev <igor@sysoev.ru>
parents:
184
diff
changeset
|
292 |
4673
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
293 failed: |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
294 |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
295 if (u != utf16) { |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
296 err = ngx_errno; |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
297 ngx_free(u); |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
298 ngx_set_errno(err); |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
299 } |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
300 |
3138
a2479937dbd8
win32 ngx_file_info() utf8 support
Igor Sysoev <igor@sysoev.ru>
parents:
3137
diff
changeset
|
301 return rc; |
185
d5f50cefc322
nginx-0.0.1-2003-11-14-19:52:04 import
Igor Sysoev <igor@sysoev.ru>
parents:
184
diff
changeset
|
302 } |
d5f50cefc322
nginx-0.0.1-2003-11-14-19:52:04 import
Igor Sysoev <igor@sysoev.ru>
parents:
184
diff
changeset
|
303 |
d5f50cefc322
nginx-0.0.1-2003-11-14-19:52:04 import
Igor Sysoev <igor@sysoev.ru>
parents:
184
diff
changeset
|
304 |
561 | 305 ngx_int_t |
681 | 306 ngx_set_file_time(u_char *name, ngx_fd_t fd, time_t s) |
307 { | |
308 uint64_t intervals; | |
309 FILETIME ft; | |
310 | |
311 /* 116444736000000000 is commented in src/os/win32/ngx_time.c */ | |
312 | |
313 intervals = s * 10000000 + 116444736000000000; | |
314 | |
315 ft.dwLowDateTime = (DWORD) intervals; | |
316 ft.dwHighDateTime = (DWORD) (intervals >> 32); | |
317 | |
318 if (SetFileTime(fd, NULL, NULL, &ft) != 0) { | |
319 return NGX_OK; | |
320 } | |
321 | |
322 return NGX_ERROR; | |
323 } | |
324 | |
325 | |
3651 | 326 ngx_int_t |
327 ngx_create_file_mapping(ngx_file_mapping_t *fm) | |
328 { | |
329 LARGE_INTEGER size; | |
330 | |
331 fm->fd = ngx_open_file(fm->name, NGX_FILE_RDWR, NGX_FILE_TRUNCATE, | |
332 NGX_FILE_DEFAULT_ACCESS); | |
333 if (fm->fd == NGX_INVALID_FILE) { | |
334 ngx_log_error(NGX_LOG_CRIT, fm->log, ngx_errno, | |
335 ngx_open_file_n " \"%s\" failed", fm->name); | |
336 return NGX_ERROR; | |
337 } | |
338 | |
339 fm->handle = NULL; | |
340 | |
341 size.QuadPart = fm->size; | |
342 | |
343 if (SetFilePointerEx(fm->fd, size, NULL, FILE_BEGIN) == 0) { | |
344 ngx_log_error(NGX_LOG_CRIT, fm->log, ngx_errno, | |
345 "SetFilePointerEx(\"%s\", %uz) failed", | |
346 fm->name, fm->size); | |
347 goto failed; | |
348 } | |
349 | |
350 if (SetEndOfFile(fm->fd) == 0) { | |
351 ngx_log_error(NGX_LOG_CRIT, fm->log, ngx_errno, | |
352 "SetEndOfFile() \"%s\" failed", fm->name); | |
353 goto failed; | |
354 } | |
355 | |
356 fm->handle = CreateFileMapping(fm->fd, NULL, PAGE_READWRITE, | |
357 (u_long) ((off_t) fm->size >> 32), | |
358 (u_long) ((off_t) fm->size & 0xffffffff), | |
359 NULL); | |
360 if (fm->handle == NULL) { | |
361 ngx_log_error(NGX_LOG_CRIT, fm->log, ngx_errno, | |
362 "CreateFileMapping(%s, %uz) failed", | |
363 fm->name, fm->size); | |
364 goto failed; | |
365 } | |
366 | |
367 fm->addr = MapViewOfFile(fm->handle, FILE_MAP_WRITE, 0, 0, 0); | |
368 | |
369 if (fm->addr != NULL) { | |
370 return NGX_OK; | |
371 } | |
372 | |
373 ngx_log_error(NGX_LOG_CRIT, fm->log, ngx_errno, | |
374 "MapViewOfFile(%uz) of file mapping \"%s\" failed", | |
375 fm->size, fm->name); | |
376 | |
377 failed: | |
378 | |
379 if (fm->handle) { | |
380 if (CloseHandle(fm->handle) == 0) { | |
381 ngx_log_error(NGX_LOG_ALERT, fm->log, ngx_errno, | |
382 "CloseHandle() of file mapping \"%s\" failed", | |
383 fm->name); | |
384 } | |
385 } | |
386 | |
387 if (ngx_close_file(fm->fd) == NGX_FILE_ERROR) { | |
388 ngx_log_error(NGX_LOG_ALERT, fm->log, ngx_errno, | |
389 ngx_close_file_n " \"%s\" failed", fm->name); | |
390 } | |
391 | |
392 return NGX_ERROR; | |
393 } | |
394 | |
395 | |
396 void | |
397 ngx_close_file_mapping(ngx_file_mapping_t *fm) | |
398 { | |
399 if (UnmapViewOfFile(fm->addr) == 0) { | |
400 ngx_log_error(NGX_LOG_ALERT, fm->log, ngx_errno, | |
401 "UnmapViewOfFile(%p) of file mapping \"%s\" failed", | |
402 fm->addr, &fm->name); | |
403 } | |
404 | |
405 if (CloseHandle(fm->handle) == 0) { | |
406 ngx_log_error(NGX_LOG_ALERT, fm->log, ngx_errno, | |
407 "CloseHandle() of file mapping \"%s\" failed", | |
408 &fm->name); | |
409 } | |
410 | |
411 if (ngx_close_file(fm->fd) == NGX_FILE_ERROR) { | |
412 ngx_log_error(NGX_LOG_ALERT, fm->log, ngx_errno, | |
413 ngx_close_file_n " \"%s\" failed", fm->name); | |
414 } | |
415 } | |
416 | |
417 | |
4564
13eb3193cd63
Fixed win32 build after realpath changes in r4559.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4412
diff
changeset
|
418 u_char * |
2259 | 419 ngx_realpath(u_char *path, u_char *resolved) |
420 { | |
421 /* STUB */ | |
4564
13eb3193cd63
Fixed win32 build after realpath changes in r4559.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4412
diff
changeset
|
422 return path; |
2259 | 423 } |
424 | |
425 | |
561 | 426 ngx_int_t |
427 ngx_open_dir(ngx_str_t *name, ngx_dir_t *dir) | |
186
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
428 { |
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
429 ngx_cpystrn(name->data + name->len, NGX_DIR_MASK, NGX_DIR_MASK_LEN + 1); |
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
430 |
727 | 431 dir->dir = FindFirstFile((const char *) name->data, &dir->finddata); |
577 | 432 |
5749
a680bf4dddd5
Win32: ngx_open_dir() and ngx_close_dir() fixes.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5501
diff
changeset
|
433 name->data[name->len] = '\0'; |
a680bf4dddd5
Win32: ngx_open_dir() and ngx_close_dir() fixes.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5501
diff
changeset
|
434 |
186
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
435 if (dir->dir == INVALID_HANDLE_VALUE) { |
577 | 436 return NGX_ERROR; |
186
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
437 } |
577 | 438 |
457 | 439 dir->valid_info = 1; |
186
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
440 dir->ready = 1; |
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
441 |
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
442 return NGX_OK; |
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
443 } |
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
444 |
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
445 |
561 | 446 ngx_int_t |
447 ngx_read_dir(ngx_dir_t *dir) | |
186
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
448 { |
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
449 if (dir->ready) { |
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
450 dir->ready = 0; |
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
451 return NGX_OK; |
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
452 } |
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
453 |
727 | 454 if (FindNextFile(dir->dir, &dir->finddata) != 0) { |
3200
26784c34e8be
*) reset cached dirent.d_type after stat()
Igor Sysoev <igor@sysoev.ru>
parents:
3178
diff
changeset
|
455 dir->type = 1; |
681 | 456 return NGX_OK; |
186
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
457 } |
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
458 |
681 | 459 return NGX_ERROR; |
186
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
460 } |
185
d5f50cefc322
nginx-0.0.1-2003-11-14-19:52:04 import
Igor Sysoev <igor@sysoev.ru>
parents:
184
diff
changeset
|
461 |
d5f50cefc322
nginx-0.0.1-2003-11-14-19:52:04 import
Igor Sysoev <igor@sysoev.ru>
parents:
184
diff
changeset
|
462 |
501 | 463 ngx_int_t |
5749
a680bf4dddd5
Win32: ngx_open_dir() and ngx_close_dir() fixes.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5501
diff
changeset
|
464 ngx_close_dir(ngx_dir_t *dir) |
a680bf4dddd5
Win32: ngx_open_dir() and ngx_close_dir() fixes.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5501
diff
changeset
|
465 { |
a680bf4dddd5
Win32: ngx_open_dir() and ngx_close_dir() fixes.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5501
diff
changeset
|
466 if (FindClose(dir->dir) == 0) { |
a680bf4dddd5
Win32: ngx_open_dir() and ngx_close_dir() fixes.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5501
diff
changeset
|
467 return NGX_ERROR; |
a680bf4dddd5
Win32: ngx_open_dir() and ngx_close_dir() fixes.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5501
diff
changeset
|
468 } |
a680bf4dddd5
Win32: ngx_open_dir() and ngx_close_dir() fixes.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5501
diff
changeset
|
469 |
a680bf4dddd5
Win32: ngx_open_dir() and ngx_close_dir() fixes.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5501
diff
changeset
|
470 return NGX_OK; |
a680bf4dddd5
Win32: ngx_open_dir() and ngx_close_dir() fixes.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5501
diff
changeset
|
471 } |
a680bf4dddd5
Win32: ngx_open_dir() and ngx_close_dir() fixes.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5501
diff
changeset
|
472 |
a680bf4dddd5
Win32: ngx_open_dir() and ngx_close_dir() fixes.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5501
diff
changeset
|
473 |
a680bf4dddd5
Win32: ngx_open_dir() and ngx_close_dir() fixes.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5501
diff
changeset
|
474 ngx_int_t |
727 | 475 ngx_open_glob(ngx_glob_t *gl) |
476 { | |
2459 | 477 u_char *p; |
478 size_t len; | |
479 ngx_err_t err; | |
1632 | 480 |
727 | 481 gl->dir = FindFirstFile((const char *) gl->pattern, &gl->finddata); |
482 | |
483 if (gl->dir == INVALID_HANDLE_VALUE) { | |
1980 | 484 |
2459 | 485 err = ngx_errno; |
486 | |
487 if ((err == ERROR_FILE_NOT_FOUND || err == ERROR_PATH_NOT_FOUND) | |
488 && gl->test) | |
489 { | |
1980 | 490 gl->no_match = 1; |
491 return NGX_OK; | |
492 } | |
493 | |
727 | 494 return NGX_ERROR; |
495 } | |
496 | |
1632 | 497 for (p = gl->pattern; *p; p++) { |
498 if (*p == '/') { | |
499 gl->last = p + 1 - gl->pattern; | |
500 } | |
501 } | |
502 | |
503 len = ngx_strlen(gl->finddata.cFileName); | |
504 gl->name.len = gl->last + len; | |
505 | |
506 gl->name.data = ngx_alloc(gl->name.len + 1, gl->log); | |
507 if (gl->name.data == NULL) { | |
508 return NGX_ERROR; | |
509 } | |
510 | |
511 ngx_memcpy(gl->name.data, gl->pattern, gl->last); | |
512 ngx_cpystrn(gl->name.data + gl->last, (u_char *) gl->finddata.cFileName, | |
513 len + 1); | |
514 | |
727 | 515 gl->ready = 1; |
516 | |
517 return NGX_OK; | |
518 } | |
519 | |
520 | |
521 ngx_int_t | |
522 ngx_read_glob(ngx_glob_t *gl, ngx_str_t *name) | |
523 { | |
1632 | 524 size_t len; |
727 | 525 ngx_err_t err; |
526 | |
1980 | 527 if (gl->no_match) { |
528 return NGX_DONE; | |
529 } | |
530 | |
727 | 531 if (gl->ready) { |
1632 | 532 *name = gl->name; |
727 | 533 |
534 gl->ready = 0; | |
535 return NGX_OK; | |
536 } | |
537 | |
1632 | 538 ngx_free(gl->name.data); |
539 gl->name.data = NULL; | |
540 | |
727 | 541 if (FindNextFile(gl->dir, &gl->finddata) != 0) { |
1632 | 542 |
543 len = ngx_strlen(gl->finddata.cFileName); | |
544 gl->name.len = gl->last + len; | |
545 | |
546 gl->name.data = ngx_alloc(gl->name.len + 1, gl->log); | |
547 if (gl->name.data == NULL) { | |
548 return NGX_ERROR; | |
549 } | |
550 | |
551 ngx_memcpy(gl->name.data, gl->pattern, gl->last); | |
552 ngx_cpystrn(gl->name.data + gl->last, (u_char *) gl->finddata.cFileName, | |
553 len + 1); | |
554 | |
555 *name = gl->name; | |
727 | 556 |
557 return NGX_OK; | |
558 } | |
559 | |
560 err = ngx_errno; | |
561 | |
562 if (err == NGX_ENOMOREFILES) { | |
563 return NGX_DONE; | |
564 } | |
565 | |
566 ngx_log_error(NGX_LOG_ALERT, gl->log, err, | |
567 "FindNextFile(%s) failed", gl->pattern); | |
568 | |
569 return NGX_ERROR; | |
570 } | |
571 | |
572 | |
573 void | |
574 ngx_close_glob(ngx_glob_t *gl) | |
575 { | |
1632 | 576 if (gl->name.data) { |
577 ngx_free(gl->name.data); | |
578 } | |
579 | |
1980 | 580 if (gl->dir == INVALID_HANDLE_VALUE) { |
581 return; | |
582 } | |
583 | |
1632 | 584 if (FindClose(gl->dir) == 0) { |
727 | 585 ngx_log_error(NGX_LOG_ALERT, gl->log, ngx_errno, |
586 "FindClose(%s) failed", gl->pattern); | |
587 } | |
588 } | |
589 | |
590 | |
591 ngx_int_t | |
501 | 592 ngx_de_info(u_char *name, ngx_dir_t *dir) |
593 { | |
594 return NGX_OK; | |
595 } | |
596 | |
597 | |
598 ngx_int_t | |
599 ngx_de_link_info(u_char *name, ngx_dir_t *dir) | |
600 { | |
601 return NGX_OK; | |
602 } | |
603 | |
604 | |
561 | 605 ngx_int_t |
3178 | 606 ngx_read_ahead(ngx_fd_t fd, size_t n) |
607 { | |
608 return ~NGX_FILE_ERROR; | |
609 } | |
610 | |
611 | |
612 ngx_int_t | |
2248
1adec90a0e46
disable directio for unaligned reads in Linux
Igor Sysoev <igor@sysoev.ru>
parents:
2234
diff
changeset
|
613 ngx_directio_on(ngx_fd_t fd) |
2134
13652cba8633
fix building by bcc broken in r2130
Igor Sysoev <igor@sysoev.ru>
parents:
1980
diff
changeset
|
614 { |
3164
b1b1775698d5
uniform ngx_directio_on/off() interface with other file functions
Igor Sysoev <igor@sysoev.ru>
parents:
3158
diff
changeset
|
615 return ~NGX_FILE_ERROR; |
2134
13652cba8633
fix building by bcc broken in r2130
Igor Sysoev <igor@sysoev.ru>
parents:
1980
diff
changeset
|
616 } |
2248
1adec90a0e46
disable directio for unaligned reads in Linux
Igor Sysoev <igor@sysoev.ru>
parents:
2234
diff
changeset
|
617 |
2615 | 618 |
2248
1adec90a0e46
disable directio for unaligned reads in Linux
Igor Sysoev <igor@sysoev.ru>
parents:
2234
diff
changeset
|
619 ngx_int_t |
1adec90a0e46
disable directio for unaligned reads in Linux
Igor Sysoev <igor@sysoev.ru>
parents:
2234
diff
changeset
|
620 ngx_directio_off(ngx_fd_t fd) |
1adec90a0e46
disable directio for unaligned reads in Linux
Igor Sysoev <igor@sysoev.ru>
parents:
2234
diff
changeset
|
621 { |
3164
b1b1775698d5
uniform ngx_directio_on/off() interface with other file functions
Igor Sysoev <igor@sysoev.ru>
parents:
3158
diff
changeset
|
622 return ~NGX_FILE_ERROR; |
2248
1adec90a0e46
disable directio for unaligned reads in Linux
Igor Sysoev <igor@sysoev.ru>
parents:
2234
diff
changeset
|
623 } |
2615 | 624 |
625 | |
626 size_t | |
627 ngx_fs_bsize(u_char *name) | |
628 { | |
629 u_char root[4]; | |
630 u_long sc, bs, nfree, ncl; | |
631 | |
632 if (name[2] == ':') { | |
633 ngx_cpystrn(root, name, 4); | |
634 name = root; | |
635 } | |
636 | |
637 if (GetDiskFreeSpace((const char *) name, &sc, &bs, &nfree, &ncl) == 0) { | |
638 return 512; | |
639 } | |
640 | |
641 return sc * bs; | |
642 } | |
2628
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
643 |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
644 |
4673
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
645 static ngx_int_t |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
646 ngx_win32_check_filename(u_char *name, u_short *u, size_t len) |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
647 { |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
648 u_char *p, ch; |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
649 u_long n; |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
650 u_short *lu; |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
651 ngx_err_t err; |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
652 enum { |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
653 sw_start = 0, |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
654 sw_normal, |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
655 sw_after_slash, |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
656 sw_after_colon, |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
657 sw_after_dot |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
658 } state; |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
659 |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
660 /* check for NTFS streams (":"), trailing dots and spaces */ |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
661 |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
662 lu = NULL; |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
663 state = sw_start; |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
664 |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
665 for (p = name; *p; p++) { |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
666 ch = *p; |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
667 |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
668 switch (state) { |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
669 |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
670 case sw_start: |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
671 |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
672 /* |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
673 * skip till first "/" to allow paths starting with drive and |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
674 * relative path, like "c:html/" |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
675 */ |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
676 |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
677 if (ch == '/' || ch == '\\') { |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
678 state = sw_after_slash; |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
679 } |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
680 |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
681 break; |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
682 |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
683 case sw_normal: |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
684 |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
685 if (ch == ':') { |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
686 state = sw_after_colon; |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
687 break; |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
688 } |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
689 |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
690 if (ch == '.' || ch == ' ') { |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
691 state = sw_after_dot; |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
692 break; |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
693 } |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
694 |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
695 if (ch == '/' || ch == '\\') { |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
696 state = sw_after_slash; |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
697 break; |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
698 } |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
699 |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
700 break; |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
701 |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
702 case sw_after_slash: |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
703 |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
704 if (ch == '/' || ch == '\\') { |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
705 break; |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
706 } |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
707 |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
708 if (ch == '.') { |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
709 break; |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
710 } |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
711 |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
712 if (ch == ':') { |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
713 state = sw_after_colon; |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
714 break; |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
715 } |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
716 |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
717 state = sw_normal; |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
718 break; |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
719 |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
720 case sw_after_colon: |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
721 |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
722 if (ch == '/' || ch == '\\') { |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
723 state = sw_after_slash; |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
724 break; |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
725 } |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
726 |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
727 goto invalid; |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
728 |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
729 case sw_after_dot: |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
730 |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
731 if (ch == '/' || ch == '\\') { |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
732 goto invalid; |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
733 } |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
734 |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
735 if (ch == ':') { |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
736 goto invalid; |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
737 } |
4703 | 738 |
4673
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
739 if (ch == '.' || ch == ' ') { |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
740 break; |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
741 } |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
742 |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
743 state = sw_normal; |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
744 break; |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
745 } |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
746 } |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
747 |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
748 if (state == sw_after_dot) { |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
749 goto invalid; |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
750 } |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
751 |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
752 /* check if long name match */ |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
753 |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
754 lu = malloc(len * 2); |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
755 if (lu == NULL) { |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
756 return NGX_ERROR; |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
757 } |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
758 |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
759 n = GetLongPathNameW(u, lu, len); |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
760 |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
761 if (n == 0) { |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
762 goto failed; |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
763 } |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
764 |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
765 if (n != len - 1 || _wcsicmp(u, lu) != 0) { |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
766 goto invalid; |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
767 } |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
768 |
5437
dea321e5c021
Win32: plugged memory leak.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4703
diff
changeset
|
769 ngx_free(lu); |
dea321e5c021
Win32: plugged memory leak.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4703
diff
changeset
|
770 |
4673
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
771 return NGX_OK; |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
772 |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
773 invalid: |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
774 |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
775 ngx_set_errno(NGX_ENOENT); |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
776 |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
777 failed: |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
778 |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
779 if (lu) { |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
780 err = ngx_errno; |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
781 ngx_free(lu); |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
782 ngx_set_errno(err); |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
783 } |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
784 |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
785 return NGX_ERROR; |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
786 } |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
787 |
dc6c658942a8
Win32: disallowed access to various non-canonical name variants.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4564
diff
changeset
|
788 |
2628
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
789 static u_short * |
3417
15017418fd84
disable Win32 short file names
Igor Sysoev <igor@sysoev.ru>
parents:
3382
diff
changeset
|
790 ngx_utf8_to_utf16(u_short *utf16, u_char *utf8, size_t *len) |
2628
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
791 { |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
792 u_char *p; |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
793 u_short *u, *last; |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
794 uint32_t n; |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
795 |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
796 p = utf8; |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
797 u = utf16; |
3417
15017418fd84
disable Win32 short file names
Igor Sysoev <igor@sysoev.ru>
parents:
3382
diff
changeset
|
798 last = utf16 + *len; |
2628
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
799 |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
800 while (u < last) { |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
801 |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
802 if (*p < 0x80) { |
3417
15017418fd84
disable Win32 short file names
Igor Sysoev <igor@sysoev.ru>
parents:
3382
diff
changeset
|
803 *u++ = (u_short) *p; |
2628
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
804 |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
805 if (*p == 0) { |
3417
15017418fd84
disable Win32 short file names
Igor Sysoev <igor@sysoev.ru>
parents:
3382
diff
changeset
|
806 *len = u - utf16; |
2628
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
807 return utf16; |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
808 } |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
809 |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
810 p++; |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
811 |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
812 continue; |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
813 } |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
814 |
5501
1cd23ca84a9b
Win32: support for UTF-16 surrogate pairs (ticket #457).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5437
diff
changeset
|
815 if (u + 1 == last) { |
1cd23ca84a9b
Win32: support for UTF-16 surrogate pairs (ticket #457).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5437
diff
changeset
|
816 *len = u - utf16; |
1cd23ca84a9b
Win32: support for UTF-16 surrogate pairs (ticket #457).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5437
diff
changeset
|
817 break; |
1cd23ca84a9b
Win32: support for UTF-16 surrogate pairs (ticket #457).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5437
diff
changeset
|
818 } |
1cd23ca84a9b
Win32: support for UTF-16 surrogate pairs (ticket #457).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5437
diff
changeset
|
819 |
2628
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
820 n = ngx_utf8_decode(&p, 4); |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
821 |
5501
1cd23ca84a9b
Win32: support for UTF-16 surrogate pairs (ticket #457).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5437
diff
changeset
|
822 if (n > 0x10ffff) { |
1cd23ca84a9b
Win32: support for UTF-16 surrogate pairs (ticket #457).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5437
diff
changeset
|
823 ngx_set_errno(NGX_EILSEQ); |
1cd23ca84a9b
Win32: support for UTF-16 surrogate pairs (ticket #457).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5437
diff
changeset
|
824 return NULL; |
1cd23ca84a9b
Win32: support for UTF-16 surrogate pairs (ticket #457).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5437
diff
changeset
|
825 } |
1cd23ca84a9b
Win32: support for UTF-16 surrogate pairs (ticket #457).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5437
diff
changeset
|
826 |
2628
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
827 if (n > 0xffff) { |
5501
1cd23ca84a9b
Win32: support for UTF-16 surrogate pairs (ticket #457).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5437
diff
changeset
|
828 n -= 0x10000; |
1cd23ca84a9b
Win32: support for UTF-16 surrogate pairs (ticket #457).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5437
diff
changeset
|
829 *u++ = (u_short) (0xd800 + (n >> 10)); |
1cd23ca84a9b
Win32: support for UTF-16 surrogate pairs (ticket #457).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5437
diff
changeset
|
830 *u++ = (u_short) (0xdc00 + (n & 0x03ff)); |
1cd23ca84a9b
Win32: support for UTF-16 surrogate pairs (ticket #457).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5437
diff
changeset
|
831 continue; |
2628
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
832 } |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
833 |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
834 *u++ = (u_short) n; |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
835 } |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
836 |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
837 /* the given buffer is not enough, allocate a new one */ |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
838 |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
839 u = malloc(((p - utf8) + ngx_strlen(p) + 1) * sizeof(u_short)); |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
840 if (u == NULL) { |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
841 return NULL; |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
842 } |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
843 |
3417
15017418fd84
disable Win32 short file names
Igor Sysoev <igor@sysoev.ru>
parents:
3382
diff
changeset
|
844 ngx_memcpy(u, utf16, *len * 2); |
2628
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
845 |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
846 utf16 = u; |
3417
15017418fd84
disable Win32 short file names
Igor Sysoev <igor@sysoev.ru>
parents:
3382
diff
changeset
|
847 u += *len; |
2628
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
848 |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
849 for ( ;; ) { |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
850 |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
851 if (*p < 0x80) { |
3417
15017418fd84
disable Win32 short file names
Igor Sysoev <igor@sysoev.ru>
parents:
3382
diff
changeset
|
852 *u++ = (u_short) *p; |
2628
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
853 |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
854 if (*p == 0) { |
3417
15017418fd84
disable Win32 short file names
Igor Sysoev <igor@sysoev.ru>
parents:
3382
diff
changeset
|
855 *len = u - utf16; |
2628
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
856 return utf16; |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
857 } |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
858 |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
859 p++; |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
860 |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
861 continue; |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
862 } |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
863 |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
864 n = ngx_utf8_decode(&p, 4); |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
865 |
5501
1cd23ca84a9b
Win32: support for UTF-16 surrogate pairs (ticket #457).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5437
diff
changeset
|
866 if (n > 0x10ffff) { |
5785
fbdab7f38fd6
Style: use ngx_free() instead of free().
Tatsuhiko Kubo <cubicdaiya@gmail.com>
parents:
5749
diff
changeset
|
867 ngx_free(utf16); |
2628
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
868 ngx_set_errno(NGX_EILSEQ); |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
869 return NULL; |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
870 } |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
871 |
5501
1cd23ca84a9b
Win32: support for UTF-16 surrogate pairs (ticket #457).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5437
diff
changeset
|
872 if (n > 0xffff) { |
1cd23ca84a9b
Win32: support for UTF-16 surrogate pairs (ticket #457).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5437
diff
changeset
|
873 n -= 0x10000; |
1cd23ca84a9b
Win32: support for UTF-16 surrogate pairs (ticket #457).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5437
diff
changeset
|
874 *u++ = (u_short) (0xd800 + (n >> 10)); |
1cd23ca84a9b
Win32: support for UTF-16 surrogate pairs (ticket #457).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5437
diff
changeset
|
875 *u++ = (u_short) (0xdc00 + (n & 0x03ff)); |
1cd23ca84a9b
Win32: support for UTF-16 surrogate pairs (ticket #457).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5437
diff
changeset
|
876 continue; |
1cd23ca84a9b
Win32: support for UTF-16 surrogate pairs (ticket #457).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5437
diff
changeset
|
877 } |
1cd23ca84a9b
Win32: support for UTF-16 surrogate pairs (ticket #457).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5437
diff
changeset
|
878 |
2628
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
879 *u++ = (u_short) n; |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
880 } |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
881 |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
882 /* unreachable */ |
64a10d6b97bd
win32 ngx_open_file() supports utf8 names and NGX_FILE_APPEND
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
883 } |