mirror of
https://github.com/curl/curl.git
synced 2026-08-24 13:03:35 +03:00
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
This commit is contained in:
parent
06981ba7f6
commit
a517378de5
21 changed files with 602 additions and 4 deletions
22
lib/multi.c
22
lib/multi.c
|
|
@ -2028,6 +2028,28 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
|
|||
break;
|
||||
|
||||
case MSTATE_DO:
|
||||
if(data->set.fprereq) {
|
||||
int prereq_rc;
|
||||
|
||||
/* call the prerequest callback function */
|
||||
Curl_set_in_callback(data, true);
|
||||
prereq_rc = data->set.fprereq(data->set.prereq_userp,
|
||||
data->info.conn_primary_ip,
|
||||
data->info.conn_local_ip,
|
||||
data->info.conn_primary_port,
|
||||
data->info.conn_local_port);
|
||||
Curl_set_in_callback(data, false);
|
||||
if(prereq_rc != CURL_PREREQFUNC_OK) {
|
||||
failf(data, "operation aborted by pre-request callback");
|
||||
/* failure in pre-request callback - don't do any other processing */
|
||||
result = CURLE_ABORTED_BY_CALLBACK;
|
||||
Curl_posttransfer(data);
|
||||
multi_done(data, result, FALSE);
|
||||
stream_error = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(data->set.connect_only) {
|
||||
/* keep connection open for application to use the socket */
|
||||
connkeep(data->conn, "CONNECT_ONLY");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue