]> git.kaiwu.me - nginx.git/commitdiff
nginx-0.3.26-RELEASE import release-0.3.26
authorIgor Sysoev <igor@sysoev.ru>
Fri, 3 Feb 2006 12:58:48 +0000 (12:58 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Fri, 3 Feb 2006 12:58:48 +0000 (12:58 +0000)
    *) Change: the "optimize_host_names" directive was renamed to the
       "optimize_server_names".

    *) Bugfix: if in the "proxy_pass" directive was no the URI part, then
       the main request URI was transferred to a backend while proxying the
       SSI subrequest.

docs/xml/nginx/changes.xml
src/core/nginx.h
src/http/modules/ngx_http_proxy_module.c
src/http/modules/ngx_http_ssi_filter_module.c
src/http/modules/ngx_http_ssi_filter_module.h
src/http/ngx_http.c
src/http/ngx_http_core_module.c
src/http/ngx_http_core_module.h
src/os/unix/ngx_readv_chain.c
src/os/unix/ngx_recv.c

index 22d1e0914141b03e995a33442569f4df6bc91511..19593eb787dc076dcabec58d0e0ae43b0380fa2c 100644 (file)
@@ -9,6 +9,31 @@
 <title lang="en">nginx changelog</title>
 
 
+<changes ver="0.3.26" date="03.02.2006">
+
+<change type="change">
+<para lang="ru">
+ÄÉÒÅËÔÉ×Á optimize_host_names ÐÅÒÅÉÍÅÎÏ×ÁÎÁ × optimize_server_names.
+</para>
+<para lang="en">
+the "optimize_host_names" directive was renamed to the "optimize_server_names".
+</para>
+</change>
+
+<change type="bugfix">
+<para lang="ru">
+ÐÒÉ ÐÒÏËÓÉÒÏ×ÁÎÉÉ ÐÏÄÚÁÐÒÏÓÁ × SSI ÂÜËÅÎÄÕ ÐÅÒÅÄÁ×ÁÌÓÑ URI ÏÓÎÏ×ÎÏÇÏ ÚÁÐÒÏÓÁ,
+ÅÓÌÉ × ÄÉÒÅËÔÉ×Å proxy_pass ÏÔÓÕÔÓÔ×Ï×ÁÌ URI.
+</para>
+<para lang="en">
+if in the "proxy_pass" directive was no the URI part, then the main request
+URI was transferred to a backend while proxying the SSI subrequest.
+</para>
+</change>
+
+</changes>
+
+
 <changes ver="0.3.25" date="01.02.2006">
 
 <change type="bugfix">
@@ -53,13 +78,13 @@ to a client.
 ÐÒÉ ÉÓÐÏÌØÚÏ×ÁÎÉÉ ÂÏÌØÛÏÇÏ ËÏÌÉÞÅÓÔ×Á ÌÏÇ-ÆÁÊÌÏ× ÐÒÏÉÓÈÏÄÉÌÁ ÕÔÅÞËÁ ÐÁÍÑÔÉ. 
 </para>
 <para lang="en">
-the memory leaks were occuring if many log files were used.
+the memory leaks were occurring if many log files were used.
 </para>
 </change>
 
 <change type="bugfix">
 <para lang="ru">
-×ÎÔÕÒÉ ÏÄÎÏÇÏ location ÒÁÂÏÔÁÌÁ ÔÏÌØËÏ ÐÅÒ×ÁÑ ÄÉÒÅËÔÉ×Á proxy_redirect.
+×ÎÕÔÒÉ ÏÄÎÏÇÏ location ÒÁÂÏÔÁÌÁ ÔÏÌØËÏ ÐÅÒ×ÁÑ ÄÉÒÅËÔÉ×Á proxy_redirect.
 </para>
 <para lang="en">
 the first "proxy_redirect" directive was working inside one location.
@@ -69,7 +94,7 @@ the first "proxy_redirect" directive was working inside one location.
 <change type="bugfix">
 <para lang="ru">
 ÎÁ 64-ÂÉÔÎÙÈ ÐÌÁÔÆÏÒÍÁÈ ÐÒÉ ÓÔÁÒÔÅ ÍÏÇ ÐÒÏÉÚÏÊÔÉ segmentation fault,
