Maulin
Maulin

Reputation: 51

Compression HTTP

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

Upvotes: 5

Views: 218

Answers (2)

Konerak
Konerak

Reputation: 39763

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.

Upvotes: 2

Borealid
Borealid

Reputation: 98459

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.

Upvotes: 0

Related Questions