RFC 10008: The new HTTP Query Method
Posted by schappim 5 hours ago
Comments
Comment by 100ms 3 hours ago
Even imagining a QUERY with a large JSON filtering structure, or say an image input as request body, it feels extremely odd to include the request body as part of the cache key. It also implies an unbounded and user-controlled cache key, with the only really meaningful general caching strategy being bitwise compare of the request body (or a hash), which in a hostile scenario implies cache busting would be trivial.
This invokes multiple semantic oddities in one go with obvious difficulties for a very niche use case. If I'm writing a service that needs complex filtering or complex input like an image, any form of caching (e.g. individual data columns of a join, or embeddings keyed by perceptual hashes of a decoded image input) is going to be far away from the HTTP layer and certainly unrelated to the exact bit representation of the request on the wire.
Why even bother trying to capture this in a generic way?
I would be far more inclined to try and capture this caching semantic as a new header for POST. Something like "Vary: request-body" or similar. Perfectly backwards compatible and perfectly ignorable for all but the 0.1% of CDN use cases where the behaviour might turn out useful
Comment by Joker_vD 3 hours ago
The query part of GET's URI is also barely bounded in practice and user-controlled, and is indeed used as part of the cache key (because it's a part of URI), so I am not sure why you raise this objection at all.
Comment by giancarlostoro 3 hours ago
I've found some sites that tack on a session ID and if you try to tamper with the URL in any way, it sends you back to "Page 1" really annoys me lol at that point let me skip to any page with your web UI.
Comment by PunchyHamster 2 hours ago
It feels very pointless and there is no drawback of just using POST
Comment by OvervCW 1 hour ago
Comment by afavour 1 hour ago
Comment by CodesInChaos 3 hours ago
Comment by ralferoo 1 hour ago
Comment by tanepiper 33 minutes ago
But I think this would make it better - QUERY before POST means different request types, not just the same with a safety flag.
Comment by inigyou 1 hour ago
Realistically, systems for the public internet will use a secure hash as the cache key so it'll always be the same size. The cache key already includes a URL that can be very long, and an arbitrary set of header values.
Comment by ralferoo 1 hour ago
Comment by inigyou 28 minutes ago
Comment by cryptonym 3 hours ago
Comment by layer8 3 hours ago
Comment by cryptonym 2 hours ago
Comment by Draiken 2 hours ago
You simply can't base64 large payloads and you're stuck with workarounds.
Comment by cryptonym 2 hours ago
Are we seriously ok with linking the RFC as source while providing a statement that doesn't match? RFC does matter.
Comment by ralferoo 1 hour ago
One can infer from the RFC that you can reasonably expect many implementations to fail beyond 8000 characters, and that there are no guarantees up to that either.
True, the RFC doesn't specify a limit, but it does clearly indicate that it's not unbounded, nor should you expect it to be.
Comment by friendzis 3 hours ago
While the concern is valid, caching is entirely optional at query level, therefore it is totally valid to cache only certain "filters".
Comment by epolanski 3 hours ago
I guess it's about resolving the odd semantics of using POST which is not idempotent and thus allowing easier control flow of caches and retrys.
Your perspective is 100% correct if you think at the application-layer, but with a dedicated method, you can have that behaviour out-of-the-box out of your HTTP infrastructure (whether it's at your hyperscaler's router or your apache/nginx/browser whatever) and stop implementing yourself the post-as-a-query edge case.
Comment by davidkwast 3 hours ago
/?hash=123456789
Comment by Joker_vD 3 hours ago
Comment by wang_li 2 hours ago
Comment by CodesInChaos 3 hours ago
<form action="..." method="query">
This would avoid the annoying re-submission warnings you're getting if you refresh a page that was returned by a POST form submission, since QUERY is required to be idempotent.Comment by bob1029 2 hours ago
Comment by amluto 1 hour ago
If method=QUERY were added, there would be a new variety of this weirdness.
Comment by sheept 33 minutes ago
Comment by amluto 8 minutes ago
Comment by 100ms 3 hours ago
Comment by jagged-chisel 3 hours ago
Comment by jnewton_dev 2 hours ago
Comment by inigyou 1 hour ago
Comment by alpinisme 3 hours ago
Comment by tempfile 2 hours ago
Comment by echoangle 1 hour ago
Comment by ctdinjeu7 3 hours ago
The team will have to wait for a new header and textarea specs to fix the rest of the jank.
This site is so awful lol. Why don’t they update it?
Comment by CodesInChaos 3 hours ago
Comment submission isn't safe, so QUERY can't be used there. And it doesn't suffer from the problem anyways, since HN returns a 3XX on successful submission, so refreshing doesn't show a warning.
Comment by ynac 1 hour ago
Comment by jjice 1 hour ago
Comment by riffic 1 hour ago
Comment by riffic 1 hour ago
Comment by piterrro 2 hours ago
I've been sending request body along GET method for years now
Comment by huskyr 2 hours ago
Comment by inigyou 1 hour ago
When it's your client talking to your server you can obviously do whatever you want - it doesn't cause problems until you want to involve third-party code, such as a reverse proxy (such as nginx) or a CDN. This includes proxies your customers may be using.
Comment by preisschild 1 hour ago
Generally not a great idea. With some http implementations this is not even possible (for example, fetch)
https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/U...
> You cannot include a body with GET requests
And transparent caching might result in weird issues.
Comment by tonympls 2 hours ago
I like that we now have a way to not being forced to define Resources when we want to query. It always felt like I was missing something that there could be an infinite, defined-on-the-fly number of Resources for a "part" of a given Resource. Do I really want to define "all cats that sleep more than 20 hours a day and like sunbeams and want to eat breakfast at 3 am" as a Resource? (ok, we all know that is actually the full set of cats). I'm ok that you want to define that as a Resource but in my system, it makes more sense that Cats is the Resource and I just need some accepted way to query.
I like the implementation (again, as just a guy that programs). I don't see how it could have done it better or simpler which probably hides the complexity of getting there.
I also especially appreciate how the spec is written. Opening a spec, I wonder how far I'll get before I don't know what the heck they're talking about (and, again, as just a guy that programs). I don't think it's easy to write a spec that is complete and approachable like this. Really appreciate that.
Comment by inigyou 1 hour ago
Comment by pwdisswordfishq 4 hours ago
Comment by rhplus 3 hours ago
https://manifold.markets/CollectedOverSpread/when-will-rfc-1...
Comment by ekr____ 2 hours ago
https://mailarchive.ietf.org/arch/msg/tools-discuss/EpoQcVt_...
RFC #s are issued sometime before publication, so they can come out out of order. I would expect 9999, 10001, etc. to show up eventually.
Comment by echoangle 1 hour ago
So of 10008 is the first one after 10000, that date is the one to bet on.
Comment by Imustaskforhelp 3 hours ago
just wow, people seem to be having too much money it seems for them to bet over when RFC's are gonna get released.
This isn't even one of the worst offenders on prediction market or even comparable to it but I am just amazed (in a negative manner, surprised? its just strange) by the depth on what people actually bet on these markets.
Comment by networked 3 hours ago
Comment by Imustaskforhelp 3 hours ago
Interesting thing actually. Seems similar to the trend in South Korea recently where you can online shop to get the thrill of shopping but you aren't actually paying with money.
But I am unsure of the overlap between manifold and polymarket/kalshi. I imagine that some might win in manifold and try to bet on polymarket to win "real" money which ends up being a bit gambling-esque.
But good for manifold for atleast not playing with real money but rather points like this. I would argue that Manifold might be better than polygon/kalshi in terms of net positive outcome of its existence for the world perhaps.
Comment by networked 2 hours ago
There is an overlap between Manifold and Polymarket/Kalshi. At the very least, Polymarket is more liquid, which creates opportunities for arbitrage and incentives for Manifold users to follow Polymarket. There is something at stake on Manifold itself if you choose to pursue it. There have been ways to convert mana to charitable donations (to your preferred charity), tickets to Manifest (the Manifold conference), and also merch and now prize drawings. Mana is like HN karma in that being at the top gives you status and bragging rights and suggests technical competence.
Comment by andltsemi3 4 hours ago
Comment by inigyou 4 hours ago
Comment by mlhpdx 2 hours ago
I’ve enjoyed the combination with Range headers for paging, despite this tidbit:
> It is expected that these built-in features will be used instead of HTTP Range Requests
Using the QUERY request as the definition of a set, and Range to retrieve subsets seems very natural.
Comment by cosmotic 47 minutes ago
Comment by advisedwang 7 minutes ago
QUERY has the advantage of getting default behaviour from most proxies (which at least is well behaved even if inefficient). If there are any proxies that just drop QUERY requests, at least they won't silently mangle the request.
This is the same way that instead of improving how HTTP 301 was specified, HTTP 308 was created. It's a pragmatic move.
Comment by chadgpt3 46 minutes ago
Comment by elAhmo 34 minutes ago
Comment by moralestapia 20 minutes ago
They should not delete the body in the first place.
Comment by toybeaver 4 hours ago
Comment by smashed 2 hours ago
I think the name is confusing because the term 'query' is already used to refer to http requests in general.
Just the title of the RFC confused me.
Comment by comfydragon 42 minutes ago
In what circles is this the case? I sometimes colloquially refer to a GET request as a query, but definitely not so on a POST, PUT or DELETE.
Comment by brookst 4 hours ago
Comment by CodesInChaos 4 hours ago
There is one interesting variant though, which uses state: The client sends a QUERY containing the full query, and the server returns a url usable with GET with which this query can be triggered in the future. Similar to prepared statements in SQL databases.
Using QUERY for GraphQL queries (not mutations) would be a good match. These only read data, but are sometimes bigger than the url length limit.
Comment by brookst 3 hours ago
I still don’t get how idempotency can typically be ensured without state. It very much depends on data model and application design. Even side effects like using a user’s lookup quota need to be handled at a higher layer than HTTP (I think?).
Comment by wongarsu 2 hours ago
But what the Query method really targets are things like a graphql query that can be multiple kb for a single query, but only reads data. Sure, it might count against rate limits, trigger logs, etc. But at a conceptual level resubmitting the same query should give the same result (if the data didn't change). And since you are only reading data, resubmitting is safe
Comment by inigyou 1 hour ago
If it's not actually idempotent but you're telling the browser it is, of course you may cause bugs. Same as GET.
Comment by CodesInChaos 32 minutes ago
Comment by Joker_vD 2 hours ago
Well, how is "GET /index.html HTTP/1.1" made idempotent in practice without (additional) state?
Comment by CodesInChaos 2 hours ago
Comment by uberex 1 hour ago
Comment by trollbridge 4 hours ago
Comment by n_e 3 hours ago
> A QUERY request from user agents implementing Cross-Origin Resource Sharing (CORS) will require a "preflight" request, as QUERY does not belong to the set of CORS-safelisted methods (see [FETCH]).
Comment by CodesInChaos 3 hours ago
Comment by Joker_vD 3 hours ago
Unlike POST, however, the method is explicitly safe and idempotent, allowing
functions like caching and automatic retries to operate.
Essentially, it's for things that are inherently safe/idempotent already (e.g. search or indeed, anything that you don't mind being retried) but require a lot of data passed in the request.Comment by geth101 53 minutes ago
Comment by nottorp 3 hours ago
Comment by lanycrost 4 hours ago
Comment by drzaiusx11 2 hours ago
Comment by haeseong 3 hours ago