tags:

views:

28

answers:

2

The client is making a range request 0-1023 to the http server. It prefers gzip compression with Accept-Encoding: gzip;q=1.0, identity; q=0.5, *;q=0 in the request.

What would be the content-length in the response header? Will it be 1024 or the size of the compressed data.

Thanks,

+4  A: 

Short version: it's the compressed size.

RFC 2616 has this to say (amongst other things) about Content-Length:

"Applications SHOULD use this field to indicate the transfer-length of the message-body, unless this is prohibited by the rules in section 4.4."

Section 4.4 (Message Length) says this about transfer-length:

"The transfer-length of a message is the length of the message-body as it appears in the message; that is, after any transfer-codings have been applied."

http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.4

pkh
+1  A: 

The actual content length depends on the transfer encoding and data: If you use identity, no compression is applied and the content length is 1024; if you use gzip, the actual content length depends on the data that is to be compressed.

Gumbo