Page 1 of 1

empty http GET request body

Posted: Sun Mar 07, 2010 8:37 pm
by Luke
So I'm working on a really simple HTTP client library and I am writing a unit test for a really simple GET request. It makes a GET request. I think I already know the answer to this, but I just want to double check. A GET request has no body, right? Wouldn't it look something like this:

Code: Select all

GET / HTTP/1.1
Host: example.com
Accept-Language: whatever
Whatever-Else: whatever

Re: empty http GET request body

Posted: Sun Mar 07, 2010 10:45 pm
by Weirdan
Luke wrote:A GET request has no body, right?
It usually has no body, right, but I don't see anything in rfc2616 about message-body being forbidden in GET requests. The same rfc states that in such cases server should read and ignore the body:
rfc2616 wrote:if the request method does not include defined semantics for an entity-body, then the message-body SHOULD be ignored when handling the request.
Btw, SHOULD!=MUST, and I've read somewhere that apache+php would process data in the message-body (filling it in the superglobals).