diff src/http/ngx_http_request.c @ 260:0effe91f6083 NGINX_0_5_0

nginx 0.5.0 *) Change: the parameters in the "%name" form in the "log_format" directive are not supported anymore. *) Change: the "proxy_upstream_max_fails", "proxy_upstream_fail_timeout", "fastcgi_upstream_max_fails", "fastcgi_upstream_fail_timeout", "memcached_upstream_max_fails", and "memcached_upstream_fail_timeout" directives are not supported anymore. *) Feature: the "server" directive in the "upstream" context supports the "max_fails", "fail_timeout", and "down" parameters. *) Feature: the "ip_hash" directive inside the "upstream" block. *) Feature: the WAIT status in the "Auth-Status" header line of the IMAP/POP3 proxy authentication server response. *) Bugfix: nginx could not be built on 64-bit platforms; bug appeared in 0.4.14.
author Igor Sysoev <http://sysoev.ru>
date Mon, 04 Dec 2006 00:00:00 +0300
parents 6ae1357b7b7c
children e0b1d0a6c629
line wrap: on
line diff
--- a/src/http/ngx_http_request.c
+++ b/src/http/ngx_http_request.c
@@ -2409,9 +2409,9 @@ static u_char *
 ngx_http_log_error_handler(ngx_http_request_t *r, ngx_http_request_t *sr,
     u_char *buf, size_t len)
 {
-    u_char                 *p;
-    ngx_http_upstream_t    *u;
-    ngx_peer_connection_t  *peer;
+    char                 *uri_separator;
+    u_char               *p;
+    ngx_http_upstream_t  *u;
 
     if (r->server_name.data) {
         p = ngx_snprintf(buf, len, ", server: %V", &r->server_name);
@@ -2451,14 +2451,19 @@ ngx_http_log_error_handler(ngx_http_requ
 
     u = sr->upstream;
 
-    if (u) {
-        peer = &u->peer;
+    if (u && u->peer.name) {
+
+        uri_separator = "";
+
+#if (NGX_HAVE_UNIX_DOMAIN)
+        if (u->peer.sockaddr && u->peer.sockaddr->sa_family == AF_UNIX) {
+            uri_separator = ":";
+        }
+#endif
 
         p = ngx_snprintf(buf, len, ", upstream: \"%V%V%s%V\"",
-                         &u->conf->schema,
-                         &peer->peers->peer[peer->cur_peer].name,
-                         peer->peers->peer[peer->cur_peer].uri_separator,
-                         &u->uri);
+                         &u->conf->schema, u->peer.name,
+                         uri_separator, &u->uri);
         len -= p - buf;
         buf = p;
     }