diff 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
line wrap: on
line diff
--- a/src/core/ngx_connection.c
+++ b/src/core/ngx_connection.c
@@ -37,23 +37,23 @@ ngx_listening_inet_stream_socket(ngx_con
 
 
     ls->addr_text.data = ngx_pnalloc(cf->pool,
-                                    INET_ADDRSTRLEN - 1 + sizeof(":65535") - 1);
+                                    NGX_INET_ADDRSTRLEN + sizeof(":65535") - 1);
     if (ls->addr_text.data == NULL) {
         return NULL;
     }
 
-    len = ngx_inet_ntop(AF_INET, &addr, ls->addr_text.data, INET_ADDRSTRLEN);
+    len = ngx_inet_ntop(AF_INET, &addr, ls->addr_text.data,
+                        NGX_INET_ADDRSTRLEN);
 
     ls->addr_text.len = ngx_sprintf(ls->addr_text.data + len, ":%d", port)
                         - ls->addr_text.data;
 
     ls->fd = (ngx_socket_t) -1;
-    ls->family = AF_INET;
     ls->type = SOCK_STREAM;
     ls->sockaddr = (struct sockaddr *) sin;
     ls->socklen = sizeof(struct sockaddr_in);
     ls->addr = offsetof(struct sockaddr_in, sin_addr);
-    ls->addr_text_max_len = INET_ADDRSTRLEN;
+    ls->addr_text_max_len = NGX_INET_ADDRSTRLEN;
 
     return ls;
 }
@@ -104,17 +104,16 @@ ngx_set_inherited_sockets(ngx_cycle_t *c
             continue;
         }
 
-        ls[i].addr_text_max_len = INET_ADDRSTRLEN;
+        ls[i].addr_text_max_len = NGX_INET_ADDRSTRLEN;
 
         ls[i].addr_text.data = ngx_pnalloc(cycle->pool,
-                                   INET_ADDRSTRLEN - 1 + sizeof(":65535") - 1);
+                                   NGX_INET_ADDRSTRLEN + sizeof(":65535") - 1);
         if (ls[i].addr_text.data == NULL) {
             return NGX_ERROR;
         }
 
-        ls[i].family = sin->sin_family;
-        len = ngx_sock_ntop(ls[i].family, ls[i].sockaddr,
-                            ls[i].addr_text.data, INET_ADDRSTRLEN);
+        len = ngx_sock_ntop(ls[i].sockaddr, ls[i].addr_text.data,
+                            NGX_INET_ADDRSTRLEN);
         if (len == 0) {
             return NGX_ERROR;
         }
@@ -254,7 +253,7 @@ ngx_open_listening_sockets(ngx_cycle_t *
                 continue;
             }
 
-            s = ngx_socket(ls[i].family, ls[i].type, 0);
+            s = ngx_socket(ls[i].sockaddr->sa_family, ls[i].type, 0);
 
             if (s == -1) {
                 ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno,