cURL / Mailing Lists / curl-library / Single Mail



From: Tom Bishop, Wenlin Institute <>
Date: Wed, 20 Jun 2012 09:59:53 -0700

On Jun 19, 2012, at 2:39 PM, Dan Fandrich wrote:

> On Tue, Jun 19, 2012 at 08:35:21AM -0700, Tom Bishop, Wenlin Institute wrote:
>> As a relatively new user of libcurl, I made the silly mistake of trying to use cookies when CURL_DISABLE_COOKIES was defined. It took me a while to figure out what the problem was. To help others avoid the same mistake, maybe the following could be added in getinfo.c:
> The curl_easy_setopt call should have returned CURLE_UNKNOWN_OPTION when
> attempting to enable cookie handling in the first place.

You're right, it does return CURLE_UNKNOWN_OPTION.

> You are
> checking the return code, aren't you?

No, I hadn't realized it returned anything! I started by imitating the example programs (such as <>), which don't check the return value for curl_easy_setopt(). I should have paid more attention to the disclaimer, "These files are intended as examples only. In the interest of simplicity and clarity, they might not include proper error handling..." They might serve as better examples by at least writing "res = curl_easy_setopt(...)" even if nothing is then done with res; that would serve as a reminder that "real-world applications" should check the return value. As it is, the examples treat curl_easy_setopt() differently from, for example, curl_easy_perform(), in a way that seems to suggest that only the latter returns a value.

It might still be worthwhile to add the warning I suggested. Curl is already excellent in terms of ease-of-use for new users, but some people (like me) will always find new ways to misunderstand it. The verbose output had a lot to say about the cookies that were supposedly being received, but didn't mention that they were disabled.

Best wishes,


文林 Wenlin Institute, Inc. Software for Learning Chinese
E-mail: Web:
Telephone: 1-877-4-WENLIN (1-877-493-6546)

List admin:
Received on 2012-06-20