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

Re: P1: Content-Length SHOULD be sent

From: Zhong Yu <zhong.j.yu@gmail.com>
Date: Tue, 4 Dec 2012 18:31:54 -0600
Message-ID: <CACuKZqG4V1hR0u=DTXyfYzeoHrFaxvNrTxWKbrDRaYLozD0xFA@mail.gmail.com>
To: "Adrien W. de Croy" <adrien@qbik.com>
Cc: Willy Tarreau <w@1wt.eu>, Martin Thomson <martin.thomson@gmail.com>, Mark Nottingham <mnot@mnot.net>, "Roy T. Fielding" <fielding@gbiv.com>, HTTP Working Group <ietf-http-wg@w3.org>
On Tue, Dec 4, 2012 at 6:19 PM, Adrien W. de Croy <adrien@qbik.com> wrote:
>
> ------ Original Message ------
> From: "Willy Tarreau" <w@1wt.eu>
>>
>> Hi Martin,
>>
>> On Tue, Dec 04, 2012 at 03:08:01PM -0800, Martin Thomson wrote:
>>
>>>
>>> On 4 December 2012 15:05, Zhong Yu <zhong.j.yu@gmail.com> wrote:
>>>>
>>>> On Tue, Dec 4, 2012 at 3:30 PM, Willy Tarreau <w@1wt.eu> wrote:
>>>>>
>>>>>    6.  If this is a request message and none of the above are true,
>>>>> then
>>>>>        the message body length is zero (no message body is present).
>>>>
>>>>
>>>> I think it should simply state
>>>>
>>>>     6.  If this is a request message and none of the above are true,
>>>> then
>>>>         the message contains no body.
>>>
>>>
>>> Is it really useful to distinguish between no body and body with no
>>> content?  I can't imagine a use for such a distinction.
>>>
>>
>>
>> I think the example with the POST that is rejected without a
>> content-length
>> is valid, I have already observed this one, though I don't remember on
>> what server.
>>
> maybe that's a bug in that server?

The server conforms to RFC2616:

the request has no Content-Length/Transfer-Encoding
=> the request has no message body
=> the request has no entity body
=> the POST request contains no entity
=> the request is unintelligible.

My prev quotes from RFC2616

=====

(HTTP messages) consist of ... possibly a message-body.

The message-body (if any) of an HTTP message is used to carry the entity-body

The presence of a message-body in a request is signaled by the
inclusion of a Content-Length or Transfer-Encoding header field in the
request's message-headers.

messages MAY transfer an entity

An entity consists of entity-header fields and an entity-body,
although some *responses* will only include the entity-headers.

An entity-body is only present in a message when a message-body is present

====

We can conclude that

If a request does not have "Content-Length" or "Transfer-Encoding", it
does not contain a message body, it does not contain an entity body,
it does not contain an entity.

If a request has "Content-Length: 0", it contains a message body of 0
bytes, it contain an entity body of 0 bytes, it contain an entity.

This is true regardless of the request method.


> Adrien
>
>>
>>
>> Willy
>>
>>
>>
>>
>
Received on Wednesday, 5 December 2012 00:32:23 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 5 December 2012 00:32:25 GMT