]> git.kaiwu.me - nginx.git/commitdiff
log server address
authorIgor Sysoev <igor@sysoev.ru>
Sun, 30 Dec 2007 08:01:50 +0000 (08:01 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Sun, 30 Dec 2007 08:01:50 +0000 (08:01 +0000)
src/http/ngx_http.h
src/http/ngx_http_request.c

index d6eb263dd3ca408c66290ef1706dc81c8a4ef27b..41b6c06b5ce7c061002d726e422d3d20e775f4fb 100644 (file)
@@ -47,7 +47,7 @@ typedef u_char *(*ngx_http_log_handler_pt)(ngx_http_request_t *r,
 
 
 struct ngx_http_log_ctx_s {
-    ngx_str_t           *client;
+    ngx_connection_t    *connection;
     ngx_http_request_t  *request;
     ngx_http_request_t  *current_request;
 };
index d4ddf458628b00be507a51e1a0dac1d6d608d09e..8a8b5ac978e95257985cbf483949d6d23befe8dc 100644 (file)
@@ -173,7 +173,7 @@ ngx_http_init_connection(ngx_connection_t *c)
         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_char *buf, size_t len)
 
     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;