diff options
author | Igor Sysoev <igor@sysoev.ru> | 2009-05-01 18:41:07 +0000 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2009-05-01 18:41:07 +0000 |
commit | 71d1f492688aba3d7943d199d9d152e4dbb1ab36 (patch) | |
tree | 66b1647505cf19df2a88a644a3978b32cf6ad5ed /src/http/ngx_http_special_response.c | |
parent | b01c9cc10ee7c39fb0cd175871adbb00be8f6706 (diff) | |
download | nginx-71d1f492688aba3d7943d199d9d152e4dbb1ab36.tar.gz nginx-71d1f492688aba3d7943d199d9d152e4dbb1ab36.zip |
ngx_http_filter_finalize_request() and ngx_http_clean_header()
Diffstat (limited to 'src/http/ngx_http_special_response.c')
-rw-r--r-- | src/http/ngx_http_special_response.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/http/ngx_http_special_response.c b/src/http/ngx_http_special_response.c index 007fac3d5..7d3fd43e9 100644 --- a/src/http/ngx_http_special_response.c +++ b/src/http/ngx_http_special_response.c @@ -445,6 +445,40 @@ ngx_http_special_response_handler(ngx_http_request_t *r, ngx_int_t error) } +ngx_int_t +ngx_http_filter_finalize_request(ngx_http_request_t *r, ngx_int_t error) +{ + ngx_int_t rc; + + ngx_http_clean_header(r); + + /* clear the modules contexts */ + ngx_memzero(r->ctx, sizeof(void *) * ngx_http_max_module); + + rc = ngx_http_special_response_handler(r, error); + + /* NGX_ERROR resets any pending data */ + + return (rc == NGX_OK) ? NGX_ERROR : rc; +} + + +void +ngx_http_clean_header(ngx_http_request_t *r) +{ + ngx_memzero(&r->headers_out.status, + sizeof(ngx_http_headers_out_t) + - offsetof(ngx_http_headers_out_t, status)); + + r->headers_out.headers.part.nelts = 0; + r->headers_out.headers.part.next = NULL; + r->headers_out.headers.last = &r->headers_out.headers.part; + + r->headers_out.content_length_n = -1; + r->headers_out.last_modified_time = -1; +} + + static ngx_int_t ngx_http_send_error_page(ngx_http_request_t *r, ngx_http_err_page_t *err_page) { |