[PATCH] Add missing NGX_HAVE_UNIX_DOMAIN checks

Piotr Sikora piotr at cloudflare.com
Wed Mar 27 20:54:57 UTC 2013


Hey,
I've noticed that Maxim's recent commit (r5142) was missing a check
for AF_UNIX existence (NGX_HAVE_UNIX_DOMAIN) and it seems
that the check was missing in a few other places as well.

Attached patch adds those, even though apparently they aren't really needed.

Best regards,
Piotr Sikora


diff -r afea5259e05c src/event/ngx_event_connect.c
--- a/src/event/ngx_event_connect.c     Wed Mar 27 15:18:34 2013 +0000
+++ b/src/event/ngx_event_connect.c     Wed Mar 27 13:41:59 2013 -0700
@@ -84,6 +84,7 @@

     c->log_error = pc->log_error;

+#if (NGX_HAVE_UNIX_DOMAIN)
     if (pc->sockaddr->sa_family == AF_UNIX) {
         c->tcp_nopush = NGX_TCP_NOPUSH_DISABLED;
         c->tcp_nodelay = NGX_TCP_NODELAY_DISABLED;
@@ -93,6 +94,7 @@
         c->sendfile = 0;
 #endif
     }
+#endif

     rev = c->read;
     wev = c->write;
diff -r afea5259e05c src/http/modules/ngx_http_proxy_module.c
--- a/src/http/modules/ngx_http_proxy_module.c  Wed Mar 27 15:18:34 2013 +0000
+++ b/src/http/modules/ngx_http_proxy_module.c  Wed Mar 27 13:41:59 2013 -0700
@@ -3767,7 +3767,9 @@
 static void
 ngx_http_proxy_set_vars(ngx_url_t *u, ngx_http_proxy_vars_t *v)
 {
+#if (NGX_HAVE_UNIX_DOMAIN)
     if (u->family != AF_UNIX) {
+#endif

         if (u->no_port || u->port == u->default_port) {

@@ -3788,11 +3790,13 @@

         v->key_start.len += v->host_header.len;

+#if (NGX_HAVE_UNIX_DOMAIN)
     } else {
         ngx_str_set(&v->host_header, "localhost");
         ngx_str_null(&v->port);
         v->key_start.len += sizeof("unix:") - 1 + u->host.len + 1;
     }
+#endif

     v->uri = u->uri;
 }
diff -r afea5259e05c src/mail/ngx_mail_auth_http_module.c
--- a/src/mail/ngx_mail_auth_http_module.c      Wed Mar 27 15:18:34 2013 +0000
+++ b/src/mail/ngx_mail_auth_http_module.c      Wed Mar 27 13:41:59 2013 -0700
@@ -1416,12 +1416,16 @@

     ahcf->peer = u.addrs;

+#if (NGX_HAVE_UNIX_DOMAIN)
     if (u.family != AF_UNIX) {
+#endif
         ahcf->host_header = u.host;

+#if (NGX_HAVE_UNIX_DOMAIN)
     } else {
         ngx_str_set(&ahcf->host_header, "localhost");
     }
+#endif

     ahcf->uri = u.uri;



More information about the nginx-devel mailing list