-ÅÓÌÉ ÉÓÐÏÌØÚÏ×ÁÌÏÓØ ÂÏÌØÛÏÅ ËÏÌÉÞÉÓÔ×Ï ÉͣΠנÄÉÒÅËÔÉ×ÁÈ server_name;
+ÅÓÌÉ ÉÓÐÏÌØÚÏ×ÁÌÏÓØ ÂÏÌØÛÏÅ ËÏÌÉÞÅÓÔ×Ï ÉͣΠנÄÉÒÅËÔÉ×ÁÈ server_name;
 ÏÛÉÂËÁ ÐÏÑ×ÉÌÁÓØ × 0.3.18.
 </para>
 <para lang="en">
@@ -163,7 +188,7 @@ the ngx_http_perl_module.
 
 <change type="change">
 <para lang="ru">
-ÄÉÒÅËÔÉ×Á valid_referers ÒÁÚÒÅÛÁÅÔ ÉÓÐÏÌØÚÏ×ÁÔØ ÒÅÆÅÒÅÒÙ cÏ×ÓÅÍ ÂÅÚ URI.
+ÄÉÒÅËÔÉ×Á valid_referers ÒÁÚÒÅÛÁÅÔ ÉÓÐÏÌØÚÏ×ÁÔØ ÒÅÆÅÒÅÒÙ ÓÏ×ÓÅÍ ÂÅÚ URI.
 </para>
 <para lang="en">
 the "valid_referers" directive allows the referreres without URI part.
index 66df80dff1eb058ffe762c09382a523d313ff4f8..c8ddddbd9b2ff9db535e7ceee1ff595949240d37 100644 (file)
@@ -8,7 +8,7 @@
 #define _NGINX_H_INCLUDED_
 
 
-#define NGINX_VER          "nginx/0.3.25"
+#define NGINX_VER          "nginx/0.3.26"
 
 #define NGINX_VAR          "NGINX"
 #define NGX_OLDPID_EXT     ".oldbin"
