W3C home > Mailing lists > Public > ietf-http-wg@w3.org > October to December 2012

Re: P1: Content-Length SHOULD be sent

From: Martin Thomson <martin.thomson@gmail.com>
Date: Tue, 27 Nov 2012 16:10:07 -0800
Message-ID: <CABkgnnXfKK1gAFjxKOwAoH0ttuHTVbnHE-WmNDozbsrgkLDbfg@mail.gmail.com>
To: Mark Nottingham <mnot@mnot.net>
Cc: "Roy T. Fielding" <fielding@gbiv.com>, HTTP Working Group <ietf-http-wg@w3.org>
On 27 November 2012 14:58, Mark Nottingham <mnot@mnot.net> wrote:
> When a message is allowed to contain a body, does not have a Transfer-Encoding header field, and has a payload body length that is known to the sender before the message header section has been sent, the sender should send a Content-Length header field to indicate the length of the payload body as a decimal number of octets, unless the message is a request and the method does not define any meaning for the body (in which case the Content-Length header MAY be sent).

IANAL, so this was hard to parse for me.  How about:

--8<--
The Content-Length header indicates the size of a message body as a
decimal number of octets.  The sender SHOULD set Content-Length if:
   o  the message is allowed to contain a body,
   o  the Transfer-Encoding header field is not included, and
   o  the size of the message body is known at the time that headers are sent.
Messages that do not define a meaning for the body MAY either omit the
Content-Length header field or include a value of 0.
-->8--

I'm leery of the "SHOULD" still.  It seems weak.  I'd almost go with
MUST include and a fourth condition: the message size is unknown and
the end of the body is signaled by closing the connection (in which
case the Connection header MUST include the 'close' token).
Received on Wednesday, 28 November 2012 00:10:35 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 28 November 2012 00:10:37 GMT