cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Support for GZIP Content-Encoding in HTTP responses

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 24 Apr 2003 08:31:38 +0200 (CEST)

On Wed, 23 Apr 2003, Dan Fandrich wrote:

> While working on a gzip test script, I discovered that I forgot to update
> the curl front-end to support gzip as well. That highlighted two
> weaknesses in curl's content-encoding support. First, the CURLOPT_ENCODING
> semantics requires that the application know which encodings are supported
> by the curl library; there's no way to say "request all supported
> content-encodings". That's easily changed by specifying that an empty (not
> NULL) string set for CURLOPT_ENCODING means to request all supported
> encodings. I can't think of any unexpected side effects of this change.

I can. We need to be able to tell libcurl to disable the requesting for
encoded content, so setting NULL would probably go back to how it was before.

Instead I suggest we add a "magic" string that means "all supported
encodings" and I suggest we do that by recommending the use of a particular
define, like this:

   curl_easy_setopt(handle, CURLOPT_ENCODING, CURLENCODE_ALL_SUPPORTED);

... with the CURLENCODE_ALL_SUPPORTED being set to something that is not
likely to ever be confused with a true and actual encoding name.

> Secondly, there's no way to see what Content-Encoding the server actually
> sent on an CURLE_BAD_CONTENT_ENCODING return code or if CURLOPT_ENCODING
> isn't set. In the more general case, I don't see a way to look at
> arbitrary HTTP headers except by enabling CURLOPT_HEADER and parsing them
> myself. This is a less severe problem than the first.

I'm not sure I understand the implications of this problem. What are the
drawbacks you see from this limitation?

> The attached patch against CVS adds gzip support to the front-end.

Thanks! I'll apply.

> If the consensus is that the first option above is suitable, I'll make that
> quick change.

With my minor little detail above considered, I'll appreciate a patch!

-- 
 Daniel Stenberg -- curl, cURL, Curl, CURL. Groks URLs.
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Received on 2003-04-24