]> git.kaiwu.me - nginx.git/commitdiff
nginx-0.3.33-RELEASE import release-0.3.33
authorIgor Sysoev <igor@sysoev.ru>
Wed, 15 Mar 2006 09:53:04 +0000 (09:53 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Wed, 15 Mar 2006 09:53:04 +0000 (09:53 +0000)
    *) Feature: the "http_503" parameter of the "proxy_next_upstream" or
       "fastcgi_next_upstream" directives.

    *) Bugfix: ngx_http_perl_module did not work with inlined in the
       configuration code, if it was not started with the "sub" word.

    *) Bugfix: in the "post_action" directive.

15 files changed:
auto/os/features
docs/xml/nginx/changes.xml
src/core/nginx.h
src/core/ngx_conf_file.h
src/event/modules/ngx_kqueue_module.c
src/http/modules/ngx_http_fastcgi_module.c
src/http/modules/ngx_http_proxy_module.c
src/http/modules/perl/ngx_http_perl_module.c
src/http/ngx_http_core_module.c
src/http/ngx_http_parse.c
src/http/ngx_http_request.c
src/http/ngx_http_script.c
src/http/ngx_http_script.h
src/http/ngx_http_upstream.c
src/http/ngx_http_upstream.h

index 7028151875e9d84800abeec4f73fafac686a79b2..e8ae033d08b25bbc98b37079c709ba8ec31ffb83 100644 (file)
@@ -120,8 +120,8 @@ if test -z "$NGX_KQUEUE_CHECKED"; then
 
         if [ "$NGX_SYSTEM" = "Darwin" ]; then
 
-            ngx_feature="MacOSX 64-bit kqueue millisecond timeout bug"
-            ngx_feature_name=
+            ngx_feature="Darwin 64-bit kqueue millisecond timeout bug"
+            ngx_feature_name=NGX_DARWIN_KEVENT_BUG
             ngx_feature_run=bug
             ngx_feature_incs="#include <sys/event.h>
 #include <sys/time.h>"
@@ -144,30 +144,11 @@ if test -z "$NGX_KQUEUE_CHECKED"; then
                   if (tv.tv_sec * 1000000 + tv.tv_usec < 900000) return 1;"
 
             . auto/feature
-
-            ngx_macosx_kevent_bug=$ngx_found
         fi
     fi
 fi
 
 
-if [ ".$ngx_macosx_kevent_bug" = .yes ]; then
-
-    cat << END >> $NGX_AUTO_CONFIG_H
-
-#define NGX_MACOSX_KEVENT_BUG_SHIFT   << 32
-
-END
-
-else
-    cat << END >> $NGX_AUTO_CONFIG_H
-
-#define NGX_MACOSX_KEVENT_BUG_SHIFT
-
-END
-fi
-
-
 if [ "$NGX_SYSTEM" = "NetBSD" ]; then
 
     # NetBSD 2.0 incompatibly defines kevent.udata as "intptr_t"
index 168dc552b9a2f0c5cc617b43cedc553fe57d7fc3..cf27af24b5b39f8f463a84e8eeb585f634b1c1b5 100644 (file)
@@ -9,6 +9,41 @@
 <title lang="en">nginx changelog</title>
 
 
+<changes ver="0.3.33" date="15.03.2006">
+
+<change type="feature">
+<para lang="ru">
+ÐÁÒÁÍÅÔÒ http_503 × ÄÉÒÅËÔÉ×ÁÈ proxy_next_upstream ÉÌÉ fastcgi_next_upstream.
+</para>
+<para lang="en">
+the "http_503" parameter of the "proxy_next_upstream" or
+"fastcgi_next_upstream" directives.
+</para>
+</change>
+
+<change type="bugfix">
+<para lang="ru">
+ngx_http_perl_module ÎÅ ÒÁÂÏÔÁÌ ÓÏ ×ÓÔÒÏÅÎÎÙÍ × ËÏÎÆÉÇÕÒÁÃÉÎÎÙÊ ÆÁÊÌ ËÏÄÏÍ,
+ÅÓÌÉ ÏΠÎÅ ÎÁÞÉÎÁÌÓÑ ÓÒÁÚÕ ÖÅ Ó "sub".
+</para>
+<para lang="en">
+ngx_http_perl_module did not work with inlined in the configuration code,
+if it was not started with the "sub" word.
+</para>
+</change>
+
+<change type="bugfix">
+<para lang="ru">
+× ÄÉÒÅËÔÉ×Å post_action.
+</para>
+<para lang="en">
+in the "post_action" directive.
+</para>
+</change>
+
+</changes>
+
+
 <changes ver="0.3.32" date="11.03.2006">
 
 <change type="bugfix">
