cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: CURLOPT_STDERR option not customizable

From: Jean-Philippe Barrette-LaPierre <jpbl_at_ygingras.net>
Date: Wed, 13 Mar 2002 10:57:20 -0500

Le 13 Mars 2002 03:54, vous avez écrit :
> On Mon, 11 Mar 2002, Jean-Philippe Barrette-LaPierre wrote:
> > > > I saw that the option CURLOPT_STDERR need a FILE *. I suggest to put
> > > > a CURLOPT_STDERRFUNCTION to be able to set a customized function.
> > > >
> > > > I can set this but I need to know if this FILE * is just used in
> > > > Curl_infof
> > >
> > > How would you suggest that the prototype for such a callback would look
> > > like?
> >
> > I sugget to set the prototype exactly like the others write functions
> > using (normaly) a FILE *:
> >
> > size_t function( void *ptr, size_t size, size_t nmemb, void *stream)
>
> I don't like the prototype of the regular write function, so I would
> suggest that we make it slightly different.
>
> (There's also another minor effort slowly starting to change the read and
> write callback prototypes.)
>
> I'd prefer something like this:
>
> int info_function(CURL *easyhandle, size_t size, char *data, void
> *userp);
>
> But, this wouldn't cover everything we output today.
>
> Currently, we output "<" and ">" before outgoing or incoming data, and we
> output "*" before texts that are purely informational.
>
> How would that information be passed to this function? Should we just write
> those prefixes like ordinary data?
>
> In order to make a good suggestion, I think it would help if you would
> describe your use case for this function.
>
> This suggestion function also duplicates some of the things I was planning
> for the data_sent_to_peer callback:
>
> http://curl.haxx.se/mail/lib-2002-03/0012.html
>
> We might be able to work out a solution for all of this.

For the C++ wrapper I want to be able to output this output to a stream
so I need to pass a basic_stream<T>* instead of a FILE* and the function
processing need to be different.

I suggest:
int function( void *data, size_t size, void *stream)
(in fact I don't why you're putting a CURL *easyhandle in your new function
prototype, can you elaborate more on this?)

but I see that you have only one descriptor to ouput incoming, outcoming and
informationnal data.

do you consider it will put too much complexity for the API user to give the
possibility to set a different descriptor, for each type of output (and by
the same idea a different function)?

after that if you want to set a "<", ">" or "*" prefix, you just need to make
a function call for each of them, taht will set the prefix in the data before
it goes outputed

-- 
Jean-Philippe Barrette-LaPierre
Programmeur-Analyste
ProgSo Technologies
(www.progso.com)
Received on 2002-03-13