From 2034d0ad35298dabf20772c85293c16f67647bce Mon Sep 17 00:00:00 2001 From: Adrian Perez Date: Wed, 14 Mar 2012 00:54:31 +0200 Subject: [PATCH] Initialize headers_out.status to NGX_OK and improve error check When issuing subrequests (currently for non-builtin headers and footers), initialize the headers_out.status field to NGX_OK. Also, change the check of the result from ngx_http_send_header() to only check for NGX_OK, as it is redundant to check it and also NGX_ERROR. --- ngx_http_fancyindex_module.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/ngx_http_fancyindex_module.c b/ngx_http_fancyindex_module.c index 2970ea5..6fa57b9 100644 --- a/ngx_http_fancyindex_module.c +++ b/ngx_http_fancyindex_module.c @@ -762,17 +762,15 @@ ngx_http_fancyindex_handler(ngx_http_request_t *r) out[0].buf->last_in_chain = 1; - r->headers_out.status = NGX_HTTP_OK; + r->headers_out.status = NGX_OK; r->headers_out.content_type_len = ngx_sizeof_ssz("text/html"); r->headers_out.content_type.len = ngx_sizeof_ssz("text/html"); r->headers_out.content_type.data = (u_char *) "text/html"; rc = ngx_http_send_header(r); - if (rc == NGX_ERROR || rc > NGX_OK || r->header_only) { + if (rc != NGX_OK || r->header_only) return rc; - } - if (alcf->header.len > 0) { /* URI is configured, make Nginx take care of with a subrequest. */