1CURLOPT_AUTOREFERER(3)     curl_easy_setopt options     CURLOPT_AUTOREFERER(3)
2
3
4

NAME

6       CURLOPT_AUTOREFERER - automatically update the referer header
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURLcode curl_easy_setopt(CURL *handle, CURLOPT_AUTOREFERER, long autorefer);
12

DESCRIPTION

14       Pass  a  parameter  set to 1 to enable this. When enabled, libcurl will
15       automatically set the Referer: header field in  HTTP  requests  to  the
16       full URL where it follows a Location: redirect.
17

DEFAULT

19       0, disabled
20

PROTOCOLS

22       HTTP
23

EXAMPLE

25       CURL *curl = curl_easy_init();
26       if(curl) {
27         curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
28
29         /* follow redirects */
30         curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
31
32         /* set Referer: automatically when following redirects */
33         curl_easy_setopt(curl, CURLOPT_AUTOREFERER, 1L);
34
35         ret = curl_easy_perform(curl);
36
37         curl_easy_cleanup(curl);
38       }
39

AVAILABILITY

41       Along with HTTP
42

RETURN VALUE

44       Returns CURLE_OK if HTTP is supported, and CURLE_UNKNOWN_OPTION if not.
45

SEE ALSO

47       CURLOPT_REFERER(3), CURLOPT_FOLLOWLOCATION(3),
48
49
50
51libcurl 7.82.0                 November 26, 2021        CURLOPT_AUTOREFERER(3)
Impressum