Sixteen years without a new method - and here comes the QUERY. We understand why IETF needed to expand the HTTP protocol after so many years

Complex search queries have their own way to communicate with the server. The Internet Engineering Council (IETF) has approved a new HTTP method called QUERY, which will allow you to transfer large sets of conditions without giant addresses and the unsuitable for such a task of the POST method.





The new method is described in the RFC 10008 standard. QUERY transmits the query parameters in its contents, as POST, but is considered safe and edimpotute. The latter term means that a request sent again should not change the result or cause undesirable actions. The server can get QUERY once or several times without creating new records and writing off money again.





So far, GET has usually been used to search for. Parameters were added directly to the address after the question mark. This approach works well for simple queries, but nested filters, sorting, date bands and other conditions quickly turn the address into a long and inconvenient string.





There is no single limit of the length of the address. The standard recommends maintaining at least 8000 octets, but too long string can be rejected by a browser, server, firewall or other intermediate equipment. In addition, the settings from the address may get into the history of the browser, server logs and bookmarks, which is why confidential data risk leaking.








The developers bypassed the restrictions using POST, placing difficult conditions in the contents of the query, often in JSON format. This method is widely used by software interfaces, including GraphQL. The problem is what POST is originally intended for: the protocol does not consider it safe and edampant, since the query can create or change data on the server.





Therefore, proxy servers, content delivery networks and gateways cannot save POST responses in a cache without additional information or automatically repeat the request after a connection break. QUERY explicitly informs intermediate systems that the operation only requests data and does not change the state of the resource. Thanks to this, the answers can be cached, and unsuccessful requests are repeated automatically.





For the new method to be maintained everywhere, it will take time. Conventional HTML forms are still only working with GET and POST, and unfamiliar queries can be rejected by proxy servers, load balancers, content delivery networks, firewalls and web platforms.





Server tools are already starting to support a new method. Node.js adds QUERY to the HTTP module, the Go language allows you to send arbitrary methods, and the Laravel platform is already able to accept such requests. The developers expect that first QUERY will master the servers and tools of development, then web platforms, and browsers and the fetch software interface will connect later.
 
Top Bottom