koen
koen

Reputation: 1057

Compressing text for HTTP with POST parameters

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?

Upvotes: 3

Views: 4231

Answers (2)

user2826695
user2826695

Reputation: 1

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.

Upvotes: 0

John Parker
John Parker

Reputation: 54445

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?

Upvotes: 1

Related Questions