diff options
author | Max Dymond <max.dymond@microsoft.com> | 2021-07-22 15:32:30 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2021-09-27 17:16:43 +0200 |
commit | a517378de58358a85b7cfe9efecb56051268f629 (patch) | |
tree | 8b8b43685911d3cbc6450b8d7255f5a10d2b8795 /include/curl/curl.h | |
parent | 06981ba7f620364eba253f5afcd7ebfaefcc8694 (diff) | |
download | curl-a517378de58358a85b7cfe9efecb56051268f629.tar.gz |
CURLOPT_PREREQFUNCTION: add new callback
Triggered before a request is made but after a connection is set up
Changes:
- callback: Update docs and callback for pre-request callback
- Add documentation for CURLOPT_PREREQDATA and CURLOPT_PREREQFUNCTION,
- Add redirect test and callback failure test
- Note that the function may be called multiple times on a redirection
- Disable new 2086 test due to Windows weirdness
Closes #7477
Diffstat (limited to 'include/curl/curl.h')
-rw-r--r-- | include/curl/curl.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/include/curl/curl.h b/include/curl/curl.h index 6eb0fcb82..d0862afaf 100644 --- a/include/curl/curl.h +++ b/include/curl/curl.h @@ -470,6 +470,20 @@ typedef int (*curl_debug_callback) size_t size, /* size of the data pointed to */ void *userptr); /* whatever the user please */ +/* This is the CURLOPT_PREREQFUNCTION callback prototype. */ +typedef int (*curl_prereq_callback)(void *clientp, + char *conn_primary_ip, + char *conn_local_ip, + int conn_primary_port, + int conn_local_port); + +/* Return code for when the pre-request callback has terminated without + any errors */ +#define CURL_PREREQFUNC_OK 0 +/* Return code for when the pre-request callback wants to abort the + request */ +#define CURL_PREREQFUNC_ABORT 1 + /* All possible error codes from all sorts of curl functions. Future versions may return other values, stay prepared. @@ -2105,6 +2119,13 @@ typedef enum { /* used by scp/sftp to verify the host's public key */ CURLOPT(CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256, CURLOPTTYPE_STRINGPOINT, 311), + /* Function that will be called immediately before the initial request + is made on a connection (after any protocol negotiation step). */ + CURLOPT(CURLOPT_PREREQFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 312), + + /* Data passed to the CURLOPT_PREREQFUNCTION callback */ + CURLOPT(CURLOPT_PREREQDATA, CURLOPTTYPE_CBPOINT, 313), + CURLOPT_LASTENTRY /* the last unused */ } CURLoption; |