mirror of
https://github.com/nginx/nginx.git
synced 2025-06-07 17:52:38 +08:00
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.
This commit is contained in:
parent
ab3c0f9250
commit
42c049bd2d
@ -432,7 +432,9 @@ ngx_http_range_multipart_header(ngx_http_request_t *r,
|
|||||||
+ r->headers_out.content_type.len
|
+ r->headers_out.content_type.len
|
||||||
+ sizeof(CRLF "Content-Range: bytes ") - 1;
|
+ 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;
|
len += sizeof("; charset=") - 1 + r->headers_out.charset.len;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -451,7 +453,9 @@ ngx_http_range_multipart_header(ngx_http_request_t *r,
|
|||||||
* "Content-Range: bytes "
|
* "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,
|
ctx->boundary_header.len = ngx_sprintf(ctx->boundary_header.data,
|
||||||
CRLF "--%0muA" CRLF
|
CRLF "--%0muA" CRLF
|
||||||
"Content-Type: %V; charset=%V" CRLF
|
"Content-Type: %V; charset=%V" CRLF
|
||||||
@ -461,8 +465,6 @@ ngx_http_range_multipart_header(ngx_http_request_t *r,
|
|||||||
&r->headers_out.charset)
|
&r->headers_out.charset)
|
||||||
- ctx->boundary_header.data;
|
- ctx->boundary_header.data;
|
||||||
|
|
||||||
r->headers_out.charset.len = 0;
|
|
||||||
|
|
||||||
} else if (r->headers_out.content_type.len) {
|
} else if (r->headers_out.content_type.len) {
|
||||||
ctx->boundary_header.len = ngx_sprintf(ctx->boundary_header.data,
|
ctx->boundary_header.len = ngx_sprintf(ctx->boundary_header.data,
|
||||||
CRLF "--%0muA" CRLF
|
CRLF "--%0muA" CRLF
|
||||||
@ -501,6 +503,8 @@ ngx_http_range_multipart_header(ngx_http_request_t *r,
|
|||||||
|
|
||||||
r->headers_out.content_type_len = r->headers_out.content_type.len;
|
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 */
|
/* the size of the last boundary CRLF "--0123456789--" CRLF */
|
||||||
|
|
||||||
len = sizeof(CRLF "--") - 1 + NGX_ATOMIC_T_LEN + sizeof("--" CRLF) - 1;
|
len = sizeof(CRLF "--") - 1 + NGX_ATOMIC_T_LEN + sizeof("--" CRLF) - 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user