diff src/http/ngx_http_core_module.c @ 366:babd3d9efb62 NGINX_0_6_27

nginx 0.6.27 *) Change: now by default the rtsig method is not built on Linux 2.6.18+. *) Change: now a request method is not changed while redirection to a named location via an "error_page" directive. *) Feature: the "resolver" and "resolver_timeout" directives in SMTP proxy. *) Feature: the "post_action" directive supports named locations. *) Bugfix: a segmentation fault occurred in worker process, if a request was redirected from proxy, FastCGI, or memcached location to static named locations. *) Bugfix: browsers did not repeat SSL handshake if there is no valid client certificate in first handshake. Thanks to Alexander V. Inyukhin. *) Bugfix: if response code 495-497 was redirected via an "error_page" directive without code change, then nginx tried to allocate too many memory. *) Bugfix: memory leak in long-lived non buffered connections. *) Bugfix: memory leak in resolver. *) Bugfix: a segmentation fault occurred in worker process, if a request was redirected from proxy, FastCGI, or memcached location to static named locations. *) Bugfix: in the $proxy_host and $proxy_port variables caching. Thanks to Sergey Bochenkov. *) Bugfix: a "proxy_pass" directive with variables used incorrectly the same port as in another "proxy_pass" directive with the same host name and without variables. Thanks to Sergey Bochenkov. *) Bugfix: an alert "sendmsg() failed (9: Bad file descriptor)" on some 64-bit platforms while reconfiguration. *) Bugfix: a segmentation fault occurred in worker process, if empty stub block was used second time in SSI. *) Bugfix: in copying URI part contained escaped symbols into arguments.
author Igor Sysoev <http://sysoev.ru>
date Wed, 12 Mar 2008 00:00:00 +0300
parents a39aab45a53f
children 6639b93e81b2
line wrap: on
line diff
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -1916,7 +1916,7 @@ ngx_http_named_location(ngx_http_request
                        "named location: %V \"%V?%V\"", name, &r->uri, &r->args);
 
         r->internal = 1;
-
+        r->content_handler = NULL;
         r->loc_conf = clcfp[i]->loc_conf;
 
         ngx_http_update_location_config(r);
@@ -1924,6 +1924,7 @@ ngx_http_named_location(ngx_http_request
         cmcf = ngx_http_get_module_main_conf(r, ngx_http_core_module);
 
         r->phase_handler = cmcf->phase_engine.location_rewrite_index;
+
         ngx_http_core_run_phases(r);
 
         return NGX_DONE;
@@ -2907,14 +2908,21 @@ ngx_http_core_merge_loc_conf(ngx_conf_t 
                               prev->resolver_timeout, 30000);
 
     if (conf->resolver == NULL) {
-        conf->resolver = prev->resolver;
-
-        if (conf->resolver == NULL) {
-            conf->resolver = ngx_resolver_create(NULL, cf->cycle->new_log);
-            if (conf->resolver == NULL) {
+
+        if (prev->resolver == NULL) {
+
+            /*
+             * create dummy resolver in http {} context
+             * to inherit it in all servers
+             */
+
+            prev->resolver = ngx_resolver_create(cf, NULL);
+            if (prev->resolver == NULL) {
                 return NGX_CONF_ERROR;
             }
         }
+ 
+        conf->resolver = prev->resolver;
     }
 
     ngx_conf_merge_path_value(conf->client_body_temp_path,
@@ -3551,7 +3559,22 @@ ngx_http_core_error_page(ngx_conf_t *cf,
             return NGX_CONF_ERROR;
         }
 
-        err->overwrite = (overwrite >= 0) ? overwrite : err->status;
+        if (overwrite >= 0) {
+            err->overwrite = overwrite;
+
+        } else {
+            switch (err->status) {
+                case NGX_HTTP_TO_HTTPS:
+                case NGX_HTTPS_CERT_ERROR:
+                case NGX_HTTPS_NO_CERT:
+                    err->overwrite = NGX_HTTP_BAD_REQUEST;
+                    break;
+
+                default:
+                    err->overwrite = err->status;
+                    break;
+            }
+        }
 
         err->uri = uri;
         err->uri_lengths = uri_lengths;
@@ -3716,6 +3739,10 @@ ngx_http_core_resolver(ngx_conf_t *cf, n
     ngx_url_t   u;
     ngx_str_t  *value;
 
+    if (clcf->resolver) {
+        return "is duplicate";
+    }
+
     value = cf->args->elts;
 
     ngx_memzero(&u, sizeof(ngx_url_t));
@@ -3728,7 +3755,7 @@ ngx_http_core_resolver(ngx_conf_t *cf, n
         return NGX_CONF_ERROR;
     }
 
-    clcf->resolver = ngx_resolver_create(&u.addrs[0], cf->cycle->new_log);
+    clcf->resolver = ngx_resolver_create(cf, &u.addrs[0]);
     if (clcf->resolver == NULL) {
         return NGX_OK;
     }