开发者

C http request gzip (zlib)

开发者 https://www.devze.com 2022-12-21 15:50 出处:网络
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

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/gzi开发者_开发技巧p 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.


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")?

0

精彩评论

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

关注公众号