index c85f587f60f28f1510563c8d312bc5d7bc3bb4c8..579da9465e3c85979d1b2016c85297eb6e264999 100644 (file)
@@ -442,7 +442,7 @@ static ngx_int_t
 ngx_http_proxy_create_request(ngx_http_request_t *r)
 {
     size_t                        len, loc_len, body_len;
-    ngx_uint_t                    i, key;
+    ngx_uint_t                    i, key, unparsed_uri;
     uintptr_t                     escape;
     ngx_buf_t                    *b;
     ngx_str_t                    *hh, method;
@@ -488,10 +488,12 @@ ngx_http_proxy_create_request(ngx_http_request_t *r)
 
     loc_len = r->valid_location ? u->conf->location.len : 0;
 
-    if (u->conf->uri.len == 0 && r->valid_unparsed_uri) {
+    if (u->conf->uri.len == 0 && r->valid_unparsed_uri && r == r->main) {
+        unparsed_uri = 1;
         len += r->unparsed_uri.len;
 
     } else {
+        unparsed_uri = 0;
         if (r->quoted_uri) {
             escape = 2 * ngx_escape_uri(NULL, r->uri.data + loc_len,
                                         r->uri.len - loc_len, NGX_ESCAPE_URI);
@@ -581,7 +583,7 @@ ngx_http_proxy_create_request(ngx_http_request_t *r)
 
     u->uri.data = b->last;
 
-    if (u->conf->uri.len == 0 && r->valid_unparsed_uri) {
+    if (unparsed_uri) {
         b->last = ngx_copy(b->last, r->unparsed_uri.data, r->unparsed_uri.len);
 
     } else {
index 66b2b96dc6fb56bd4aae570381f5ffb104b9b329..4ec6749713a51aef3dd37e58f631a486f9ac9a76 100644 (file)
@@ -761,7 +761,7 @@ ngx_http_ssi_output(ngx_http_request_t *r, ngx_http_ssi_ctx_t *ctx)
 static ngx_int_t
 ngx_http_ssi_parse(ngx_http_request_t *r, ngx_http_ssi_ctx_t *ctx)
 {
-    u_char                *p, *last, *copy_end, ch;
+    u_char                *p, *value, *last, *copy_end, ch;
     size_t                 looked;
     ngx_http_ssi_state_e   state;
 
@@ -914,12 +914,13 @@ ngx_http_ssi_parse(ngx_http_request_t *r, ngx_http_ssi_ctx_t *ctx)
             default:
                 ctx->command.len = 1;
                 ctx->command.data = ngx_palloc(r->pool,
-                                               NGX_HTTP_SSI_COMMAND_LEN + 1);
+                                               NGX_HTTP_SSI_COMMAND_LEN);
                 if (ctx->command.data == NULL) {
                     return NGX_ERROR;
                 }
 
                 ctx->command.data[0] = ch;
+
                 ctx->key = 0;
                 ctx->key = ngx_hash(ctx->key, ch);
 
@@ -944,17 +945,17 @@ ngx_http_ssi_parse(ngx_http_request_t *r, ngx_http_ssi_ctx_t *ctx)
                 break;
 
             default:
-                ctx->command.data[ctx->command.len++] = ch;
-                ctx->key = ngx_hash(ctx->key, ch);
-
                 if (ctx->command.len == NGX_HTTP_SSI_COMMAND_LEN) {
                     ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
-                                  "the \"%V\" SSI command is too long",
-                                  &ctx->command);
+                                  "the \"%V%c...\" SSI command is too long",
+                                  &ctx->command, ch);
 
                     state = ssi_error_state;
                     break;
                 }
+
+                ctx->command.data[ctx->command.len++] = ch;
+                ctx->key = ngx_hash(ctx->key, ch);
             }
 
             break;
@@ -979,7 +980,7 @@ ngx_http_ssi_parse(ngx_http_request_t *r, ngx_http_ssi_ctx_t *ctx)
 
                 ctx->param->key.len = 1;
                 ctx->param->key.data = ngx_palloc(r->pool,
-                                                  NGX_HTTP_SSI_PARAM_LEN + 1);
+                                                  NGX_HTTP_SSI_PARAM_LEN);
                 if (ctx->param->key.data == NULL) {
                     return NGX_ERROR;
                 }
@@ -987,10 +988,16 @@ ngx_http_ssi_parse(ngx_http_request_t *r, ngx_http_ssi_ctx_t *ctx)
                 ctx->param->key.data[0] = ch;
 
                 ctx->param->value.len = 0;
-                ctx->param->value.data = ngx_palloc(r->pool,
-                                                    ctx->value_len + 1);
-                if (ctx->param->value.data == NULL) {
-                    return NGX_ERROR;
+
+                if (ctx->value_buf == NULL) {
+                    ctx->param->value.data = ngx_palloc(r->pool,
+                                                        ctx->value_len);
+                    if (ctx->param->value.data == NULL) {
+                        return NGX_ERROR;
+                    }
+
+                } else {
+                    ctx->param->value.data = ctx->value_buf;
                 }
 
                 state = ssi_param_state;
@@ -1022,16 +1029,16 @@ ngx_http_ssi_parse(ngx_http_request_t *r, ngx_http_ssi_ctx_t *ctx)
                 break;
 
             default:
-                ctx->param->key.data[ctx->param->key.len++] = ch;
-
                 if (ctx->param->key.len == NGX_HTTP_SSI_PARAM_LEN) {
                     state = ssi_error_state;
                     ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
-                                  "too long \"%V\" parameter in "
+                                  "too long \"%V%c...\" parameter in "
                                   "\"%V\" SSI command",
-                                  &ctx->param->key, &ctx->command);
+                                  &ctx->param->key, ch, &ctx->command);
                     break;
                 }
+
+                ctx->param->key.data[ctx->param->key.len++] = ch;
             }
 
             break;
@@ -1109,17 +1116,17 @@ ngx_http_ssi_parse(ngx_http_request_t *r, ngx_http_ssi_ctx_t *ctx)
                 /* fall through */
 
             default:
-                ctx->param->value.data[ctx->param->value.len++] = ch;
-
                 if (ctx->param->value.len == ctx->value_len) {
                     ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
-                                  "too long \"%V\" value of \"%V\" parameter "
-                                  "in \"%V\" SSI command",
-                                  &ctx->param->value, &ctx->param->key,
+                                  "too long \"%V%c...\" value of \"%V\" "
+                                  "parameter in \"%V\" SSI command",
+                                  &ctx->param->value, ch, &ctx->param->key,
                                   &ctx->command);
                     state = ssi_error_state;
                     break;
                 }
+
+                ctx->param->value.data[ctx->param->value.len++] = ch;
             }
 
             break;
@@ -1137,17 +1144,17 @@ ngx_http_ssi_parse(ngx_http_request_t *r, ngx_http_ssi_ctx_t *ctx)
                 /* fall through */
 
             default:
