Re: HTTP rfc related question, Content-length: 0 in GET request

Kuba Witczak schrieb:
> 
> 
> 
> 
> Hi,
> 
> I'm not sure if this is the right group to ask this question. If you
> know a better place please give me such advice.
> 
> The problem relates to HTTP protocol specification. I studied the RFC
> 2616 which describes HTTP/1.1, but AFAIC the situation is not described
> directly there.
> 
> The problem is that a system, which relies on HTTP protocol, refuses to
> accept GET requests with header 'Content-length: 0'. This header added
> to request doesn't bring any information, and should be ignored by a
> system which relies on HTTP protocol, am i correct?

No, it shouldn't be ignored. It should be processed. In this 
*particular* case that's the same as ignoring, but in theory the request 
*could* have a request body (although RFC2616 currently doesn't define 
what that would mean). In the latter case, the recipient would need to 
read the request body (potentially throwing it away afterwards).

> The sample request which causes error:
> 
> GET /somepath/gfx.png HTTP/1.1
> ...som other headers
> Content-length: 0
> 
> Perhaps you've faced similar problem previously and have some
> experiences.
> Is there any general rule in HTTP/1.1 protocol which allows or forbids
> 'Content-length: 0' header in GET requests?

There's no rule that forbids it.

> I've really tried to find it on my own in RFC 2616, but I might missed
> some valuable information.
> Please share your opinions.

Best regards, Julian

Received on Thursday, 22 June 2006 07:56:33 UTC