comparison src/http/modules/ngx_http_ssi_filter_module.c @ 508:68c0ae0a4959 NGINX_0_7_66

nginx 0.7.66 *) Security: now nginx/Windows ignores default file stream name. Thanks to Jose Antonio Vazquez Gonzalez. *) Change: now the charset filter runs before the SSI filter. *) Change: now no message is written in an error log if a variable is not found by $r->variable() method. *) Change: now keepalive connections after POST requests are not disabled for MSIE 7.0+. Thanks to Adam Lounds. *) Feature: the "proxy_no_cache" and "fastcgi_no_cache" directives. *) Feature: now the "rewrite" directive does a redirect automatically if the $scheme variable is used. Thanks to Piotr Sikora. *) Feature: the "chunked_transfer_encoding" directive. *) Feature: the $geoip_city_continent_code, $geoip_latitude, and $geoip_longitude variables. Thanks to Arvind Sundararajan. *) Feature: now the ngx_http_image_filter_module deletes always EXIF and other application specific data if the data consume more than 5% of a JPEG file. *) Feature: now the "msie_padding" directive works for Chrome too. *) Workaround: now keepalive connections are disabled for Safari. Thanks to Joshua Sierles. *) Bugfix: nginx ignored the "private" and "no-store" values in the "Cache-Control" backend response header line. *) Bugfix: an "&" character was not escaped when it was copied in arguments part in a rewrite rule. *) Bugfix: nginx might be terminated abnormally while a signal processing or if the directive "timer_resolution" was used on platforms which do not support kqueue or eventport notification methods. Thanks to George Xie and Maxim Dounin. *) Bugfix: if temporary files and permanent storage area resided at different file systems, then permanent file modification times were incorrect. Thanks to Maxim Dounin. *) Bugfix: ngx_http_memcached_module might issue the error message "memcached sent invalid trailer". Thanks to Maxim Dounin. *) Bugfix: nginx could not built zlib-1.2.4 library using the library sources. Thanks to Maxim Dounin. *) Bugfix: values of the $query_string, $arg_..., etc. variables cached in main request were used by the SSI module in subrequests. *) Bugfix: nginx did not support HTTPS referrers. *) Bugfix: nginx/Windows might not find file if path in configuration was given in other character case; the bug had appeared in 0.7.65. *) Bugfix: the $date_local variable has an incorrect value, if the "%s" format was used. Thanks to Maxim Dounin. *) Bugfix: nginx did not support all ciphers and digests used in client certificates. Thanks to Innocenty Enikeew. *) Bugfix: if ssl_session_cache was not set or was set to "none", then during client certificate verify the error "session id context uninitialized" might occur; the bug had appeared in 0.7.1. *) Bugfix: OpenSSL-1.0.0 compatibility on 64-bit Linux. Thanks to Maxim Dounin. *) Bugfix: a geo range returned default value if the range included two or more /16 networks and did not begin at /16 network boundary. *) Bugfix: the $uid_got variable might not be used in the SSI and perl modules. *) Bugfix: a worker process hung if a FIFO file was requested. Thanks to Vicente Aguilar and Maxim Dounin. *) Bugfix: a variable value was repeatedly encoded after each an "echo" SSI-command output; the bug had appeared in 0.6.14. *) Bugfix: a "stub" parameter of an "include" SSI directive was not used, if empty response has 200 status code. *) Bugfix: a block used in a "stub" parameter of an "include" SSI directive was output with "text/plain" MIME type. *) Bugfix: if a proxied or FastCGI request was internally redirected to another proxied or FastCGI location, then a segmentation fault might occur in a worker process; the bug had appeared in 0.7.65. Thanks to Yichun Zhang. *) Bugfix: IMAP connections may hang until they timed out while talking to Zimbra server. Thanks to Alan Batie. *) Bugfix: nginx did not support chunked transfer encoding for 201 responses. Thanks to Julian Reich.
author Igor Sysoev <http://sysoev.ru>
date Mon, 07 Jun 2010 00:00:00 +0400
parents 89dc5654117c
children e1f4748dc78e
comparison
equal deleted inserted replaced
507:bfc170196f52 508:68c0ae0a4959
12 12
13 #define NGX_HTTP_SSI_DATE_LEN 2048 13 #define NGX_HTTP_SSI_DATE_LEN 2048
14 14
15 #define NGX_HTTP_SSI_ADD_PREFIX 1 15 #define NGX_HTTP_SSI_ADD_PREFIX 1
16 #define NGX_HTTP_SSI_ADD_ZERO 2 16 #define NGX_HTTP_SSI_ADD_ZERO 2
17 #define NGX_HTTP_SSI_EXPR_TEST 4
18 17
19 18
20 typedef struct { 19 typedef struct {
21 ngx_flag_t enable; 20 ngx_flag_t enable;
22 ngx_flag_t silent_errors; 21 ngx_flag_t silent_errors;
1699 key = ngx_hash_strlow(var.data, var.data, var.len); 1698 key = ngx_hash_strlow(var.data, var.data, var.len);
1700 1699
1701 val = ngx_http_ssi_get_variable(r, &var, key); 1700 val = ngx_http_ssi_get_variable(r, &var, key);
1702 1701
1703 if (val == NULL) { 1702 if (val == NULL) {
1704 vv = ngx_http_get_variable(r, &var, key, 1703 vv = ngx_http_get_variable(r, &var, key);
1705 flags & NGX_HTTP_SSI_EXPR_TEST);
1706 if (vv == NULL) { 1704 if (vv == NULL) {
1707 return NGX_ERROR; 1705 return NGX_ERROR;
1708 } 1706 }
1709 1707
1710 if (vv->not_found) { 1708 if (vv->not_found) {
2059 "ssi stub output: \"%V?%V\"", &r->uri, &r->args); 2057 "ssi stub output: \"%V?%V\"", &r->uri, &r->args);
2060 2058
2061 out = data; 2059 out = data;
2062 2060
2063 if (!r->header_sent) { 2061 if (!r->header_sent) {
2064 if (ngx_http_set_content_type(r) != NGX_OK) { 2062 r->headers_out.content_type_len =
2065 return NGX_ERROR; 2063 r->parent->headers_out.content_type_len;
2066 } 2064 r->headers_out.content_type = r->parent->headers_out.content_type;
2067 2065
2068 if (ngx_http_send_header(r) == NGX_ERROR) { 2066 if (ngx_http_send_header(r) == NGX_ERROR) {
2069 return NGX_ERROR; 2067 return NGX_ERROR;
2070 } 2068 }
2071 } 2069 }
2108 key = ngx_hash_strlow(var->data, var->data, var->len); 2106 key = ngx_hash_strlow(var->data, var->data, var->len);
2109 2107
2110 value = ngx_http_ssi_get_variable(r, var, key); 2108 value = ngx_http_ssi_get_variable(r, var, key);
2111 2109
2112 if (value == NULL) { 2110 if (value == NULL) {
2113 vv = ngx_http_get_variable(r, var, key, 1); 2111 vv = ngx_http_get_variable(r, var, key);
2114 2112
2115 if (vv == NULL) { 2113 if (vv == NULL) {
2116 return NGX_HTTP_SSI_ERROR; 2114 return NGX_HTTP_SSI_ERROR;
2117 } 2115 }
2118 2116
2159 "unknown encoding \"%V\" in the \"echo\" command", 2157 "unknown encoding \"%V\" in the \"echo\" command",
2160 enc); 2158 enc);
2161 } 2159 }
2162 } 2160 }
2163 2161
2162 p = value->data;
2163
2164 switch (ctx->encoding) { 2164 switch (ctx->encoding) {
2165
2166 case NGX_HTTP_SSI_NO_ENCODING:
2167 break;
2168 2165
2169 case NGX_HTTP_SSI_URL_ENCODING: 2166 case NGX_HTTP_SSI_URL_ENCODING:
2170 len = 2 * ngx_escape_uri(NULL, value->data, value->len, 2167 len = 2 * ngx_escape_uri(NULL, value->data, value->len,
2171 NGX_ESCAPE_HTML); 2168 NGX_ESCAPE_HTML);
2172 2169
2175 if (p == NULL) { 2172 if (p == NULL) {
2176 return NGX_HTTP_SSI_ERROR; 2173 return NGX_HTTP_SSI_ERROR;
2177 } 2174 }
2178 2175
2179 (void) ngx_escape_uri(p, value->data, value->len, NGX_ESCAPE_HTML); 2176 (void) ngx_escape_uri(p, value->data, value->len, NGX_ESCAPE_HTML);
2180 2177 }
2181 value->len += len; 2178
2182 value->data = p; 2179 len += value->len;
2183 }
2184
2185 break; 2180 break;
2186 2181
2187 case NGX_HTTP_SSI_ENTITY_ENCODING: 2182 case NGX_HTTP_SSI_ENTITY_ENCODING:
2188 len = ngx_escape_html(NULL, value->data, value->len); 2183 len = ngx_escape_html(NULL, value->data, value->len);
2189 2184
2192 if (p == NULL) { 2187 if (p == NULL) {
2193 return NGX_HTTP_SSI_ERROR; 2188 return NGX_HTTP_SSI_ERROR;
2194 } 2189 }
2195 2190
2196 (void) ngx_escape_html(p, value->data, value->len); 2191 (void) ngx_escape_html(p, value->data, value->len);
2197 2192 }
2198 value->len += len; 2193
2199 value->data = p; 2194 len += value->len;
2200 } 2195 break;
2201 2196
2197 default: /* NGX_HTTP_SSI_NO_ENCODING */
2198 len = value->len;
2202 break; 2199 break;
2203 } 2200 }
2204 2201
2205 b = ngx_calloc_buf(r->pool); 2202 b = ngx_calloc_buf(r->pool);
2206 if (b == NULL) { 2203 if (b == NULL) {
2211 if (cl == NULL) { 2208 if (cl == NULL) {
2212 return NGX_HTTP_SSI_ERROR; 2209 return NGX_HTTP_SSI_ERROR;
2213 } 2210 }
2214 2211
2215 b->memory = 1; 2212 b->memory = 1;
2216 b->pos = value->data; 2213 b->pos = p;
2217 b->last = value->data + value->len; 2214 b->last = p + len;
2218 2215
2219 cl->buf = b; 2216 cl->buf = b;
2220 cl->next = NULL; 2217 cl->next = NULL;
2221 *ctx->last_out = cl; 2218 *ctx->last_out = cl;
2222 ctx->last_out = &cl->next; 2219 ctx->last_out = &cl->next;
2360 2357
2361 while (p < last && *p == ' ') { 2358 while (p < last && *p == ' ') {
2362 p++; 2359 p++;
2363 } 2360 }
2364 2361
2365 flags = (p == last) ? NGX_HTTP_SSI_EXPR_TEST : 0; 2362 flags = 0;
2366 2363
2367 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, 2364 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
2368 "left: \"%V\"", &left); 2365 "left: \"%V\"", &left);
2369 2366
2370 rc = ngx_http_ssi_evaluate_string(r, ctx, &left, flags); 2367 rc = ngx_http_ssi_evaluate_string(r, ctx, &left, flags);
2612 v->data = ngx_pnalloc(r->pool, NGX_TIME_T_LEN); 2609 v->data = ngx_pnalloc(r->pool, NGX_TIME_T_LEN);
2613 if (v->data == NULL) { 2610 if (v->data == NULL) {
2614 return NGX_ERROR; 2611 return NGX_ERROR;
2615 } 2612 }
2616 2613
2617 v->len = ngx_sprintf(v->data, "%T", tp->sec + (gmt ? 0 : tp->gmtoff)) 2614 v->len = ngx_sprintf(v->data, "%T", tp->sec) - v->data;
2618 - v->data;
2619 2615
2620 return NGX_OK; 2616 return NGX_OK;
2621 } 2617 }
2622 2618
2623 if (gmt) { 2619 if (gmt) {