Mercurial > hg > nginx-vendor-0-7
comparison src/os/unix/ngx_files.c @ 506:b9fdcaf2062b NGINX_0_7_65
nginx 0.7.65
*) Security: now nginx/Windows ignores trailing spaces in URI.
Thanks to Dan Crowley, Core Security Technologies.
*) Security: now nginx/Windows ignores short files names.
Thanks to Dan Crowley, Core Security Technologies.
*) Change: now the "009" status code is written to an access log for
proxied HTTP/0.9 responses.
*) Change: now the default buffer size of the
"large_client_header_buffers" directive is 8K.
Thanks to Andrew Cholakian.
*) Change: now default SSL ciphers are "HIGH:!ADH:!MD5".
*) Change: now SSLv2 protocol is disabled by default.
*) Change: now $host variable value is always low case.
*) Feature: the conf/fastcgi.conf for simple FastCGI configurations.
*) Feature: now URI part is not required a "proxy_pass" directive if
variables are used.
*) Feature: the $ssl_session_id variable.
*) Bugfix: if a proxied or FastCGI request was internally redirected to
another proxied or FastCGI location, then $upstream_response_time
variable may have abnormally large value; the bug had appeared in
0.7.63.
*) Bugfix: if the "expires modified" set date in the past, then a
negative number was set in the "Cache-Control" response header
line.
Thanks to Alex Kapranoff.
*) Bugfix: nginx closed a connection if a cached response had an empty
body.
Thanks to Piotr Sikora.
*) Bugfix: nginx cached a 304 response if there was the "If-None-Match"
header line in a proxied request.
Thanks to Tim Dettrick and David Kostal.
*) Bugfix: nginx did not treat a comma as separator in the
"Cache-Control" backend response header line.
*) Bugfix: cached HTTP/0.9 responses were handled incorrectly.
*) Bugfix: nginx sent gzipped responses to clients those do not support
gzip, if "gzip_static on" and "gzip_vary off"; the bug had appeared
in 0.8.16.
*) Bugfix: nginx always added "Content-Encoding: gzip" response header
line in 304 responses sent by ngx_http_gzip_static_module.
*) Bugfix: the "!-x" operator did not work.
Thanks to Maxim Dounin.
*) Bugfix: a segmentation fault might occur in a worker process, if
limit_rate was used in HTTPS server.
Thanks to Maxim Dounin.
*) Bugfix: a segmentation fault might occur in a worker process while
$limit_rate logging.
Thanks to Maxim Dounin.
*) Bugfix: nginx did not support dates in 2038 year on 32-bit platforms;
*) Bugfix: nginx/Windows tried to delete a temporary file twice if the
file should replace an already existent file.
*) Bugfix: nginx/Windows tried to rename a temporary file twice if the
file should replace an already existent file.
*) Bugfix: nginx/Windows might not create temporary file, a cache file,
or "proxy/fastcgi_store"d file if a worker had no enough access
rights for top level directories.
*) Bugfix: in UTF-8 encoding support by "try_files" directive in
nginx/Windows.
*) Bugfix: UTF-8 encoding usage in the ngx_http_autoindex_module.
Thanks to Maxim Dounin.
*) Bugfix: the ngx_http_autoindex_module did not show the trailing
slash in links to a directory; the bug had appeared in 0.7.15.
*) Bugfix: nginx did not close a log file set by the --error-log-path
configuration option; the bug had appeared in 0.7.53.
*) Bugfix: "addition_types" directive was incorrectly named
"addtion_types".
*) Bugfix: invalid request line in $request variable was written in
access_log only if error_log was set to "info" or "debug" level.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Mon, 01 Feb 2010 00:00:00 +0000 |
parents | 56baf312c1b5 |
children |
comparison
equal
deleted
inserted
replaced
505:c62da3dcc544 | 506:b9fdcaf2062b |
---|---|
20 | 20 |
21 n = pread(file->fd, buf, size, offset); | 21 n = pread(file->fd, buf, size, offset); |
22 | 22 |
23 if (n == -1) { | 23 if (n == -1) { |
24 ngx_log_error(NGX_LOG_CRIT, file->log, ngx_errno, | 24 ngx_log_error(NGX_LOG_CRIT, file->log, ngx_errno, |
25 "pread() failed, file \"%s\"", file->name.data); | 25 "pread() \"%s\" failed", file->name.data); |
26 return NGX_ERROR; | 26 return NGX_ERROR; |
27 } | 27 } |
28 | 28 |
29 #else | 29 #else |
30 | 30 |
31 if (file->sys_offset != offset) { | 31 if (file->sys_offset != offset) { |
32 if (lseek(file->fd, offset, SEEK_SET) == -1) { | 32 if (lseek(file->fd, offset, SEEK_SET) == -1) { |
33 ngx_log_error(NGX_LOG_CRIT, file->log, ngx_errno, "lseek() failed"); | 33 ngx_log_error(NGX_LOG_CRIT, file->log, ngx_errno, |
34 "lseek() \"%s\" failed", file->name.data); | |
34 return NGX_ERROR; | 35 return NGX_ERROR; |
35 } | 36 } |
36 | 37 |
37 file->sys_offset = offset; | 38 file->sys_offset = offset; |
38 } | 39 } |
39 | 40 |
40 n = read(file->fd, buf, size); | 41 n = read(file->fd, buf, size); |
41 | 42 |
42 if (n == -1) { | 43 if (n == -1) { |
43 ngx_log_error(NGX_LOG_CRIT, file->log, ngx_errno, "read() failed"); | 44 ngx_log_error(NGX_LOG_CRIT, file->log, ngx_errno, |
45 "read() \"%s\" failed", file->name.data); | |
44 return NGX_ERROR; | 46 return NGX_ERROR; |
45 } | 47 } |
46 | 48 |
47 file->sys_offset += n; | 49 file->sys_offset += n; |
48 | 50 |
55 | 57 |
56 | 58 |
57 ssize_t | 59 ssize_t |
58 ngx_write_file(ngx_file_t *file, u_char *buf, size_t size, off_t offset) | 60 ngx_write_file(ngx_file_t *file, u_char *buf, size_t size, off_t offset) |
59 { | 61 { |
60 ssize_t n; | 62 ssize_t n, written; |
61 | 63 |
62 ngx_log_debug4(NGX_LOG_DEBUG_CORE, file->log, 0, | 64 ngx_log_debug4(NGX_LOG_DEBUG_CORE, file->log, 0, |
63 "write: %d, %p, %uz, %O", file->fd, buf, size, offset); | 65 "write: %d, %p, %uz, %O", file->fd, buf, size, offset); |
64 | 66 |
67 written = 0; | |
68 | |
65 #if (NGX_HAVE_PWRITE) | 69 #if (NGX_HAVE_PWRITE) |
66 | 70 |
67 n = pwrite(file->fd, buf, size, offset); | 71 for ( ;; ) { |
68 | 72 n = pwrite(file->fd, buf, size, offset); |
69 if (n == -1) { | 73 |
70 ngx_log_error(NGX_LOG_CRIT, file->log, ngx_errno, "pwrite() failed"); | 74 if (n == -1) { |
71 return NGX_ERROR; | 75 ngx_log_error(NGX_LOG_CRIT, file->log, ngx_errno, |
72 } | 76 "pwrite() \"%s\" failed", file->name.data); |
73 | 77 return NGX_ERROR; |
74 if ((size_t) n != size) { | 78 } |
75 ngx_log_error(NGX_LOG_CRIT, file->log, 0, | 79 |
76 "pwrite() has written only %z of %uz", n, size); | 80 file->offset += n; |
77 return NGX_ERROR; | 81 written += n; |
82 | |
83 if ((size_t) n == size) { | |
84 return written; | |
85 } | |
86 | |
87 offset += n; | |
88 size -= n; | |
78 } | 89 } |
79 | 90 |
80 #else | 91 #else |
81 | 92 |
82 if (file->sys_offset != offset) { | 93 if (file->sys_offset != offset) { |
83 if (lseek(file->fd, offset, SEEK_SET) == -1) { | 94 if (lseek(file->fd, offset, SEEK_SET) == -1) { |
84 ngx_log_error(NGX_LOG_CRIT, file->log, ngx_errno, "lseek() failed"); | 95 ngx_log_error(NGX_LOG_CRIT, file->log, ngx_errno, |
96 "lseek() \"%s\" failed", file->name.data); | |
85 return NGX_ERROR; | 97 return NGX_ERROR; |
86 } | 98 } |
87 | 99 |
88 file->sys_offset = offset; | 100 file->sys_offset = offset; |
89 } | 101 } |
90 | 102 |
91 n = write(file->fd, buf, size); | 103 for ( ;; ) { |
92 | 104 n = write(file->fd, buf, size); |
93 if (n == -1) { | 105 |
94 ngx_log_error(NGX_LOG_CRIT, file->log, ngx_errno, "write() failed"); | 106 if (n == -1) { |
95 return NGX_ERROR; | 107 ngx_log_error(NGX_LOG_CRIT, file->log, ngx_errno, |
96 } | 108 "write() \"%s\" failed", file->name.data); |
97 | 109 return NGX_ERROR; |
98 if ((size_t) n != size) { | 110 } |
99 ngx_log_error(NGX_LOG_CRIT, file->log, 0, | 111 |
100 "write() has written only %z of %uz", n, size); | 112 file->offset += n; |
101 return NGX_ERROR; | 113 written += n; |
102 } | 114 |
103 | 115 if ((size_t) n == size) { |
104 file->sys_offset += n; | 116 return written; |
105 | 117 } |
106 #endif | 118 |
107 | 119 size -= n; |
108 file->offset += n; | 120 } |
109 | 121 #endif |
110 return n; | |
111 } | 122 } |
112 | 123 |
113 | 124 |
114 ngx_fd_t | 125 ngx_fd_t |
115 ngx_open_tempfile(u_char *name, ngx_uint_t persistent, ngx_uint_t access) | 126 ngx_open_tempfile(u_char *name, ngx_uint_t persistent, ngx_uint_t access) |
189 } | 200 } |
190 | 201 |
191 if (file->sys_offset != offset) { | 202 if (file->sys_offset != offset) { |
192 if (lseek(file->fd, offset, SEEK_SET) == -1) { | 203 if (lseek(file->fd, offset, SEEK_SET) == -1) { |
193 ngx_log_error(NGX_LOG_CRIT, file->log, ngx_errno, | 204 ngx_log_error(NGX_LOG_CRIT, file->log, ngx_errno, |
194 "lseek() failed"); | 205 "lseek() \"%s\" failed", file->name.data); |
195 return NGX_ERROR; | 206 return NGX_ERROR; |
196 } | 207 } |
197 | 208 |
198 file->sys_offset = offset; | 209 file->sys_offset = offset; |
199 } | 210 } |
200 | 211 |
201 n = writev(file->fd, vec.elts, vec.nelts); | 212 n = writev(file->fd, vec.elts, vec.nelts); |
202 | 213 |
203 if (n == -1) { | 214 if (n == -1) { |
204 ngx_log_error(NGX_LOG_CRIT, file->log, ngx_errno, | 215 ngx_log_error(NGX_LOG_CRIT, file->log, ngx_errno, |
205 "writev() failed"); | 216 "writev() \"%s\" failed", file->name.data); |
206 return NGX_ERROR; | 217 return NGX_ERROR; |
207 } | 218 } |
208 | 219 |
209 if ((size_t) n != size) { | 220 if ((size_t) n != size) { |
210 ngx_log_error(NGX_LOG_CRIT, file->log, 0, | 221 ngx_log_error(NGX_LOG_CRIT, file->log, 0, |
211 "writev() has written only %z of %uz", n, size); | 222 "writev() \"%s\" has written only %z of %uz", |
223 file->name.data, n, size); | |
212 return NGX_ERROR; | 224 return NGX_ERROR; |
213 } | 225 } |
214 | 226 |
215 file->sys_offset += n; | 227 file->sys_offset += n; |
216 file->offset += n; | 228 file->offset += n; |
260 dir->de = readdir(dir->dir); | 272 dir->de = readdir(dir->dir); |
261 | 273 |
262 if (dir->de) { | 274 if (dir->de) { |
263 #if (NGX_HAVE_D_TYPE) | 275 #if (NGX_HAVE_D_TYPE) |
264 dir->type = dir->de->d_type; | 276 dir->type = dir->de->d_type; |
265 dir->valid_type = dir->type ? 1 : 0; | |
266 #else | 277 #else |
267 dir->valid_type = 0; | 278 dir->type = 0; |
268 #endif | 279 #endif |
269 return NGX_OK; | 280 return NGX_OK; |
270 } | 281 } |
271 | 282 |
272 return NGX_ERROR; | 283 return NGX_ERROR; |
392 int flags; | 403 int flags; |
393 | 404 |
394 flags = fcntl(fd, F_GETFL); | 405 flags = fcntl(fd, F_GETFL); |
395 | 406 |
396 if (flags == -1) { | 407 if (flags == -1) { |
397 return -1; | 408 return NGX_FILE_ERROR; |
398 } | 409 } |
399 | 410 |
400 return fcntl(fd, F_SETFL, flags | O_DIRECT); | 411 return fcntl(fd, F_SETFL, flags | O_DIRECT); |
401 } | 412 } |
402 | 413 |
407 int flags; | 418 int flags; |
408 | 419 |
409 flags = fcntl(fd, F_GETFL); | 420 flags = fcntl(fd, F_GETFL); |
410 | 421 |
411 if (flags == -1) { | 422 if (flags == -1) { |
412 return -1; | 423 return NGX_FILE_ERROR; |
413 } | 424 } |
414 | 425 |
415 return fcntl(fd, F_SETFL, flags & ~O_DIRECT); | 426 return fcntl(fd, F_SETFL, flags & ~O_DIRECT); |
416 } | 427 } |
417 | 428 |