views:

53

answers:

2

Hello,

suppose that I've a huge amount of data (>KB/MB) to transfer from an ajax request (JS) to a webpage (PHP), is it usefull to deflate data (by JS scripting) before send it to server and inflate it in my Webpage or the Apache module (Content-Encoding:gzip) do it by itself?

Thanks.

A: 

stick with gzip, it it transparent to you and will give you decent compression ratios.

one could argue that it will give you a better ratio for the amount of work you put in setting it up, then writing your own proprietary compressor that will complicated things and cause bugs.

mkoryak
@mkoryak - the question seems to be related to compressing data sent from client to server. Is there any built in support in js to use gzip your answer doesnot seem to clarify on that part
Vinay B R
This seems fairly not be true, I'm using Wireshark in order to see what happen when I do an Ajax Request and I see all my POST data in plain text, human readable and exactly the string I send in my data JSON array.
Arnaud F.
A: 

Content Compression offered by apache will only compress data sent from server to client.

For you to compress data that you are sending to the server would involve a lot of effort which i am not sure will be worth the effort.

you could try using a js data zip api like http://jszip.stuartk.co.uk/

Vinay B R
Seems not be true, I used Wireshark and the answer sent back from server contain data like I sent it in my Webpage. Is my use of Wireshark to abusive ? I checked out your link and it seems not be working with IE, and my users only use IE ...
Arnaud F.
Data sent from server when compression is enabled works without any issues, i have tried it on IIS. I think you have missed out something in your configuration. try implementing one of the basic compression algorithms like (Huffman) this should be pretty straight forward.
Vinay B R
Thanks a lot for your answer :)
Arnaud F.