]> git.kaiwu.me - nginx.git/commitdiff
Gzip static: ranges support (ticket #2349).
authorMaxim Dounin <mdounin@mdounin.ru>
Tue, 24 Jan 2023 00:01:51 +0000 (03:01 +0300)
committerMaxim Dounin <mdounin@mdounin.ru>
Tue, 24 Jan 2023 00:01:51 +0000 (03:01 +0300)
In contrast to on-the-fly gzipping with gzip filter, static gzipped
representation as returned by gzip_static is persistent, and therefore
the same binary representation is available for future requests, making
it possible to use range requests.

Further, if a gzipped representation is re-generated with different
compression settings, it is expected to result in different ETag and
different size reported in the Content-Range header, making it possible
to safely use range requests anyway.

As such, ranges are now allowed for files returned by gzip_static.

src/http/modules/ngx_http_gzip_static_module.c

index 66fcc5d1bf57a79595a95b1d4526578676315838..0ab14636e6c4359ca523a8ba2f6d5a99b570740a 100644 (file)
@@ -247,6 +247,8 @@ ngx_http_gzip_static_handler(ngx_http_request_t *r)
     ngx_str_set(&h->value, "gzip");
     r->headers_out.content_encoding = h;
 
+    r->allow_ranges = 1;
+
     /* we need to allocate all before the header would be sent */
 
     b = ngx_calloc_buf(r->pool);