diff src/http/ngx_http_special_response.c @ 238:a528ae0fe909 NGINX_0_4_4

nginx 0.4.4 *) Feature: the $scheme variable. *) Feature: the "expires" directive supports the "max" parameter. *) Feature: the "include" directive supports the "*" mask. Thanks to Jonathan Dance. *) Bugfix: the "return" directive always overrode the "error_page" response code redirected by the "error_page" directive. *) Bugfix: a segmentation fault occurred if zero-length body was in PUT method. *) Bugfix: the redirect was changed incorrectly if the variables were used in the "proxy_redirect" directive.
author Igor Sysoev <http://sysoev.ru>
date Mon, 02 Oct 2006 00:00:00 +0400
parents c982febb7588
children c5c2b2883984
line wrap: on
line diff
--- a/src/http/ngx_http_special_response.c
+++ b/src/http/ngx_http_special_response.c
@@ -455,25 +455,32 @@ ngx_http_special_response_handler(ngx_ht
 
     msie_padding = 0;
 
-    if (error_pages[err].len) {
-        r->headers_out.content_length_n = error_pages[err].len
-                                          + sizeof(error_tail) - 1;
+    if (!r->zero_body) {
+        if (error_pages[err].len) {
+            r->headers_out.content_length_n = error_pages[err].len
+                                              + sizeof(error_tail) - 1;
 
-        if (clcf->msie_padding
-            && r->headers_in.msie
-            && r->http_version >= NGX_HTTP_VERSION_10
-            && error >= NGX_HTTP_BAD_REQUEST
-            && error != NGX_HTTP_REQUEST_URI_TOO_LARGE)
-        {
-            r->headers_out.content_length_n += sizeof(ngx_http_msie_stub) - 1;
-            msie_padding = 1;
+            if (clcf->msie_padding
+                && r->headers_in.msie
+                && r->http_version >= NGX_HTTP_VERSION_10
+                && error >= NGX_HTTP_BAD_REQUEST
+                && error != NGX_HTTP_REQUEST_URI_TOO_LARGE)
+            {
+                r->headers_out.content_length_n +=
+                                                sizeof(ngx_http_msie_stub) - 1;
+                msie_padding = 1;
+            }
+
+            r->headers_out.content_type.len = sizeof("text/html") - 1;
+            r->headers_out.content_type.data = (u_char *) "text/html";
+
+        } else {
+            r->headers_out.content_length_n = -1;
         }
 
-        r->headers_out.content_type.len = sizeof("text/html") - 1;
-        r->headers_out.content_type.data = (u_char *) "text/html";
-
     } else {
-        r->headers_out.content_length_n = -1;
+        r->headers_out.content_length_n = 0;
+        err = 0;
     }
 
     if (r->headers_out.content_length) {