]> git.kaiwu.me - nginx.git/commitdiff
Fixed setting of content type in some cases.
authorRuslan Ermilov <ru@nginx.com>
Fri, 27 Dec 2013 15:40:04 +0000 (19:40 +0400)
committerRuslan Ermilov <ru@nginx.com>
Fri, 27 Dec 2013 15:40:04 +0000 (19:40 +0400)
This fixes content type set in stub_status and autoindex responses
to be usable in content type checks made by filter modules, such
as charset and sub filters.

src/http/modules/ngx_http_autoindex_module.c
src/http/modules/ngx_http_image_filter_module.c
src/http/modules/ngx_http_stub_status_module.c

index 221455120a6110e95e370ee31edf46096fe7e8e9..f694df075db3f46dea6c8002597d493ae9b0b32d 100644 (file)
@@ -233,6 +233,7 @@ ngx_http_autoindex_handler(ngx_http_request_t *r)
     r->headers_out.status = NGX_HTTP_OK;
     r->headers_out.content_type_len = sizeof("text/html") - 1;
     ngx_str_set(&r->headers_out.content_type, "text/html");
+    r->headers_out.content_type_lowcase = NULL;
 
     rc = ngx_http_send_header(r);
 
index cc41ef0d50f341e332d3f756c924c76befd4be38..c983b973b4646a965384b873a169a1a7d819bec2 100644 (file)
@@ -572,6 +572,7 @@ ngx_http_image_json(ngx_http_request_t *r, ngx_http_image_filter_ctx_t *ctx)
     ngx_http_clean_header(r);
 
     r->headers_out.status = NGX_HTTP_OK;
+    r->headers_out.content_type_len = sizeof("application/json") - 1;
     ngx_str_set(&r->headers_out.content_type, "application/json");
     r->headers_out.content_type_lowcase = NULL;
 
index fe9132df841a785c5a4d2ec5c9a7be4a355585b8..b5ecd6d9e2f1a18ea34ffc9d200775b85c6f3ae7 100644 (file)
@@ -98,7 +98,9 @@ static ngx_int_t ngx_http_status_handler(ngx_http_request_t *r)
         return rc;
     }
 
+    r->headers_out.content_type_len = sizeof("text/plain") - 1;
     ngx_str_set(&r->headers_out.content_type, "text/plain");
+    r->headers_out.content_type_lowcase = NULL;
 
     if (r->method == NGX_HTTP_HEAD) {
         r->headers_out.status = NGX_HTTP_OK;