Sergey Kandaurov
July 15, 2022 09:36AM
details: https://hg.nginx.org/nginx/rev/ae2d62bb12c0
branches:
changeset: 8057:ae2d62bb12c0
user: Maxim Dounin <mdounin@mdounin.ru>
date: Fri Jul 15 07:01:44 2022 +0300
description:
Range filter: clearing of pre-existing Content-Range headers.

Some servers might emit Content-Range header on 200 responses, and this
does not seem to contradict RFC 9110: as per RFC 9110, the Content-Range
header has no meaning for status codes other than 206 and 416. Previously
this resulted in duplicate Content-Range headers in nginx responses handled
by the range filter. Fix is to clear pre-existing headers.

diffstat:

src/http/modules/ngx_http_range_filter_module.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)

diffs (37 lines):

diff -r 0422365794f7 -r ae2d62bb12c0 src/http/modules/ngx_http_range_filter_module.c
--- a/src/http/modules/ngx_http_range_filter_module.c Thu Jul 14 21:26:54 2022 +0400
+++ b/src/http/modules/ngx_http_range_filter_module.c Fri Jul 15 07:01:44 2022 +0300
@@ -425,6 +425,10 @@ ngx_http_range_singlepart_header(ngx_htt
return NGX_ERROR;
}

+ if (r->headers_out.content_range) {
+ r->headers_out.content_range->hash = 0;
+ }
+
r->headers_out.content_range = content_range;

content_range->hash = 1;
@@ -582,6 +586,11 @@ ngx_http_range_multipart_header(ngx_http
r->headers_out.content_length = NULL;
}

+ if (r->headers_out.content_range) {
+ r->headers_out.content_range->hash = 0;
+ r->headers_out.content_range = NULL;
+ }
+
return ngx_http_next_header_filter(r);
}

@@ -598,6 +607,10 @@ ngx_http_range_not_satisfiable(ngx_http_
return NGX_ERROR;
}

+ if (r->headers_out.content_range) {
+ r->headers_out.content_range->hash = 0;
+ }
+
r->headers_out.content_range = content_range;

content_range->hash = 1;
_______________________________________________
nginx-devel mailing list -- nginx-devel@nginx.org
To unsubscribe send an email to nginx-devel-leave@nginx.org
Subject Author Views Posted

[nginx] Range filter: clearing of pre-existing Content-Range headers.

Sergey Kandaurov 577 July 15, 2022 09:36AM



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

Online Users

Guests: 276
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