From 21e2df801556dcdc451c3372248c481552451d7f Mon Sep 17 00:00:00 2001 From: Caleb Raitto Date: Wed, 3 Jul 2019 17:35:52 -0400 Subject: 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 --- docs/libcurl/opts/CURLOPT_HEADEROPT.3 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/libcurl/opts/CURLOPT_HEADEROPT.3 b/docs/libcurl/opts/CURLOPT_HEADEROPT.3 index b9a0075cc..7d7a7fc68 100644 --- a/docs/libcurl/opts/CURLOPT_HEADEROPT.3 +++ b/docs/libcurl/opts/CURLOPT_HEADEROPT.3 @@ -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 -- cgit v1.2.3