comparison src/os/unix/ngx_channel.c @ 126:df17fbafec8f NGINX_0_3_10

nginx 0.3.10 *) 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 <http://sysoev.ru>
date Tue, 15 Nov 2005 00:00:00 +0300
parents 408f195b3482
children babd3d9efb62
comparison
equal deleted inserted replaced
125:97504de1f89e 126:df17fbafec8f
9 #include <ngx_channel.h> 9 #include <ngx_channel.h>
10 10
11 11
12 ngx_int_t 12 ngx_int_t
13 ngx_write_channel(ngx_socket_t s, ngx_channel_t *ch, size_t size, 13 ngx_write_channel(ngx_socket_t s, ngx_channel_t *ch, size_t size,
14 ngx_log_t *log) 14 ngx_log_t *log)
15 { 15 {
16 ssize_t n; 16 ssize_t n;
17 ngx_err_t err; 17 ngx_err_t err;
18 struct iovec iov[1]; 18 struct iovec iov[1];
19 struct msghdr msg; 19 struct msghdr msg;
32 } else { 32 } else {
33 msg.msg_control = (caddr_t) &cmsg; 33 msg.msg_control = (caddr_t) &cmsg;
34 msg.msg_controllen = sizeof(cmsg); 34 msg.msg_controllen = sizeof(cmsg);
35 35
36 cmsg.cm.cmsg_len = sizeof(cmsg); 36 cmsg.cm.cmsg_len = sizeof(cmsg);
37 cmsg.cm.cmsg_level = SOL_SOCKET; 37 cmsg.cm.cmsg_level = SOL_SOCKET;
38 cmsg.cm.cmsg_type = SCM_RIGHTS; 38 cmsg.cm.cmsg_type = SCM_RIGHTS;
39 *(int *) CMSG_DATA(&cmsg.cm) = ch->fd; 39 *(int *) CMSG_DATA(&cmsg.cm) = ch->fd;
40 } 40 }
41 41
42 msg.msg_flags = 0; 42 msg.msg_flags = 0;
78 } 78 }
79 79
80 80
81 ngx_int_t 81 ngx_int_t
82 ngx_read_channel(ngx_socket_t s, ngx_channel_t *ch, size_t size, ngx_log_t *log) 82 ngx_read_channel(ngx_socket_t s, ngx_channel_t *ch, size_t size, ngx_log_t *log)
83 { 83 {
84 ssize_t n; 84 ssize_t n;
85 ngx_err_t err; 85 ngx_err_t err;
86 struct iovec iov[1]; 86 struct iovec iov[1];
87 struct msghdr msg; 87 struct msghdr msg;
88 88
163 163
164 #else 164 #else
165 165
166 if (ch->command == NGX_CMD_OPEN_CHANNEL) { 166 if (ch->command == NGX_CMD_OPEN_CHANNEL) {
167 if (msg.msg_accrightslen != sizeof(int)) { 167 if (msg.msg_accrightslen != sizeof(int)) {
168 ngx_log_error(NGX_LOG_ALERT, log, 0, 168 ngx_log_error(NGX_LOG_ALERT, log, 0,
169 "recvmsg() returned no ancillary data"); 169 "recvmsg() returned no ancillary data");
170 return NGX_ERROR; 170 return NGX_ERROR;
171 } 171 }
172 172
173 ch->fd = fd; 173 ch->fd = fd;
217 if (ngx_add_conn && (ngx_event_flags & NGX_USE_EPOLL_EVENT) == 0) { 217 if (ngx_add_conn && (ngx_event_flags & NGX_USE_EPOLL_EVENT) == 0) {
218 if (ngx_add_conn(c) == NGX_ERROR) { 218 if (ngx_add_conn(c) == NGX_ERROR) {
219 ngx_free_connection(c); 219 ngx_free_connection(c);
220 return NGX_ERROR; 220 return NGX_ERROR;
221 } 221 }
222 222
223 } else { 223 } else {
224 if (ngx_add_event(ev, event, 0) == NGX_ERROR) { 224 if (ngx_add_event(ev, event, 0) == NGX_ERROR) {
225 ngx_free_connection(c); 225 ngx_free_connection(c);
226 return NGX_ERROR; 226 return NGX_ERROR;
227 } 227 }
228 } 228 }