curl-library
Re: Patch to add a callback for setting socket options
Date: Tue, 21 Mar 2006 23:49:00 +0100 (CET)
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.
-- Commercial curl and libcurl Technical Support: http://haxx.se/curl.htmlReceived on 2006-03-21