Mercurial > hg > nginx-vendor-0-7
annotate src/os/unix/ngx_solaris_sendfilev_chain.c @ 508:68c0ae0a4959 NGINX_0_7_66
nginx 0.7.66
*) Security: now nginx/Windows ignores default file stream name.
Thanks to Jose Antonio Vazquez Gonzalez.
*) Change: now the charset filter runs before the SSI filter.
*) Change: now no message is written in an error log if a variable is
not found by $r->variable() method.
*) Change: now keepalive connections after POST requests are not
disabled for MSIE 7.0+.
Thanks to Adam Lounds.
*) Feature: the "proxy_no_cache" and "fastcgi_no_cache" directives.
*) Feature: now the "rewrite" directive does a redirect automatically
if the $scheme variable is used.
Thanks to Piotr Sikora.
*) Feature: the "chunked_transfer_encoding" directive.
*) Feature: the $geoip_city_continent_code, $geoip_latitude, and
$geoip_longitude variables.
Thanks to Arvind Sundararajan.
*) Feature: now the ngx_http_image_filter_module deletes always EXIF
and other application specific data if the data consume more than 5%
of a JPEG file.
*) Feature: now the "msie_padding" directive works for Chrome too.
*) Workaround: now keepalive connections are disabled for Safari.
Thanks to Joshua Sierles.
*) Bugfix: nginx ignored the "private" and "no-store" values in the
"Cache-Control" backend response header line.
*) Bugfix: an "&" character was not escaped when it was copied in
arguments part in a rewrite rule.
*) Bugfix: nginx might be terminated abnormally while a signal
processing or if the directive "timer_resolution" was used on
platforms which do not support kqueue or eventport notification
methods.
Thanks to George Xie and Maxim Dounin.
*) Bugfix: if temporary files and permanent storage area resided at
different file systems, then permanent file modification times were
incorrect.
Thanks to Maxim Dounin.
*) Bugfix: ngx_http_memcached_module might issue the error message
"memcached sent invalid trailer".
Thanks to Maxim Dounin.
*) Bugfix: nginx could not built zlib-1.2.4 library using the library
sources.
Thanks to Maxim Dounin.
*) Bugfix: values of the $query_string, $arg_..., etc. variables cached
in main request were used by the SSI module in subrequests.
*) Bugfix: nginx did not support HTTPS referrers.
*) Bugfix: nginx/Windows might not find file if path in configuration
was given in other character case; the bug had appeared in 0.7.65.
*) Bugfix: the $date_local variable has an incorrect value, if the "%s"
format was used.
Thanks to Maxim Dounin.
*) Bugfix: nginx did not support all ciphers and digests used in client
certificates.
Thanks to Innocenty Enikeew.
*) Bugfix: if ssl_session_cache was not set or was set to "none", then
during client certificate verify the error "session id context
uninitialized" might occur; the bug had appeared in 0.7.1.
*) Bugfix: OpenSSL-1.0.0 compatibility on 64-bit Linux.
Thanks to Maxim Dounin.
*) Bugfix: a geo range returned default value if the range included two
or more /16 networks and did not begin at /16 network boundary.
*) Bugfix: the $uid_got variable might not be used in the SSI and perl
modules.
*) Bugfix: a worker process hung if a FIFO file was requested.
Thanks to Vicente Aguilar and Maxim Dounin.
*) Bugfix: a variable value was repeatedly encoded after each an "echo"
SSI-command output; the bug had appeared in 0.6.14.
*) Bugfix: a "stub" parameter of an "include" SSI directive was not
used, if empty response has 200 status code.
*) Bugfix: a block used in a "stub" parameter of an "include" SSI
directive was output with "text/plain" MIME type.
*) Bugfix: if a proxied or FastCGI request was internally redirected to
another proxied or FastCGI location, then a segmentation fault might
occur in a worker process; the bug had appeared in 0.7.65.
Thanks to Yichun Zhang.
*) Bugfix: IMAP connections may hang until they timed out while talking
to Zimbra server.
Thanks to Alan Batie.
*) Bugfix: nginx did not support chunked transfer encoding for 201
responses.
Thanks to Julian Reich.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Mon, 07 Jun 2010 00:00:00 +0400 |
parents | f7cd062ee035 |
children |
rev | line source |
---|---|
0 | 1 |
2 /* | |
3 * Copyright (C) Igor Sysoev | |
4 */ | |
5 | |
6 | |
7 #include <ngx_config.h> | |
8 #include <ngx_core.h> | |
9 #include <ngx_event.h> | |
10 | |
11 | |
22 | 12 #if (NGX_TEST_BUILD_SOLARIS_SENDFILEV) |
13 | |
14 /* Solaris declarations */ | |
15 | |
16 typedef struct sendfilevec { | |
17 int sfv_fd; | |
18 u_int sfv_flag; | |
19 off_t sfv_off; | |
20 size_t sfv_len; | |
21 } sendfilevec_t; | |
22 | |
23 #define SFV_FD_SELF -2 | |
24 | |
25 static ssize_t sendfilev(int fd, const struct sendfilevec *vec, | |
134 | 26 int sfvcnt, size_t *xferred) |
22 | 27 { |
28 return -1; | |
29 } | |
30 | |
31 #endif | |
32 | |
33 | |
146 | 34 #if (IOV_MAX > 64) |
35 #define NGX_SENDFILEVECS 64 | |
36 #else | |
37 #define NGX_SENDFILEVECS IOV_MAX | |
38 #endif | |
39 | |
0 | 40 |
41 | |
134 | 42 ngx_chain_t * |
43 ngx_solaris_sendfilev_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit) | |
0 | 44 { |
45 int fd; | |
46 u_char *prev; | |
22 | 47 off_t size, send, prev_send, aligned, fprev; |
48 size_t sent; | |
49 ssize_t n; | |
0 | 50 ngx_int_t eintr, complete; |
51 ngx_err_t err; | |
52 sendfilevec_t *sfv, sfvs[NGX_SENDFILEVECS]; | |
53 ngx_array_t vec; | |
54 ngx_event_t *wev; | |
50 | 55 ngx_chain_t *cl; |
0 | 56 |
57 wev = c->write; | |
58 | |
59 if (!wev->ready) { | |
60 return in; | |
61 } | |
62 | |
2 | 63 if (!c->sendfile) { |
64 return ngx_writev_chain(c, in, limit); | |
65 } | |
66 | |
22 | 67 |
68 /* the maximum limit size is the maximum size_t value - the page size */ | |
69 | |
324 | 70 if (limit == 0 || limit > (off_t) (NGX_MAX_SIZE_T_VALUE - ngx_pagesize)) { |
26 | 71 limit = NGX_MAX_SIZE_T_VALUE - ngx_pagesize; |
22 | 72 } |
73 | |
74 | |
0 | 75 send = 0; |
76 complete = 0; | |
77 | |
78 vec.elts = sfvs; | |
79 vec.size = sizeof(sendfilevec_t); | |
80 vec.nalloc = NGX_SENDFILEVECS; | |
81 vec.pool = c->pool; | |
82 | |
83 for ( ;; ) { | |
84 fd = SFV_FD_SELF; | |
85 prev = NULL; | |
86 fprev = 0; | |
87 sfv = NULL; | |
88 eintr = 0; | |
89 sent = 0; | |
22 | 90 prev_send = send; |
0 | 91 |
92 vec.nelts = 0; | |
93 | |
94 /* create the sendfilevec and coalesce the neighbouring bufs */ | |
95 | |
96 for (cl = in; cl && vec.nelts < IOV_MAX && send < limit; cl = cl->next) | |
97 { | |
98 if (ngx_buf_special(cl->buf)) { | |
99 continue; | |
100 } | |
101 | |
102 if (ngx_buf_in_memory_only(cl->buf)) { | |
103 fd = SFV_FD_SELF; | |
104 | |
105 size = cl->buf->last - cl->buf->pos; | |
106 | |
107 if (send + size > limit) { | |
108 size = limit - send; | |
109 } | |
110 | |
111 if (prev == cl->buf->pos) { | |
22 | 112 sfv->sfv_len += (size_t) size; |
0 | 113 |
114 } else { | |
50 | 115 sfv = ngx_array_push(&vec); |
116 if (sfv == NULL) { | |
0 | 117 return NGX_CHAIN_ERROR; |
118 } | |
119 | |
120 sfv->sfv_fd = SFV_FD_SELF; | |
121 sfv->sfv_flag = 0; | |
122 sfv->sfv_off = (off_t) (uintptr_t) cl->buf->pos; | |
22 | 123 sfv->sfv_len = (size_t) size; |
0 | 124 } |
125 | |
22 | 126 prev = cl->buf->pos + (size_t) size; |
0 | 127 send += size; |
128 | |
129 } else { | |
130 prev = NULL; | |
131 | |
22 | 132 size = cl->buf->file_last - cl->buf->file_pos; |
0 | 133 |
134 if (send + size > limit) { | |
135 size = limit - send; | |
136 | |
137 aligned = (cl->buf->file_pos + size + ngx_pagesize - 1) | |
298 | 138 & ~((off_t) ngx_pagesize - 1); |
0 | 139 |
140 if (aligned <= cl->buf->file_last) { | |
141 size = aligned - cl->buf->file_pos; | |
142 } | |
143 } | |
144 | |
145 if (fd == cl->buf->file->fd && fprev == cl->buf->file_pos) { | |
22 | 146 sfv->sfv_len += (size_t) size; |
0 | 147 |
148 } else { | |
50 | 149 sfv = ngx_array_push(&vec); |
150 if (sfv == NULL) { | |
0 | 151 return NGX_CHAIN_ERROR; |
152 } | |
153 | |
154 fd = cl->buf->file->fd; | |
155 sfv->sfv_fd = fd; | |
156 sfv->sfv_flag = 0; | |
157 sfv->sfv_off = cl->buf->file_pos; | |
22 | 158 sfv->sfv_len = (size_t) size; |
0 | 159 } |
160 | |
161 fprev = cl->buf->file_pos + size; | |
162 send += size; | |
163 } | |
164 } | |
165 | |
166 n = sendfilev(c->fd, vec.elts, vec.nelts, &sent); | |
167 | |
168 if (n == -1) { | |
169 err = ngx_errno; | |
170 | |
171 if (err == NGX_EAGAIN || err == NGX_EINTR) { | |
172 if (err == NGX_EINTR) { | |
173 eintr = 1; | |
174 } | |
175 | |
176 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, err, | |
22 | 177 "sendfilev() sent only %uz bytes", sent); |
0 | 178 |
179 } else { | |
180 wev->error = 1; | |
181 ngx_connection_error(c, err, "sendfilev() failed"); | |
182 return NGX_CHAIN_ERROR; | |
183 } | |
184 } | |
185 | |
186 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, c->log, 0, | |
10 | 187 "sendfilev: %z %z", n, sent); |
0 | 188 |
22 | 189 if (send - prev_send == (off_t) sent) { |
0 | 190 complete = 1; |
191 } | |
192 | |
193 c->sent += sent; | |
194 | |
195 for (cl = in; cl; cl = cl->next) { | |
196 | |
197 if (ngx_buf_special(cl->buf)) { | |
126 | 198 continue; |
0 | 199 } |
200 | |
201 if (sent == 0) { | |
202 break; | |
203 } | |
204 | |
205 size = ngx_buf_size(cl->buf); | |
206 | |
22 | 207 if ((off_t) sent >= size) { |
208 sent = (size_t) ((off_t) sent - size); | |
0 | 209 |
210 if (ngx_buf_in_memory(cl->buf)) { | |
211 cl->buf->pos = cl->buf->last; | |
212 } | |
213 | |
214 if (cl->buf->in_file) { | |
215 cl->buf->file_pos = cl->buf->file_last; | |
216 } | |
217 | |
218 continue; | |
219 } | |
220 | |
221 if (ngx_buf_in_memory(cl->buf)) { | |
222 cl->buf->pos += sent; | |
223 } | |
224 | |
225 if (cl->buf->in_file) { | |
226 cl->buf->file_pos += sent; | |
227 } | |
228 | |
229 break; | |
230 } | |
231 | |
232 if (eintr) { | |
233 continue; | |
234 } | |
235 | |
236 if (!complete) { | |
237 wev->ready = 0; | |
238 return cl; | |
239 } | |
240 | |
241 if (send >= limit || cl == NULL) { | |
242 return cl; | |
243 } | |
244 | |
245 in = cl; | |
246 } | |
247 } |