3
votes

I am writing client software that initiates a HTTP request with a large blob of text (JSON object actually) as POST parameter. I want to compress this text before sending and decompress the text on the server.

Gzip produces binary, which I can't send as a POST parameter, I think.

Which options/algorithms exist to compress text and send it to a web server?

Edit: Would it be an option to GZIP and then BASE64 encode the binary data?

2
What language is the client-side application being written in?John Parker
Are you using the WebRequest Class or ?John Parker
Take a look at netomatix.com/HttpPostData.aspx - you simply need to compress the data prior to determining the length and transmitting it.John Parker
Most web servers only support serving compressed responses. I have not heard of server accepting a compressed request, neither would I know how to actually notify the server.leppie

2 Answers

1
votes

Why don't you just use the standard HTTP gzip compression?

(It just seems a bit mad to needlessly re-invent the wheel.)

Update

Ah yes - my bad. So why not simply gzip the file, upload it to the server as you would a multipart/form-data file upload and then un-gzip it on the server?

0
votes

The file is a long/unnecessary work around, the original question relates to battle with unbearably large Json blob. From my hacking around I can tell it highly depends on the server, some do support it some don't.

To the original question, you can set the binary data in http post, the real question what is the server going to do with it. It is the same way that C# client does not automatically unzip, you have to write extra code.