<div dir="ltr"># HG changeset patch<br># User Sangdeuk Kwon <<a href="mailto:sangdeuk.kwon@quantil.com">sangdeuk.kwon@quantil.com</a>><br># Date 1596515879 -32400<br>#      Tue Aug 04 13:37:59 2020 +0900<br># Node ID 6ed0cfe89f288587b6815333bab798d6aedc6137<br># Parent  da8d758aabebbba833405463aa5a785b4c324495<br>slice and gzip problem<br><br>When slice is enabled, client request content with "Accept-Encoding: gzip" and "Range: bytes=2048-3071",<br>nginx serves only partial gzipped content with "200 OK" instead of "206 Parital Content".<br>This response is wrong because nginx reply "200 OK" even if it serves only partial content.<br>Client thinks he receives whole content because of "200 OK".<br><br>ngx_http_gzip_filter_module is higher priority than ngx_http_slice_filter_module.<br>gzip_filter_module remove slice_filter_module's info when gzip is invoked.<br>So, nginx reply "200 OK" with gzipped whole content.<br><br>But, what if user request has "Range" header (only one slice case),<br>nginx can't access the previous slice of user request's.<br>It means nginx can't serve correct content if gzip_filter_module remove slice's info.<br>nginx can serve correct content with "206 Partial Content" without gzip because nginx can't access whole content.<br><br>If user reuqest has "Range" header (only one slice case), gzip_filter should be disabled instead of slice_filter.<br><br>diff -r da8d758aabeb -r 6ed0cfe89f28 src/http/modules/ngx_http_gzip_filter_module.c<br>--- a/src/http/modules/ngx_http_gzip_filter_module.c Mon Jul 27 16:02:15 2020 +0300<br>+++ b/src/http/modules/ngx_http_gzip_filter_module.c    Tue Aug 04 13:37:59 2020 +0900<br>@@ -233,6 +233,8 @@<br>             && r->headers_out.content_encoding->value.len)<br>         || (r->headers_out.content_length_n != -1<br>             && r->headers_out.content_length_n < conf->min_length)<br>+        || (r->allow_ranges && r == r->main<br>+            && r->headers_out.content_offset > 0)<br>         || ngx_http_test_content_type(r, &conf->types) == NULL<br>         || r->header_only)<br>     {<br></div>