user3791372
user3791372

Reputation: 4665

Downloading Gzip'ed content with libcurl without deflating

I want to retrieve webpages in their gzipped format, but instead of deflating it, I'd like to write the gzipped bytes to a file stream. Is this possible? If I don't send the correct accepts header for gzip, I get the normal html content, but if I do send the accepts gzip header, then it appears libcurl automatically defaltes it. Am I able to retrieve the original compressed bytes without the overhead of decompressing?

Upvotes: 0

Views: 91

Answers (1)

Daniel Stenberg
Daniel Stenberg

Reputation: 58024

If you pass in Accept-Encoding: gzip as a custom header with CURLOPT_HTTPHEADER, libcurl won't decompress it automatically. It will only automatically decompress gzip if you set CURLOPT_ACCEPT_ENCODING.

Upvotes: 1

Related Questions