Welcome! Log In Create A New Profile

Advanced

[nginx] Fixed setting of content type in some cases.

Ruslan Ermilov
December 27, 2013 10:42AM
details: http://hg.nginx.org/nginx/rev/2cfc095a607a
branches:
changeset: 5497:2cfc095a607a
user: Ruslan Ermilov <ru@nginx.com>
date: Fri Dec 27 19:40:04 2013 +0400
description:
Fixed setting of content type in some cases.

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.

diffstat:

src/http/modules/ngx_http_autoindex_module.c | 1 +
src/http/modules/ngx_http_image_filter_module.c | 1 +
src/http/modules/ngx_http_stub_status_module.c | 2 ++
3 files changed, 4 insertions(+), 0 deletions(-)

diffs (35 lines):

diff -r 9d056f10fb99 -r 2cfc095a607a src/http/modules/ngx_http_autoindex_module.c
--- a/src/http/modules/ngx_http_autoindex_module.c Fri Dec 27 18:47:42 2013 +0400
+++ b/src/http/modules/ngx_http_autoindex_module.c Fri Dec 27 19:40:04 2013 +0400
@@ -233,6 +233,7 @@ ngx_http_autoindex_handler(ngx_http_requ
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);

diff -r 9d056f10fb99 -r 2cfc095a607a src/http/modules/ngx_http_image_filter_module.c
--- a/src/http/modules/ngx_http_image_filter_module.c Fri Dec 27 18:47:42 2013 +0400
+++ b/src/http/modules/ngx_http_image_filter_module.c Fri Dec 27 19:40:04 2013 +0400
@@ -572,6 +572,7 @@ ngx_http_image_json(ngx_http_request_t *
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;

diff -r 9d056f10fb99 -r 2cfc095a607a src/http/modules/ngx_http_stub_status_module.c
--- a/src/http/modules/ngx_http_stub_status_module.c Fri Dec 27 18:47:42 2013 +0400
+++ b/src/http/modules/ngx_http_stub_status_module.c Fri Dec 27 19:40:04 2013 +0400
@@ -98,7 +98,9 @@ static ngx_int_t ngx_http_status_handler
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;

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] Fixed setting of content type in some cases.

Ruslan Ermilov 747 December 27, 2013 10:42AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 135
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready