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
This commit is contained in:
Igor Sysoev 2010-06-07 09:54:19 +00:00
parent f3a89a2cd3
commit 3baed8e663
4 changed files with 25 additions and 25 deletions

View File

@ -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"

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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);