]> git.kaiwu.me - nginx.git/commitdiff
merge r3452, r3462, r3471, r3472:
authorIgor Sysoev <igor@sysoev.ru>
Mon, 7 Jun 2010 09:36:33 +0000 (09:36 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Mon, 7 Jun 2010 09:36:33 +0000 (09:36 +0000)
fix miscellaneous name bugs:

*) fix $upstream_http_ variable prefix length
*) use a right "Location" header name, however, it did not harm,
   since ngx_http_variable_sent_location() never use key name field
*) fix proxy_redirect name in error message
*) "proxy_redirect default" may not be used if a proxy_pass uses variables

src/http/modules/ngx_http_proxy_module.c
src/http/ngx_http_header_filter_module.c
src/http/ngx_http_variables.c

index 19dbd5cfcf73f3719249786cf539a8d2e3810607..03750784c708a79b36cc37a18394cb5acb9dbb51 100644 (file)
@@ -1906,7 +1906,7 @@ ngx_http_proxy_create_loc_conf(ngx_conf_t *cf)
      *     conf->body_set_len = NULL;
      *     conf->body_set = NULL;
      *     conf->body_source = { 0, NULL };
-     *     conf->rewrite_locations = NULL;
+     *     conf->redirects = NULL;
      */
 
     conf->upstream.store = NGX_CONF_UNSET;
@@ -2747,9 +2747,16 @@ ngx_http_proxy_redirect(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
     }
 
     if (ngx_strcmp(value[1].data, "default") == 0) {
+        if (plcf->proxy_lengths) {
+            ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+                               "\"proxy_redirect default\" may not be used "
+                               "with \"proxy_pass\" directive with variables");
+            return NGX_CONF_ERROR;
+        }
+
         if (plcf->url.data == NULL) {
             ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
-                               "\"proxy_rewrite_location default\" must go "
+                               "\"proxy_redirect default\" must go "
                                "after the \"proxy_pass\" directive");
             return NGX_CONF_ERROR;
         }
index 0f6f1731a1cc5e7032ccd9dd35a1751aafe6531d..237911154036bd265d1f6a06b25346fa52b3988f 100644 (file)
@@ -538,8 +538,8 @@ ngx_http_header_filter(ngx_http_request_t *r)
 
         r->headers_out.location->value.len = b->last - p;
         r->headers_out.location->value.data = p;
-        r->headers_out.location->key.len = sizeof("Location") - 1;
-        r->headers_out.location->key.data = (u_char *) "Location";
+        r->headers_out.location->key.len = sizeof("Location") - 1;
+        r->headers_out.location->key.data = (u_char *) "Location";
 
         *b->last++ = CR; *b->last++ = LF;
     }
index fc8ca9b023df8c6fcc559b91ea043663b7e97d07..f68edc27bfea9243062d83c4ce050e2bcb602f69 100644 (file)
@@ -494,7 +494,7 @@ ngx_http_get_variable(ngx_http_request_t *r, ngx_str_t *name, ngx_uint_t key,
         return NULL;
     }
 
-    if (ngx_strncmp(name->data, "upstream_http_", 10) == 0) {
+    if (ngx_strncmp(name->data, "upstream_http_", 14) == 0) {
 
         if (ngx_http_upstream_header_variable(r, vv, (uintptr_t) name)
             == NGX_OK)