Mercurial > hg > nginx
comparison src/http/modules/ngx_http_gzip_static_module.c @ 8120:c7e103acb409
Gzip static: ranges support (ticket #2349).
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.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Tue, 24 Jan 2023 03:01:51 +0300 |
parents | d26db4f82d7d |
children | f5515e727656 |
comparison
equal
deleted
inserted
replaced
8119:ec26874c3f60 | 8120:c7e103acb409 |
---|---|
245 h->next = NULL; | 245 h->next = NULL; |
246 ngx_str_set(&h->key, "Content-Encoding"); | 246 ngx_str_set(&h->key, "Content-Encoding"); |
247 ngx_str_set(&h->value, "gzip"); | 247 ngx_str_set(&h->value, "gzip"); |
248 r->headers_out.content_encoding = h; | 248 r->headers_out.content_encoding = h; |
249 | 249 |
250 r->allow_ranges = 1; | |
251 | |
250 /* we need to allocate all before the header would be sent */ | 252 /* we need to allocate all before the header would be sent */ |
251 | 253 |
252 b = ngx_calloc_buf(r->pool); | 254 b = ngx_calloc_buf(r->pool); |
253 if (b == NULL) { | 255 if (b == NULL) { |
254 return NGX_HTTP_INTERNAL_SERVER_ERROR; | 256 return NGX_HTTP_INTERNAL_SERVER_ERROR; |