![]() |
![]()
| ![]() |
![]()
NAMECURLOPT_PREREQFUNCTION - user callback called when a connection has been established, but before a request has been made. SYNOPSIS#include <curl/curl.h> /* These are the return codes for the pre-request callback. */ #define CURL_PREREQFUNC_OK 0 #define CURL_PREREQFUNC_ABORT 1 /* fail the entire transfer */ int prereq_callback(void *clientp, DESCRIPTIONPass a pointer to your callback function, which should match the prototype shown above. This function gets called by libcurl after a connection has been established or a connection has been reused (including any SSL handshaking), but before any request is actually made on the connection. For example, for HTTP, this callback is called once a connection has been established to the server, but before a GET/HEAD/POST/etc request has been sent. This function may be called multiple times if redirections are enabled and are being followed (see CURLOPT_FOLLOWLOCATION(3)). The callback function must return CURL_PREREQFUNC_OK on success, or CURL_PREREQFUNC_ABORT to cause the transfer to fail with result CURLE_ABORTED_BY_CALLBACK. This function is passed the following arguments:
DEFAULTNULL PROTOCOLSThis functionality affects all supported protocols EXAMPLEstruct priv { AVAILABILITYAdded in curl 7.80.0 RETURN VALUEcurl_easy_setopt(3) returns a CURLcode indicating success or error. CURLE_OK (0) means everything was OK, non-zero means an error occurred, see libcurl-errors(3). SEE ALSOCURLINFO_PRIMARY_IP(3), CURLINFO_PRIMARY_PORT(3), CURLOPT_PREREQDATA(3)
|