Commit 5acadc9c authored by Daniel Stenberg's avatar Daniel Stenberg
Browse files

David McCreedy added CURLOPT_SOCKOPTFUNCTION and CURLOPT_SOCKOPTDATA to

allow applications to set their own socket options.
parent 2ff609dd
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -6,6 +6,10 @@


                                  Changelog
                                  Changelog


Daniel (29 August 2006)
- David McCreedy added CURLOPT_SOCKOPTFUNCTION and CURLOPT_SOCKOPTDATA to
  allow applications to set their own socket options.

Daniel (25 August 2006)
Daniel (25 August 2006)
- Armel Asselin reported that the 'running_handles' counter wasn't updated
- Armel Asselin reported that the 'running_handles' counter wasn't updated
  properly if you removed a "live" handle from a multi handle with
  properly if you removed a "live" handle from a multi handle with
+3 −2
Original line number Original line Diff line number Diff line
@@ -3,7 +3,7 @@ Curl and libcurl 7.15.6
 Public curl release number:               96
 Public curl release number:               96
 Releases counted from the very beginning: 123
 Releases counted from the very beginning: 123
 Available command line options:           114
 Available command line options:           114
 Available curl_easy_setopt() options:     133
 Available curl_easy_setopt() options:     135
 Number of public functions in libcurl:    54
 Number of public functions in libcurl:    54
 Amount of public web site mirrors:        33
 Amount of public web site mirrors:        33
 Number of known libcurl bindings:         32
 Number of known libcurl bindings:         32
@@ -11,12 +11,13 @@ Curl and libcurl 7.15.6


This release includes the following changes:
This release includes the following changes:


 o CURLOPT_SOCKOPTFUNCTION and CURLOPT_SOCKOPTDATA were added
 o (FTP) libcurl avoids sending TYPE if the desired type was already set
 o (FTP) libcurl avoids sending TYPE if the desired type was already set
 o (FTP) CURLOPT_PREQUOTE works even when CURLOPT_NOBODY is set true
 o (FTP) CURLOPT_PREQUOTE works even when CURLOPT_NOBODY is set true


This release includes the following bugfixes:
This release includes the following bugfixes:


 o running_handles' counter wasn't always updated properly when
 o the 'running_handles' counter wasn't always updated properly when
   curl_multi_remove_handle() was used
   curl_multi_remove_handle() was used
 o (FTP) EPRT transfers with IPv6 didn't work properly
 o (FTP) EPRT transfers with IPv6 didn't work properly
 o (FTP) SINGLECWD mode and using files in the root dir
 o (FTP) SINGLECWD mode and using files in the root dir
