开发者

Compressing text for HTTP with POST parameters

I am writing clien开发者_如何学Got 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?


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?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