5

Is it possible to POST request data from browser to server in compressed format? If yes, How can we do that?

Maulin
  • 51
  • 1
  • 1
    possible 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
  • 1
    See: http://stackoverflow.com/questions/294297/javascript-implementation-of-gzip – mattbasta Jul 12 '10 at 06:19

2 Answers2

2

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.

Konerak
  • 39,272
  • 12
  • 98
  • 118
0

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.

Borealid
  • 95,191
  • 9
  • 106
  • 122