diff src/http/ngx_http_request.c @ 126:df17fbafec8f NGINX_0_3_10

nginx 0.3.10 *) Change: the "valid_referers" directive and the "$invalid_referer" variable were moved to the new ngx_http_referer_module from the ngx_http_rewrite_module. *) Change: the "$apache_bytes_sent" variable name was changed to "$body_bytes_sent". *) Feature: the "$sent_http_..." variables. *) Feature: the "if" directive supports the "=" and "!=" operations. *) Feature: the "proxy_pass" directive supports the HTTPS protocol. *) Feature: the "proxy_set_body" directive. *) Feature: the "post_action" directive. *) Feature: the ngx_http_empty_gif_module. *) Feature: the "worker_cpu_affinity" directive for Linux. *) Bugfix: the "rewrite" directive did not unescape URI part in redirect, now it is unescaped except the %00-%25 and %7F-%FF characters. *) Bugfix: nginx could not be built by the icc 9.0 compiler. *) Bugfix: if the SSI was enabled for zero size static file, then the chunked response was encoded incorrectly.
author Igor Sysoev <http://sysoev.ru>
date Tue, 15 Nov 2005 00:00:00 +0300
parents d25a1d6034f1
children 82d695e3d662
line wrap: on
line diff
--- a/src/http/ngx_http_request.c
+++ b/src/http/ngx_http_request.c
@@ -51,7 +51,6 @@ static u_char *ngx_http_log_error_handle
 #if (NGX_HTTP_SSL)
 static void ngx_http_ssl_handshake(ngx_event_t *rev);
 static void ngx_http_ssl_handshake_handler(ngx_connection_t *c);
-static void ngx_http_ssl_close_handler(ngx_event_t *ev);
 #endif
 
 
@@ -451,7 +450,7 @@ ngx_http_ssl_handshake(ngx_event_t *rev)
         return;
     }
 
-    n = recv(c->fd, buf, 1, MSG_PEEK); 
+    n = recv(c->fd, buf, 1, MSG_PEEK);
 
     if (n == -1 && ngx_socket_errno == NGX_EAGAIN) {
         return;
@@ -1346,7 +1345,7 @@ ngx_http_find_virtual_server(ngx_http_re
         }
 
         if (rc < 0) {
-            /* the server names are lexicographically sorted */ 
+            /* the server names are lexicographically sorted */
             break;
         }
     }
@@ -1520,6 +1519,13 @@ ngx_http_finalize_request(ngx_http_reque
         return;
     }
 
+    clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
+
+    if (clcf->post_action.data) {
+        ngx_http_internal_redirect(r, &clcf->post_action, NULL);
+        return;
+    }
+
     if (r->connection->read->timer_set) {
         ngx_del_timer(r->connection->read);
     }
@@ -1539,8 +1545,6 @@ ngx_http_finalize_request(ngx_http_reque
         return;
     }
 
-    clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
-
     if (!ngx_terminate
          && !ngx_exiting
          && r->keepalive != 0
@@ -1894,7 +1898,7 @@ ngx_http_set_keepalive(ngx_http_request_
              * If the large header buffers were allocated while the previous
              * request processing then we do not use c->buffer for
              * the pipelined request (see ngx_http_init_request()).
-             * 
+             *
              * Now we would move the large header buffers to the free list.
              */
 
@@ -2178,7 +2182,7 @@ ngx_http_keepalive_handler(ngx_event_t *
 
 static void
 ngx_http_set_lingering_close(ngx_http_request_t *r)
-{   
+{
     ngx_event_t               *rev, *wev;
     ngx_connection_t          *c;
     ngx_http_core_loc_conf_t  *clcf;
@@ -2248,6 +2252,7 @@ ngx_http_lingering_close_handler(ngx_eve
                    "http lingering close handler");
 
     if (rev->timedout) {
+        c->timedout = 1;
         ngx_http_close_request(r, 0);
         return;
     }
@@ -2423,8 +2428,7 @@ ngx_http_close_connection(ngx_connection
 
     if (c->ssl) {
         if (ngx_ssl_shutdown(c) == NGX_AGAIN) {
-            c->read->handler = ngx_http_ssl_close_handler;
-            c->write->handler = ngx_http_ssl_close_handler;
+            c->ssl->handler = ngx_http_close_connection;
             return;
         }
     }
@@ -2443,27 +2447,6 @@ ngx_http_close_connection(ngx_connection
 }
 
 
-#if (NGX_HTTP_SSL)
-
-static void
-ngx_http_ssl_close_handler(ngx_event_t *ev)
-{
-    ngx_connection_t  *c;
-
-    c = ev->data;
-
-    ngx_log_debug0(NGX_LOG_DEBUG_HTTP, ev->log, 0, "http ssl close handler");
-
-    if (ngx_ssl_shutdown(c) == NGX_AGAIN) {
-        return;
-    }
-
-    ngx_http_close_connection(c);
-}
-
-#endif
-
-
 static u_char *
 ngx_http_log_error(ngx_log_t *log, u_char *buf, size_t len)
 {