Sortix cross-nightly manual
This manual documents Sortix cross-nightly. You can instead view this document in the latest official manual.
CURLOPT_DEFAULT_PROTOCOL(3) | Library Functions Manual | CURLOPT_DEFAULT_PROTOCOL(3) |
NAME
CURLOPT_DEFAULT_PROTOCOL - default protocol to use if the URL is missing a scheme nameSYNOPSIS
#include <curl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DEFAULT_PROTOCOL,
char *protocol);
DESCRIPTION
This option tells libcurl to use protocol if the URL is missing a scheme name.DEFAULT
NULL (make a guess based on the host)PROTOCOLS
This functionality affects all supported protocolsEXAMPLE
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
/* set a URL without a scheme */
curl_easy_setopt(curl, CURLOPT_URL, "example.com");
/* set the default protocol (scheme) for schemeless URLs */
curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
/* Perform the request */
curl_easy_perform(curl);
}
}
AVAILABILITY
Added in curl 7.45.0RETURN VALUE
CURLE_OK if the option is supported.SEE ALSO
CURLINFO_PROTOCOL(3), CURLINFO_SCHEME(3), CURLOPT_URL(3)2024-11-24 | libcurl |