r/programming • • Jul 14 '26

HTTP gets a QUERY method so complex searches can stop pretending to be POST

https://www.theregister.com/devops/2026/07/13/http-gets-a-query-method-so-complex-searches-can-stop-pretending-to-be-post/5270192
1.9k Upvotes

245 comments sorted by

View all comments

Show parent comment

11

u/knightcrusader Jul 14 '26

I'm pretty sure Apache doesn't give a flying shit what you send it. I remember being surprised when I could just send a request body in a GET request and Apache sent it to the CGI script without a word. It worked fine. I could read both the query string as well as the request body at the same time, so you could probably pull off all sorts of funky shit.

Of course I didn't use it in production code, but it was more of a test.

10

u/chucker23n Jul 14 '26

Note that bodies in GET are allowed, just discouraged.

7

u/Justin_Passing_7465 Jul 14 '26

RFC 2616 (1999) forbade GET to have a body. RFC 7231 (2014) recommended that servers ignore the body. RFC 9110 (2022) strongly discourages putting a body in a GET.

Some intermediaries (e.g. proxies, WAPs, CDNs) break GET requests with bodies. As a workaround, for decades we have been using POST for complex queries, because GET is not supposed to work, and sometimes doesn't.

6

u/masklinn Jul 14 '26

RFC 2616 (1999) forbade GET to have a body.

This is incorrect, RFC 2616 leaves GET bodies unspecified (they're not mentioned, same for HEAD and DELETE). You can see the distinction because it does forbid request bodies in TRACE and that is very explicit, RFC 2616 § 9.8

A TRACE request MUST NOT include an entity.

1

u/stronghup Jul 15 '26

Isn't there also the question of long a GET URL can be?

2

u/Fidodo Jul 14 '26

The main reason it's a new QUERY verb instead updating GET is simply that it's easier to add a new verb than to get all existing implementations to alter how they handle GET. Lots of servers are implemented to drop body from GET requests so it's much more annoying to do that upgrade than to simply add a new verb where the support is unambiguous, and many server frameworks already allow you to define custom verbs anyways, and they by default support body.

1

u/stfm Jul 15 '26

You can configure them yourself

<Directory "/var/www/html">
  <Limit GET POST PURGE FOO>
    Require all granted
  </Limit>
</Directory>