]> git.kaiwu.me - nginx.git/commitdiff
nginx-0.1.42-RELEASE import release-0.1.42
authorIgor Sysoev <igor@sysoev.ru>
Tue, 23 Aug 2005 15:36:54 +0000 (15:36 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Tue, 23 Aug 2005 15:36:54 +0000 (15:36 +0000)
    *) 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; the bug had appeared in 0.1.38.

docs/xml/nginx/changes.xml
src/core/nginx.h
src/event/ngx_event_timer.c
src/http/ngx_http.h
src/http/ngx_http_core_module.c
src/http/ngx_http_request.c
src/http/ngx_http_request.h
src/http/ngx_http_script.c
src/http/ngx_http_special_response.c
src/os/unix/ngx_process_cycle.c

index 0dbd65260f5e2de38d4613a4a2059882de4eb6a3..9ba8ffa8d01c0af06bb96db5e4824db32ba3cf8f 100644 (file)
@@ -9,6 +9,35 @@
 <title lang="en">nginx changelog</title>
 
 
+<changes ver="0.1.42" date="23.08.2005">
+
+<change type="bugfix">
+<para lang="ru">
+ÅÓÌÉ URI ÚÁÐÒÏÓÁ ÐÏÌÕÞÁÌÓÑ ÎÕÌÅ×ÏÊ ÄÌÉÎÙ ÐÏÓÌÅ ÏÂÒÁÂÏÔËÉ ÍÏÄÕÌÅÍ
+ngx_http_rewrite_module, ÔÏ × ÍÏÄÕÌÅ ngx_http_proxy_module ÐÒÏÉÓÈÏÄÉÌ
+segmentation fault ÉÌÉ bus error.
+</para>
+<para lang="en">
+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.
+</para>
+</change>
+
+<change type="bugfix">
+<para lang="ru">
+ÄÉÒÅËÔÉ×Á limit_rate ÎÅ ÒÁÂÏÔÁÌÁ ×ÎÕÔÒÉ ÂÌÏËÁ if;
+ÏÛÉÂËÁ ÐÏÑ×ÉÌÁÓØ × 0.1.38.
+</para>
+<para lang="en">
+the "limit_rate" directive did not work inside the "if" block;
+bug appeared in 0.1.38.
+</para>
+</change>
+
+</changes>
+
+
 <changes ver="0.1.41" date="25.07.2005">
 
 <change type="bugfix">
index 281036f3371f75d6b19b8cc71bd162cbdc935c41..8f0a3651386185b3d826254f3b40442c7495c689 100644 (file)
@@ -8,7 +8,7 @@
 #define _NGINX_H_INCLUDED_
 
 
-#define NGINX_VER          "nginx/0.1.41"
+#define NGINX_VER          "nginx/0.1.42"
 
 #define NGINX_VAR          "NGINX"
 #define NGX_NEWPID_EXT     ".newbin"
index 53bbc5f09b36927a4adfbbecd61a409e069a3b9a..4d6c647da5dcd922d6702b8ec571c53507cee72c 100644 (file)
@@ -67,7 +67,7 @@ ngx_event_find_timer(void)
                          (node->key * NGX_TIMER_RESOLUTION - ngx_elapsed_msec);
 #endif
 
-    return timer > 0 ? timer: 0 ;
+    return timer > 0 ? timer : 0 ;
 }
 
 
index 2a62896c50d73a9e930f6c6b931080f4b506524c..5be39363bc9401ac18bf15bc3b94fd4f83ea1955 100644 (file)
@@ -67,6 +67,7 @@ ngx_int_t ngx_http_parse_multi_header_lines(ngx_array_t *headers,
     ngx_str_t *name, ngx_str_t *value);
 
 ngx_int_t ngx_http_find_server_conf(ngx_http_request_t *r);
+void ngx_http_update_location_config(ngx_http_request_t *r);
 void ngx_http_handler(ngx_http_request_t *r);
 void ngx_http_finalize_request(ngx_http_request_t *r, ngx_int_t rc);
 
index cb7c9e8d0cfdb0e64d806dba6f3f6a7663fcf213..852a9bbc046d2c7cf487ec56d4c46a5172565b7b 100644 (file)
@@ -586,27 +586,7 @@ ngx_http_find_location_config(ngx_http_request_t *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_request_t *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_request_t *r,
     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);
index 6c8bf2fa4d47bd5dfd817855cc786e521d094b95..c6a5809484d689c3355a4f913af5e45f37e1b416 100644 (file)
@@ -1696,9 +1696,6 @@ static ngx_int_t
 ngx_http_postponed_handler(ngx_http_request_t *r)
 {
     ngx_int_t                      rc;
-#if 0
-    ngx_http_request_t            *mr;
-#endif
     ngx_http_postponed_request_t  *pr;
 
     ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
index d1ba774ef442ced21c0f3729622373deeba42af4..2e80991028d829c78ade689856cc6e9e058958e4 100644 (file)
@@ -241,9 +241,9 @@ typedef struct {
 typedef struct ngx_http_postponed_request_s  ngx_http_postponed_request_t;
 
 struct ngx_http_postponed_request_s {
-    ngx_http_request_t            *request;
-    ngx_chain_t                   *out;
-    ngx_http_postponed_request_t  *next;
+    ngx_http_request_t               *request;
+    ngx_chain_t                      *out;
+    ngx_http_postponed_request_t     *next;
 };
 
 
index 716a6f054041092dbfdc5a9dd49dacf821b0376d..27c9ce045685082d0e38a850463fdff8d5f5d61c 100644 (file)
@@ -687,6 +687,14 @@ ngx_http_script_regex_end_code(ngx_http_script_engine_t *e)
     if (code->uri) {
         r->uri = e->buf;
 
+        if (r->uri.len == 0) {
+            ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
+                          "the rewritten URI has a zero length");
+            e->ip = ngx_http_script_exit;
+            e->status = NGX_HTTP_INTERNAL_SERVER_ERROR;
+            return;
+        }
+
         if (ngx_http_set_exten(r) != NGX_OK) {
             e->ip = ngx_http_script_exit;
             e->status = NGX_HTTP_INTERNAL_SERVER_ERROR;
@@ -737,6 +745,7 @@ ngx_http_script_if_code(ngx_http_script_engine_t *e)
     if (e->sp->value) {
         if (code->loc_conf) {
             e->request->loc_conf = code->loc_conf;
+            ngx_http_update_location_config(e->request);
         }
 
         e->ip += sizeof(ngx_http_script_if_code_t);
index 14d4c80224ed63e510f10223a73b44715887c4a5..ba3bfcbc6080f0f6925652fbb1368a8dbd7a233f 100644 (file)
@@ -161,7 +161,7 @@ static char error_501_page[] =
 "<html>" CRLF
 "<head><title>501 Method Not Implemented</title></head>" CRLF
 "<body bgcolor=\"white\">" CRLF
-"<center><h1>500 Method Not Implemented</h1></center>" CRLF
+"<center><h1>501 Method Not Implemented</h1></center>" CRLF
 ;
 
 
index 9d056941180ecb5f70e2f915ea40cf49bd20f07f..0c8fdd27ca7665dd84fc3e79f8d5123ea8ef5ae9 100644 (file)
@@ -916,7 +916,7 @@ ngx_worker_process_init(ngx_cycle_t *cycle, ngx_uint_t priority)
 #endif
 
     if (ngx_add_channel_event(cycle, ngx_channel, NGX_READ_EVENT,
-                                             ngx_channel_handler) == NGX_ERROR)
+                              ngx_channel_handler) == NGX_ERROR)
     {
         /* fatal */
         exit(2);