cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: CURLOPT_STDERR option not customizable

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 21 Mar 2002 00:28:41 +0100 (MET)

On Wed, 20 Mar 2002, Jean-Philippe Barrette-LaPierre wrote:

> > int information(CURL *handle, /* the handle/transfer this concerns */
> > curl_infotype type /* what kind of data */
> > char *data, /* points to the data */
> > size_t size, /* size of the data pointed to */
> > void *userp); /* whatever the user please */
>
> I'm working on that.
>
> I choose that if you set the CURLOPT_STDERRFUNCTION to NULL, it reset the
> default callback.
>
> But in my opinion it should reset the CURLOPT_STDERR to stderr too.

In my opinion, they're not named STDERRFUNCTION and STDERR at all! ;-) The
name 'stderr' refers to the fact that it sets another file stream writes to
stderr is written to (and the sole original purpose for that is for systems
that can't redirect their stderr stream using the normal system). I think the
current CURLOPT_STDERR behavior can be preserved. We have never defined
exactly what content that is written to the stderr stream.

This new function (and associated callback extra pointer) is a different
beast and thus I think it should use a different name. I suggest
CURLOPT_DEBUGFUNCTION and CURLOPT_DEBUGDATA.

> Now the callback permit to set a void pointer, so it's not sure that the
> CURLOPT_STDERR is a FILE *(needed by the default callback) and may cause a
> crash. But in the case that the user was using a FILE * and he want to use
> it again, he will be forced to set again his FILE *(by calling
> CURLOPT_STDERR).

This is not a problem for CURLOPT_DEBUGDATA, which can be set to NULL with no
harm done. And so can CURLOPT_DEBUGFUNCTION.

> So the desicion is: Do we let the possibility to the user to let crash his
> application, or do we force him to set again his FILE *?

Actually, that ability (to crash libcurl) already exists, for CURLOPT_FILE
and CURLOPT_INFILE to mention two examples.

(Implementation-wise, I figure that the CURLOPT_STDERR should be tweaked to
use the new CURLOPT_DEBUG* options to have the default libcurl write debug
messages to the given stream or default to stderr. That would of course
imply that the STDERR option can be used combined with the DEBUG* ones, but
I can't see how that would make sense anyway!)

Or am I halucinating?

-- 
    Daniel Stenberg -- curl groks URLs -- http://curl.haxx.se/
Received on 2002-03-21