Mercurial > hg > nginx-mail
comparison src/core/ngx_connection.c @ 72:b31656313b59 NGINX_0_1_36
nginx 0.1.36
*) Change: if the request header has duplicate the "Host",
"Connection", "Content-Length", or "Authorization" lines, then nginx
now returns the 400 error.
*) Change: the "post_accept_timeout" directive was canceled.
*) Feature: the "default", "af=", "bl=", "deferred", and "bind"
parameters of the "listen" directive.
*) Feature: the FreeBSD accept filters support.
*) Feature: the Linux TCP_DEFER_ACCEPT support.
*) Bugfix: the ngx_http_autoindex_module did not support the file names
in UTF-8.
*) Bugfix: the new log file can be rotated by the -USR1 signal only if
the reconfiguration by the -HUP signal was made twice.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Wed, 15 Jun 2005 00:00:00 +0400 |
parents | 8ad297c88dcb |
children | 962c43960644 |
comparison
equal
deleted
inserted
replaced
71:66f1f40f29d6 | 72:b31656313b59 |
---|---|
60 | 60 |
61 | 61 |
62 ngx_int_t | 62 ngx_int_t |
63 ngx_set_inherited_sockets(ngx_cycle_t *cycle) | 63 ngx_set_inherited_sockets(ngx_cycle_t *cycle) |
64 { | 64 { |
65 size_t len; | 65 size_t len; |
66 ngx_uint_t i; | 66 ngx_uint_t i; |
67 ngx_listening_t *ls; | 67 ngx_listening_t *ls; |
68 struct sockaddr_in *sin; | 68 struct sockaddr_in *sin; |
69 #if (NGX_HAVE_DEFERRED_ACCEPT && defined SO_ACCEPTFILTER) | |
70 socklen_t aflen; | |
71 struct accept_filter_arg af; | |
72 #endif | |
73 #if (NGX_HAVE_DEFERRED_ACCEPT && defined TCP_DEFER_ACCEPT) | |
74 socklen_t tlen; | |
75 int timeout; | |
76 #endif | |
69 | 77 |
70 ls = cycle->listening.elts; | 78 ls = cycle->listening.elts; |
71 for (i = 0; i < cycle->listening.nelts; i++) { | 79 for (i = 0; i < cycle->listening.nelts; i++) { |
72 | 80 |
73 /* AF_INET only */ | 81 /* AF_INET only */ |
96 continue; | 104 continue; |
97 } | 105 } |
98 | 106 |
99 ls[i].addr_text_max_len = INET_ADDRSTRLEN; | 107 ls[i].addr_text_max_len = INET_ADDRSTRLEN; |
100 | 108 |
101 | |
102 ls[i].addr_text.data = ngx_palloc(cycle->pool, INET_ADDRSTRLEN - 1 | 109 ls[i].addr_text.data = ngx_palloc(cycle->pool, INET_ADDRSTRLEN - 1 |
103 + sizeof(":65535") - 1); | 110 + sizeof(":65535") - 1); |
104 if (ls[i].addr_text.data == NULL) { | 111 if (ls[i].addr_text.data == NULL) { |
105 return NGX_ERROR; | 112 return NGX_ERROR; |
106 } | 113 } |
113 } | 120 } |
114 | 121 |
115 ls[i].addr_text.len = ngx_sprintf(ls[i].addr_text.data + len, ":%d", | 122 ls[i].addr_text.len = ngx_sprintf(ls[i].addr_text.data + len, ":%d", |
116 ntohs(sin->sin_port)) | 123 ntohs(sin->sin_port)) |
117 - ls[i].addr_text.data; | 124 - ls[i].addr_text.data; |
125 | |
126 #if (NGX_HAVE_DEFERRED_ACCEPT && defined SO_ACCEPTFILTER) | |
127 | |
128 ngx_memzero(&af, sizeof(struct accept_filter_arg)); | |
129 aflen = sizeof(struct accept_filter_arg); | |
130 | |
131 if (getsockopt(ls[i].fd, SOL_SOCKET, SO_ACCEPTFILTER, &af, &aflen) | |
132 == -1) | |
133 { | |
134 ngx_log_error(NGX_LOG_NOTICE, cycle->log, ngx_errno, | |
135 "getsockopt(SO_ACCEPTFILTER) for %V failed, ignored", | |
136 &ls[i].addr_text); | |
137 continue; | |
138 } | |
139 | |
140 if (aflen < sizeof(struct accept_filter_arg) || af.af_name[0] == '\0') { | |
141 continue; | |
142 } | |
143 | |
144 ls[i].accept_filter = ngx_palloc(cycle->pool, 16); | |
145 if (ls[i].accept_filter == NULL) { | |
146 return NGX_ERROR; | |
147 } | |
148 | |
149 (void) ngx_cpystrn((u_char *) ls[i].accept_filter, | |
150 (u_char *) af.af_name, 16); | |
151 #endif | |
152 | |
153 #if (NGX_HAVE_DEFERRED_ACCEPT && defined TCP_DEFER_ACCEPT) | |
154 | |
155 timeout = 0; | |
156 tlen = sizeof(int); | |
157 | |
158 if (getsockopt(ls[i].fd, IPPROTO_TCP, TCP_DEFER_ACCEPT, &timeout, &tlen) | |
159 == -1) | |
160 { | |
161 ngx_log_error(NGX_LOG_NOTICE, cycle->log, ngx_errno, | |
162 "getsockopt(TCP_DEFER_ACCEPT) for %V failed, ignored", | |
163 &ls[i].addr_text); | |
164 continue; | |
165 } | |
166 | |
167 if (tlen < sizeof(int) || timeout == 0) { | |
168 continue; | |
169 } | |
170 | |
171 ls[i].deferred_accept = 1; | |
172 #endif | |
118 } | 173 } |
119 | 174 |
120 return NGX_OK; | 175 return NGX_OK; |
121 } | 176 } |
122 | 177 |