+17 −1
Original line number Original line Diff line number Diff line
@@ -160,12 +160,28 @@ found in \fI<curl/curl.h>\fP. This function gets called by libcurl when
something special I/O-related needs to be done that the library can't do by
something special I/O-related needs to be done that the library can't do by
itself. For now, rewinding the read data stream is the only action it can
itself. For now, rewinding the read data stream is the only action it can
request. The rewinding of the read data stream may be necessary when doing a
request. The rewinding of the read data stream may be necessary when doing a
HTTP PUT or POST with a multi-pass authentication method.  (Opion added in
HTTP PUT or POST with a multi-pass authentication method.  (Option added in
7.12.3)
7.12.3)
.IP CURLOPT_IOCTLDATA
.IP CURLOPT_IOCTLDATA
Pass a pointer that will be untouched by libcurl and passed as the 3rd
Pass a pointer that will be untouched by libcurl and passed as the 3rd
argument in the ioctl callback set with \fICURLOPT_IOCTLFUNCTION\fP.  (Option
argument in the ioctl callback set with \fICURLOPT_IOCTLFUNCTION\fP.  (Option
added in 7.12.3)
added in 7.12.3)
.IP CURLOPT_SOCKOPTFUNCTION
Function pointer that should match the \fIcurl_sockopt_callback\fP prototype
found in \fI<curl/curl.h>\fP. This function gets called by libcurl after the
socket() call but before the connect() call. The callback's \fIpurpose\fP
argument identifies the exact purpose for this particular socket, and
currently only one value is supported: \fICURLSOCKTYPE_IPCXN\fP for the
primary connection (meaning the control connection in the FTP case). Future
versions of libcurl may support more purposes. It passes the newly created
socket descriptor so additional setsockopt() calls can be done at the user's
discretion.  A non-zero return code from the callback function will signal an
unrecoverable error to the library and it will close the socket and return
\fICURLE_COULDNT_CONNECT\fP.  (Option added in 7.15.6.)
.IP CURLOPT_SOCKOPTDATA
Pass a pointer that will be untouched by libcurl and passed as the first
argument in the sockopt callback set with \fICURLOPT_SOCKOPTFUNCTION\fP.
(Option added in 7.15.6.)
.IP CURLOPT_PROGRESSFUNCTION
.IP CURLOPT_PROGRESSFUNCTION
Function pointer that should match the \fIcurl_progress_callback\fP prototype
Function pointer that should match the \fIcurl_progress_callback\fP prototype
found in \fI<curl/curl.h>\fP. This function gets called by libcurl instead of
found in \fI<curl/curl.h>\fP. This function gets called by libcurl instead of
+53 −0
Original line number Original line Diff line number Diff line
@@ -133,6 +133,47 @@ extern "C" {
#undef FILESIZEBITS
#undef FILESIZEBITS
#endif
#endif


#if defined(_WIN32) && !defined(WIN32)
/* Chris Lewis mentioned that he doesn't get WIN32 defined, only _WIN32 so we
   make this adjustment to catch this. */
#define WIN32 1
#endif

#if defined(WIN32) && !defined(_WIN32_WCE) && !defined(__GNUC__) && \
  !defined(__CYGWIN__) || defined(__MINGW32__)
#if !(defined(_WINSOCKAPI_) || defined(_WINSOCK_H))
/* The check above prevents the winsock2 inclusion if winsock.h already was
   included, since they can't co-exist without problems */
#include <winsock2.h>
#endif
#else

/* HP-UX systems version 9, 10 and 11 lack sys/select.h and so does oldish
   libc5-based Linux systems. Only include it on system that are known to
   require it! */
#if defined(_AIX) || defined(NETWARE) || defined(__NetBSD__) || defined(__minix)
#include <sys/select.h>
#endif

#ifndef _WIN32_WCE
#include <sys/socket.h>
#endif
#include <sys/time.h>
#include <sys/types.h>
#endif

#ifndef curl_socket_typedef
/* socket typedef */
#ifdef WIN32
typedef SOCKET curl_socket_t;
#define CURL_SOCKET_BAD INVALID_SOCKET
#else
typedef int curl_socket_t;
#define CURL_SOCKET_BAD -1
#endif
#define curl_socket_typedef
#endif /* curl_socket_typedef */

struct curl_httppost {
struct curl_httppost {
  struct curl_httppost *next;       /* next entry in the list */
  struct curl_httppost *next;       /* next entry in the list */
  char *name;                       /* pointer to allocated name */
  char *name;                       /* pointer to allocated name */
@@ -184,6 +225,14 @@ typedef size_t (*curl_read_callback)(char *buffer,
                                      size_t nitems,
                                      size_t nitems,
                                      void *instream);
                                      void *instream);


typedef enum  {
  CURLSOCKTYPE_IPCXN, /* socket created for a specific IP connection */
  CURLSOCKTYPE_LAST   /* never use */
} curlsocktype;

typedef int (*curl_sockopt_callback)(void *clientp,
                                     curl_socket_t curlfd,
                                     curlsocktype purpose);


#ifndef CURL_NO_OLDIES
#ifndef CURL_NO_OLDIES
  /* not used since 7.10.8, will be removed in a future release */
  /* not used since 7.10.8, will be removed in a future release */
@@ -982,6 +1031,10 @@ typedef enum {
  /* Pointer to command string to send if USER/PASS fails. */
  /* Pointer to command string to send if USER/PASS fails. */
  CINIT(FTP_ALTERNATIVE_TO_USER, OBJECTPOINT, 147),
  CINIT(FTP_ALTERNATIVE_TO_USER, OBJECTPOINT, 147),


  /* callback function for setting socket options */
  CINIT(SOCKOPTFUNCTION, FUNCTIONPOINT, 148),
  CINIT(SOCKOPTDATA, OBJECTPOINT, 149),

  CURLOPT_LASTENTRY /* the last unused */
  CURLOPT_LASTENTRY /* the last unused */
} CURLoption;
} CURLoption;


+0 −40
Original line number Original line Diff line number Diff line
@@ -37,34 +37,6 @@
    file descriptors simultaneous easily.
    file descriptors simultaneous easily.


*/
*/
#if defined(_WIN32) && !defined(WIN32)
/* Chris Lewis mentioned that he doesn't get WIN32 defined, only _WIN32 so we
   make this adjustment to catch this. */
#define WIN32 1
#endif

#if defined(WIN32) && !defined(_WIN32_WCE) && !defined(__GNUC__) && \
  !defined(__CYGWIN__) || defined(__MINGW32__)
#if !(defined(_WINSOCKAPI_) || defined(_WINSOCK_H))
/* The check above prevents the winsock2 inclusion if winsock.h already was
   included, since they can't co-exist without problems */
#include <winsock2.h>
#endif
#else

/* HP-UX systems version 9, 10 and 11 lack sys/select.h and so does oldish
   libc5-based Linux systems. Only include it on system that are known to
   require it! */
#if defined(_AIX) || defined(NETWARE) || defined(__NetBSD__) || defined(__minix)
#include <sys/select.h>
#endif

#ifndef _WIN32_WCE
#include <sys/socket.h>
#endif
#include <sys/time.h>
#include <sys/types.h>
#endif


/*
/*
 * This header file should not really need to include "curl.h" since curl.h
 * This header file should not really need to include "curl.h" since curl.h
@@ -83,18 +55,6 @@ extern "C" {


typedef void CURLM;
typedef void CURLM;


#ifndef curl_socket_typedef
/* Public socket typedef */
#ifdef WIN32
typedef SOCKET curl_socket_t;
#define CURL_SOCKET_BAD INVALID_SOCKET
#else
typedef int curl_socket_t;
#define CURL_SOCKET_BAD -1
#endif
#define curl_socket_typedef
#endif /* curl_socket_typedef */

typedef enum {
typedef enum {
  CURLM_CALL_MULTI_PERFORM = -1, /* please call curl_multi_perform() or
  CURLM_CALL_MULTI_PERFORM = -1, /* please call curl_multi_perform() or
                                    curl_multi_socket*() soon */
                                    curl_multi_socket*() soon */
Loading