diff options
Diffstat (limited to 'src/http')
| -rw-r--r-- | src/http/modules/ngx_http_autoindex_handler.c | 5 | ||||
| -rw-r--r-- | src/http/modules/ngx_http_range_filter.c | 2 | ||||
| -rw-r--r-- | src/http/modules/proxy/ngx_http_proxy_handler.c | 32 | ||||
| -rw-r--r-- | src/http/ngx_http_core_module.c | 18 | ||||
| -rw-r--r-- | src/http/ngx_http_core_module.h | 2 |
5 files changed, 45 insertions, 14 deletions
diff --git a/src/http/modules/ngx_http_autoindex_handler.c b/src/http/modules/ngx_http_autoindex_handler.c index c78d4e616..f5ec9704f 100644 --- a/src/http/modules/ngx_http_autoindex_handler.c +++ b/src/http/modules/ngx_http_autoindex_handler.c @@ -304,10 +304,9 @@ static ngx_int_t ngx_http_autoindex_handler(ngx_http_request_t *r) + 1 /* 1 is for "/" */ + entry[i].name.len + entry[i].escape + sizeof("\">") - 1 - + NGX_HTTP_AUTOINDEX_NAME_LEN + + NGX_HTTP_AUTOINDEX_NAME_LEN + sizeof(">") - 2 + sizeof("</a>") - 1 - + 1 - + sizeof("28-Sep-1970 12:00 ") - 1 + + sizeof(" 28-Sep-1970 12:00 ") - 1 + sizeof("1023G") - 1 + 2; } diff --git a/src/http/modules/ngx_http_range_filter.c b/src/http/modules/ngx_http_range_filter.c index f96456cef..8f98719a1 100644 --- a/src/http/modules/ngx_http_range_filter.c +++ b/src/http/modules/ngx_http_range_filter.c @@ -340,7 +340,7 @@ static ngx_int_t ngx_http_range_header_filter(ngx_http_request_t *r) return NGX_ERROR; } - boundary = ngx_next_temp_number(0); + boundary = (uint32_t) ngx_next_temp_number(0); /* * The boundary header of the range: diff --git a/src/http/modules/proxy/ngx_http_proxy_handler.c b/src/http/modules/proxy/ngx_http_proxy_handler.c index 915d378e6..c0a8cf3d9 100644 --- a/src/http/modules/proxy/ngx_http_proxy_handler.c +++ b/src/http/modules/proxy/ngx_http_proxy_handler.c @@ -165,6 +165,13 @@ static ngx_command_t ngx_http_proxy_commands[] = { offsetof(ngx_http_proxy_loc_conf_t, temp_path), (void *) ngx_garbage_collector_temp_handler }, + { ngx_string("proxy_max_temp_file_size"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, + ngx_conf_set_size_slot, + NGX_HTTP_LOC_CONF_OFFSET, + offsetof(ngx_http_proxy_loc_conf_t, max_temp_file_size), + NULL }, + { ngx_string("proxy_temp_file_write_size"), NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, ngx_conf_set_size_slot, @@ -954,12 +961,7 @@ static void *ngx_http_proxy_create_loc_conf(ngx_conf_t *cf) conf->read_timeout = NGX_CONF_UNSET_MSEC; conf->busy_buffers_size = NGX_CONF_UNSET_SIZE; - /* - * "proxy_max_temp_file_size" is hardcoded to 1G for reverse proxy, - * it should be configurable in the generic proxy - */ - conf->max_temp_file_size = 1024 * 1024 * 1024; - + conf->max_temp_file_size = NGX_CONF_UNSET_SIZE; conf->temp_file_write_size = NGX_CONF_UNSET_SIZE; /* "proxy_cyclic_temp_file" is disabled */ @@ -1059,11 +1061,25 @@ static char *ngx_http_proxy_merge_loc_conf(ngx_conf_t *cf, prev->max_temp_file_size, NGX_CONF_UNSET_SIZE); if (conf->max_temp_file_size == NGX_CONF_UNSET_SIZE) { + + /* + * "proxy_max_temp_file_size" is set to 1G for reverse proxy, + * it should be much less in the generic proxy + */ + + conf->max_temp_file_size = 1024 * 1024 * 1024; + +#if 0 conf->max_temp_file_size = 2 * size; +#endif + - } else if (conf->max_temp_file_size < size) { + } else if (conf->max_temp_file_size != 0 + && conf->max_temp_file_size < size) + { ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, - "\"proxy_max_temp_file_size\" must be equal or bigger than " + "\"proxy_max_temp_file_size\" must be equal to zero to disable " + "the temporary files usage or must be equal or bigger than " "maximum of the value of \"proxy_header_buffer_size\" and " "one of the \"proxy_buffers\""); diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c index 29a6f76fc..c764b2a00 100644 --- a/src/http/ngx_http_core_module.c +++ b/src/http/ngx_http_core_module.c @@ -13,7 +13,8 @@ #define NGX_HTTP_LOCATION_EXACT 1 #define NGX_HTTP_LOCATION_AUTO_REDIRECT 2 -#define NGX_HTTP_LOCATION_REGEX 3 +#define NGX_HTTP_LOCATION_NOREGEX 3 +#define NGX_HTTP_LOCATION_REGEX 4 static void ngx_http_phase_event_handler(ngx_event_t *rev); @@ -564,12 +565,13 @@ static ngx_int_t ngx_http_find_location(ngx_http_request_t *r, ngx_array_t *locations, size_t len) { ngx_int_t n, rc; - ngx_uint_t i, found; + ngx_uint_t i, found, noregex; ngx_http_core_loc_conf_t *clcf, **clcfp; ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "find location"); found = 0; + noregex = 0; clcfp = locations->elts; for (i = 0; i < locations->nelts; i++) { @@ -619,6 +621,7 @@ static ngx_int_t ngx_http_find_location(ngx_http_request_t *r, } r->loc_conf = clcfp[i]->loc_conf; + noregex = clcfp[i]->noregex; found = 1; } } @@ -637,6 +640,10 @@ static ngx_int_t ngx_http_find_location(ngx_http_request_t *r, #if (NGX_PCRE) + if (noregex) { + return NGX_HTTP_LOCATION_NOREGEX; + } + /* regex matches */ for (/* void */; i < locations->nelts; i++) { @@ -1069,6 +1076,13 @@ static char *ngx_location_block(ngx_conf_t *cf, ngx_command_t *cmd, void *dummy) clcf->name = value[2]; clcf->exact_match = 1; + } else if (value[1].len == 2 + && value[1].data[0] == '^' + && value[1].data[1] == '~') + { + clcf->name = value[2]; + clcf->noregex = 1; + } else if ((value[1].len == 1 && value[1].data[0] == '~') || (value[1].len == 2 && value[1].data[0] == '~' diff --git a/src/http/ngx_http_core_module.h b/src/http/ngx_http_core_module.h index 9a17130b8..a70b472d5 100644 --- a/src/http/ngx_http_core_module.h +++ b/src/http/ngx_http_core_module.h @@ -142,6 +142,8 @@ struct ngx_http_core_loc_conf_s { #endif unsigned exact_match:1; + unsigned noregex:1; + unsigned auto_redirect:1; unsigned alias:1; |
