cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Making lack of cookie support more obvious

From: Fabian Keil <freebsd-listen_at_fabiankeil.de>
Date: Sun, 4 May 2014 13:05:18 +0200

Dan Fandrich <dan_at_coneharvesters.com> wrote:

> On Sun, May 04, 2014 at 09:32:18AM +0200, Fabian Keil wrote:
> > Recently a script [0] I infrequently use stopped working because
> > curl had been configured without cookie support and thus the --cookie
> > and --cookie-jar options were silently ignored.
> >
> > Obviously that was my mistake, but I think it would be preferable
> > if the options were rejected with a clear error message and return
> > code.
> >
> > It certainly would have helped me figure out the problem more
> > quickly.
> >
> > Any opinions about this?
>
> All the cookie options return CURLE_UNKNOWN_OPTION when set from
> curl_easy_setopt, in the case when they've been disabled. You are checking that
> return code, aren't you?

Sorry, I should have been more clear.

The script is using libcurl through curl(1):

| @page = `$curl_command`;
| if ($?) {
| bad_news("Failed to execute $curl_command: @page");
| }
| die_unless_page_contains_pattern(\@page, $page_name, $pattern);

I'd prefer it to fail after checking $? (bad_news() is a die() wrapper),
but it actually failed in die_unless_page_contains_pattern() and thus it
looked like the server changed the login procedure (again).

Fabian

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html

Received on 2014-05-04