diff src/http/ngx_http_request.c @ 190:3689cd4e3228 NGINX_0_3_42

nginx 0.3.42 *) Feature: the "bind" option of the "listen" directive in IMAP/POP3 proxy. *) Bugfix: if the same capture in the "rewrite" directive was used more then once. *) Bugfix: the $sent_http_content_type, $sent_http_content_length, $sent_http_last_modified, $sent_http_connection, $sent_http_keep_alive, and $sent_http_transfer_encoding variables were not written to access log. *) Bugfix: the $sent_http_cache_control returned value of the single "Cache-Control" response header line.
author Igor Sysoev <http://sysoev.ru>
date Wed, 26 Apr 2006 00:00:00 +0400
parents af37b7cb6698
children 003bd800ec2a
line wrap: on
line diff
--- a/src/http/ngx_http_request.c
+++ b/src/http/ngx_http_request.c
@@ -201,11 +201,11 @@ ngx_http_init_connection(ngx_connection_
 }
 
 
-static
-void ngx_http_init_request(ngx_event_t *rev)
+static void
+ngx_http_init_request(ngx_event_t *rev)
 {
+    socklen_t                   len;
     ngx_uint_t                  i;
-    socklen_t                   len;
     struct sockaddr_in          sin;
     ngx_connection_t           *c;
     ngx_http_request_t         *r;
@@ -274,7 +274,7 @@ void ngx_http_init_request(ngx_event_t *
 
     /* AF_INET only */
 
-    hip = c->servers;
+    hip = c->listening->servers;
     hia = hip->addrs;
 
     r->port = hip->port;
@@ -311,7 +311,7 @@ void ngx_http_init_request(ngx_event_t *
             r->in_addr = sin.sin_addr.s_addr;
         }
 
-        /* the last in_port->addrs address is "*" */
+        /* the last address is "*" */
 
         for ( /* void */ ; i < hip->naddrs - 1; i++) {
             if (hia[i].addr == r->in_addr) {
@@ -1405,6 +1405,12 @@ ngx_http_finalize_request(ngx_http_reque
         || rc == NGX_HTTP_REQUEST_TIME_OUT
         || r->connection->error)
     {
+        if (rc == NGX_HTTP_CLIENT_CLOSED_REQUEST
+            && r->headers_out.status == 0)
+        {
+            r->headers_out.status = NGX_HTTP_CLIENT_CLOSED_REQUEST;
+        }
+
         if (ngx_http_post_action(r) == NGX_OK) {
             return;
         }