Welcome! Log In Create A New Profile

Advanced

[nginx] Range filter: fixed duplicate charset.

Ruslan Ermilov
February 10, 2014 07:44AM
details: http://hg.nginx.org/nginx/rev/eeb3c2719147
branches:
changeset: 5558:eeb3c2719147
user: Ruslan Ermilov <ru@nginx.com>
date: Tue Feb 04 17:13:35 2014 +0400
description:
Range filter: fixed duplicate charset.

If a proxied response had charset in Content-Type, the
charset was duplicated in a response to client request
with byte ranges.

diffstat:

src/http/modules/ngx_http_range_filter_module.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)

diffs (43 lines):

diff -r 188481078faf -r eeb3c2719147 src/http/modules/ngx_http_range_filter_module.c
--- a/src/http/modules/ngx_http_range_filter_module.c Mon Feb 03 14:17:17 2014 -0800
+++ b/src/http/modules/ngx_http_range_filter_module.c Tue Feb 04 17:13:35 2014 +0400
@@ -432,7 +432,9 @@ ngx_http_range_multipart_header(ngx_http
+ r->headers_out.content_type.len
+ sizeof(CRLF "Content-Range: bytes ") - 1;

- if (r->headers_out.charset.len) {
+ if (r->headers_out.content_type_len == r->headers_out.content_type.len
+ && r->headers_out.charset.len)
+ {
len += sizeof("; charset=") - 1 + r->headers_out.charset.len;
}

@@ -451,7 +453,9 @@ ngx_http_range_multipart_header(ngx_http
* "Content-Range: bytes "
*/

- if (r->headers_out.charset.len) {
+ if (r->headers_out.content_type_len == r->headers_out.content_type.len
+ && r->headers_out.charset.len)
+ {
ctx->boundary_header.len = ngx_sprintf(ctx->boundary_header.data,
CRLF "--%0muA" CRLF
"Content-Type: %V; charset=%V" CRLF
@@ -461,8 +465,6 @@ ngx_http_range_multipart_header(ngx_http
&r->headers_out.charset)
- ctx->boundary_header.data;

- r->headers_out.charset.len = 0;
-
} else if (r->headers_out.content_type.len) {
ctx->boundary_header.len = ngx_sprintf(ctx->boundary_header.data,
CRLF "--%0muA" CRLF
@@ -501,6 +503,8 @@ ngx_http_range_multipart_header(ngx_http

r->headers_out.content_type_len = r->headers_out.content_type.len;

+ r->headers_out.charset.len = 0;
+
/* the size of the last boundary CRLF "--0123456789--" CRLF */

len = sizeof(CRLF "--") - 1 + NGX_ATOMIC_T_LEN + sizeof("--" CRLF) - 1;

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

[nginx] Range filter: fixed duplicate charset.

Ruslan Ermilov 878 February 10, 2014 07:44AM



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

Online Users

Guests: 180
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready