How to read GZip content sent in a http response

912 Views Asked by At

I have been trying for over a week now to be able to read the gzipped content sent in an Http Respose.

OK, let me be more specific - the web server sends a response which has the Content-Disposition header and the attachment attribute, like under,

Content-Disposition: attachment, filename=00011122.txt

I can save all the "response headers" that come to me, however am unable to save the .txt file that is sent. Moreover, after all the headers are recevied, I also received some gibberish text, which I assume is the .txt file.

But I have absolutely no clue how I can save this file and decompress it and view the contents as any other text file.

I have searched the internet and tried many things, but nothing seems to help.

I am using cURL - libcurl.net, C# as my programming languages.

Any help, suggestion, feedback will be greatly appreciated.

Regards, Jay

2

There are 2 best solutions below

2
Kedar Mhaswade On

The support is yet to be added to cURL. See: http://curl.haxx.se/mail/tracker-2007-12/0008.html

0
JaySO On

I wish it was as easy as you mentioned. Unfortunately, it cannot be done that easily. Especially when the content is gzip'd.

I have come across quite a few examples on the internet that save data from a response. However, not a single example that shows how to save data that is sent as part of the Content-Dispositon header and especially when the content is gzip'd.

Do kindly let me know if you know how to do this.

Regards, Jay