Re: 304 response with Content-Length header == OK?

In a previous episode Wham Bang said...
:: 
:: While testing an HTTP/1.1 proxy server I am working on,
:: I found a page on a major site that returns the following
:: response on a conditional GET:
:: 
:: > HTTP/1.0 304 Not Modified
:: > Content-type: image/gif
:: > Content-length: 4672
:: > Expires: Thu, 15 Apr 2010 20:00:00 GMT
:: > Last-modified: Fri, 15 Apr 1994 00:00:00 GMT
:: >
:: 
:: The response didn't contain a body, but the presence
:: of a Content-Length threw off the proxy.  I'll be fixing
:: that in the name of tolerance in any case. But I was
:: wondering if including a Content-Length on a response
:: that must NOT include a body and which isn't produced by
:: a HEAD request should be considered a bug?  That is,

my reasonably literate (but not super expert) reading makes this look
like a lose-lose (you're both wrong ;).. story of my life some days..)

as for your proxy:

   4.4 Message 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. When a message-body is included with a message,
   the transfer-length of that body is determined by one of the
   following (in order of precedence):

   1.Any response message which "MUST NOT" include a message-body
     (such as the 1xx, 204, and 304 responses and any response to a
     HEAD request) is always terminated by the first empty line after
     the header fields, regardless of the entity-header fields present
     in the message.

so ignoring content-length isn't just tolerant, it's required.

and as for the content provider:

14.13 Content-Length

   The Content-Length entity-header field indicates the size of the
   entity-body, in decimal number of OCTETs, sent to the recipient or,
   in the case of the HEAD method, the size of the entity-body that
   would have been sent have been sent had the request been a GET.

they're definitely in the wrong as their entity body is size 0 and
they aren't responding to a HEAD.

-P

Received on Monday, 28 June 1999 14:05:57 UTC