curl-library
Patch to add a callback for setting socket options
Date: Wed, 15 Mar 2006 20:07:23 -0500
I want to use setsockopt on my libcurl connections to set IP_TOS, SO_SNDBUF, and
SO_RCVBUF options. After searching around I found a quick discussion on
curl-library with the same topic about a year ago. But it looks like no patch
was ever created.
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().
Most of the verbosity in the patch comes from moving the definition of
curl_socket_t into curl.h, so that it can be referenced by the typedef for
curl_sockopt_callback.
Please let me know what you think of this patch.
Thanks,
-andy
- application/octet-stream attachment: curl-7.15.2-sockopt.patch