cURL / Mailing Lists / curl-library / Single Mail

curl-library

How can I GET a gzipped static resource and have libcurl uncompress it?

From: Mohun Biswas <m_biswas_at_mailinator.com>
Date: Wed, 10 Jun 2009 23:48:33 -0400

My libcurl-using program currently uses a servlet to get gzipped static
content. This is easy: I set CURLOPT_ENCODING to "", the servlet adds a
header "Content-Encoding: gzip", libcurl automatically unzips the
result, and everything's fine. The only problem is that there are a lot
of files like this to download, one after the other, and it's a little slow.

Since I can determine the URL of the static resource, I think it might
be faster to bypass the servlet and issue a GET directly to that URL.
The only problem is that as far as I can tell, libcurl won't uncompress
it unless it sees the Content-Encoding header, and there's no way to add
a custom header to a static resource.

Am I missing something? All I want is to tell the libcurl library
"Here's the URL of a compressed file. Go get it and decompress it".

BTW, there's no compatibility problem here. The server is private and
talks only to my client, so I can do whatever I want to make it work -
as long as there is a way to make it work.

Thanks,
MB
Received on 2009-06-11