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.

Answers


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


Need Your Help

PHP: Trouble with mysql statement.

php mysql class

I am having a public function doing query for mysql. Everything works great in my local computer but having trouble once it was uploaded to the godaddy server. Basically, the $rows is null when I c...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.