aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2015-03-17 08:03:46 +0100
committerDaniel Stenberg <daniel@haxx.se>2015-03-17 08:03:46 +0100
commit8c41f368f5f3be2738221a107d715ef1d3c4506e (patch)
treecbc475dfa4b7ed952315110273d1cb035231a76b /docs
parent6105029b23f465cc7388d3b07397149a3c37619b (diff)
CURLOPT_*.3: added lots of small example sections
Diffstat (limited to 'docs')
-rw-r--r--docs/libcurl/opts/CURLOPT_COOKIE.313
-rw-r--r--docs/libcurl/opts/CURLOPT_IGNORE_CONTENT_LENGTH.314
-rw-r--r--docs/libcurl/opts/CURLOPT_INFILESIZE.317
-rw-r--r--docs/libcurl/opts/CURLOPT_INFILESIZE_LARGE.317
-rw-r--r--docs/libcurl/opts/CURLOPT_READDATA.316
-rw-r--r--docs/libcurl/opts/CURLOPT_REFERER.314
-rw-r--r--docs/libcurl/opts/CURLOPT_SSL_VERIFYHOST.314
-rw-r--r--docs/libcurl/opts/CURLOPT_SSL_VERIFYPEER.314
-rw-r--r--docs/libcurl/opts/CURLOPT_TCP_KEEPALIVE.320
-rw-r--r--docs/libcurl/opts/CURLOPT_TCP_KEEPIDLE.320
-rw-r--r--docs/libcurl/opts/CURLOPT_TCP_KEEPINTVL.320
11 files changed, 157 insertions, 22 deletions
diff --git a/docs/libcurl/opts/CURLOPT_COOKIE.3 b/docs/libcurl/opts/CURLOPT_COOKIE.3
index 379296a7e..df115c66b 100644
--- a/docs/libcurl/opts/CURLOPT_COOKIE.3
+++ b/docs/libcurl/opts/CURLOPT_COOKIE.3
@@ -5,7 +5,7 @@
.\" * | (__| |_| | _ <| |___
.\" * \___|\___/|_| \_\_____|
.\" *
-.\" * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+.\" * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
.\" *
.\" * This software is licensed as described in the file COPYING, which
.\" * you should have received as part of this distribution. The terms
@@ -51,7 +51,16 @@ NULL, no cookies
.SH PROTOCOLS
HTTP
.SH EXAMPLE
-TODO
+.nf
+CURL *curl = curl_easy_init();
+if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
+
+ curl_easy_setopt(curl, CURLOPT_COOKIE, "tool=curl; fun=yes;");
+
+ curl_easy_perform(curl);
+}
+.fi
.SH AVAILABILITY
If HTTP is enabled
.SH RETURN VALUE
diff --git a/docs/libcurl/opts/CURLOPT_IGNORE_CONTENT_LENGTH.3 b/docs/libcurl/opts/CURLOPT_IGNORE_CONTENT_LENGTH.3
index 11bff65c6..51fd6b08c 100644
--- a/docs/libcurl/opts/CURLOPT_IGNORE_CONTENT_LENGTH.3
+++ b/docs/libcurl/opts/CURLOPT_IGNORE_CONTENT_LENGTH.3
@@ -5,7 +5,7 @@
.\" * | (__| |_| | _ <| |___
.\" * \___|\___/|_| \_\_____|
.\" *
-.\" * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+.\" * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
.\" *
.\" * This software is licensed as described in the file COPYING, which
.\" * you should have received as part of this distribution. The terms
@@ -42,7 +42,17 @@ Only use this option if strictly necessary.
.SH PROTOCOLS
HTTP
.SH EXAMPLE
-TODO
+.nf
+CURL *curl = curl_easy_init();
+if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
+
+ /* we know the server is silly, ignore content-length */
+ curl_easy_setopt(curl, CURLOPT_IGNORE_CONTENT_LENGTH, 1L);
+
+ curl_easy_perform(curl);
+}
+.fi
.SH AVAILABILITY
Added in 7.14.1
.SH RETURN VALUE
diff --git a/docs/libcurl/opts/CURLOPT_INFILESIZE.3 b/docs/libcurl/opts/CURLOPT_INFILESIZE.3
index 129414c07..fd49e21a7 100644
--- a/docs/libcurl/opts/CURLOPT_INFILESIZE.3
+++ b/docs/libcurl/opts/CURLOPT_INFILESIZE.3
@@ -5,7 +5,7 @@
.\" * | (__| |_| | _ <| |___
.\" * \___|\___/|_| \_\_____|
.\" *
-.\" * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+.\" * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
.\" *
.\" * This software is licensed as described in the file COPYING, which
.\" * you should have received as part of this distribution. The terms
@@ -49,7 +49,20 @@ Unset
.SH PROTOCOLS
Many
.SH EXAMPLE
-TODO
+.nf
+CURL *curl = curl_easy_init();
+if(curl) {
+ long uploadsize = FILE_SIZE;
+
+ curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/destination.tar.gz");
+
+ curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
+
+ curl_easy_setopt(curl, CURLOPT_INFILESIZE, uploadsize);
+
+ curl_easy_perform(curl);
+}
+.fi
.SH AVAILABILITY
SMTP support added in 7.23.0
.SH RETURN VALUE
diff --git a/docs/libcurl/opts/CURLOPT_INFILESIZE_LARGE.3 b/docs/libcurl/opts/CURLOPT_INFILESIZE_LARGE.3
index 0aa522452..114676d0e 100644
--- a/docs/libcurl/opts/CURLOPT_INFILESIZE_LARGE.3
+++ b/docs/libcurl/opts/CURLOPT_INFILESIZE_LARGE.3
@@ -5,7 +5,7 @@
.\" * | (__| |_| | _ <| |___
.\" * \___|\___/|_| \_\_____|
.\" *
-.\" * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+.\" * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
.\" *
.\" * This software is licensed as described in the file COPYING, which
.\" * you should have received as part of this distribution. The terms
@@ -50,7 +50,20 @@ Unset
.SH PROTOCOLS
Many
.SH EXAMPLE
-TODO
+.nf
+CURL *curl = curl_easy_init();
+if(curl) {
+ curl_off_t uploadsize = FILE_SIZE;
+
+ curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/destination.tar.gz");
+
+ curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
+
+ curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE, uploadsize);
+
+ curl_easy_perform(curl);
+}
+.fi
.SH AVAILABILITY
SMTP support added in 7.23.0
.SH RETURN VALUE
diff --git a/docs/libcurl/opts/CURLOPT_READDATA.3 b/docs/libcurl/opts/CURLOPT_READDATA.3
index db666316e..a67f41542 100644
--- a/docs/libcurl/opts/CURLOPT_READDATA.3
+++ b/docs/libcurl/opts/CURLOPT_READDATA.3
@@ -5,7 +5,7 @@
.\" * | (__| |_| | _ <| |___
.\" * \___|\___/|_| \_\_____|
.\" *
-.\" * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+.\" * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
.\" *
.\" * This software is licensed as described in the file COPYING, which
.\" * you should have received as part of this distribution. The terms
@@ -42,7 +42,19 @@ By default, this is a FILE * to stdin.
.SH PROTOCOLS
This is used for all protocols when sending data.
.SH EXAMPLE
-TODO
+.nf
+CURL *curl = curl_easy_init();
+struct MyData this;
+if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
+
+ /* pass pointer that gets passed in to the
+ CURLOPT_READFUNCTION callback */
+ curl_easy_setopt(curl, CURLOPT_READDATA, &this);
+
+ curl_easy_perform(curl);
+}
+.fi
.SH AVAILABILITY
This option was once known by the older name \fICURLOPT_INFILE\fP, the name
\fICURLOPT_READDATA\fP was introduced in 7.9.7.
diff --git a/docs/libcurl/opts/CURLOPT_REFERER.3 b/docs/libcurl/opts/CURLOPT_REFERER.3
index d00019b01..bcb162515 100644
--- a/docs/libcurl/opts/CURLOPT_REFERER.3
+++ b/docs/libcurl/opts/CURLOPT_REFERER.3
@@ -5,7 +5,7 @@
.\" * | (__| |_| | _ <| |___
.\" * \___|\___/|_| \_\_____|
.\" *
-.\" * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+.\" * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
.\" *
.\" * This software is licensed as described in the file COPYING, which
.\" * you should have received as part of this distribution. The terms
@@ -37,7 +37,17 @@ NULL
.SH PROTOCOLS
HTTP
.SH EXAMPLE
-TODO
+.nf
+CURL *curl = curl_easy_init();
+if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
+
+ /* tell it where we found the link to this place */
+ curl_easy_setopt(curl, CURLOPT_REFERER, "http://example.com/aboutme.html");
+
+ curl_easy_perform(curl);
+}
+.fi
.SH AVAILABILITY
If built with HTTP support
.SH RETURN VALUE
diff --git a/docs/libcurl/opts/CURLOPT_SSL_VERIFYHOST.3 b/docs/libcurl/opts/CURLOPT_SSL_VERIFYHOST.3
index ca39a09ec..fbf204286 100644
--- a/docs/libcurl/opts/CURLOPT_SSL_VERIFYHOST.3
+++ b/docs/libcurl/opts/CURLOPT_SSL_VERIFYHOST.3
@@ -5,7 +5,7 @@
.\" * | (__| |_| | _ <| |___
.\" * \___|\___/|_| \_\_____|
.\" *
-.\" * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+.\" * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
.\" *
.\" * This software is licensed as described in the file COPYING, which
.\" * you should have received as part of this distribution. The terms
@@ -66,7 +66,17 @@ also set to zero and cannot be overridden.
.SH PROTOCOLS
All TLS based protocols: HTTPS, FTPS, IMAPS, POP3, SMTPS etc.
.SH EXAMPLE
-TODO
+.nf
+CURL *curl = curl_easy_init();
+if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+
+ /* Set the default value: strict name check please */
+ curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 2L);
+
+ curl_easy_perform(curl);
+}
+.fi
.SH AVAILABILITY
If built TLS enabled.
.SH RETURN VALUE
diff --git a/docs/libcurl/opts/CURLOPT_SSL_VERIFYPEER.3 b/docs/libcurl/opts/CURLOPT_SSL_VERIFYPEER.3
index f2bad7464..81bb59397 100644
--- a/docs/libcurl/opts/CURLOPT_SSL_VERIFYPEER.3
+++ b/docs/libcurl/opts/CURLOPT_SSL_VERIFYPEER.3
@@ -5,7 +5,7 @@
.\" * | (__| |_| | _ <| |___
.\" * \___|\___/|_| \_\_____|
.\" *
-.\" * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+.\" * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
.\" *
.\" * This software is licensed as described in the file COPYING, which
.\" * you should have received as part of this distribution. The terms
@@ -62,7 +62,17 @@ By default, curl assumes a value of 1.
.SH PROTOCOLS
All TLS based protocols: HTTPS, FTPS, IMAPS, POP3, SMTPS etc.
.SH EXAMPLE
-TODO
+.nf
+CURL *curl = curl_easy_init();
+if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+
+ /* Set the default value: strict certificate check please */
+ curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 1L);
+
+ curl_easy_perform(curl);
+}
+.fi
.SH AVAILABILITY
If built TLS enabled.
.SH RETURN VALUE
diff --git a/docs/libcurl/opts/CURLOPT_TCP_KEEPALIVE.3 b/docs/libcurl/opts/CURLOPT_TCP_KEEPALIVE.3
index daf3df4a2..5ddadd093 100644
--- a/docs/libcurl/opts/CURLOPT_TCP_KEEPALIVE.3
+++ b/docs/libcurl/opts/CURLOPT_TCP_KEEPALIVE.3
@@ -5,7 +5,7 @@
.\" * | (__| |_| | _ <| |___
.\" * \___|\___/|_| \_\_____|
.\" *
-.\" * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+.\" * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
.\" *
.\" * This software is licensed as described in the file COPYING, which
.\" * you should have received as part of this distribution. The terms
@@ -38,7 +38,23 @@ disable keepalive probes
.SH PROTOCOLS
All
.SH EXAMPLE
-TODO
+.nf
+CURL *curl = curl_easy_init();
+if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
+
+ /* enable TCP keep-alive for this transfer */
+ curl_easy_setopt(curl, CURLOPT_TCP_KEEPALIVE, 1L);
+
+ /* keep-alive idle time to 120 seconds */
+ curl_easy_setopt(curl, CURLOPT_TCP_KEEPIDLE, 120L);
+
+ /* interval time between keep-alive probes: 60 seconds */
+ curl_easy_setopt(curl, CURLOPT_TCP_KEEPIDLE, 60L);
+
+ curl_easy_perform(curl);
+}
+.fi
.SH AVAILABILITY
Added in 7.25.0
.SH RETURN VALUE
diff --git a/docs/libcurl/opts/CURLOPT_TCP_KEEPIDLE.3 b/docs/libcurl/opts/CURLOPT_TCP_KEEPIDLE.3
index 1724824f2..843f65057 100644
--- a/docs/libcurl/opts/CURLOPT_TCP_KEEPIDLE.3
+++ b/docs/libcurl/opts/CURLOPT_TCP_KEEPIDLE.3
@@ -5,7 +5,7 @@
.\" * | (__| |_| | _ <| |___
.\" * \___|\___/|_| \_\_____|
.\" *
-.\" * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+.\" * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
.\" *
.\" * This software is licensed as described in the file COPYING, which
.\" * you should have received as part of this distribution. The terms
@@ -36,7 +36,23 @@ operating systems support this option.
.SH PROTOCOLS
All
.SH EXAMPLE
-TODO
+.nf
+CURL *curl = curl_easy_init();
+if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
+
+ /* enable TCP keep-alive for this transfer */
+ curl_easy_setopt(curl, CURLOPT_TCP_KEEPALIVE, 1L);
+
+ /* set keep-alive idle time to 120 seconds */
+ curl_easy_setopt(curl, CURLOPT_TCP_KEEPIDLE, 120L);
+
+ /* interval time between keep-alive probes: 60 seconds */
+ curl_easy_setopt(curl, CURLOPT_TCP_KEEPIDLE, 60L);
+
+ curl_easy_perform(curl);
+}
+.fi
.SH AVAILABILITY
Added in 7.25.0
.SH RETURN VALUE
diff --git a/docs/libcurl/opts/CURLOPT_TCP_KEEPINTVL.3 b/docs/libcurl/opts/CURLOPT_TCP_KEEPINTVL.3
index e4bcf7ff4..ee4d53543 100644
--- a/docs/libcurl/opts/CURLOPT_TCP_KEEPINTVL.3
+++ b/docs/libcurl/opts/CURLOPT_TCP_KEEPINTVL.3
@@ -5,7 +5,7 @@
.\" * | (__| |_| | _ <| |___
.\" * \___|\___/|_| \_\_____|
.\" *
-.\" * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+.\" * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
.\" *
.\" * This software is licensed as described in the file COPYING, which
.\" * you should have received as part of this distribution. The terms
@@ -34,7 +34,23 @@ option. (Added in 7.25.0)
.SH DEFAULT
.SH PROTOCOLS
.SH EXAMPLE
-TODO
+.nf
+CURL *curl = curl_easy_init();
+if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
+
+ /* enable TCP keep-alive for this transfer */
+ curl_easy_setopt(curl, CURLOPT_TCP_KEEPALIVE, 1L);
+
+ /* keep-alive idle time to 120 seconds */
+ curl_easy_setopt(curl, CURLOPT_TCP_KEEPIDLE, 120L);
+
+ /* interval time between keep-alive probes: 60 seconds */
+ curl_easy_setopt(curl, CURLOPT_TCP_KEEPIDLE, 60L);
+
+ curl_easy_perform(curl);
+}
+.fi
.SH AVAILABILITY
Always
.SH RETURN VALUE