diff src/http/ngx_http_request.c @ 1810:755e09d5c271

log server address
author Igor Sysoev <igor@sysoev.ru>
date Sun, 30 Dec 2007 08:01:50 +0000
parents bb72f7518992
children 0d9c6fe7502b
line wrap: on
line diff
--- a/src/http/ngx_http_request.c
+++ b/src/http/ngx_http_request.c
@@ -173,7 +173,7 @@ ngx_http_init_connection(ngx_connection_
         return;
     }
 
-    ctx->client = &c->addr_text;
+    ctx->connection = c;
     ctx->request = NULL;
     ctx->current_request = NULL;
 
@@ -2584,13 +2584,17 @@ ngx_http_log_error(ngx_log_t *log, u_cha
 
     ctx = log->data;
 
-    p = ngx_snprintf(buf, len, ", client: %V", ctx->client);
+    p = ngx_snprintf(buf, len, ", client: %V", &ctx->connection->addr_text);
     len -= p - buf;
 
     r = ctx->request;
 
     if (r) {
         return r->log_handler(r, ctx->current_request, p, len);
+
+    } else {
+        p = ngx_snprintf(p, len, ", server: %V",
+                         &ctx->connection->listening->addr_text);
     }
 
     return p;