nginx-0.0.1-2003-11-11-21:13:43 import
diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c index 3a0ec8b..3f19b78 100644 --- a/src/http/ngx_http_core_module.c +++ b/src/http/ngx_http_core_module.c
@@ -429,7 +429,7 @@ return NGX_OK; } - if (r->err_status) { + if (r->err_ctx) { r->headers_out.status = r->err_status; r->headers_out.status_line.len = 0; } @@ -499,17 +499,19 @@ } } - /* clear the modules contexts */ + if (r->err_ctx) { - if (r->error_page) { - r->err_status = r->headers_out.status; - r->err_ctx = r->ctx; + /* allocate the new modules contexts */ + r->ctx = ngx_pcalloc(r->pool, sizeof(void *) * ngx_http_max_module); if (r->ctx == NULL) { return NGX_HTTP_INTERNAL_SERVER_ERROR; } } else { + + /* clear the modules contexts */ + ngx_memzero(r->ctx, sizeof(void *) * ngx_http_max_module); }
diff --git a/src/http/ngx_http_parse_time.c b/src/http/ngx_http_parse_time.c index 09e56b4..26deb28 100644 --- a/src/http/ngx_http_parse_time.c +++ b/src/http/ngx_http_parse_time.c
@@ -232,16 +232,22 @@ return NGX_ERROR; } - /* shift new year to 1st March, needed for Gauss's formula */ + /* shift new year to March 1, needed for Gauss's formula */ + if (--month <= 0) { month += 12; year -= 1; } - /* Gauss's formula for Grigorian days from 1 March 1 BC */ + + /* Gauss's formula for Grigorian days from 1 March 1 BC */ + return (365 * year + year / 4 - year / 100 + year / 400 + 367 * month / 12 + day - 31 - /* 719527 days are between 1 March 1 BC and 1 March 1970, - 31 and 28 days in Jan and Feb 1970 */ + /* + * 719527 days are between March 1, 1 BC and March 1, 1970, + * 31 and 28 days in January and February 1970 + */ + - 719527 + 31 + 28) * 86400 + hour * 3600 + min * 60 + sec; }
diff --git a/src/http/ngx_http_request.h b/src/http/ngx_http_request.h index a87c6dc..a91dbea 100644 --- a/src/http/ngx_http_request.h +++ b/src/http/ngx_http_request.h
@@ -205,8 +205,6 @@ unsigned bypass_cache:1; unsigned no_cache:1; - unsigned error_page:1; - #if 0 unsigned cachable:1; #endif
diff --git a/src/http/ngx_http_special_response.c b/src/http/ngx_http_special_response.c index c1cb23a..8e93e90 100644 --- a/src/http/ngx_http_special_response.c +++ b/src/http/ngx_http_special_response.c
@@ -203,11 +203,12 @@ clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); - if (!r->error_page && clcf->error_pages) { + if (r->err_ctx == NULL && clcf->error_pages) { err_page = clcf->error_pages->elts; for (i = 0; i < clcf->error_pages->nelts; i++) { if (err_page[i].code == error) { - r->error_page = 1; + r->err_status = error; + r->err_ctx = r->ctx; return ngx_http_internal_redirect(r, &err_page[i].uri, NULL); } }