comparison src/core/ngx_connection.c @ 400:6ebbca3d5ed7 NGINX_0_7_12

nginx 0.7.12 *) Feature: the "server_name" directive supports empty name "". *) Feature: the "gzip_disable" directive supports special "msie6" mask. *) Bugfix: if the "max_fails=0" parameter was used in upstream with several servers, then a worker process exited on a SIGFPE signal. Thanks to Maxim Dounin. *) Bugfix: a request body was dropped while redirection via an "error_page" directive. *) Bugfix: a full response was returned for request method HEAD while redirection via an "error_page" directive. *) Bugfix: the $r->header_in() method did not return value of the "Host", "User-Agent", and "Connection" request header lines; the bug had appeared in 0.7.0.
author Igor Sysoev <http://sysoev.ru>
date Tue, 26 Aug 2008 00:00:00 +0400
parents 984bb0b1399b
children b246022ef454
comparison
equal deleted inserted replaced
399:59e324e4d6d3 400:6ebbca3d5ed7
35 sin->sin_addr.s_addr = addr; 35 sin->sin_addr.s_addr = addr;
36 sin->sin_port = htons(port); 36 sin->sin_port = htons(port);
37 37
38 38
39 ls->addr_text.data = ngx_pnalloc(cf->pool, 39 ls->addr_text.data = ngx_pnalloc(cf->pool,
40 INET_ADDRSTRLEN - 1 + sizeof(":65535") - 1); 40 NGX_INET_ADDRSTRLEN + sizeof(":65535") - 1);
41 if (ls->addr_text.data == NULL) { 41 if (ls->addr_text.data == NULL) {
42 return NULL; 42 return NULL;
43 } 43 }
44 44
45 len = ngx_inet_ntop(AF_INET, &addr, ls->addr_text.data, INET_ADDRSTRLEN); 45 len = ngx_inet_ntop(AF_INET, &addr, ls->addr_text.data,
46 NGX_INET_ADDRSTRLEN);
46 47
47 ls->addr_text.len = ngx_sprintf(ls->addr_text.data + len, ":%d", port) 48 ls->addr_text.len = ngx_sprintf(ls->addr_text.data + len, ":%d", port)
48 - ls->addr_text.data; 49 - ls->addr_text.data;
49 50
50 ls->fd = (ngx_socket_t) -1; 51 ls->fd = (ngx_socket_t) -1;
51 ls->family = AF_INET;
52 ls->type = SOCK_STREAM; 52 ls->type = SOCK_STREAM;
53 ls->sockaddr = (struct sockaddr *) sin; 53 ls->sockaddr = (struct sockaddr *) sin;
54 ls->socklen = sizeof(struct sockaddr_in); 54 ls->socklen = sizeof(struct sockaddr_in);
55 ls->addr = offsetof(struct sockaddr_in, sin_addr); 55 ls->addr = offsetof(struct sockaddr_in, sin_addr);
56 ls->addr_text_max_len = INET_ADDRSTRLEN; 56 ls->addr_text_max_len = NGX_INET_ADDRSTRLEN;
57 57
58 return ls; 58 return ls;
59 } 59 }
60 60
61 61
102 "unsupported family", ls[i].fd); 102 "unsupported family", ls[i].fd);
103 ls[i].ignore = 1; 103 ls[i].ignore = 1;
104 continue; 104 continue;
105 } 105 }
106 106
107 ls[i].addr_text_max_len = INET_ADDRSTRLEN; 107 ls[i].addr_text_max_len = NGX_INET_ADDRSTRLEN;
108 108
109 ls[i].addr_text.data = ngx_pnalloc(cycle->pool, 109 ls[i].addr_text.data = ngx_pnalloc(cycle->pool,
110 INET_ADDRSTRLEN - 1 + sizeof(":65535") - 1); 110 NGX_INET_ADDRSTRLEN + sizeof(":65535") - 1);
111 if (ls[i].addr_text.data == NULL) { 111 if (ls[i].addr_text.data == NULL) {
112 return NGX_ERROR; 112 return NGX_ERROR;
113 } 113 }
114 114
115 ls[i].family = sin->sin_family; 115 len = ngx_sock_ntop(ls[i].sockaddr, ls[i].addr_text.data,
116 len = ngx_sock_ntop(ls[i].family, ls[i].sockaddr, 116 NGX_INET_ADDRSTRLEN);
117 ls[i].addr_text.data, INET_ADDRSTRLEN);
118 if (len == 0) { 117 if (len == 0) {
119 return NGX_ERROR; 118 return NGX_ERROR;
120 } 119 }
121 120
122 ls[i].addr_text.len = ngx_sprintf(ls[i].addr_text.data + len, ":%d", 121 ls[i].addr_text.len = ngx_sprintf(ls[i].addr_text.data + len, ":%d",
252 /* TODO: deferred accept */ 251 /* TODO: deferred accept */
253 252
254 continue; 253 continue;
255 } 254 }
256 255
257 s = ngx_socket(ls[i].family, ls[i].type, 0); 256 s = ngx_socket(ls[i].sockaddr->sa_family, ls[i].type, 0);
258 257
259 if (s == -1) { 258 if (s == -1) {
260 ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno, 259 ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno,
261 ngx_socket_n " %V failed", &ls[i].addr_text); 260 ngx_socket_n " %V failed", &ls[i].addr_text);
262 return NGX_ERROR; 261 return NGX_ERROR;