Skip to content

Commit

Permalink
CURLOPT_HEADEROPT.3: Fix example
Browse files Browse the repository at this point in the history
Fix an issue where example builds a curl_slist, but fails to actually
use it, or free it.

Closes #4090
  • Loading branch information
caraitto authored and jay committed Jul 7, 2019
1 parent 5feb58c commit 21e2df8
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/libcurl/opts/CURLOPT_HEADEROPT.3
Expand Up @@ -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
Expand Down

0 comments on commit 21e2df8

Please sign in to comment.