1CURLOPT_AUTOREFERER(3) curl_easy_setopt options CURLOPT_AUTOREFERER(3)
2
3
4
6 CURLOPT_AUTOREFERER - automatically update the referer header
7
9 #include <curl/curl.h>
10
11 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_AUTOREFERER, long
12 autorefer);
13
15 Pass a parameter set to 1 to enable this. When enabled, libcurl will
16 automatically set the Referer: header field in HTTP requests where it
17 follows a Location: redirect.
18
20 0, disabled
21
23 HTTP
24
26 CURL *curl = curl_easy_init();
27 if(curl) {
28 curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/foo.bin");
29
30 /* follow redirects */
31 curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
32
33 /* set Referer: automatically when following redirects */
34 curl_easy_setopt(curl, CURLOPT_AUTOREFERER, 1L);
35
36 ret = curl_easy_perform(curl);
37
38 curl_easy_cleanup(curl);
39 }
40
42 Along with HTTP
43
45 Returns CURLE_OK if HTTP is supported, and CURLE_UNKNOWN_OPTION if not.
46
48 CURLOPT_REFERER(3), CURLOPT_FOLLOWLOCATION(3),
49
50
51
52libcurl 7.66.0 May 05, 2017 CURLOPT_AUTOREFERER(3)