Mercurial > hg > nginx
diff src/http/ngx_http_special_response.c @ 153:c71aeb75c071
nginx-0.0.1-2003-10-21-20:49:56 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Tue, 21 Oct 2003 16:49:56 +0000 |
parents | 5afee0074707 |
children | 46eb23d9471d |
line wrap: on
line diff
--- a/src/http/ngx_http_special_response.c +++ b/src/http/ngx_http_special_response.c @@ -152,8 +152,9 @@ static ngx_str_t error_pages[] = { int ngx_http_special_response_handler(ngx_http_request_t *r, int error) { - int err, rc; - ngx_hunk_t *h; + int err, rc; + ngx_hunk_t *h; + ngx_chain_t *out, **le, *ce; r->headers_out.status = error; @@ -189,9 +190,9 @@ int ngx_http_special_response_handler(ng } if (error_pages[err].len) { - r->headers_out.content_length = error_pages[err].len - + sizeof(error_tail) - 1 - + sizeof(msie_stub) - 1; + r->headers_out.content_length_n = error_pages[err].len + + sizeof(error_tail) - 1 + + sizeof(msie_stub) - 1; ngx_test_null(r->headers_out.content_type, ngx_push_table(r->headers_out.headers), @@ -203,7 +204,8 @@ int ngx_http_special_response_handler(ng r->headers_out.content_type->value.data = "text/html"; } else { - r->headers_out.content_length = -1; + r->headers_out.content_length_n = -1; + r->headers_out.content_length = NULL; } rc = ngx_http_send_header(r); @@ -216,41 +218,42 @@ int ngx_http_special_response_handler(ng return NGX_OK; } + out = NULL; + le = NULL; + ngx_test_null(h, ngx_calloc_hunk(r->pool), NGX_ERROR); - h->type = NGX_HUNK_MEMORY|NGX_HUNK_IN_MEMORY; h->pos = error_pages[err].data; h->last = error_pages[err].data + error_pages[err].len; - if (ngx_http_output_filter(r, h) == NGX_ERROR) { - return NGX_ERROR; - } + ngx_alloc_ce_and_set_hunk(ce, h, r->pool, NGX_ERROR); + ngx_chain_add_ce(out, le, ce); + ngx_test_null(h, ngx_calloc_hunk(r->pool), NGX_ERROR); - h->type = NGX_HUNK_MEMORY|NGX_HUNK_IN_MEMORY; h->pos = error_tail; h->last = error_tail + sizeof(error_tail) - 1; + ngx_alloc_ce_and_set_hunk(ce, h, r->pool, NGX_ERROR); + ngx_chain_add_ce(out, le, ce); + if (/* STUB: "msie_padding on/off" */ 1 && r->http_version >= NGX_HTTP_VERSION_10 && error >= NGX_HTTP_BAD_REQUEST && error != NGX_HTTP_REQUEST_URI_TOO_LARGE ) { - - if (ngx_http_output_filter(r, h) == NGX_ERROR) { - return NGX_ERROR; - } - ngx_test_null(h, ngx_calloc_hunk(r->pool), NGX_ERROR); - h->type = NGX_HUNK_MEMORY|NGX_HUNK_IN_MEMORY; h->pos = msie_stub; h->last = msie_stub + sizeof(msie_stub) - 1; + + ngx_alloc_ce_and_set_hunk(ce, h, r->pool, NGX_ERROR); + ngx_chain_add_ce(out, le, ce); } h->type |= NGX_HUNK_LAST; - return ngx_http_output_filter(r, h); + return ngx_http_output_filter(r, out); }