diff options
author | Daniel Stenberg <daniel@haxx.se> | 2014-10-21 08:58:03 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2014-10-21 08:58:24 +0200 |
commit | c857bb68ec37f82b62238fca73942e6ede8bd8f7 (patch) | |
tree | 084c1ff2355e2b3ce77c8a69bec4657a78cbfcc2 /docs/libcurl/opts/CURLOPT_MAXREDIRS.3 | |
parent | 005f2adaaa8025849760b30289e06916ea25f548 (diff) |
opts: added examples
Diffstat (limited to 'docs/libcurl/opts/CURLOPT_MAXREDIRS.3')
-rw-r--r-- | docs/libcurl/opts/CURLOPT_MAXREDIRS.3 | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/docs/libcurl/opts/CURLOPT_MAXREDIRS.3 b/docs/libcurl/opts/CURLOPT_MAXREDIRS.3 index 52d256767..34608c391 100644 --- a/docs/libcurl/opts/CURLOPT_MAXREDIRS.3 +++ b/docs/libcurl/opts/CURLOPT_MAXREDIRS.3 @@ -39,9 +39,23 @@ Set it to -1 for an infinite number of redirects. .SH DEFAULT -1, unlimited .SH PROTOCOLS -HTTP +HTTP(S) .SH EXAMPLE -TODO +.nf +curl = curl_easy_init(); +if(curl) { + curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/"); + + /* enable redirect following */ + curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); + + /* allow three redirects */ + curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 3L); + + /* Perform the request */ + curl_easy_perform(curl); +} +.fi .SH AVAILABILITY Along with HTTP .SH RETURN VALUE |