mirror of
https://github.com/curl/curl.git
synced 2026-08-24 21:43:32 +03:00
setopt: support certificate options in memory with struct curl_blob
This change introduces a generic way to provide binary data in setopt options, called BLOBs. This change introduces these new setopts: CURLOPT_ISSUERCERT_BLOB, CURLOPT_PROXY_SSLCERT_BLOB, CURLOPT_PROXY_SSLKEY_BLOB, CURLOPT_SSLCERT_BLOB and CURLOPT_SSLKEY_BLOB. Reviewed-by: Daniel Stenberg Closes #5357
This commit is contained in:
parent
8df455479f
commit
cac5374298
21 changed files with 960 additions and 129 deletions
|
|
@ -683,7 +683,7 @@ CURLcode tool_setopt(CURL *curl, bool str, struct GlobalConfig *config,
|
|||
ret = curl_easy_setopt(curl, tag, pval);
|
||||
|
||||
}
|
||||
else {
|
||||
else if(tag < CURLOPTTYPE_BLOB) {
|
||||
/* Value is expected to be curl_off_t */
|
||||
curl_off_t oval = va_arg(arg, curl_off_t);
|
||||
msnprintf(buf, sizeof(buf),
|
||||
|
|
@ -694,6 +694,20 @@ CURLcode tool_setopt(CURL *curl, bool str, struct GlobalConfig *config,
|
|||
if(!oval)
|
||||
skip = TRUE;
|
||||
}
|
||||
else {
|
||||
/* Value is a blob */
|
||||
void *pblob = va_arg(arg, void *);
|
||||
|
||||
/* blobs are never printable */
|
||||
if(pblob) {
|
||||
value = "blobpointer";
|
||||
remark = TRUE;
|
||||
}
|
||||
else
|
||||
skip = TRUE;
|
||||
|
||||
ret = curl_easy_setopt(curl, tag, pblob);
|
||||
}
|
||||
|
||||
va_end(arg);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue