From 5192b3651f2f44fb5769828a2a4060989c7e9c5f Mon Sep 17 00:00:00 2001 From: Igor Sysoev Date: Fri, 8 Jul 2005 14:34:20 +0000 Subject: nginx-0.1.38-RELEASE import *) Feature: the "limit_rate" directive is supported in in proxy and FastCGI mode. *) Feature: the "X-Accel-Limit-Rate" response header line is supported in proxy and FastCGI mode. *) Feature: the "break" directive. *) Feature: the "log_not_found" directive. *) Bugfix: the response status code was not changed when request was redirected by the ""X-Accel-Redirect" header line. *) Bugfix: the variables set by the "set" directive could not be used in SSI. *) Bugfix: the segmentation fault may occurred if the SSI page has more than one remote subrequest. *) Bugfix: nginx treated the backend response as invalid if the status line in the header was transferred in two packets; the bug had appeared in 0.1.29. *) Feature: the "ssi_types" directive. *) Feature: the "autoindex_exact_size" directive. *) Bugfix: the ngx_http_autoindex_module did not support the long file names in UTF-8. *) Feature: the IMAP/POP3 proxy. --- src/core/nginx.h | 2 +- src/core/ngx_connection.h | 1 + src/core/ngx_palloc.c | 2 +- src/core/ngx_string.c | 54 ++- src/core/ngx_string.h | 2 + src/event/modules/ngx_rtsig_module.c | 2 +- src/event/ngx_event_pipe.c | 6 +- src/http/modules/ngx_http_autoindex_module.c | 93 +++- src/http/modules/ngx_http_gzip_filter_module.c | 82 ++-- src/http/modules/ngx_http_proxy_module.c | 6 +- src/http/modules/ngx_http_rewrite_module.c | 28 ++ src/http/modules/ngx_http_ssi_filter_module.c | 115 ++++- src/http/modules/ngx_http_static_module.c | 6 +- src/http/ngx_http_copy_filter_module.c | 12 +- src/http/ngx_http_core_module.c | 17 +- src/http/ngx_http_core_module.h | 1 + src/http/ngx_http_postpone_filter_module.c | 15 +- src/http/ngx_http_request.c | 52 +- src/http/ngx_http_request.h | 3 +- src/http/ngx_http_request_body.c | 2 +- src/http/ngx_http_script.c | 10 + src/http/ngx_http_script.h | 1 + src/http/ngx_http_special_response.c | 3 + src/http/ngx_http_upstream.c | 86 +++- src/http/ngx_http_upstream.h | 6 +- src/http/ngx_http_variables.c | 4 +- src/http/ngx_http_write_filter_module.c | 15 +- src/imap/ngx_imap.h | 63 ++- src/imap/ngx_imap_auth_http_module.c | 648 ++++++++++++++++++++++++- src/imap/ngx_imap_core_module.c | 159 +++++- src/imap/ngx_imap_handler.c | 289 +++++++++-- src/imap/ngx_imap_parse.c | 447 ++++++++++++++--- src/imap/ngx_imap_proxy_module.c | 296 ++++++++--- src/os/unix/ngx_linux_config.h | 5 + src/os/unix/ngx_user.c | 4 +- 35 files changed, 2193 insertions(+), 344 deletions(-) (limited to 'src') diff --git a/src/core/nginx.h b/src/core/nginx.h index f9f1a061b..221ba38f0 100644 --- a/src/core/nginx.h +++ b/src/core/nginx.h @@ -8,7 +8,7 @@ #define _NGINX_H_INCLUDED_ -#define NGINX_VER "nginx/0.1.37" +#define NGINX_VER "nginx/0.1.38" #define NGINX_VAR "NGINX" #define NGX_NEWPID_EXT ".newbin" diff --git a/src/core/ngx_connection.h b/src/core/ngx_connection.h index 0224d98dd..10a5cd587 100644 --- a/src/core/ngx_connection.h +++ b/src/core/ngx_connection.h @@ -128,6 +128,7 @@ struct ngx_connection_s { unsigned single_connection:1; unsigned unexpected_eof:1; unsigned timedout:1; + unsigned closed:1; unsigned sendfile:1; unsigned sndlowat:1; diff --git a/src/core/ngx_palloc.c b/src/core/ngx_palloc.c index e7c888285..9bb50f79c 100644 --- a/src/core/ngx_palloc.c +++ b/src/core/ngx_palloc.c @@ -15,7 +15,7 @@ ngx_create_pool(size_t size, ngx_log_t *log) p = ngx_alloc(size, log); if (p == NULL) { - return NULL; + return NULL; } p->last = (u_char *) p + sizeof(ngx_pool_t); diff --git a/src/core/ngx_string.c b/src/core/ngx_string.c index e21a9fcdd..575e60e84 100644 --- a/src/core/ngx_string.c +++ b/src/core/ngx_string.c @@ -753,20 +753,62 @@ ngx_utf_length(ngx_str_t *utf) continue; } - if (c < 0xC0) { - /* invalid utf */ - return utf->len; - } + if (c >= 0xc0) { + for (c <<= 1; c & 0x80; c <<= 1) { + i++; + } - for (c <<= 1; c & 0x80; c <<= 1) { - i++; + continue; } + + /* invalid utf */ + + return utf->len; } return len; } +u_char * +ngx_utf_cpystrn(u_char *dst, u_char *src, size_t n) +{ + u_char c; + + if (n == 0) { + return dst; + } + + for ( /* void */ ; --n; dst++, src++) { + + c = *src; + *dst = c; + + if (c < 0x80) { + if (*dst != '\0') { + continue; + } + + return dst; + } + + if (c >= 0xc0) { + for (c <<= 1; c & 0x80; c <<= 1) { + *++dst = *++src; + } + + continue; + } + + /* invalid utf */ + } + + *dst = '\0'; + + return dst; +} + + uintptr_t ngx_escape_uri(u_char *dst, u_char *src, size_t size, ngx_uint_t type) { diff --git a/src/core/ngx_string.h b/src/core/ngx_string.h index ff21619ae..545c6cc85 100644 --- a/src/core/ngx_string.h +++ b/src/core/ngx_string.h @@ -97,6 +97,8 @@ void ngx_encode_base64(ngx_str_t *dst, ngx_str_t *src); ngx_int_t ngx_decode_base64(ngx_str_t *dst, ngx_str_t *src); size_t ngx_utf_length(ngx_str_t *utf); +u_char * ngx_utf_cpystrn(u_char *dst, u_char *src, size_t n); + #define NGX_ESCAPE_URI 0 #define NGX_ESCAPE_ARGS 1 diff --git a/src/event/modules/ngx_rtsig_module.c b/src/event/modules/ngx_rtsig_module.c index 122b0918d..838b27d70 100644 --- a/src/event/modules/ngx_rtsig_module.c +++ b/src/event/modules/ngx_rtsig_module.c @@ -761,7 +761,7 @@ ngx_rtsig_process_overflow(ngx_cycle_t *cycle) } } - ngx_log_error(NGX_LOG_INFO, cycle->log, 0, + ngx_log_error(NGX_LOG_ALERT, cycle->log, 0, "rt signal queue overflow recovered"); overflow = 0; diff --git a/src/event/ngx_event_pipe.c b/src/event/ngx_event_pipe.c index e18621167..74cfac2d1 100644 --- a/src/event/ngx_event_pipe.c +++ b/src/event/ngx_event_pipe.c @@ -182,7 +182,8 @@ static ngx_int_t ngx_event_pipe_read_upstream(ngx_event_pipe_t *p) } else if (!p->cachable && p->downstream->data == p->output_ctx - && p->downstream->write->ready) + && p->downstream->write->ready + && !p->downstream->write->delayed) { /* * if the bufs are not needed to be saved in a cache and @@ -461,7 +462,8 @@ static ngx_int_t ngx_event_pipe_write_to_downstream(ngx_event_pipe_t *p) } if (p->downstream->data != p->output_ctx - || !p->downstream->write->ready) + || !p->downstream->write->ready + || p->downstream->write->delayed) { break; } diff --git a/src/http/modules/ngx_http_autoindex_module.c b/src/http/modules/ngx_http_autoindex_module.c index e26d2947e..d12834083 100644 --- a/src/http/modules/ngx_http_autoindex_module.c +++ b/src/http/modules/ngx_http_autoindex_module.c @@ -35,6 +35,7 @@ typedef struct { typedef struct { ngx_flag_t enable; ngx_flag_t localtime; + ngx_flag_t exact_size; } ngx_http_autoindex_loc_conf_t; @@ -67,6 +68,13 @@ static ngx_command_t ngx_http_autoindex_commands[] = { offsetof(ngx_http_autoindex_loc_conf_t, localtime), NULL }, + { ngx_string("autoindex_exact_size"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, + ngx_conf_set_flag_slot, + NGX_HTTP_LOC_CONF_OFFSET, + offsetof(ngx_http_autoindex_loc_conf_t, exact_size), + NULL }, + ngx_null_command }; @@ -117,10 +125,11 @@ static u_char tail[] = static ngx_int_t ngx_http_autoindex_handler(ngx_http_request_t *r) { - u_char *last; - size_t len; + u_char *last, scale; + off_t length; + size_t len, copy; ngx_tm_t tm; - ngx_int_t rc; + ngx_int_t rc, size; ngx_uint_t i, level; ngx_err_t err; ngx_buf_t *b; @@ -351,7 +360,7 @@ ngx_http_autoindex_handler(ngx_http_request_t *r) + NGX_HTTP_AUTOINDEX_NAME_LEN + sizeof(">") - 2 + sizeof("") - 1 + sizeof(" 28-Sep-1970 12:00 ") - 1 - + 19 + + 20 + 2; } @@ -396,14 +405,27 @@ ngx_http_autoindex_handler(ngx_http_request_t *r) *b->last++ = '"'; *b->last++ = '>'; - b->last = ngx_cpystrn(b->last, entry[i].name.data, - NGX_HTTP_AUTOINDEX_NAME_LEN + 1); - len = entry[i].utf_len; + if (len) { + if (len > NGX_HTTP_AUTOINDEX_NAME_LEN) { + copy = NGX_HTTP_AUTOINDEX_NAME_LEN - 3 + 1; + + } else { + copy = NGX_HTTP_AUTOINDEX_NAME_LEN + 1; + } + + b->last = ngx_utf_cpystrn(b->last, entry[i].name.data, copy); + last = b->last; + + } else { + b->last = ngx_cpystrn(b->last, entry[i].name.data, + NGX_HTTP_AUTOINDEX_NAME_LEN + 1); + last = b->last - 3; + } + if (len > NGX_HTTP_AUTOINDEX_NAME_LEN) { - b->last = ngx_cpymem(b->last - 3, "..>", - sizeof("..>") - 1); + b->last = ngx_cpymem(last, "..>", sizeof("..>") - 1); } else { if (entry[i].dir && NGX_HTTP_AUTOINDEX_NAME_LEN - len > 0) { @@ -427,12 +449,55 @@ ngx_http_autoindex_handler(ngx_http_request_t *r) tm.ngx_tm_hour, tm.ngx_tm_min); - if (entry[i].dir) { - b->last = ngx_cpymem(b->last, " -", - sizeof(" -") - 1); + if (alcf->exact_size) { + if (entry[i].dir) { + b->last = ngx_cpymem(b->last, " -", + sizeof(" -") - 1); + } else { + b->last = ngx_sprintf(b->last, "%19O", entry[i].size); + } } else { - b->last = ngx_sprintf(b->last, "%19O", entry[i].size); + if (entry[i].dir) { + b->last = ngx_cpymem(b->last, " -", sizeof(" -") - 1); + + } else { + length = entry[i].size; + + if (length > 1024 * 1024 * 1024 - 1) { + size = (ngx_int_t) (length / (1024 * 1024 * 1024)); + if ((length % (1024 * 1024 * 1024)) + > (1024 * 1024 * 1024 / 2 - 1)) + { + size++; + } + scale = 'G'; + + } else if (length > 1024 * 1024 - 1) { + size = (ngx_int_t) (length / (1024 * 1024)); + if ((length % (1024 * 1024)) > (1024 * 1024 / 2 - 1)) { + size++; + } + scale = 'M'; + + } else if (length > 9999) { + size = (ngx_int_t) (length / 1024); + if (length % 1024 > 511) { + size++; + } + scale = 'K'; + + } else { + size = (ngx_int_t) length; + scale = ' '; + } + + b->last = ngx_sprintf(b->last, "%6i", size); + + if (scale != ' ') { + *b->last++ = scale; + } + } } *b->last++ = CR; @@ -559,6 +624,7 @@ ngx_http_autoindex_create_loc_conf(ngx_conf_t *cf) conf->enable = NGX_CONF_UNSET; conf->localtime = NGX_CONF_UNSET; + conf->exact_size = NGX_CONF_UNSET; return conf; } @@ -572,6 +638,7 @@ ngx_http_autoindex_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child) ngx_conf_merge_value(conf->enable, prev->enable, 0); ngx_conf_merge_value(conf->localtime, prev->localtime, 0); + ngx_conf_merge_value(conf->exact_size, prev->exact_size, 1); return NGX_CONF_OK; } diff --git a/src/http/modules/ngx_http_gzip_filter_module.c b/src/http/modules/ngx_http_gzip_filter_module.c index f7cb92c18..596e52403 100644 --- a/src/http/modules/ngx_http_gzip_filter_module.c +++ b/src/http/modules/ngx_http_gzip_filter_module.c @@ -15,7 +15,7 @@ typedef struct { ngx_flag_t enable; ngx_flag_t no_buffer; - ngx_array_t *types; /* array of ngx_http_gzip_type_t */ + ngx_array_t *types; /* array of ngx_str_t */ ngx_bufs_t bufs; @@ -29,12 +29,6 @@ typedef struct { } ngx_http_gzip_conf_t; -typedef struct { - ngx_str_t name; - ngx_uint_t enable; -} ngx_http_gzip_type_t; - - #define NGX_HTTP_GZIP_PROXIED_OFF 0x0002 #define NGX_HTTP_GZIP_PROXIED_EXPIRED 0x0004 #define NGX_HTTP_GZIP_PROXIED_NO_CACHE 0x0008 @@ -91,20 +85,18 @@ static ngx_int_t ngx_http_gzip_filter_init(ngx_cycle_t *cycle); static void *ngx_http_gzip_create_conf(ngx_conf_t *cf); static char *ngx_http_gzip_merge_conf(ngx_conf_t *cf, void *parent, void *child); -static char *ngx_http_gzip_set_types(ngx_conf_t *cf, ngx_command_t *cmd, +static char *ngx_http_gzip_types(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); -static char *ngx_http_gzip_set_window(ngx_conf_t *cf, void *post, void *data); -static char *ngx_http_gzip_set_hash(ngx_conf_t *cf, void *post, void *data); +static char *ngx_http_gzip_window(ngx_conf_t *cf, void *post, void *data); +static char *ngx_http_gzip_hash(ngx_conf_t *cf, void *post, void *data); static ngx_conf_num_bounds_t ngx_http_gzip_comp_level_bounds = { ngx_conf_check_num_bounds, 1, 9 }; -static ngx_conf_post_handler_pt ngx_http_gzip_set_window_p = - ngx_http_gzip_set_window; -static ngx_conf_post_handler_pt ngx_http_gzip_set_hash_p = - ngx_http_gzip_set_hash; +static ngx_conf_post_handler_pt ngx_http_gzip_window_p = ngx_http_gzip_window; +static ngx_conf_post_handler_pt ngx_http_gzip_hash_p = ngx_http_gzip_hash; @@ -148,7 +140,7 @@ static ngx_command_t ngx_http_gzip_filter_commands[] = { { ngx_string("gzip_types"), NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE, - ngx_http_gzip_set_types, + ngx_http_gzip_types, NGX_HTTP_LOC_CONF_OFFSET, 0, NULL }, @@ -165,14 +157,14 @@ static ngx_command_t ngx_http_gzip_filter_commands[] = { ngx_conf_set_size_slot, NGX_HTTP_LOC_CONF_OFFSET, offsetof(ngx_http_gzip_conf_t, wbits), - &ngx_http_gzip_set_window_p }, + &ngx_http_gzip_window_p }, { ngx_string("gzip_hash"), 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_gzip_conf_t, memlevel), - &ngx_http_gzip_set_hash_p }, + &ngx_http_gzip_hash_p }, { ngx_string("gzip_no_buffer"), NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, @@ -270,10 +262,10 @@ static ngx_http_output_body_filter_pt ngx_http_next_body_filter; static ngx_int_t ngx_http_gzip_header_filter(ngx_http_request_t *r) { - ngx_uint_t i, found; + ngx_str_t *type; + ngx_uint_t i; ngx_http_gzip_ctx_t *ctx; ngx_http_gzip_conf_t *conf; - ngx_http_gzip_type_t *type; conf = ngx_http_get_module_loc_conf(r, ngx_http_gzip_filter_module); @@ -297,24 +289,21 @@ ngx_http_gzip_header_filter(ngx_http_request_t *r) } - found = 0; type = conf->types->elts; - for (i = 0; i < conf->types->nelts; i++) { - if (r->headers_out.content_type.len >= type[i].name.len + if (r->headers_out.content_type.len >= type[i].len && ngx_strncasecmp(r->headers_out.content_type.data, - type[i].name.data, type[i].name.len) == 0) + type[i].data, type[i].len) == 0) { - found = 1; - break; + goto found; } } - if (!found) { - return ngx_http_next_header_filter(r); - } + return ngx_http_next_header_filter(r); +found: + if (r->headers_in.via) { if (conf->proxied & NGX_HTTP_GZIP_PROXIED_OFF) { return ngx_http_next_header_filter(r); @@ -1031,7 +1020,7 @@ ngx_http_gzip_merge_conf(ngx_conf_t *cf, void *parent, void *child) ngx_http_gzip_conf_t *prev = parent; ngx_http_gzip_conf_t *conf = child; - ngx_http_gzip_type_t *type; + ngx_str_t *type; ngx_conf_merge_value(conf->enable, prev->enable, 0); @@ -1051,8 +1040,7 @@ ngx_http_gzip_merge_conf(ngx_conf_t *cf, void *parent, void *child) if (conf->types == NULL) { if (prev->types == NULL) { - conf->types = ngx_array_create(cf->pool, 1, - sizeof(ngx_http_gzip_type_t)); + conf->types = ngx_array_create(cf->pool, 1, sizeof(ngx_str_t)); if (conf->types == NULL) { return NGX_CONF_ERROR; } @@ -1062,9 +1050,8 @@ ngx_http_gzip_merge_conf(ngx_conf_t *cf, void *parent, void *child) return NGX_CONF_ERROR; } - type->name.len = sizeof("text/html") - 1; - type->name.data = (u_char *) "text/html"; - type->enable = 1; + type->len = sizeof("text/html") - 1; + type->data = (u_char *) "text/html"; } else { conf->types = prev->types; @@ -1076,17 +1063,15 @@ ngx_http_gzip_merge_conf(ngx_conf_t *cf, void *parent, void *child) static char * -ngx_http_gzip_set_types(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) +ngx_http_gzip_types(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) { ngx_http_gzip_conf_t *gcf = conf; - ngx_str_t *value; - ngx_uint_t i; - ngx_http_gzip_type_t *type; + ngx_str_t *value, *type; + ngx_uint_t i; if (gcf->types == NULL) { - gcf->types = ngx_array_create(cf->pool, 4, - sizeof(ngx_http_gzip_type_t)); + gcf->types = ngx_array_create(cf->pool, 4, sizeof(ngx_str_t)); if (gcf->types == NULL) { return NGX_CONF_ERROR; } @@ -1096,9 +1081,8 @@ ngx_http_gzip_set_types(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) return NGX_CONF_ERROR; } - type->name.len = sizeof("text/html") - 1; - type->name.data = (u_char *) "text/html"; - type->enable = 1; + type->len = sizeof("text/html") - 1; + type->data = (u_char *) "text/html"; } value = cf->args->elts; @@ -1114,14 +1098,14 @@ ngx_http_gzip_set_types(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) return NGX_CONF_ERROR; } - type->name.len = value[i].len; + type->len = value[i].len; - type->name.data = ngx_palloc(cf->pool, type->name.len + 1); - if (type->name.data == NULL) { + type->data = ngx_palloc(cf->pool, type->len + 1); + if (type->data == NULL) { return NGX_CONF_ERROR; } - ngx_cpystrn(type->name.data, value[i].data, type->name.len + 1); + ngx_cpystrn(type->data, value[i].data, type->len + 1); } return NGX_CONF_OK; @@ -1129,7 +1113,7 @@ ngx_http_gzip_set_types(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) static char * -ngx_http_gzip_set_window(ngx_conf_t *cf, void *post, void *data) +ngx_http_gzip_window(ngx_conf_t *cf, void *post, void *data) { int *np = data; @@ -1153,7 +1137,7 @@ ngx_http_gzip_set_window(ngx_conf_t *cf, void *post, void *data) static char * -ngx_http_gzip_set_hash(ngx_conf_t *cf, void *post, void *data) +ngx_http_gzip_hash(ngx_conf_t *cf, void *post, void *data) { int *np = data; diff --git a/src/http/modules/ngx_http_proxy_module.c b/src/http/modules/ngx_http_proxy_module.c index 83625be7b..85503d0ac 100644 --- a/src/http/modules/ngx_http_proxy_module.c +++ b/src/http/modules/ngx_http_proxy_module.c @@ -914,7 +914,7 @@ ngx_http_proxy_parse_status_line(ngx_http_request_t *r, ngx_http_proxy_ctx_t *p) } break; - /* end of request line */ + /* end of status line */ case sw_almost_done: p->status_end = pos - 1; switch (ch) { @@ -926,7 +926,7 @@ ngx_http_proxy_parse_status_line(ngx_http_request_t *r, ngx_http_proxy_ctx_t *p) } } - u->header_in.pos = pos + 1; + u->header_in.pos = pos; r->state = state; return NGX_AGAIN; @@ -1803,7 +1803,7 @@ ngx_http_proxy_pass(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) } for (i = 0; i < plcf->peers->number; i++) { - plcf->peers->peer[i].uri_separator = ":"; + plcf->peers->peer[i].uri_separator = ""; } plcf->host_header = inet_upstream.host_header; diff --git a/src/http/modules/ngx_http_rewrite_module.c b/src/http/modules/ngx_http_rewrite_module.c index ed7abd66a..5f73c026c 100644 --- a/src/http/modules/ngx_http_rewrite_module.c +++ b/src/http/modules/ngx_http_rewrite_module.c @@ -36,6 +36,8 @@ static ngx_int_t ngx_http_rewrite_init(ngx_cycle_t *cycle); static char *ngx_http_rewrite(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); static char *ngx_http_rewrite_return(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); +static char *ngx_http_rewrite_break(ngx_conf_t *cf, ngx_command_t *cmd, + void *conf); static char *ngx_http_rewrite_if(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); static char * ngx_http_rewrite_if_condition(ngx_conf_t *cf, @@ -66,6 +68,14 @@ static ngx_command_t ngx_http_rewrite_commands[] = { 0, NULL }, + { ngx_string("break"), + NGX_HTTP_SRV_CONF|NGX_HTTP_SIF_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF + |NGX_CONF_NOARGS, + ngx_http_rewrite_break, + NGX_HTTP_LOC_CONF_OFFSET, + 0, + NULL }, + { ngx_string("if"), NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_BLOCK|NGX_CONF_1MORE, ngx_http_rewrite_if, @@ -600,6 +610,24 @@ ngx_http_rewrite_return(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) } +static char * +ngx_http_rewrite_break(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) +{ + ngx_http_rewrite_loc_conf_t *lcf = conf; + + ngx_http_script_code_pt *code; + + code = ngx_http_script_start_code(cf->pool, &lcf->codes, sizeof(uintptr_t)); + if (code == NULL) { + return NGX_CONF_ERROR; + } + + *code = ngx_http_script_break_code; + + return NGX_CONF_OK; +} + + static char * ngx_http_rewrite_if(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) { diff --git a/src/http/modules/ngx_http_ssi_filter_module.c b/src/http/modules/ngx_http_ssi_filter_module.c index 2992ff59d..856726a35 100644 --- a/src/http/modules/ngx_http_ssi_filter_module.c +++ b/src/http/modules/ngx_http_ssi_filter_module.c @@ -24,6 +24,8 @@ typedef struct { ngx_flag_t silent_errors; ngx_flag_t ignore_recycled_buffers; + ngx_array_t *types; /* array of ngx_str_t */ + size_t min_file_chunk; size_t value_len; } ngx_http_ssi_conf_t; @@ -127,6 +129,8 @@ static ngx_int_t ngx_http_ssi_endif(ngx_http_request_t *r, static ngx_http_variable_value_t * ngx_http_ssi_date_gmt_local_variable(ngx_http_request_t *r, uintptr_t gmt); +static char *ngx_http_ssi_types(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); + static ngx_int_t ngx_http_ssi_add_variables(ngx_conf_t *cf); static void *ngx_http_ssi_create_conf(ngx_conf_t *cf); static char *ngx_http_ssi_merge_conf(ngx_conf_t *cf, @@ -164,6 +168,13 @@ static ngx_command_t ngx_http_ssi_filter_commands[] = { offsetof(ngx_http_ssi_conf_t, min_file_chunk), NULL }, + { ngx_string("ssi_types"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE, + ngx_http_ssi_types, + NGX_HTTP_LOC_CONF_OFFSET, + 0, + NULL }, + ngx_null_command }; @@ -201,7 +212,7 @@ static ngx_int_t (*ngx_http_next_body_filter) (ngx_http_request_t *r, static u_char ngx_http_ssi_string[] = "