comparison src/os/win32/ngx_wsasend_chain.c @ 577:4d9ea73a627a release-0.3.10

nginx-0.3.10-RELEASE import *) Change: the "valid_referers" directive and the "$invalid_referer" variable were moved to the new ngx_http_referer_module from the ngx_http_rewrite_module. *) Change: the "$apache_bytes_sent" variable name was changed to "$body_bytes_sent". *) Feature: the "$sent_http_..." variables. *) Feature: the "if" directive supports the "=" and "!=" operations. *) Feature: the "proxy_pass" directive supports the HTTPS protocol. *) Feature: the "proxy_set_body" directive. *) Feature: the "post_action" directive. *) Feature: the ngx_http_empty_gif_module. *) Feature: the "worker_cpu_affinity" directive for Linux. *) Bugfix: the "rewrite" directive did not unescape URI part in redirect, now it is unescaped except the %00-%25 and %7F-%FF characters. *) Bugfix: nginx could not be built by the icc 9.0 compiler. *) Bugfix: if the SSI was enabled for zero size static file, then the chunked response was encoded incorrectly.
author Igor Sysoev <igor@sysoev.ru>
date Tue, 15 Nov 2005 13:30:52 +0000
parents d4ea69372b94
children 02fb50962b11
comparison
equal deleted inserted replaced
576:3e0b61c26426 577:4d9ea73a627a
46 * WSASend() will return undocumented WSAEINVAL error. 46 * WSASend() will return undocumented WSAEINVAL error.
47 */ 47 */
48 48
49 vec.elts = wsabufs; 49 vec.elts = wsabufs;
50 vec.size = sizeof(WSABUF); 50 vec.size = sizeof(WSABUF);
51 vec.nalloc = NGX_WSABUFS; 51 vec.nalloc = NGX_WSABUFS;
52 vec.pool = c->pool; 52 vec.pool = c->pool;
53 53
54 for ( ;; ) { 54 for ( ;; ) {
55 prev = NULL; 55 prev = NULL;
56 wsabuf = NULL; 56 wsabuf = NULL;
185 /* the maximum limit size is the maximum u_long value - the page size */ 185 /* the maximum limit size is the maximum u_long value - the page size */
186 186
187 if (limit == 0 || limit > NGX_MAX_UINT32_VALUE - ngx_pagesize) { 187 if (limit == 0 || limit > NGX_MAX_UINT32_VALUE - ngx_pagesize) {
188 limit = NGX_MAX_UINT32_VALUE - ngx_pagesize; 188 limit = NGX_MAX_UINT32_VALUE - ngx_pagesize;
189 } 189 }
190 190
191 /* 191 /*
192 * WSABUFs must be 4-byte aligned otherwise 192 * WSABUFs must be 4-byte aligned otherwise
193 * WSASend() will return undocumented WSAEINVAL error. 193 * WSASend() will return undocumented WSAEINVAL error.
194 */ 194 */
195 195
196 vec.elts = wsabufs; 196 vec.elts = wsabufs;
197 vec.nelts = 0; 197 vec.nelts = 0;
198 vec.size = sizeof(WSABUF); 198 vec.size = sizeof(WSABUF);
199 vec.nalloc = NGX_WSABUFS; 199 vec.nalloc = NGX_WSABUFS;
200 vec.pool = c->pool; 200 vec.pool = c->pool;
201 201
202 send = 0; 202 send = 0;
203 prev = NULL; 203 prev = NULL;
204 wsabuf = NULL; 204 wsabuf = NULL;
205 205
206 /* create the WSABUF and coalesce the neighbouring bufs */ 206 /* create the WSABUF and coalesce the neighbouring bufs */
207 207
208 for (cl = in; 208 for (cl = in;
209 cl && vec.nelts < ngx_max_wsabufs && send < limit; 209 cl && vec.nelts < ngx_max_wsabufs && send < limit;
210 cl = cl->next) 210 cl = cl->next)
236 send += size; 236 send += size;
237 } 237 }
238 238
239 ovlp = (LPWSAOVERLAPPED) &c->write->ovlp; 239 ovlp = (LPWSAOVERLAPPED) &c->write->ovlp;
240 ngx_memzero(ovlp, sizeof(WSAOVERLAPPED)); 240 ngx_memzero(ovlp, sizeof(WSAOVERLAPPED));
241 241
242 rc = WSASend(c->fd, vec.elts, vec.nelts, &sent, 0, ovlp, NULL); 242 rc = WSASend(c->fd, vec.elts, vec.nelts, &sent, 0, ovlp, NULL);
243 243
244 wev->complete = 0; 244 wev->complete = 0;
245 245
246 if (rc == -1) { 246 if (rc == -1) {
255 } else { 255 } else {
256 wev->error = 1; 256 wev->error = 1;
257 ngx_connection_error(c, err, "WSASend() failed"); 257 ngx_connection_error(c, err, "WSASend() failed");
258 return NGX_CHAIN_ERROR; 258 return NGX_CHAIN_ERROR;
259 } 259 }
260 260
261 } else if (ngx_event_flags & NGX_USE_IOCP_EVENT) { 261 } else if (ngx_event_flags & NGX_USE_IOCP_EVENT) {
262 262
263 /* 263 /*
264 * if a socket was bound with I/O completion port then 264 * if a socket was bound with I/O completion port then
265 * GetQueuedCompletionStatus() would anyway return its status 265 * GetQueuedCompletionStatus() would anyway return its status
291 } else { 291 } else {
292 if (WSAGetOverlappedResult(c->fd, (LPWSAOVERLAPPED) &wev->ovlp, 292 if (WSAGetOverlappedResult(c->fd, (LPWSAOVERLAPPED) &wev->ovlp,
293 &sent, 0, NULL) == 0) { 293 &sent, 0, NULL) == 0) {
294 ngx_connection_error(c, ngx_socket_errno, 294 ngx_connection_error(c, ngx_socket_errno,
295 "WSASend() or WSAGetOverlappedResult() failed"); 295 "WSASend() or WSAGetOverlappedResult() failed");
296 296
297 return NGX_CHAIN_ERROR; 297 return NGX_CHAIN_ERROR;
298 } 298 }
299 } 299 }
300 } 300 }
301 301