RE: current HTTP/2 spec prevents gzip of response to "Range" request

> Again, quoting the HTTP/1.1 spec, RFC2616 requires ranges to apply to the content-encoded content:
> - from Section 14.35.1: "Byte range specifications in HTTP apply to the sequence of bytes in the entity-body ..."
> - from Section 7.2.1: "entity-body := Content-Encoding( Content-Type( data ) )"



Here is an example from a HTTP/1.1 compliant server (Google's "sffe" server). Consider the following two range requests for an arbitrary url from google pointing to a static html page. (For  brevity, headers superfluous to the example have been omitted. Binary data are converted to hex. Captures were taken with Fiddler.)



1. Here is a range request without accepting gzip and the response from google...

GET https://www.google.at/insidesearch/howsearchworks/crawling-indexing.html HTTP/1.1

Host: www.google.at

User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)

Range: bytes=0-46



HTTP/1.1 206 Partial Content

Content-Range: bytes 0-46/18586

Server: sffe

Content-Length: 47



<!DOCTYPE html>

<html class="google" lang="de">



2. Now, here is the same range request, with "Accept-Encoding: gzip", and the response from google...

GET https://www.google.at/insidesearch/howsearchworks/crawling-indexing.html HTTP/1.1

Host: www.google.at

User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)

Range: bytes=0-46

Accept-Encoding: gzip



HTTP/1.1 206 Partial Content

Content-Range: bytes 0-46/4882

Content-Encoding: gzip

Server: sffe

Content-Length: 47



0000000 1f 8b 08 00 00 00 00 00 02 ff ad 5c ed 6f 1c c7

0000020 79 ff ee bf 62 72 1f 42 12 e5 dd 91 b6 e2 26 12

0000040 29 81 34 f5 56 db 32 23 d2 16 aa 24 20 e6 6e



What are these 47 bytes? And why is the Content-Range of the first "0-46/18586", but the second is "0-46/4882"?



The second request has returned the first 47 bytes of the gzip representation of the _entire_ file (not the gzip representation of just the range).



What can you do with these bytes?  Nothing.  You can't decompress a partial gzip file. The only thing you could do is request the rest of the file (i.e. range 47-4882), reassemble the gzip, decompress (yielding the entire file) and then extract the 47 bytes you are interested in.





--

Keith S. Morgan

Remote Monitoring Unit

Safeguards, International Atomic Energy Agency (IAEA)

Vienna, Austria

This email message is intended only for the use of the named recipient. Information contained in this email message and its attachments may be privileged, confidential and protected from disclosure. If you are not the intended recipient, please do not read, copy, use or disclose this communication to others. Also please notify the sender by replying to this message and then delete it from your system.

Received on Wednesday, 26 March 2014 10:45:46 UTC