Mercurial > hg > nginx-vendor-1-0
comparison src/core/ngx_connection.c @ 28:7ca9bdc82b3f NGINX_0_1_14
nginx 0.1.14
*) Feature: the autoconfiguration directives:
--http-client-body-temp-path=PATH, --http-proxy-temp-path=PATH, and
--http-fastcgi-temp-path=PATH
*) Change: the directory name for the temporary files with the client
request body is specified by directive client_body_temp_path, by
default it is <prefix>/client_body_temp.
*) Feature: the ngx_http_fastcgi_module and the directives:
fastcgi_pass, fastcgi_root, fastcgi_index, fastcgi_params,
fastcgi_connect_timeout, fastcgi_send_timeout, fastcgi_read_timeout,
fastcgi_send_lowat, fastcgi_header_buffer_size, fastcgi_buffers,
fastcgi_busy_buffers_size, fastcgi_temp_path,
fastcgi_max_temp_file_size, fastcgi_temp_file_write_size,
fastcgi_next_upstream, and fastcgi_x_powered_by.
*) Bugfix: the "[alert] zero size buf" error; bug appeared in 0.1.3.
*) Change: the URI must be specified after the host name in the
proxy_pass directive.
*) Change: the %3F symbol in the URI was considered as the argument
string start.
*) Feature: the unix domain sockets support in the
ngx_http_proxy_module.
*) Feature: the ssl_engine and ssl_ciphers directives.
Thanks to Sergey Skvortsov for SSL-accelerator.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Tue, 18 Jan 2005 00:00:00 +0300 |
parents | 45fe5b98a9de |
children | da8c190bdaba |
comparison
equal
deleted
inserted
replaced
27:66901c2556fd | 28:7ca9bdc82b3f |
---|---|
16 in_addr_t addr, | 16 in_addr_t addr, |
17 in_port_t port) | 17 in_port_t port) |
18 { | 18 { |
19 size_t len; | 19 size_t len; |
20 ngx_listening_t *ls; | 20 ngx_listening_t *ls; |
21 struct sockaddr_in *addr_in; | 21 struct sockaddr_in *sin; |
22 | 22 |
23 if (!(ls = ngx_array_push(&cf->cycle->listening))) { | 23 if (!(ls = ngx_array_push(&cf->cycle->listening))) { |
24 return NULL; | 24 return NULL; |
25 } | 25 } |
26 | 26 |
27 ngx_memzero(ls, sizeof(ngx_listening_t)); | 27 ngx_memzero(ls, sizeof(ngx_listening_t)); |
28 | 28 |
29 if (!(addr_in = ngx_pcalloc(cf->pool, sizeof(struct sockaddr_in)))) { | 29 if (!(sin = ngx_pcalloc(cf->pool, sizeof(struct sockaddr_in)))) { |
30 return NULL; | 30 return NULL; |
31 } | 31 } |
32 | 32 |
33 addr_in->sin_family = AF_INET; | 33 sin->sin_family = AF_INET; |
34 addr_in->sin_addr.s_addr = addr; | 34 sin->sin_addr.s_addr = addr; |
35 addr_in->sin_port = htons(port); | 35 sin->sin_port = htons(port); |
36 | 36 |
37 | 37 |
38 ls->addr_text.data = ngx_palloc(cf->pool, | 38 ls->addr_text.data = ngx_palloc(cf->pool, |
39 INET_ADDRSTRLEN - 1 + sizeof(":65535") - 1); | 39 INET_ADDRSTRLEN - 1 + sizeof(":65535") - 1); |
40 if (ls->addr_text.data == NULL) { | 40 if (ls->addr_text.data == NULL) { |
48 | 48 |
49 | 49 |
50 ls->fd = (ngx_socket_t) -1; | 50 ls->fd = (ngx_socket_t) -1; |
51 ls->family = AF_INET; | 51 ls->family = AF_INET; |
52 ls->type = SOCK_STREAM; | 52 ls->type = SOCK_STREAM; |
53 ls->protocol = IPPROTO_IP; | 53 ls->sockaddr = (struct sockaddr *) sin; |
54 ls->sockaddr = (struct sockaddr *) addr_in; | |
55 ls->socklen = sizeof(struct sockaddr_in); | 54 ls->socklen = sizeof(struct sockaddr_in); |
56 ls->addr = offsetof(struct sockaddr_in, sin_addr); | 55 ls->addr = offsetof(struct sockaddr_in, sin_addr); |
57 ls->addr_text_max_len = INET_ADDRSTRLEN; | 56 ls->addr_text_max_len = INET_ADDRSTRLEN; |
58 | 57 |
59 return ls; | 58 return ls; |
63 ngx_int_t ngx_set_inherited_sockets(ngx_cycle_t *cycle) | 62 ngx_int_t ngx_set_inherited_sockets(ngx_cycle_t *cycle) |
64 { | 63 { |
65 size_t len; | 64 size_t len; |
66 ngx_uint_t i; | 65 ngx_uint_t i; |
67 ngx_listening_t *ls; | 66 ngx_listening_t *ls; |
68 struct sockaddr_in *addr_in; | 67 struct sockaddr_in *sin; |
69 | 68 |
70 ls = cycle->listening.elts; | 69 ls = cycle->listening.elts; |
71 for (i = 0; i < cycle->listening.nelts; i++) { | 70 for (i = 0; i < cycle->listening.nelts; i++) { |
72 | 71 |
73 /* AF_INET only */ | 72 /* AF_INET only */ |
84 "socket #%d failed", ls[i].fd); | 83 "socket #%d failed", ls[i].fd); |
85 ls[i].ignore = 1; | 84 ls[i].ignore = 1; |
86 continue; | 85 continue; |
87 } | 86 } |
88 | 87 |
89 addr_in = (struct sockaddr_in *) ls[i].sockaddr; | 88 sin = (struct sockaddr_in *) ls[i].sockaddr; |
90 | 89 |
91 if (addr_in->sin_family != AF_INET) { | 90 if (sin->sin_family != AF_INET) { |
92 ngx_log_error(NGX_LOG_CRIT, cycle->log, ngx_socket_errno, | 91 ngx_log_error(NGX_LOG_CRIT, cycle->log, ngx_socket_errno, |
93 "the inherited socket #%d has " | 92 "the inherited socket #%d has " |
94 "unsupported family", ls[i].fd); | 93 "unsupported family", ls[i].fd); |
95 ls[i].ignore = 1; | 94 ls[i].ignore = 1; |
96 continue; | 95 continue; |
103 + sizeof(":65535") - 1); | 102 + sizeof(":65535") - 1); |
104 if (ls[i].addr_text.data == NULL) { | 103 if (ls[i].addr_text.data == NULL) { |
105 return NGX_ERROR; | 104 return NGX_ERROR; |
106 } | 105 } |
107 | 106 |
108 ls[i].family = addr_in->sin_family; | 107 ls[i].family = sin->sin_family; |
109 len = ngx_sock_ntop(ls[i].family, ls[i].sockaddr, | 108 len = ngx_sock_ntop(ls[i].family, ls[i].sockaddr, |
110 ls[i].addr_text.data, INET_ADDRSTRLEN); | 109 ls[i].addr_text.data, INET_ADDRSTRLEN); |
111 if (len == 0) { | 110 if (len == 0) { |
112 return NGX_ERROR; | 111 return NGX_ERROR; |
113 } | 112 } |
114 | 113 |
115 ls[i].addr_text.len = ngx_sprintf(ls[i].addr_text.data + len, ":%d", | 114 ls[i].addr_text.len = ngx_sprintf(ls[i].addr_text.data + len, ":%d", |
116 ntohs(addr_in->sin_port)) | 115 ntohs(sin->sin_port)) |
117 - ls[i].addr_text.data; | 116 - ls[i].addr_text.data; |
118 } | 117 } |
119 | 118 |
120 return NGX_OK; | 119 return NGX_OK; |
121 } | 120 } |
161 /* TODO: deferred accept */ | 160 /* TODO: deferred accept */ |
162 | 161 |
163 continue; | 162 continue; |
164 } | 163 } |
165 | 164 |
166 s = ngx_socket(ls[i].family, ls[i].type, ls[i].protocol); | 165 s = ngx_socket(ls[i].family, ls[i].type, 0); |
167 | 166 |
168 if (s == -1) { | 167 if (s == -1) { |
169 ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno, | 168 ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno, |
170 ngx_socket_n " %V failed", &ls[i].addr_text); | 169 ngx_socket_n " %V failed", &ls[i].addr_text); |
171 return NGX_ERROR; | 170 return NGX_ERROR; |
311 | 310 |
312 void ngx_close_connection(ngx_connection_t *c) | 311 void ngx_close_connection(ngx_connection_t *c) |
313 { | 312 { |
314 ngx_socket_t fd; | 313 ngx_socket_t fd; |
315 | 314 |
316 if (c->pool == NULL) { | 315 if (c->fd == -1) { |
317 ngx_log_error(NGX_LOG_ALERT, c->log, 0, "connection already closed"); | 316 ngx_log_error(NGX_LOG_ALERT, c->log, 0, "connection already closed"); |
318 return; | 317 return; |
319 } | 318 } |
320 | 319 |
321 if (c->read->timer_set) { | 320 if (c->read->timer_set) { |
386 | 385 |
387 fd = c->fd; | 386 fd = c->fd; |
388 c->fd = (ngx_socket_t) -1; | 387 c->fd = (ngx_socket_t) -1; |
389 c->data = NULL; | 388 c->data = NULL; |
390 | 389 |
391 ngx_destroy_pool(c->pool); | |
392 | |
393 if (ngx_close_socket(fd) == -1) { | 390 if (ngx_close_socket(fd) == -1) { |
394 | 391 |
395 /* we use ngx_cycle->log because c->log was in c->pool */ | 392 /* we use ngx_cycle->log because c->log was in c->pool */ |
396 | 393 |
397 ngx_log_error(NGX_LOG_ALERT, ngx_cycle->log, ngx_socket_errno, | 394 ngx_log_error(NGX_LOG_ALERT, ngx_cycle->log, ngx_socket_errno, |