curl-library
Re: Patch to add a callback for setting socket options
Date: Thu, 23 Mar 2006 19:17:04 -0800
On Mar 21, 2006, at 2:49 PM, Daniel Stenberg wrote:
> On Wed, 15 Mar 2006, Andy Berkheimer wrote:
>
>> I went ahead and created a patch to accomplish this. It adds a
>> new option for curl_easy_setopt, CURLOPT_SOCKOPTFUNCTION, which
>> sets a callback function to be triggered after libcurl calls socket
>> (), but before calling connect(). This location is necessary
>> since some options like SO_SNDBUF and SO_RCVBUF must be set before
>> connect. The callback takes a single parameter - the
>> curl_socket_t created by socket().
>
> Thanks for the patch. I like it!
>
> Two things I'd like to see addressed before I commit:
>
> 1) Can you please make an addition to the curl_easy_setopt.3 man
> page too,
> explaining how this option is used.
>
> 2) I think we should use the return code from the callback to mean
> something.
> I'd suggest that zero means success and that non-zero means make
> libcurl
> return an error. I mean for cases where the changing of the
> socket is
> considered very important and the callback function fails to do
> that.
I like both of those suggestions, I'll take care of them and submit a
new patch soon.
-andy
Received on 2006-03-24