index 86959ad6a52f768c018adaaf3ca984c5e591c5dc..c5842582a3f2008702d61bbfe1e19090e2c6864b 100644 (file)
@@ -8,7 +8,7 @@
 #define _NGINX_H_INCLUDED_
 
 
-#define NGINX_VER          "nginx/0.3.32"
+#define NGINX_VER          "nginx/0.3.33"
 
 #define NGINX_VAR          "NGINX"
 #define NGX_OLDPID_EXT     ".oldbin"
index 62f365552c37fdf68e574c9cc0e1be2d3af11dd0..a183a57473c25f4fc9161ed7b6c1340504ef234e 100644 (file)
@@ -282,7 +282,7 @@ char *ngx_conf_check_num_bounds(ngx_conf_t *cf, void *post, void *data);
 
 #define ngx_conf_merge_str_value(conf, prev, default)                        \
     if (conf.data == NULL) {                                                 \
-        if (prev.data) {                                                      \
+        if (prev.data) {                                                     \
             conf.len = prev.len;                                             \
             conf.data = prev.data;                                           \
         } else {                                                             \
index f3ca737bebc13e7edbd73a184db3723bc636cbc2..af916759317b17a1f9a5709e3bb65aec897793f1 100644 (file)
@@ -491,16 +491,19 @@ ngx_kqueue_process_events(ngx_cycle_t *cycle, ngx_msec_t timer,
 
     } else {
 
+        ts.tv_sec = timer / 1000;
+        ts.tv_nsec = (timer % 1000) * 1000000;
+
         /*
-         * 64-bit MacOSX kernel has the bug: kernel level ts.tv_nsec is
+         * 64-bit Darwin kernel has the bug: kernel level ts.tv_nsec is
          * the int32_t while user level ts.tv_nsec is the long (64-bit),
          * so on the big endian PowerPC all nanoseconds are lost.
-         * NGX_MACOSX_KEVENT_BUG_SHIFT on these machines is "<< 32".
          */
 
-        ts.tv_sec = timer / 1000;
-        ts.tv_nsec = (long) ((timer % 1000) * 1000000)
-                            NGX_MACOSX_KEVENT_BUG_SHIFT;
+#if (NGX_DARWIN_KEVENT_BUG)
+        ts.tv_nsec <<= 32;
+#endif
+
         tp = &ts;
     }
 
index 715b07020891fa105489aa7b433cf39cf56e897d..66e221f2b71ceec5a31b851feccb607e29f4a54b 100644 (file)
@@ -161,6 +161,7 @@ static ngx_conf_bitmask_t  ngx_http_fastcgi_next_upstream_masks[] = {
     { ngx_string("timeout"), NGX_HTTP_UPSTREAM_FT_TIMEOUT },
     { ngx_string("invalid_header"), NGX_HTTP_UPSTREAM_FT_INVALID_HEADER },
     { ngx_string("http_500"), NGX_HTTP_UPSTREAM_FT_HTTP_500 },
+    { ngx_string("http_503"), NGX_HTTP_UPSTREAM_FT_HTTP_503 },
     { ngx_string("http_404"), NGX_HTTP_UPSTREAM_FT_HTTP_404 },
     { ngx_null_string, 0 }
 };
index 34e6dd197fa0775a524b8c16c6a097c30f99a187..e8d3107533ce63d02206ed492a5a5aa463878143 100644 (file)
@@ -121,6 +121,7 @@ static ngx_conf_bitmask_t  ngx_http_proxy_next_upstream_masks[] = {
     { ngx_string("timeout"), NGX_HTTP_UPSTREAM_FT_TIMEOUT },
     { ngx_string("invalid_header"), NGX_HTTP_UPSTREAM_FT_INVALID_HEADER },
     { ngx_string("http_500"), NGX_HTTP_UPSTREAM_FT_HTTP_500 },
+    { ngx_string("http_503"), NGX_HTTP_UPSTREAM_FT_HTTP_503 },
     { ngx_string("http_404"), NGX_HTTP_UPSTREAM_FT_HTTP_404 },
     { ngx_null_string, 0 }
 };
index 0a982e6e4712651db5520474ca50f0da13fa8f9c..0bcad5ccbe449d438cef6eb524407176db6b8939 100644 (file)
@@ -692,10 +692,18 @@ ngx_http_perl_call_handler(pTHX_ ngx_http_request_t *r, SV *sub,
 static void
 ngx_http_perl_eval_anon_sub(pTHX_ ngx_str_t *handler, SV **sv)
 {
-    if (ngx_strncmp(handler->data, "sub ", 4) == 0
-        || ngx_strncmp(handler->data, "use ", 4) == 0)
+    u_char  *p;
+
+    for (p = handler->data; *p; p++) {
+        if (*p != ' ' && *p != '\t' && *p != CR && *p != LF) {
+            break;
+        }
+    }
+
+    if (ngx_strncmp(p, "sub ", 4) == 0
+        || ngx_strncmp(p, "use ", 4) == 0)
     {
-        *sv = eval_pv((char *) handler->data, FALSE);
+        *sv = eval_pv((char *) p, FALSE);
 
         return;
     }
index 26a1d6962b330ff92bec53412e01f6dbe1476906..8e9d0b3f07b61ed07e5b7e3c2a3b480bf8c2a5c3 100644 (file)
@@ -1003,12 +1003,9 @@ u_char *
 ngx_http_map_uri_to_path(ngx_http_request_t *r, ngx_str_t *path,
     size_t reserved)
 {
-    u_char                       *last;
-    size_t                        alias, len;
-    ngx_http_script_code_pt       code;
-    ngx_http_script_engine_t      e;
-    ngx_http_core_loc_conf_t     *clcf;
-    ngx_http_script_len_code_pt   lcode;
+    u_char                    *last;
+    size_t                     alias;
+    ngx_http_core_loc_conf_t  *clcf;
 
     clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
 
@@ -1021,11 +1018,13 @@ ngx_http_map_uri_to_path(ngx_http_request_t *r, ngx_str_t *path,
         return NULL;
     }
 
+    reserved += r->uri.len - alias + 1;
+
     if (clcf->root_lengths == NULL) {
 
         r->root_length = clcf->root.len;
 
-        path->len = clcf->root.len + r->uri.len - alias + 1 + reserved;
+        path->len = clcf->root.len + reserved;
 
         path->data = ngx_palloc(r->pool, path->len);
         if (path->data == NULL) {
@@ -1033,43 +1032,18 @@ ngx_http_map_uri_to_path(ngx_http_request_t *r, ngx_str_t *path,
         }
 
         last = ngx_copy(path->data, clcf->root.data, clcf->root.len);
-        last = ngx_cpystrn(last, r->uri.data + alias, r->uri.len - alias + 1);
-
-        return last;
-    }
-
-    ngx_memzero(&e, sizeof(ngx_http_script_engine_t));
-
-    e.ip = clcf->root_lengths->elts;
-    e.request = r;
-    e.flushed = 1;
-
-    len = 0;
-
-    while (*(uintptr_t *) e.ip) {
-        lcode = *(ngx_http_script_len_code_pt *) e.ip;
-        len += lcode(&e);
-    }
 
-    r->root_length = len;
-
-    len += r->uri.len - alias + 1 + reserved;
-
-    path->len = len;
-    path->data = ngx_palloc(r->pool, len);
-    if (path->data == NULL) {
-        return NULL;
-    }
-
-    e.ip = clcf->root_values->elts;
-    e.pos = path->data;
+    } else {
+        last = ngx_http_script_run(r, path, clcf->root_lengths->elts, reserved,
+                                   clcf->root_values->elts);
+        if (last == NULL) {
+            return NULL;
+        }
 
-    while (*(uintptr_t *) e.ip) {
-        code = *(ngx_http_script_code_pt *) e.ip;
-        code((ngx_http_script_engine_t *) &e);
+        r->root_length = path->len - reserved;
     }
 
-    last = ngx_cpystrn(e.pos, r->uri.data + alias, r->uri.len - alias + 1);
+    last = ngx_cpystrn(last, r->uri.data + alias, r->uri.len - alias + 1);
 
     return last;
 }
index ba08e59b3fa4cbb400cb9c65a0eb77057fce5005..2ec6979d056988595be7d478a69d65ebebcd868a 100644 (file)
@@ -682,6 +682,8 @@ ngx_http_parse_header_line(ngx_http_request_t *r, ngx_buf_t *b)
         /* end of header line */
         case sw_almost_done:
             switch (ch) {
+            case CR:
+                break;
             case LF:
                 goto done;
             default:
index 348c84bfc06d47a0a257ad4330ab59a6de36aa72..870dd8bcc3bd24d55d4f7e3ba3a9d8613d351dfc 100644 (file)
@@ -2249,6 +2249,9 @@ ngx_http_post_action(ngx_http_request_t *r)
         return NGX_DECLINED;
     }
 
+    ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
+                   "post action: \"%V\"", &clcf->post_action);
+
     r->http_version = NGX_HTTP_VERSION_9;
     r->header_only = 1;
 
index b46c9bb3588dfed9842f96b722c78e9f7ecd79cb..dc7b895386439334f57a1eb4978c32fb38b43e45 100644 (file)
@@ -294,6 +294,44 @@ invalid_variable:
 }
 
 
+u_char *
+ngx_http_script_run(ngx_http_request_t *r, ngx_str_t *value,
+    void *code_lengths, size_t len, void *code_values)
+{
+    ngx_http_script_code_pt      code;
+    ngx_http_script_len_code_pt  lcode;
+    ngx_http_script_engine_t     e;
+
+    ngx_memzero(&e, sizeof(ngx_http_script_engine_t));
+
+    e.ip = code_lengths;
+    e.request = r;
+    e.flushed = 1;
+
+    while (*(uintptr_t *) e.ip) {
+        lcode = *(ngx_http_script_len_code_pt *) e.ip;
+        len += lcode(&e);
+    }
+
+
+    value->len = len;
+    value->data = ngx_palloc(r->pool, len);
+    if (value->data == NULL) {
+        return NULL;
+    }
+
+    e.ip = code_values;
+    e.pos = value->data;
+
+    while (*(uintptr_t *) e.ip) {
+        code = *(ngx_http_script_code_pt *) e.ip;
+        code((ngx_http_script_engine_t *) &e);
+    }
+
+    return e.pos;
+}
+
+
 void
 ngx_http_script_flush_no_cachable_variables(ngx_http_request_t *r,
     ngx_array_t *indices)
index 46e448a9936b20fe374db1ba87c9c5a1376b4da9..5c53aec59b58d244c76b368866bf39cbef41f78c 100644 (file)
@@ -152,6 +152,8 @@ typedef struct {
 
 ngx_uint_t ngx_http_script_variables_count(ngx_str_t *value);
 ngx_int_t ngx_http_script_compile(ngx_http_script_compile_t *sc);
+u_char *ngx_http_script_run(ngx_http_request_t *r, ngx_str_t *value,
+    void *code_lengths, size_t reserved, void *code_values);
 void ngx_http_script_flush_no_cachable_variables(ngx_http_request_t *r,
     ngx_array_t *indices);
 
index 78608181d26b3cfc8ee5a271bc9519fbfef827c9..9fd1a1ebdbc85fa60ae0089d49c927396251182e 100644 (file)
@@ -1947,7 +1947,11 @@ ngx_http_upstream_finalize_request(ngx_http_request_t *r,
 
     r->connection->log->action = "sending to client";
 
-    if (rc == 0 && r == r->main) {
+    if (rc == 0
+        && r == r->main
+             /* not a post_action */
+        && !(r->http_version == NGX_HTTP_VERSION_9 && r->header_only))
+    {
         rc = ngx_http_send_special(r, NGX_HTTP_LAST);
     }
 
index a1780292cd17550d589a48e726c0478edba85bfc..117def185fcb3fe101953627fb07ebd6a16f6da0 100644 (file)
 #include <ngx_http.h>
 
 
-#define NGX_HTTP_UPSTREAM_FT_ERROR           0x02
-#define NGX_HTTP_UPSTREAM_FT_TIMEOUT         0x04
-#define NGX_HTTP_UPSTREAM_FT_INVALID_HEADER  0x08
-#define NGX_HTTP_UPSTREAM_FT_HTTP_500        0x10
-#define NGX_HTTP_UPSTREAM_FT_HTTP_404        0x20
-#define NGX_HTTP_UPSTREAM_FT_BUSY_LOCK       0x40
-#define NGX_HTTP_UPSTREAM_FT_MAX_WAITING     0x80
+#define NGX_HTTP_UPSTREAM_FT_ERROR           0x002
+#define NGX_HTTP_UPSTREAM_FT_TIMEOUT         0x004
+#define NGX_HTTP_UPSTREAM_FT_INVALID_HEADER  0x008
+#define NGX_HTTP_UPSTREAM_FT_HTTP_500        0x010
+#define NGX_HTTP_UPSTREAM_FT_HTTP_503        0x020
+#define NGX_HTTP_UPSTREAM_FT_HTTP_404        0x040
+#define NGX_HTTP_UPSTREAM_FT_BUSY_LOCK       0x080
+#define NGX_HTTP_UPSTREAM_FT_MAX_WAITING     0x100
 
 
 #define NGX_HTTP_UPSTREAM_INVALID_HEADER     40