Re: P1: Content-Length SHOULD be sent

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 UTC