C http request gzip (zlib)

I am making http requests using winsock and I need to parse the answer. The problem is that some gzip sites no matter what I specify in the request header. I even tried to refuse the request HTTP/1.0without success. So now I have to add deflate / gzip support and no luck. I had my program write compressed content to a file. Then I tried to unzip it using the tool gzip, but it gave an error stating that it was a file with several parts of gzip. After some reading, I found out that this is caused by damage to the gzip header due to the fact that it is not processed as a binary file. I'm not sure what to do at this moment.

+3
source share
1 answer

When you write gzipped data to a file, did you open it as a binary file? Assuming you use C as in the header, did you open with fopen (..., "wb") ?

+3
source

Source: https://habr.com/ru/post/1734650/


All Articles