Mercurial > hg > nginx-vendor-0-7
annotate src/os/unix/ngx_recv.c @ 502:89dc5654117c NGINX_0_7_63
nginx 0.7.63
*) Security: now "/../" are disabled in "Destination" request header
line.
*) Change: minimum supported OpenSSL version is 0.9.7.
*) Change: the "ask" parameter of the "ssl_verify_client" directive was
changed to the "optional" parameter and now it checks a client
certificate if it was offered.
Thanks to Brice Figureau.
*) Feature: now the "-V" switch shows TLS SNI support.
*) Feature: the $ssl_client_verify variable.
Thanks to Brice Figureau.
*) Feature: the "ssl_crl" directive.
Thanks to Brice Figureau.
*) Bugfix: the $ssl_client_cert variable usage corrupted memory; the
bug had appeared in 0.7.7.
Thanks to Sergey Zhuravlev.
*) Feature: now the start cache loader runs in a separate process; this
should improve large caches handling.
*) Feature: now temporary files and permanent storage area may reside
at different file systems.
*) Bugfix: nginx counted incorrectly disk cache size.
*) Change: now directive "gzip_disable msie6" does not disable gzipping
for MSIE 6.0 SV1.
*) Bugfix: nginx always added "Vary: Accept-Encoding" response header
line, if both "gzip_static" and "gzip_vary" were on.
*) Feature: the "proxy" parameter of the "geo" directive.
*) Feature: the ngx_http_geoip_module.
*) Feature: the "limit_rate_after" directive.
Thanks to Ivan Debnar.
*) Feature: the "limit_req_log_level" and "limit_conn_log_level"
directives.
*) Bugfix: now "limit_req" directive conforms to the leaky bucket
algorithm.
Thanks to Maxim Dounin.
*) Bugfix: in ngx_http_limit_req_module.
Thanks to Maxim Dounin.
*) Bugfix: now nginx allows underscores in a request method.
*) Bugfix: "proxy_pass_header" and "fastcgi_pass_header" directives did
not pass to a client the "X-Accel-Redirect", "X-Accel-Limit-Rate",
"X-Accel-Buffering", and "X-Accel-Charset" lines from backend
response header.
Thanks to Maxim Dounin.
*) Bugfix: in handling "Last-Modified" and "Accept-Ranges" backend
response header lines; the bug had appeared in 0.7.44.
Thanks to Maxim Dounin.
*) Feature: the "image_filter_transparency" directive.
*) Feature: the "image_filter" directive supports variables for setting
size.
*) Bugfix: in PNG alpha-channel support in the
ngx_http_image_filter_module.
*) Bugfix: in transparency support in the ngx_http_image_filter_module.
*) Feature: now several "perl_modules" directives may be used.
*) Bugfix: ngx_http_perl_module responses did not work in subrequests.
*) Bugfix: nginx sent '\0' in a "Location" response header line on
MKCOL request.
Thanks to Xie Zhenye.
*) Bugfix: an "error_page" directive did not redirect a 413 error; the
bug had appeared in 0.6.10.
*) Bugfix: in memory allocation error handling.
Thanks to Maxim Dounin and Kirill A. Korinskiy.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Mon, 26 Oct 2009 00:00:00 +0300 |
parents | a39aab45a53f |
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 | |
18 | 12 #if (NGX_HAVE_KQUEUE) |
0 | 13 |
354 | 14 ssize_t |
15 ngx_unix_recv(ngx_connection_t *c, u_char *buf, size_t size) | |
0 | 16 { |
17 ssize_t n; | |
18 ngx_err_t err; | |
19 ngx_event_t *rev; | |
20 | |
21 rev = c->read; | |
22 | |
4 | 23 if (ngx_event_flags & NGX_USE_KQUEUE_EVENT) { |
0 | 24 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 0, |
25 "recv: eof:%d, avail:%d, err:%d", | |
26 rev->pending_eof, rev->available, rev->kq_errno); | |
27 | |
28 if (rev->available == 0) { | |
136 | 29 if (rev->pending_eof) { |
0 | 30 rev->ready = 0; |
31 rev->eof = 1; | |
32 | |
33 if (rev->kq_errno) { | |
34 rev->error = 1; | |
35 ngx_set_socket_errno(rev->kq_errno); | |
36 | |
86 | 37 return ngx_connection_error(c, rev->kq_errno, |
38 "kevent() reported about an closed connection"); | |
0 | 39 } |
40 | |
41 return 0; | |
136 | 42 |
43 } else { | |
364 | 44 rev->ready = 0; |
136 | 45 return NGX_AGAIN; |
0 | 46 } |
47 } | |
48 } | |
49 | |
50 do { | |
51 n = recv(c->fd, buf, size, 0); | |
52 | |
53 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 0, | |
54 "recv: fd:%d %d of %d", c->fd, n, size); | |
55 | |
56 if (n >= 0) { | |
4 | 57 if (ngx_event_flags & NGX_USE_KQUEUE_EVENT) { |
0 | 58 rev->available -= n; |
59 | |
60 /* | |
132 | 61 * rev->available may be negative here because some additional |
136 | 62 * bytes may be received between kevent() and recv() |
0 | 63 */ |
64 | |
65 if (rev->available <= 0) { | |
66 if (!rev->pending_eof) { | |
67 rev->ready = 0; | |
68 } | |
69 | |
70 if (rev->available < 0) { | |
71 rev->available = 0; | |
72 } | |
73 } | |
74 | |
154 | 75 if (n == 0) { |
76 | |
77 /* | |
78 * on FreeBSD recv() may return 0 on closed socket | |
79 * even if kqueue reported about available data | |
80 */ | |
81 | |
82 rev->eof = 1; | |
83 rev->available = 0; | |
84 } | |
85 | |
0 | 86 return n; |
87 } | |
88 | |
89 if ((size_t) n < size) { | |
90 rev->ready = 0; | |
91 } | |
92 | |
93 if (n == 0) { | |
94 rev->eof = 1; | |
95 } | |
96 | |
97 return n; | |
98 } | |
99 | |
100 err = ngx_socket_errno; | |
101 | |
102 if (err == NGX_EAGAIN || err == NGX_EINTR) { | |
103 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, err, | |
104 "recv() not ready"); | |
105 n = NGX_AGAIN; | |
106 | |
107 } else { | |
108 n = ngx_connection_error(c, err, "recv() failed"); | |
109 break; | |
110 } | |
111 | |
112 } while (err == NGX_EINTR); | |
113 | |
114 rev->ready = 0; | |
115 | |
116 if (n == NGX_ERROR){ | |
117 rev->error = 1; | |
118 } | |
119 | |
120 return n; | |
121 } | |
122 | |
18 | 123 #else /* ! NGX_HAVE_KQUEUE */ |
0 | 124 |
354 | 125 ssize_t |
126 ngx_unix_recv(ngx_connection_t *c, u_char *buf, size_t size) | |
0 | 127 { |
128 ssize_t n; | |
129 ngx_err_t err; | |
130 ngx_event_t *rev; | |
131 | |
132 rev = c->read; | |
133 | |
134 do { | |
135 n = recv(c->fd, buf, size, 0); | |
136 | |
137 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 0, | |
138 "recv: fd:%d %d of %d", c->fd, n, size); | |
139 | |
140 if (n == 0) { | |
141 rev->ready = 0; | |
142 rev->eof = 1; | |
143 return n; | |
144 | |
145 } else if (n > 0) { | |
146 | |
147 if ((size_t) n < size | |
4 | 148 && !(ngx_event_flags & NGX_USE_GREEDY_EVENT)) |
0 | 149 { |
150 rev->ready = 0; | |
151 } | |
152 | |
153 return n; | |
154 } | |
155 | |
156 err = ngx_socket_errno; | |
157 | |
158 if (err == NGX_EAGAIN || err == NGX_EINTR) { | |
159 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, err, | |
160 "recv() not ready"); | |
161 n = NGX_AGAIN; | |
162 | |
163 } else { | |
164 n = ngx_connection_error(c, err, "recv() failed"); | |
165 break; | |
166 } | |
167 | |
168 } while (err == NGX_EINTR); | |
169 | |
170 rev->ready = 0; | |
171 | |
172 if (n == NGX_ERROR){ | |
173 rev->error = 1; | |
174 } | |
175 | |
176 return n; | |
177 } | |
178 | |
18 | 179 #endif /* NGX_HAVE_KQUEUE */ |