On 05/02/2016 11:06 PM, <ggcampinho / gmail.com> wrote:
>
> Issue #12055 has been reported by Glauber Campinho.
>
> The RFC 7233, section 4.2 describes the the possibility of using a custom
`Content-Range` header and not only for bytes [[
https://tools.ietf.org/html/rfc7233#section-4.2]]. Although, the
`NET::HTTPResponse` considers that `Content-Range` present on the response
during the inflating is in `bytes` unit.
>
> This issue is caused by this line [[
https://github.com/ruby/ruby/blob/trunk/lib/net/http/response.rb#L252]]. In
the patch I changed it to check if the `Content-Range` unit is `bytes` and
there is a test to reproduce the error.
>

I don't see a problem with the existing code. No matter what range unit is
used, if the response body is not the complete resource representation, it
should not be inflated, because it's not the complete gzip/etc. stream.

If your example 'item' unit is applicable to a content-type that allows its
'items' to be individually compressed, that compression is a property of
the content-type itself, not a content-encoding of the resource as a whole.

Conversely, it's hard to reason about a range of 'items' inside a
gzip-encoded resource -- how do I transmit just the third line of
foo.csv.gz, for example?

If you want to transport individual chunks compressed, even though the
content-type doesn't necessarily support compressed chunks, you should look
at transfer encoding.

Incidentally, Content-Range does not apply to 200 Ok responses, you should
use 206 Partial Content.
(supressed text/html)
Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>