Is it possible to POST request data from browser to server in compressed format? If yes, How can we do that?
-
1possible duplicate of [Why can't browser send gzip request?](http://stackoverflow.com/questions/424917/why-cant-browser-send-gzip-request) – Quentin Jul 12 '10 at 06:15
-
@David Dorward: not an exact duplicate: here, they're actually asking how to do it regardless of standards. – Borealid Jul 12 '10 at 06:18
-
1See: http://stackoverflow.com/questions/294297/javascript-implementation-of-gzip – mattbasta Jul 12 '10 at 06:19
2 Answers
Compressing data sent from the browser to the server is not natively supported in the browsers.
You'll have to find a workaround, using a clientside language (maybe a JavaScript GZip implementation, or a Java Applet, or ...). Be sure to visually display to the user what the browser is doing and why it is taking some time.
I don't know the scope of your application, but on company websites you could just restrict input to compressed files. Ask your users to upload .zip/.7z/.rar/... files.

- 39,272
- 12
- 98
- 118
The server->client responses can be gzip compressed automagically by the server.
Compressing the client->server messages is not standard, so will require some work by you. Take your very large POST data and compress it client-side, using JavaScript. Then decompress it manually on the server side.
This will usually not be a beneficial thing to do unless your bandwidth usage is a major bottleneck. Compression requires both time and CPU usage to perform.

- 95,191
- 9
- 106
- 122