summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2010-06-07 09:54:19 +0000
committerIgor Sysoev <igor@sysoev.ru>2010-06-07 09:54:19 +0000
commit90b8db32242fb32d130c2268c6f26de316a44f25 (patch)
tree16b2e3f98632b2483b1b4f52db03ae123a9e2aa4
parent149578df888a43b592c5efc4fb2e0441dbd5a9ff (diff)
downloadnginx-90b8db32242fb32d130c2268c6f26de316a44f25.tar.gz
merge r3454, r3455, r3486, r3496, r3519, r3523:
SSI fixes: *) use content type of the parent request in SSI stub block output instead of default one *) SSI %s timefmt has no timezone offset *) change ngx_http_ssi_filter and ngx_http_charset_filter order *) do not store an encoded variable value as a new cached variable value *) fix SSI include stub for valid empty responses *) allow to use $uid_got in SSI and perl module
-rw-r--r--auto/modules14
-rw-r--r--src/http/modules/ngx_http_ssi_filter_module.c30
-rw-r--r--src/http/modules/ngx_http_userid_filter_module.c2
-rw-r--r--src/http/ngx_http_copy_filter_module.c4
4 files changed, 25 insertions, 25 deletions
diff --git a/auto/modules b/auto/modules
index 01951c738..d19eda1db 100644
--- a/auto/modules
+++ b/auto/modules
@@ -101,8 +101,8 @@ fi
# ngx_http_range_header_filter
# ngx_http_gzip_filter
# ngx_http_postpone_filter
-# ngx_http_charset_filter
# ngx_http_ssi_filter
+# ngx_http_charset_filter
# ngx_http_xslt_filter
# ngx_http_image_filter_filter
# ngx_http_sub_filter
@@ -130,12 +130,6 @@ if [ $HTTP_POSTPONE = YES ]; then
HTTP_SRCS="$HTTP_SRCS $HTTP_POSTPONE_FILTER_SRCS"
fi
-if [ $HTTP_CHARSET = YES ]; then
- have=NGX_HTTP_CHARSET . auto/have
- HTTP_FILTER_MODULES="$HTTP_FILTER_MODULES $HTTP_CHARSET_FILTER_MODULE"
- HTTP_SRCS="$HTTP_SRCS $HTTP_CHARSET_SRCS"
-fi
-
if [ $HTTP_SSI = YES ]; then
have=NGX_HTTP_SSI . auto/have
HTTP_FILTER_MODULES="$HTTP_FILTER_MODULES $HTTP_SSI_FILTER_MODULE"
@@ -143,6 +137,12 @@ if [ $HTTP_SSI = YES ]; then
HTTP_SRCS="$HTTP_SRCS $HTTP_SSI_SRCS"
fi
+if [ $HTTP_CHARSET = YES ]; then
+ have=NGX_HTTP_CHARSET . auto/have
+ HTTP_FILTER_MODULES="$HTTP_FILTER_MODULES $HTTP_CHARSET_FILTER_MODULE"
+ HTTP_SRCS="$HTTP_SRCS $HTTP_CHARSET_SRCS"
+fi
+
if [ $HTTP_XSLT = YES ]; then
USE_LIBXSLT=YES
HTTP_FILTER_MODULES="$HTTP_FILTER_MODULES $HTTP_XSLT_FILTER_MODULE"
diff --git a/src/http/modules/ngx_http_ssi_filter_module.c b/src/http/modules/ngx_http_ssi_filter_module.c
index d03e58407..4ac35c60a 100644
--- a/src/http/modules/ngx_http_ssi_filter_module.c
+++ b/src/http/modules/ngx_http_ssi_filter_module.c
@@ -2061,9 +2061,9 @@ ngx_http_ssi_stub_output(ngx_http_request_t *r, void *data, ngx_int_t rc)
out = data;
if (!r->header_sent) {
- if (ngx_http_set_content_type(r) != NGX_OK) {
- return NGX_ERROR;
- }
+ r->headers_out.content_type_len =
+ r->parent->headers_out.content_type_len;
+ r->headers_out.content_type = r->parent->headers_out.content_type;
if (ngx_http_send_header(r) == NGX_ERROR) {
return NGX_ERROR;
@@ -2161,10 +2161,9 @@ ngx_http_ssi_echo(ngx_http_request_t *r, ngx_http_ssi_ctx_t *ctx,
}
}
- switch (ctx->encoding) {
+ p = value->data;
- case NGX_HTTP_SSI_NO_ENCODING:
- break;
+ switch (ctx->encoding) {
case NGX_HTTP_SSI_URL_ENCODING:
len = 2 * ngx_escape_uri(NULL, value->data, value->len,
@@ -2177,11 +2176,9 @@ ngx_http_ssi_echo(ngx_http_request_t *r, ngx_http_ssi_ctx_t *ctx,
}
(void) ngx_escape_uri(p, value->data, value->len, NGX_ESCAPE_HTML);
-
- value->len += len;
- value->data = p;
}
+ len += value->len;
break;
case NGX_HTTP_SSI_ENTITY_ENCODING:
@@ -2194,11 +2191,13 @@ ngx_http_ssi_echo(ngx_http_request_t *r, ngx_http_ssi_ctx_t *ctx,
}
(void) ngx_escape_html(p, value->data, value->len);
-
- value->len += len;
- value->data = p;
}
+ len += value->len;
+ break;
+
+ default: /* NGX_HTTP_SSI_NO_ENCODING */
+ len = value->len;
break;
}
@@ -2213,8 +2212,8 @@ ngx_http_ssi_echo(ngx_http_request_t *r, ngx_http_ssi_ctx_t *ctx,
}
b->memory = 1;
- b->pos = value->data;
- b->last = value->data + value->len;
+ b->pos = p;
+ b->last = p + len;
cl->buf = b;
cl->next = NULL;
@@ -2614,8 +2613,7 @@ ngx_http_ssi_date_gmt_local_variable(ngx_http_request_t *r,
return NGX_ERROR;
}
- v->len = ngx_sprintf(v->data, "%T", tp->sec + (gmt ? 0 : tp->gmtoff))
- - v->data;
+ v->len = ngx_sprintf(v->data, "%T", tp->sec) - v->data;
return NGX_OK;
}
diff --git a/src/http/modules/ngx_http_userid_filter_module.c b/src/http/modules/ngx_http_userid_filter_module.c
index 9997274a6..c5a148737 100644
--- a/src/http/modules/ngx_http_userid_filter_module.c
+++ b/src/http/modules/ngx_http_userid_filter_module.c
@@ -545,7 +545,7 @@ ngx_http_userid_add_variables(ngx_conf_t *cf)
{
ngx_http_variable_t *var;
- var = ngx_http_add_variable(cf, &ngx_http_userid_got, NGX_HTTP_VAR_NOHASH);
+ var = ngx_http_add_variable(cf, &ngx_http_userid_got, 0);
if (var == NULL) {
return NGX_ERROR;
}
diff --git a/src/http/ngx_http_copy_filter_module.c b/src/http/ngx_http_copy_filter_module.c
index c7f6be29d..97cd846a1 100644
--- a/src/http/ngx_http_copy_filter_module.c
+++ b/src/http/ngx_http_copy_filter_module.c
@@ -104,7 +104,9 @@ ngx_http_copy_filter(ngx_http_request_t *r, ngx_chain_t *in)
ctx->output_filter = (ngx_output_chain_filter_pt) ngx_http_next_filter;
ctx->filter_ctx = r;
- r->request_output = 1;
+ if (in && in->buf && ngx_buf_size(in->buf)) {
+ r->request_output = 1;
+ }
}
rc = ngx_output_chain(ctx, in);