diff src/http/ngx_http_core_module.c @ 84:991c6e4c7654 NGINX_0_1_42

nginx 0.1.42 *) Bugfix: if the request URI had a zero length after the processing in the ngx_http_proxy_module, then the segmentation fault or bus error occurred in the ngx_http_proxy_module. *) Bugfix: the "limit_rate" directive did not work inside the "if" block; bug appeared in 0.1.38.
author Igor Sysoev <http://sysoev.ru>
date Tue, 23 Aug 2005 00:00:00 +0400
parents 6ae11d59d10e
children e916a291e9aa
line wrap: on
line diff
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -586,27 +586,7 @@ ngx_http_find_location_config(ngx_http_r
         return NGX_HTTP_NOT_FOUND;
     }
 
-    r->connection->log->file = clcf->err_log->file;
-    if (!(r->connection->log->log_level & NGX_LOG_DEBUG_CONNECTION)) {
-        r->connection->log->log_level = clcf->err_log->log_level;
-    }
-
-    if ((ngx_io.flags & NGX_IO_SENDFILE) && clcf->sendfile) {
-        r->connection->sendfile = 1;
-
-    } else {
-        r->connection->sendfile = 0;
-    }
-
-    if (r->keepalive && clcf->keepalive_timeout == 0) {
-        r->keepalive = 0;
-    }
-
-    if (!clcf->tcp_nopush) {
-        /* disable TCP_NOPUSH/TCP_CORK use */
-        r->connection->tcp_nopush = NGX_TCP_NOPUSH_DISABLED;
-    }
-
+    ngx_http_update_location_config(r);
 
     ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
                    "http cl:%z max:%uz",
@@ -640,13 +620,43 @@ ngx_http_find_location_config(ngx_http_r
         return NGX_HTTP_MOVED_PERMANENTLY;
     }
 
+    return NGX_OK;
+}
+
+
+void
+ngx_http_update_location_config(ngx_http_request_t *r)
+{
+    ngx_http_core_loc_conf_t  *clcf;
+
+    clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
+
+    r->connection->log->file = clcf->err_log->file;
+    if (!(r->connection->log->log_level & NGX_LOG_DEBUG_CONNECTION)) {
+        r->connection->log->log_level = clcf->err_log->log_level;
+    }
+
+    if ((ngx_io.flags & NGX_IO_SENDFILE) && clcf->sendfile) {
+        r->connection->sendfile = 1;
+
+    } else {
+        r->connection->sendfile = 0;
+    }
+
+    if (r->keepalive && clcf->keepalive_timeout == 0) {
+        r->keepalive = 0;
+    }
+
+    if (!clcf->tcp_nopush) {
+        /* disable TCP_NOPUSH/TCP_CORK use */
+        r->connection->tcp_nopush = NGX_TCP_NOPUSH_DISABLED;
+    }
+
     r->limit_rate = clcf->limit_rate;
 
     if (clcf->handler) {
         r->content_handler = clcf->handler;
     }
-
-    return NGX_OK;
 }
 
 
@@ -1072,6 +1082,8 @@ ngx_http_internal_redirect(ngx_http_requ
     cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module);
     r->loc_conf = cscf->ctx->loc_conf;
 
+    ngx_http_update_location_config(r);
+
     r->internal = 1;
 
     ngx_http_handler(r);