diff src/http/ngx_http_header_filter_module.c @ 60:df7d3fff122b NGINX_0_1_30

nginx 0.1.30 *) Bugfix: the worker process may got caught in an endless loop if the SSI was used. *) Bugfix: the response encrypted by SSL may not transferred complete. *) Bugfix: if the length of the response part received at once from proxied or FastCGI server was equal to 500, then nginx returns the 500 response code; in proxy mode the bug appeared in 0.1.29 only. *) Bugfix: nginx did not consider the directives with 8 or 9 parameters as invalid. *) Feature: the "return" directive can return the 204 response code. *) Feature: the "ignore_invalid_headers" directive.
author Igor Sysoev <http://sysoev.ru>
date Sat, 14 May 2005 00:00:00 +0400
parents b55cbf18157e
children 818201e5a553
line wrap: on
line diff
--- a/src/http/ngx_http_header_filter_module.c
+++ b/src/http/ngx_http_header_filter_module.c
@@ -48,7 +48,7 @@ static ngx_str_t ngx_http_status_lines[]
     ngx_null_string,  /* "201 Created" */
     ngx_null_string,  /* "202 Accepted" */
     ngx_null_string,  /* "203 Non-Authoritative Information" */
-    ngx_null_string,  /* "204 No Content" */
+    ngx_string("204 No Content"),
     ngx_null_string,  /* "205 Reset Content" */
     ngx_string("206 Partial Content"),
 
@@ -167,8 +167,8 @@ ngx_http_header_filter(ngx_http_request_
 
     if (r->headers_out.last_modified_time != -1) {
         if (r->headers_out.status != NGX_HTTP_OK
-            && r->headers_out.status != NGX_HTTP_NOT_MODIFIED
-            && r->headers_out.status != NGX_HTTP_PARTIAL_CONTENT)
+            && r->headers_out.status != NGX_HTTP_PARTIAL_CONTENT
+            && r->headers_out.status != NGX_HTTP_NOT_MODIFIED)
         {
             r->headers_out.last_modified_time = -1;
             r->headers_out.last_modified = NULL;
@@ -193,6 +193,16 @@ ngx_http_header_filter(ngx_http_request_
             /* 2XX */
             status = r->headers_out.status - NGX_HTTP_OK;
 
+            if (r->headers_out.status == NGX_HTTP_NO_CONTENT) {
+                r->header_only = 1;
+                r->headers_out.content_type.len = 0;
+                r->headers_out.content_type.data = NULL;
+                r->headers_out.last_modified_time = -1;
+                r->headers_out.last_modified = NULL;
+                r->headers_out.content_length = NULL;
+                r->headers_out.content_length_n = -1;
+            }
+
         } else if (r->headers_out.status < NGX_HTTP_BAD_REQUEST) {
             /* 3XX */
             status = r->headers_out.status - NGX_HTTP_MOVED_PERMANENTLY