summaryrefslogtreecommitdiffhomepage
path: root/src/http/modules
diff options
context:
space:
mode:
Diffstat (limited to 'src/http/modules')
-rw-r--r--src/http/modules/ngx_http_charset_filter.c17
-rw-r--r--src/http/modules/ngx_http_headers_filter.c3
2 files changed, 14 insertions, 6 deletions
diff --git a/src/http/modules/ngx_http_charset_filter.c b/src/http/modules/ngx_http_charset_filter.c
index 63ac0e1ce..d7ce88e10 100644
--- a/src/http/modules/ngx_http_charset_filter.c
+++ b/src/http/modules/ngx_http_charset_filter.c
@@ -148,12 +148,19 @@ static ngx_int_t ngx_http_charset_header_filter(ngx_http_request_t *r)
}
#endif
- if (r->headers_out.content_type == NULL
- || ngx_strncasecmp(r->headers_out.content_type->value.data,
+ if (r->headers_out.content_type == NULL) {
+ return ngx_http_next_header_filter(r);
+ }
+
+ if (ngx_strncasecmp(r->headers_out.content_type->value.data,
"text/", 5) != 0
- || ngx_strstr(r->headers_out.content_type->value.data, "charset")
- != NULL
- )
+ && ngx_strncasecmp(r->headers_out.content_type->value.data,
+ "application/x-javascript", 24) != 0)
+ {
+ return ngx_http_next_header_filter(r);
+ }
+
+ if (ngx_strstr(r->headers_out.content_type->value.data, "charset") != NULL)
{
return ngx_http_next_header_filter(r);
}
diff --git a/src/http/modules/ngx_http_headers_filter.c b/src/http/modules/ngx_http_headers_filter.c
index b850ee36d..7dcb88d10 100644
--- a/src/http/modules/ngx_http_headers_filter.c
+++ b/src/http/modules/ngx_http_headers_filter.c
@@ -125,7 +125,8 @@ static ngx_int_t ngx_http_headers_filter(ngx_http_request_t *r)
cc->value.data = (u_char *) "no-cache";
} else {
- cc->value.data = ngx_palloc(r->pool, TIME_T_LEN + 1);
+ cc->value.data = ngx_palloc(r->pool,
+ sizeof("max-age=") + TIME_T_LEN + 1);
if (cc->value.data == NULL) {
return NGX_ERROR;
}