Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request body should be allowed with GET/HEAD requests #698

Closed
kaedroho opened this issue Nov 29, 2015 · 2 comments
Closed

Request body should be allowed with GET/HEAD requests #698

kaedroho opened this issue Nov 29, 2015 · 2 comments

Comments

@kaedroho
Copy link
Contributor

Currently, the body is ignored when the request method is either GET or HEAD.

I had a look through the HTTP 1.1 spec and didn't find any mention of restricting request bodies to certian methods (http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.3).

I have also seen this behaviour used in the wild. For example, Elasticsearch uses it for passing the search query when performing a search request (https://www.elastic.co/guide/en/elasticsearch/reference/1.4/search-request-body.html).

Relevant code: https://github.com/hyperium/hyper/blob/master/src/server/request.rs#L44-L45
Introduced in: a60a67c

@jdm
Copy link

jdm commented Nov 29, 2015

2616 has been superseded. See http://tools.ietf.org/html/rfc7231#section-4.3.2 for the relevant MUST NOT.

@kaedroho
Copy link
Contributor Author

@jdm Thanks!

That excerpt you referenced refers to the body on HEAD responses. Here, I'm refering to the body on GET/HEAD requests. This is actually mentioned in that spec in a separate paragraph:

A payload within a GET request message has no defined semantics;
sending a payload body on a GET request might cause some existing
implementations to reject the request.

"no defined semantics" does sound a little worrying, but I can't see anything here that disallows it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants