Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added the no_error_pages patch for nginx 1.1.2.
- Loading branch information
Showing
1 changed file
with
90 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
--- nginx-1.1.2/src/http/ngx_http_core_module.c 2010-12-14 18:38:42.000000000 +0800 | ||
+++ nginx-1.1.2-patched/src/http/ngx_http_core_module.c 2011-01-30 19:24:34.956354518 +0800 | ||
@@ -57,6 +57,8 @@ | ||
void *conf); | ||
static char *ngx_http_core_error_page(ngx_conf_t *cf, ngx_command_t *cmd, | ||
void *conf); | ||
+static char *ngx_http_core_no_error_pages(ngx_conf_t *cf, ngx_command_t *cmd, | ||
+ void *conf); | ||
static char *ngx_http_core_try_files(ngx_conf_t *cf, ngx_command_t *cmd, | ||
void *conf); | ||
static char *ngx_http_core_open_file_cache(ngx_conf_t *cf, ngx_command_t *cmd, | ||
@@ -614,6 +616,14 @@ | ||
0, | ||
NULL }, | ||
|
||
+ { ngx_string("no_error_pages"), | ||
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF | ||
+ |NGX_CONF_NOARGS, | ||
+ ngx_http_core_no_error_pages, | ||
+ NGX_HTTP_LOC_CONF_OFFSET, | ||
+ 0, | ||
+ NULL }, | ||
+ | ||
{ ngx_string("try_files"), | ||
NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_2MORE, | ||
ngx_http_core_try_files, | ||
@@ -3052,7 +3062,6 @@ | ||
* clcf->types = NULL; | ||
* clcf->default_type = { 0, NULL }; | ||
* clcf->error_log = NULL; | ||
- * clcf->error_pages = NULL; | ||
* clcf->try_files = NULL; | ||
* clcf->client_body_path = NULL; | ||
* clcf->regex = NULL; | ||
@@ -3062,6 +3071,7 @@ | ||
* clcf->gzip_proxied = 0; | ||
*/ | ||
|
||
+ clcf->error_pages = NGX_CONF_UNSET_PTR; | ||
clcf->client_max_body_size = NGX_CONF_UNSET; | ||
clcf->client_body_buffer_size = NGX_CONF_UNSET_SIZE; | ||
clcf->client_body_timeout = NGX_CONF_UNSET_MSEC; | ||
@@ -3250,9 +3260,7 @@ | ||
} | ||
} | ||
|
||
- if (conf->error_pages == NULL && prev->error_pages) { | ||
- conf->error_pages = prev->error_pages; | ||
- } | ||
+ ngx_conf_merge_ptr_value(conf->error_pages, prev->error_pages, NULL); | ||
|
||
ngx_conf_merge_str_value(conf->default_type, | ||
prev->default_type, "text/plain"); | ||
@@ -3988,6 +3996,10 @@ | ||
ngx_http_compile_complex_value_t ccv; | ||
|
||
if (clcf->error_pages == NULL) { | ||
+ return "conflicts with \"no_error_pages\""; | ||
+ } | ||
+ | ||
+ if (clcf->error_pages == NGX_CONF_UNSET_PTR) { | ||
clcf->error_pages = ngx_array_create(cf->pool, 4, | ||
sizeof(ngx_http_err_page_t)); | ||
if (clcf->error_pages == NULL) { | ||
@@ -4095,6 +4107,25 @@ | ||
|
||
|
||
static char * | ||
+ngx_http_core_no_error_pages(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | ||
+{ | ||
+ ngx_http_core_loc_conf_t *clcf = conf; | ||
+ | ||
+ if (clcf->error_pages == NULL) { | ||
+ return "is duplicate"; | ||
+ } | ||
+ | ||
+ if (clcf->error_pages != NGX_CONF_UNSET_PTR) { | ||
+ return "conflicts with \"error_page\""; | ||
+ } | ||
+ | ||
+ clcf->error_pages = NULL; | ||
+ | ||
+ return NGX_CONF_OK; | ||
+} | ||
+ | ||
+ | ||
+static char * | ||
ngx_http_core_try_files(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | ||
{ | ||
ngx_http_core_loc_conf_t *clcf = conf; |