Ilia Choly
Ilia Choly

Reputation: 18557

C http request gzip (zlib)

I'm making http requests using winsock and I need to parse the response. The problem is that some sites gzip no matter what I specify in my request header. I've even tried downgrading the request to HTTP/1.0 with no success. So now I'm to add deflate/gzip support and having no luck. I had my program write the compressed content to file. Then I tried decompressing it with the gzip tool but it gave an error saying that it was a multi part gzip file. After some reading I found out that this is caused by the gzip header being corrupted due to not being handled as a binary. I'm not sure what to do at this point.

Upvotes: 3

Views: 1018

Answers (1)

Thomas Padron-McCarthy
Thomas Padron-McCarthy

Reputation: 27632

When you write the gzipped data to a file, have you opened it as a binary file? Assuming you are using C as in the title, did you open with fopen(..., "wb")?

Upvotes: 3

Related Questions