Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why can't browser send gzip request?

If webserver can send gzip response, why can't browser sent gzip request?

like image 669
Herman Avatar asked Jan 08 '09 16:01

Herman


People also ask

Do any browsers not support gzip?

All modern browsers can handle a gzip encoded response. In fact, if you look at their requests, they'll have a header that says something along the lines of Accept-Encoding: gzip which is their way of saying to the server that they can handle gzipped responses.

Is gzip supported by all browsers?

gzip compressionThis HTTP header is supported in effectively all browsers.

Does browser decompress gzip?

gzip is commonly supported by web servers and modern browsers, meaning that servers can automatically compress files with gzip before sending them, and browsers can uncompress files upon receiving them.


1 Answers

The client and server have to agree on how to communicate; part of this is whether the communication can be compressed. HTTP was designed as a request/response model, and the original creation was almost certainly envisioned to always have small requests and potentially large responses. Compression is not required to implement HTTP, there are both servers and clients that don't support it.

HTTP compression is implemented by the client saying it can support compression, and if the server sees this in the request and it supports compression it can compress the response. To compress the request the client would have to have a "pre-request" that actually negotiated that the request would be made compressed OR it would have to require compression as a supported encoding for ALL requests.

* UPDATE Feb '17 * It's been 8 years, but as @Phil_1984_ notes, a 3rd possible solution would be for the client and server to negotiate compression support and then use that for subsequent requests. In fact, things like HSTS work just this way with the client caching that the server expects to only speak TLS and ignore any unencrypted links. HTTP was explicitly designed to be stateless but we've moved beyond that at this point.

like image 154
Peter Oehlert Avatar answered Sep 19 '22 15:09

Peter Oehlert