empty http GET request body

XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).

Moderator: General Moderators

Post Reply
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

empty http GET request body

Post 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
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Re: empty http GET request body

Post 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).
Post Reply