nginx-0.3.59-RELEASE import

    *) Feature: now is possible to do several redirection using the
       "error_page" directive.

    *) Bugfix: the "dav_access" directive did not support three parameters.

    *) Bugfix: the "error_page" directive did not changes the
       "Content-Type" header line after the "X-Accel-Redirect" was used;
       the bug had appeared in 0.3.58.
diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c
index 764f35c..b289317 100644
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -464,7 +464,7 @@
 
     r->connection->unexpected_eof = 0;
 
-    if (r->err_ctx == NULL) {
+    if (!r->internal) {
         switch (r->headers_in.connection_type) {
         case 0:
             if (r->http_version > NGX_HTTP_VERSION_10) {
@@ -1341,21 +1341,8 @@
         return NGX_HTTP_INTERNAL_SERVER_ERROR;
     }
 
-    if (r->err_ctx) {
-
-        /* allocate the new module's contexts */
-
-        r->ctx = ngx_pcalloc(r->pool, sizeof(void *) * ngx_http_max_module);
-        if (r->ctx == NULL) {
-            return NGX_HTTP_INTERNAL_SERVER_ERROR;
-        }
-
-    } else {
-
-        /* clear the modules contexts */
-
-        ngx_memzero(r->ctx, sizeof(void *) * ngx_http_max_module);
-    }
+    /* clear the modules contexts */
+    ngx_memzero(r->ctx, sizeof(void *) * ngx_http_max_module);
 
     cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module);
     r->loc_conf = cscf->ctx->loc_conf;