mirror of https://github.com/openresty/openresty
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
92 lines
3.1 KiB
C
92 lines
3.1 KiB
C
4 years ago
|
diff -upr nginx-1.19.9/src/http/ngx_http_core_module.c nginx-1.19.9-patched/src/http/ngx_http_core_module.c
|
||
|
--- nginx-1.19.9/src/http/ngx_http_core_module.c 2017-08-31 18:14:41.000000000 -0700
|
||
|
+++ nginx-1.19.9-patched/src/http/ngx_http_core_module.c 2017-08-31 18:21:31.638098196 -0700
|
||
|
@@ -61,6 +61,8 @@ static char *ngx_http_core_directio(ngx_
|
||
|
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_open_file_cache(ngx_conf_t *cf, ngx_command_t *cmd,
|
||
|
void *conf);
|
||
|
static char *ngx_http_core_error_log(ngx_conf_t *cf, ngx_command_t *cmd,
|
||
|
@@ -647,6 +649,14 @@ static ngx_command_t ngx_http_core_comm
|
||
|
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("post_action"),
|
||
|
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF
|
||
|
|NGX_CONF_TAKE1,
|
||
|
@@ -3334,7 +3344,6 @@ ngx_http_core_create_loc_conf(ngx_conf_t
|
||
|
* clcf->types = NULL;
|
||
|
* clcf->default_type = { 0, NULL };
|
||
|
* clcf->error_log = NULL;
|
||
|
- * clcf->error_pages = NULL;
|
||
|
* clcf->client_body_path = NULL;
|
||
|
* clcf->regex = NULL;
|
||
|
* clcf->exact_match = 0;
|
||
|
@@ -3344,6 +3353,7 @@ ngx_http_core_create_loc_conf(ngx_conf_t
|
||
|
* clcf->keepalive_disable = 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;
|
||
|
@@ -3543,9 +3553,7 @@ ngx_http_core_merge_loc_conf(ngx_conf_t
|
||
|
}
|
||
|
}
|
||
|
|
||
|
- 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");
|
||
|
@@ -4553,6 +4561,10 @@ ngx_http_core_error_page(ngx_conf_t *cf,
|
||
|
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) {
|
||
|
@@ -4655,6 +4667,25 @@ ngx_http_core_error_page(ngx_conf_t *cf,
|
||
|
|
||
|
return NGX_CONF_OK;
|
||
|
}
|
||
|
+
|
||
|
+
|
||
|
+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 *
|