Subject: Re: Transfer-Encoding in a HEAD response

From: Henrik Nordström <[email-masked]>
Date: Tue, 04 May 2010 01:41:21 +0200

sön 2010-04-11 klockan 15:05 -0700 skrev Wenbo Zhu:
> I have recently noticed that many public websites, in responding to a
> HEAD request, will:
> 
> - omit Transfer-Encoding from the response headers if the GET response
> will be chunk-encoded;

ok.

> -- or (as expected) set the Content-Length if the GET response isn't
> going to be chunk-encoded;

ok.

> - or set Content-Length = 0;

not ok, unless it's really 0 on a GET as well.

> - or set a manual Content-Length as if there would be no
> chunk-encoding for the GET response.

not OK, unless the length is the actual length a GET would have
returned.

> While rfc-2616 doesn't require all the headers appear in the HEAD
> response, the confusion here mostly lies in whether Transfer-Encoding
> is applicable for a HEAD response (as it is the case for
> Content-Length).

I would say it's close to irrelevant. Transfer-Encoding is hop-by-hop
and have no impact on the response entity as such.

Regards
Henrik