-
-
Notifications
You must be signed in to change notification settings - Fork 273
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
13 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,18 @@ | ||
#include "shim.h" | ||
|
||
#define INTEGER_OPTION_MAX 10000 | ||
#include "shim.h" | ||
|
||
int _curl_easy_setopt(void* curl, int option, void* parameter) { | ||
// printf("****** hijack test begins: \n"); | ||
// int val = curl_easy_setopt(instance->curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_0); | ||
// printf("****** hijack test ends. opt: %d, val: %d, result is: %d\n", CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_0, val); | ||
CURLoption opt_value = (CURLoption) option; | ||
// CURLoption opt_value = (CURLoption) option; | ||
// printf("option: %d, setopt parameter: %d\n", option, *(int*)parameter); | ||
// for integer options, we need to convert param from pointers to integers | ||
if (option < INTEGER_OPTION_MAX) { | ||
return (int)curl_easy_setopt(curl, (CURLoption)option, *(int*)parameter); | ||
if (option < CURLOPTTYPE_OBJECTPOINT) { | ||
return (int)curl_easy_setopt(curl, (CURLoption)option, *(long*)parameter); | ||
} | ||
if (CURLOPTTYPE_OFF_T <= option && option < CURLOPTTYPE_BLOB) { | ||
return (int)curl_easy_setopt(curl, (CURLoption)option, *(curl_off_t*)parameter); | ||
} | ||
return (int)curl_easy_setopt(curl, (CURLoption)option, parameter); | ||
} |