mirror of
https://github.com/moparisthebest/curl
synced 2024-08-13 17:03:50 -04:00
CURLOPT_HEADEROPT.3: Fix example
Fix an issue where example builds a curl_slist, but fails to actually use it, or free it. Closes https://github.com/curl/curl/pull/4090
This commit is contained in:
parent
5feb58ca12
commit
21e2df8015
@ -57,12 +57,14 @@ if(curl) {
|
||||
list = curl_slist_append(list, "Accept:");
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
|
||||
curl_easy_setopt(curl, CURLOPT_PROXY, "http://localhost:8080");
|
||||
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, list);
|
||||
|
||||
/* HTTPS over a proxy makes a separate CONNECT to the proxy, so tell
|
||||
libcurl to not send the custom headers to the proxy. Keep them
|
||||
separate! */
|
||||
curl_easy_setopt(curl, CURLOPT_HEADEROPT, CURLHEADER_SEPARATE);
|
||||
ret = curl_easy_perform(curl);
|
||||
curl_slist_free_all(list);
|
||||
curl_easy_cleanup(curl);
|
||||
}
|
||||
.fi
|
||||
|
Loading…
Reference in New Issue
Block a user