Mercurial > hg > nginx
changeset 730:1be87cdd010f
set "Content-Length: 0" for errors handled by "return 204"
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Mon, 02 Oct 2006 10:22:51 +0000 |
parents | 52d1379de54e |
children | 44161d685b8a |
files | src/http/ngx_http_request.h src/http/ngx_http_script.c src/http/ngx_http_special_response.c |
diffstat | 3 files changed, 24 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/src/http/ngx_http_request.h Mon Oct 02 08:53:30 2006 +0000 +++ b/src/http/ngx_http_request.h Mon Oct 02 10:22:51 2006 +0000 @@ -430,6 +430,7 @@ unsigned plain_http:1; unsigned chunked:1; unsigned header_only:1; + unsigned zero_body:1; unsigned keepalive:1; unsigned lingering_close:1; unsigned discard_body:1;
--- a/src/http/ngx_http_script.c Mon Oct 02 08:53:30 2006 +0000 +++ b/src/http/ngx_http_script.c Mon Oct 02 10:22:51 2006 +0000 @@ -841,6 +841,7 @@ if (code->status == NGX_HTTP_NO_CONTENT) { e->request->header_only = 1; + e->request->zero_body = 1; } e->ip += sizeof(ngx_http_script_return_code_t) - sizeof(uintptr_t);
--- a/src/http/ngx_http_special_response.c Mon Oct 02 08:53:30 2006 +0000 +++ b/src/http/ngx_http_special_response.c Mon Oct 02 10:22:51 2006 +0000 @@ -455,25 +455,32 @@ 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) {