Mercurial > hg > nginx
comparison src/os/win32/ngx_wsarecv_chain.c @ 501:d4ea69372b94 release-0.1.25
nginx-0.1.25-RELEASE import
*) Bugfix: nginx did run on Linux parisc.
*) Feature: nginx now does not start under FreeBSD if the sysctl
kern.ipc.somaxconn value is too big.
*) Bugfix: if a request was internally redirected by the
ngx_http_index_module module to the ngx_http_proxy_module or
ngx_http_fastcgi_module modules, then the index file was not closed
after request completion.
*) Feature: the "proxy_pass" can be used in location with regular
expression.
*) Feature: the ngx_http_rewrite_filter_module module supports the
condition like "if ($HTTP_USER_AGENT ~ MSIE)".
*) Bugfix: nginx started too slow if the large number of addresses and
text values were used in the "geo" directive.
*) Change: a variable name must be declared as "$name" in the "geo"
directive. The previous variant without "$" is still supported, but
will be removed soon.
*) Feature: the "%{VARIABLE}v" logging parameter.
*) Feature: the "set $name value" directive.
*) Bugfix: gcc 4.0 compatibility.
*) Feature: the --with-openssl-opt=OPTIONS autoconfiguration directive.
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Sat, 19 Mar 2005 12:38:37 +0000 |
parents | 42d11f017717 |
children | 4d9ea73a627a |
comparison
equal
deleted
inserted
replaced
500:9a0f304470f5 | 501:d4ea69372b94 |
---|---|
7 #include <ngx_config.h> | 7 #include <ngx_config.h> |
8 #include <ngx_core.h> | 8 #include <ngx_core.h> |
9 #include <ngx_event.h> | 9 #include <ngx_event.h> |
10 | 10 |
11 | 11 |
12 ssize_t ngx_wsarecv_chain(ngx_connection_t *c, ngx_chain_t *chain) | 12 #define NGX_WSABUFS 8 |
13 | |
14 | |
15 ssize_t | |
16 ngx_wsarecv_chain(ngx_connection_t *c, ngx_chain_t *chain) | |
13 { | 17 { |
14 int rc; | 18 int rc; |
15 u_char *prev; | 19 u_char *prev; |
16 u_long bytes, flags; | 20 u_long bytes, flags; |
17 size_t size; | 21 size_t size; |
18 WSABUF *wsabuf; | |
19 ngx_err_t err; | 22 ngx_err_t err; |
20 ngx_array_t io; | 23 ngx_array_t vec; |
21 ngx_event_t *rev; | 24 ngx_event_t *rev; |
25 LPWSABUF wsabuf; | |
26 WSABUF wsabufs[NGX_WSABUFS]; | |
22 | 27 |
23 prev = NULL; | 28 prev = NULL; |
24 wsabuf = NULL; | 29 wsabuf = NULL; |
25 flags = 0; | 30 flags = 0; |
26 size = 0; | 31 size = 0; |
27 bytes = 0; | 32 bytes = 0; |
28 | 33 |
29 ngx_init_array(io, c->pool, 10, sizeof(WSABUF), NGX_ERROR); | 34 vec.elts = wsabufs; |
35 vec.nelts = 0; | |
36 vec.size = sizeof(WSABUF); | |
37 vec.nalloc = NGX_WSABUFS; | |
38 vec.pool = c->pool; | |
30 | 39 |
31 /* coalesce the neighbouring bufs */ | 40 /* coalesce the neighbouring bufs */ |
32 | 41 |
33 while (chain) { | 42 while (chain) { |
34 if (prev == chain->buf->last) { | 43 if (prev == chain->buf->last) { |
35 wsabuf->len += chain->buf->end - chain->buf->last; | 44 wsabuf->len += chain->buf->end - chain->buf->last; |
36 | 45 |
37 } else { | 46 } else { |
38 ngx_test_null(wsabuf, ngx_push_array(&io), NGX_ERROR); | 47 wsabuf = ngx_array_push(&vec); |
48 if (wsabuf == NULL) { | |
49 return NGX_ERROR; | |
50 } | |
51 | |
39 wsabuf->buf = (char *) chain->buf->last; | 52 wsabuf->buf = (char *) chain->buf->last; |
40 wsabuf->len = chain->buf->end - chain->buf->last; | 53 wsabuf->len = chain->buf->end - chain->buf->last; |
41 } | 54 } |
42 | 55 |
43 size += chain->buf->end - chain->buf->last; | 56 size += chain->buf->end - chain->buf->last; |
44 prev = chain->buf->end; | 57 prev = chain->buf->end; |
45 chain = chain->next; | 58 chain = chain->next; |
46 } | 59 } |
47 | 60 |
48 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, c->log, 0, | 61 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, c->log, 0, |
49 "WSARecv: %d:%d", io.nelts, wsabuf->len); | 62 "WSARecv: %d:%d", vec.nelts, wsabuf->len); |
50 | 63 |
51 | 64 |
52 rc = WSARecv(c->fd, io.elts, io.nelts, &bytes, &flags, NULL, NULL); | 65 rc = WSARecv(c->fd, vec.elts, vec.nelts, &bytes, &flags, NULL, NULL); |
53 | 66 |
54 rev = c->read; | 67 rev = c->read; |
55 | 68 |
56 if (rc == -1) { | 69 if (rc == -1) { |
57 rev->ready = 0; | 70 rev->ready = 0; |