-                ctx->param->value.data[ctx->param->value.len++] = ch;
-
                 if (ctx->param->value.len == ctx->value_len) {
                     ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
-                                  "too long \"%V\" value of \"%V\" parameter "
-                                  "in \"%V\" SSI command",
-                                  &ctx->param->value, &ctx->param->key,
+                                  "too long \"%V%c...\" value of \"%V\" "
+                                  "parameter in \"%V\" SSI command",
+                                  &ctx->param->value, ch, &ctx->param->key,
                                   &ctx->command);
                     state = ssi_error_state;
                     break;
                 }
+
+                ctx->param->value.data[ctx->param->value.len++] = ch;
             }
 
             break;
@@ -1169,23 +1176,38 @@ ngx_http_ssi_parse(ngx_http_request_t *r, ngx_http_ssi_ctx_t *ctx)
                 break;
             }
 
-            ctx->param->value.data[ctx->param->value.len++] = ch;
-
             if (ctx->param->value.len == ctx->value_len) {
-                if (ctx->param->value.len == ctx->value_len) {
-                    ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
-                                  "too long \"%V\" value of \"%V\" parameter "
-                                  "in \"%V\" SSI command",
-                                  &ctx->param->value, &ctx->param->key,
-                                  &ctx->command);
-                    state = ssi_error_state;
-                    break;
-                }
+                ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
+                              "too long \"%V%c...\" value of \"%V\" "
+                              "parameter in \"%V\" SSI command",
+                              &ctx->param->value, ch, &ctx->param->key,
+                              &ctx->command);
+                state = ssi_error_state;
+                break;
             }
 
+            ctx->param->value.data[ctx->param->value.len++] = ch;
+
             break;
 
         case ssi_postparam_state:
+
+            if (ctx->param->value.len < ctx->value_len / 2) {
+                value = ngx_palloc(r->pool, ctx->param->value.len);
+                if (value == NULL) {
+                    return NGX_ERROR;
+                }
+
+                ngx_memcpy(value, ctx->param->value.data,
+                           ctx->param->value.len);
+
+                ctx->value_buf = ctx->param->value.data;
+                ctx->param->value.data = value;
+
+            } else {
+                ctx->value_buf = NULL;
+            }
+
             switch (ch) {
             case ' ':
             case CR:
index bd736480b92307a38db3c3219d19f32f7942ab2e..5337e942aa1dfce540f208b0a742d7b2ecd516ae 100644 (file)
@@ -15,8 +15,8 @@
 
 #define NGX_HTTP_SSI_MAX_PARAMS     16
 
-#define NGX_HTTP_SSI_COMMAND_LEN    31
-#define NGX_HTTP_SSI_PARAM_LEN      31
+#define NGX_HTTP_SSI_COMMAND_LEN    32
+#define NGX_HTTP_SSI_PARAM_LEN      32
 #define NGX_HTTP_SSI_PARAMS_N       4
 
 
@@ -56,6 +56,7 @@ typedef struct {
 
     ngx_uint_t                output;        /* unsigned  output:1; */
 
+    void                     *value_buf;
     ngx_str_t                 timefmt;
     ngx_str_t                 errmsg;
 } ngx_http_ssi_ctx_t;
index 61f9430fde6b8726b2b5bc8a9998c2ea0daac1c0..6211f0e1e0b66ff9b166c6a7aa50d4e7276927d5 100644 (file)
@@ -535,7 +535,7 @@ ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
          * check whether all name-based servers have the same configuraiton
          *     as the default server,
          * or some servers restrict the host names,
-         * or some servers disable optimizing the host names
+         * or some servers disable optimizing the server names
          */
 
         in_addr = in_port[p].addrs.elts;
@@ -545,7 +545,7 @@ ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
             for (s = 0; s < in_addr[a].names.nelts; s++) {
 
                 if (in_addr[a].core_srv_conf != name[s].core_srv_conf
-                    || name[s].core_srv_conf->optimize_host_names == 0
+                    || name[s].core_srv_conf->optimize_server_names == 0
                     || name[s].core_srv_conf->restrict_host_names
                        != NGX_HTTP_RESTRICT_HOST_OFF)
                 {
@@ -557,7 +557,7 @@ ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
              * if all name-based servers have the same configuration
              *         as the default server,
              *     and no servers restrict the host names,
-             *     and no servers disable optimizing the host names
+             *     and no servers disable optimizing the server names
              * then we do not need to check them at run-time at all
              */
 
index 2784921f2abb298af4d0123dd4fabf3f61f91cd2..89f846c975fa17688fcd25d6fc37fbca1a9f7733 100644 (file)
@@ -62,6 +62,10 @@ static char *ngx_http_core_lowat_check(ngx_conf_t *cf, void *post, void *data);
 static ngx_conf_post_t  ngx_http_core_lowat_post =
                                                  { ngx_http_core_lowat_check };
 
+static ngx_conf_deprecated_t  ngx_conf_deprecated_optimize_host_names = {
+    ngx_conf_deprecated, "optimize_host_names", "optimize_server_names"
+};
+
 
 static ngx_conf_enum_t  ngx_http_restrict_host_names[] = {
     { ngx_string("off"), NGX_HTTP_RESTRICT_HOST_OFF },
@@ -136,13 +140,20 @@ static ngx_command_t  ngx_http_core_commands[] = {
       offsetof(ngx_http_core_srv_conf_t, restrict_host_names),
       &ngx_http_restrict_host_names },
 
-    { ngx_string("optimize_host_names"),
+    { ngx_string("optimize_server_names"),
       NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_FLAG,
       ngx_conf_set_flag_slot,
       NGX_HTTP_SRV_CONF_OFFSET,
-      offsetof(ngx_http_core_srv_conf_t, optimize_host_names),
+      offsetof(ngx_http_core_srv_conf_t, optimize_server_names),
       NULL },
 
+    { ngx_string("optimize_host_names"),
+      NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_FLAG,
+      ngx_conf_set_flag_slot,
+      NGX_HTTP_SRV_CONF_OFFSET,
+      offsetof(ngx_http_core_srv_conf_t, optimize_server_names),
+      &ngx_conf_deprecated_optimize_host_names },
+
     { ngx_string("ignore_invalid_headers"),
       NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_FLAG,
       ngx_conf_set_flag_slot,
@@ -1840,7 +1851,7 @@ ngx_http_core_create_srv_conf(ngx_conf_t *cf)
     cscf->client_header_timeout = NGX_CONF_UNSET_MSEC;
     cscf->client_header_buffer_size = NGX_CONF_UNSET_SIZE;
     cscf->restrict_host_names = NGX_CONF_UNSET_UINT;
-    cscf->optimize_host_names = NGX_CONF_UNSET;
+    cscf->optimize_server_names = NGX_CONF_UNSET;
     cscf->ignore_invalid_headers = NGX_CONF_UNSET;
 
     return cscf;
@@ -1928,8 +1939,8 @@ ngx_http_core_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child)
     ngx_conf_merge_unsigned_value(conf->restrict_host_names,
                               prev->restrict_host_names, 0);
 
-    ngx_conf_merge_value(conf->optimize_host_names,
-                              prev->optimize_host_names, 1);
+    ngx_conf_merge_value(conf->optimize_server_names,
+                              prev->optimize_server_names, 1);
 
     ngx_conf_merge_value(conf->ignore_invalid_headers,
                               prev->ignore_invalid_headers, 1);
index 48cbc4217c35392b7f815a2761db222a496d6b23..4382289507fe652ebd94da191313fbaec0f8d16d 100644 (file)
@@ -109,7 +109,7 @@ typedef struct {
 
     ngx_uint_t                 restrict_host_names;
 
-    ngx_flag_t                 optimize_host_names;
+    ngx_flag_t                 optimize_server_names;
     ngx_flag_t                 ignore_invalid_headers;
 } ngx_http_core_srv_conf_t;
 
index 5c2bb5af80f2f64d2f08b60785092230d2f31cab..2e621d8bb666218e0d430582e5cb50379e163c71 100644 (file)
@@ -119,7 +119,7 @@ ngx_readv_chain(ngx_connection_t *c, ngx_chain_t *chain)
                      */
 
                     ngx_log_error(NGX_LOG_ALERT, c->log, 0,
-                                  "recv() returned 0 while kevent() reported "
+                                  "readv() returned 0 while kevent() reported "
                                   "%d available bytes", rev->available);
 
                     rev->eof = 1;
index a8a351a80741d9888bc869c263ccf84b9a3b31dc..f38730ec3452bf009fc30f77a03516cf9ce64169 100644 (file)
@@ -78,7 +78,7 @@ ssize_t ngx_unix_recv(ngx_connection_t *c, u_char *buf, size_t size)
                      */
 
                     ngx_log_error(NGX_LOG_ALERT, c->log, 0,
-                                  "recv() returned 0 while keevnt() reported "
+                                  "recv() returned 0 while kevent() reported "
                                   "%d available bytes", rev->available);
 
                     rev->eof = 1;