summaryrefslogtreecommitdiff
path: root/docs/libcurl
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2017-05-05 16:30:23 +0200
committerDaniel Stenberg <daniel@haxx.se>2017-05-05 16:30:23 +0200
commit58a6265a40bce369ba523364905489dcc6a11551 (patch)
tree24985ec2d9ef29c4780e3e6842eafbc09b9c77b1 /docs/libcurl
parent22fdb0954c1492f88a49487ab1e4670938c74629 (diff)
downloadcurl-58a6265a40bce369ba523364905489dcc6a11551.tar.gz
docs/opts: 23 more man pages now have examples
Diffstat (limited to 'docs/libcurl')
-rw-r--r--docs/libcurl/opts/CURLINFO_ACTIVESOCKET.322
-rw-r--r--docs/libcurl/opts/CURLINFO_APPCONNECT_TIME.319
-rw-r--r--docs/libcurl/opts/CURLINFO_CERTINFO.334
-rw-r--r--docs/libcurl/opts/CURLINFO_CONDITION_UNMET.327
-rw-r--r--docs/libcurl/opts/CURLINFO_CONNECT_TIME.319
-rw-r--r--docs/libcurl/opts/CURLINFO_CONTENT_LENGTH_DOWNLOAD.321
-rw-r--r--docs/libcurl/opts/CURLINFO_LASTSOCKET.322
-rw-r--r--docs/libcurl/opts/CURLINFO_NAMELOOKUP_TIME.319
-rw-r--r--docs/libcurl/opts/CURLINFO_PRETRANSFER_TIME.319
-rw-r--r--docs/libcurl/opts/CURLINFO_REDIRECT_TIME.319
-rw-r--r--docs/libcurl/opts/CURLINFO_SIZE_DOWNLOAD.321
-rw-r--r--docs/libcurl/opts/CURLINFO_SIZE_UPLOAD.320
-rw-r--r--docs/libcurl/opts/CURLINFO_SPEED_DOWNLOAD.320
-rw-r--r--docs/libcurl/opts/CURLINFO_SPEED_UPLOAD.320
-rw-r--r--docs/libcurl/opts/CURLINFO_STARTTRANSFER_TIME.319
-rw-r--r--docs/libcurl/opts/CURLINFO_TOTAL_TIME.319
-rw-r--r--docs/libcurl/opts/CURLOPT_FTP_ACCOUNT.315
-rw-r--r--docs/libcurl/opts/CURLOPT_FTP_ALTERNATIVE_TO_USER.315
-rw-r--r--docs/libcurl/opts/CURLOPT_FTP_CREATE_MISSING_DIRS.315
-rw-r--r--docs/libcurl/opts/CURLOPT_FTP_FILEMETHOD.315
-rw-r--r--docs/libcurl/opts/CURLOPT_FTP_RESPONSE_TIMEOUT.314
-rw-r--r--docs/libcurl/opts/CURLOPT_FTP_SKIP_PASV_IP.315
-rw-r--r--docs/libcurl/opts/CURLOPT_FTP_USE_EPSV.316
-rw-r--r--docs/libcurl/opts/CURLOPT_FTP_USE_PRET.316
-rw-r--r--docs/libcurl/opts/CURLOPT_LOW_SPEED_LIMIT.318
-rw-r--r--docs/libcurl/opts/CURLOPT_LOW_SPEED_TIME.318
26 files changed, 445 insertions, 52 deletions
diff --git a/docs/libcurl/opts/CURLINFO_ACTIVESOCKET.3 b/docs/libcurl/opts/CURLINFO_ACTIVESOCKET.3
index 0896d150d..6c8551606 100644
--- a/docs/libcurl/opts/CURLINFO_ACTIVESOCKET.3
+++ b/docs/libcurl/opts/CURLINFO_ACTIVESOCKET.3
@@ -5,7 +5,7 @@
.\" * | (__| |_| | _ <| |___
.\" * \___|\___/|_| \_\_____|
.\" *
-.\" * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
+.\" * Copyright (C) 1998 - 2017, 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
@@ -41,7 +41,25 @@ that one isn't working on all platforms.
.SH PROTOCOLS
All
.SH EXAMPLE
-TODO
+.nf
+CURL *curl = curl_easy_init();
+if(curl) {
+ curl_socket_t sockfd;
+ curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
+
+ /* Do not do the transfer - only connect to host */
+ curl_easy_setopt(curl, CURLOPT_CONNECT_ONLY, 1L);
+ res = curl_easy_perform(curl);
+
+ /* Extract the socket from the curl handle */
+ res = curl_easy_getinfo(curl, CURLINFO_ACTIVESOCKET, &sockfd);
+
+ if(res != CURLE_OK) {
+ printf("Error: %s\n", curl_easy_strerror(res));
+ return 1;
+ }
+}
+.fi
.SH AVAILABILITY
Added in 7.45.0
.SH RETURN VALUE
diff --git a/docs/libcurl/opts/CURLINFO_APPCONNECT_TIME.3 b/docs/libcurl/opts/CURLINFO_APPCONNECT_TIME.3
index dceb98b06..dee0981ed 100644
--- a/docs/libcurl/opts/CURLINFO_APPCONNECT_TIME.3
+++ b/docs/libcurl/opts/CURLINFO_APPCONNECT_TIME.3
@@ -5,7 +5,7 @@
.\" * | (__| |_| | _ <| |___
.\" * \___|\___/|_| \_\_____|
.\" *
-.\" * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
+.\" * Copyright (C) 1998 - 2017, 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,22 @@ See also the TIMES overview in the \fIcurl_easy_getinfo(3)\fP man page.
.SH PROTOCOLS
All
.SH EXAMPLE
-TODO
+.nf
+curl = curl_easy_init();
+if(curl) {
+ double connect;
+ curl_easy_setopt(curl, CURLOPT_URL, url);
+ res = curl_easy_perform(curl);
+ if(CURLE_OK == res) {
+ res = curl_easy_getinfo(curl, CURLINFO_APPCONNECT_TIME, &connect);
+ if(CURLE_OK == res) {
+ printf("Time: %.1f", connect);
+ }
+ }
+ /* always cleanup */
+ curl_easy_cleanup(curl);
+}
+.fi
.SH AVAILABILITY
Added in 7.19.0
.SH RETURN VALUE
diff --git a/docs/libcurl/opts/CURLINFO_CERTINFO.3 b/docs/libcurl/opts/CURLINFO_CERTINFO.3
index cb0bd8aa3..b918af660 100644
--- a/docs/libcurl/opts/CURLINFO_CERTINFO.3
+++ b/docs/libcurl/opts/CURLINFO_CERTINFO.3
@@ -5,7 +5,7 @@
.\" * | (__| |_| | _ <| |___
.\" * \___|\___/|_| \_\_____|
.\" *
-.\" * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+.\" * Copyright (C) 1998 - 2017, 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
@@ -39,7 +39,37 @@ for the specific named data. See also the certinfo.c example.
.SH PROTOCOLS
All TLS-based
.SH EXAMPLE
-TODO
+.nf
+curl = curl_easy_init();
+if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://www.example.com/");
+
+ /* connect to any HTTPS site, trusted or not */
+ curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
+ curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
+
+ curl_easy_setopt(curl, CURLOPT_CERTINFO, 1L);
+
+ res = curl_easy_perform(curl);
+
+ if (!res) {
+ struct curl_certinfo *ci;
+ res = curl_easy_getinfo(curl, CURLINFO_CERTINFO, &ci);
+
+ if (!res) {
+ printf("%d certs!\n", ci->num_of_certs);
+
+ for(i = 0; i < ci->num_of_certs; i++) {
+ struct curl_slist *slist;
+
+ for(slist = ci->certinfo[i]; slist; slist = slist->next)
+ printf("%s\n", slist->data);
+ }
+ }
+ }
+ curl_easy_cleanup(curl);
+}
+.fi
.SH AVAILABILITY
This option is only working in libcurl built with OpenSSL, NSS, schannel or
GSKit support. schannel support added in 7.50.0
diff --git a/docs/libcurl/opts/CURLINFO_CONDITION_UNMET.3 b/docs/libcurl/opts/CURLINFO_CONDITION_UNMET.3
index 452c261fb..86cc0e49e 100644
--- a/docs/libcurl/opts/CURLINFO_CONDITION_UNMET.3
+++ b/docs/libcurl/opts/CURLINFO_CONDITION_UNMET.3
@@ -5,7 +5,7 @@
.\" * | (__| |_| | _ <| |___
.\" * \___|\___/|_| \_\_____|
.\" *
-.\" * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
+.\" * Copyright (C) 1998 - 2017, 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,30 @@ get a zero stored if the condition instead was met.
.SH PROTOCOLS
HTTP and some
.SH EXAMPLE
-TODO
+.nf
+CURL *curl = curl_easy_init();
+if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
+
+ /* January 1, 2020 is 1577833200 */
+ curl_easy_setopt(curl, CURLOPT_TIMEVALUE, 1577833200L);
+
+ /* If-Modified-Since the above time stamp */
+ curl_easy_setopt(curl, CURLOPT_TIMECONDITION, CURL_TIMECOND_IFMODSINCE);
+
+ /* Perform the request */
+ res = curl_easy_perform(curl);
+
+ if(!res) {
+ /* check the time condition */
+ long unmet;
+ res = curl_easy_getinfo(curl, CURLINFO_CONDITION_UNMET, &unmet);
+ if(!res) {
+ printf("The time condition was %sfulfilled\n", unmet?"NOT":"");
+ }
+ }
+}
+.fi
.SH AVAILABILITY
Added in 7.19.4
.SH RETURN VALUE
diff --git a/docs/libcurl/opts/CURLINFO_CONNECT_TIME.3 b/docs/libcurl/opts/CURLINFO_CONNECT_TIME.3
index 1b63e2386..f9e5d812a 100644
--- a/docs/libcurl/opts/CURLINFO_CONNECT_TIME.3
+++ b/docs/libcurl/opts/CURLINFO_CONNECT_TIME.3
@@ -5,7 +5,7 @@
.\" * | (__| |_| | _ <| |___
.\" * \___|\___/|_| \_\_____|
.\" *
-.\" * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
+.\" * Copyright (C) 1998 - 2017, 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
@@ -35,7 +35,22 @@ See also the TIMES overview in the \fIcurl_easy_getinfo(3)\fP man page.
.SH PROTOCOLS
All
.SH EXAMPLE
-TODO
+.nf
+curl = curl_easy_init();
+if(curl) {
+ double connect;
+ curl_easy_setopt(curl, CURLOPT_URL, url);
+ res = curl_easy_perform(curl);
+ if(CURLE_OK == res) {
+ res = curl_easy_getinfo(curl, CURLINFO_CONNECT_TIME, &connect);
+ if(CURLE_OK == res) {
+ printf("Time: %.1f", connect);
+ }
+ }
+ /* always cleanup */
+ curl_easy_cleanup(curl);
+}
+.fi
.SH AVAILABILITY
Added in 7.4.1
.SH RETURN VALUE
diff --git a/docs/libcurl/opts/CURLINFO_CONTENT_LENGTH_DOWNLOAD.3 b/docs/libcurl/opts/CURLINFO_CONTENT_LENGTH_DOWNLOAD.3
index 311f313ae..69bccc141 100644
--- a/docs/libcurl/opts/CURLINFO_CONTENT_LENGTH_DOWNLOAD.3
+++ b/docs/libcurl/opts/CURLINFO_CONTENT_LENGTH_DOWNLOAD.3
@@ -5,7 +5,7 @@
.\" * | (__| |_| | _ <| |___
.\" * \___|\___/|_| \_\_____|
.\" *
-.\" * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
+.\" * Copyright (C) 1998 - 2017, 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
@@ -35,7 +35,24 @@ is the value read from the Content-Length: field. Since 7.19.4, this returns
.SH PROTOCOLS
HTTP(S)
.SH EXAMPLE
-TODO
+.nf
+CURL *curl = curl_easy_init();
+if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
+
+ /* Perform the request */
+ res = curl_easy_perform(curl);
+
+ if(!res) {
+ /* check the size */
+ double cl;
+ res = curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &cl);
+ if(!res) {
+ printf("Size: %.0f\n", cl);
+ }
+ }
+}
+.fi
.SH AVAILABILITY
Added in 7.6.1
.SH RETURN VALUE
diff --git a/docs/libcurl/opts/CURLINFO_LASTSOCKET.3 b/docs/libcurl/opts/CURLINFO_LASTSOCKET.3
index 8e734531e..4ea2a3ed0 100644
--- a/docs/libcurl/opts/CURLINFO_LASTSOCKET.3
+++ b/docs/libcurl/opts/CURLINFO_LASTSOCKET.3
@@ -5,7 +5,7 @@
.\" * | (__| |_| | _ <| |___
.\" * \___|\___/|_| \_\_____|
.\" *
-.\" * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
+.\" * Copyright (C) 1998 - 2017, 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
@@ -43,7 +43,25 @@ type is 64 bits large while its 'long' is 32 bits. Use the
.SH PROTOCOLS
All
.SH EXAMPLE
-TODO
+.nf
+CURL *curl = curl_easy_init();
+if(curl) {
+ long sockfd; /* doesn't work on win64! */
+ curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
+
+ /* Do not do the transfer - only connect to host */
+ curl_easy_setopt(curl, CURLOPT_CONNECT_ONLY, 1L);
+ res = curl_easy_perform(curl);
+
+ /* Extract the socket from the curl handle */
+ res = curl_easy_getinfo(curl, CURLINFO_LASTSOCKET, &sockfd);
+
+ if(res != CURLE_OK) {
+ printf("Error: %s\n", curl_easy_strerror(res));
+ return 1;
+ }
+}
+.fi
.SH AVAILABILITY
Added in 7.15.2
.SH RETURN VALUE
diff --git a/docs/libcurl/opts/CURLINFO_NAMELOOKUP_TIME.3 b/docs/libcurl/opts/CURLINFO_NAMELOOKUP_TIME.3
index 68059ec65..3d98ab79d 100644
--- a/docs/libcurl/opts/CURLINFO_NAMELOOKUP_TIME.3
+++ b/docs/libcurl/opts/CURLINFO_NAMELOOKUP_TIME.3
@@ -5,7 +5,7 @@
.\" * | (__| |_| | _ <| |___
.\" * \___|\___/|_| \_\_____|
.\" *
-.\" * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
+.\" * Copyright (C) 1998 - 2017, 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
@@ -35,7 +35,22 @@ See also the TIMES overview in the \fIcurl_easy_getinfo(3)\fP man page.
.SH PROTOCOLS
All
.SH EXAMPLE
-TODO
+.nf
+curl = curl_easy_init();
+if(curl) {
+ double namelookup;
+ curl_easy_setopt(curl, CURLOPT_URL, url);
+ res = curl_easy_perform(curl);
+ if(CURLE_OK == res) {
+ res = curl_easy_getinfo(curl, CURLINFO_NAMELOOKUP_TIME, &namelookup);
+ if(CURLE_OK == res) {
+ printf("Time: %.1f", namelookup);
+ }
+ }
+ /* always cleanup */
+ curl_easy_cleanup(curl);
+}
+.fi
.SH AVAILABILITY
Added in 7.4.1
.SH RETURN VALUE
diff --git a/docs/libcurl/opts/CURLINFO_PRETRANSFER_TIME.3 b/docs/libcurl/opts/CURLINFO_PRETRANSFER_TIME.3
index c445ea093..04802f21c 100644
--- a/docs/libcurl/opts/CURLINFO_PRETRANSFER_TIME.3
+++ b/docs/libcurl/opts/CURLINFO_PRETRANSFER_TIME.3
@@ -5,7 +5,7 @@
.\" * | (__| |_| | _ <| |___
.\" * \___|\___/|_| \_\_____|
.\" *
-.\" * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
+.\" * Copyright (C) 1998 - 2017, 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,22 @@ See also the TIMES overview in the \fIcurl_easy_getinfo(3)\fP man page.
.SH PROTOCOLS
All
.SH EXAMPLE
-TODO
+.nf
+curl = curl_easy_init();
+if(curl) {
+ double pretransfer;
+ curl_easy_setopt(curl, CURLOPT_URL, url);
+ res = curl_easy_perform(curl);
+ if(CURLE_OK == res) {
+ res = curl_easy_getinfo(curl, CURLINFO_PRETRANSFER_TIME, &pretransfer);
+ if(CURLE_OK == res) {
+ printf("Time: %.1f", pretransfer);
+ }
+ }
+ /* always cleanup */
+ curl_easy_cleanup(curl);
+}
+.fi
.SH AVAILABILITY
Added in 7.4.1
.SH RETURN VALUE
diff --git a/docs/libcurl/opts/CURLINFO_REDIRECT_TIME.3 b/docs/libcurl/opts/CURLINFO_REDIRECT_TIME.3
index 1a9e6dfb1..26416c1b4 100644
--- a/docs/libcurl/opts/CURLINFO_REDIRECT_TIME.3
+++ b/docs/libcurl/opts/CURLINFO_REDIRECT_TIME.3
@@ -5,7 +5,7 @@
.\" * | (__| |_| | _ <| |___
.\" * \___|\___/|_| \_\_____|
.\" *
-.\" * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
+.\" * Copyright (C) 1998 - 2017, 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,22 @@ See also the TIMES overview in the \fIcurl_easy_getinfo(3)\fP man page.
.SH PROTOCOLS
All
.SH EXAMPLE
-TODO
+.nf
+curl = curl_easy_init();
+if(curl) {
+ double redirect;
+ curl_easy_setopt(curl, CURLOPT_URL, url);
+ res = curl_easy_perform(curl);
+ if(CURLE_OK == res) {
+ res = curl_easy_getinfo(curl, CURLINFO_REDIRECT_TIME, &redirect);
+ if(CURLE_OK == res) {
+ printf("Time: %.1f", redirect);
+ }
+ }
+ /* always cleanup */
+ curl_easy_cleanup(curl);
+}
+.fi
.SH AVAILABILITY
Added in 7.9.7
.SH RETURN VALUE
diff --git a/docs/libcurl/opts/CURLINFO_SIZE_DOWNLOAD.3 b/docs/libcurl/opts/CURLINFO_SIZE_DOWNLOAD.3
index 85039ffef..c5f5d7d8f 100644
--- a/docs/libcurl/opts/CURLINFO_SIZE_DOWNLOAD.3
+++ b/docs/libcurl/opts/CURLINFO_SIZE_DOWNLOAD.3
@@ -5,7 +5,7 @@
.\" * | (__| |_| | _ <| |___
.\" * \___|\___/|_| \_\_____|
.\" *
-.\" * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
+.\" * Copyright (C) 1998 - 2017, 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,24 @@ counted in this number.
.SH PROTOCOLS
All
.SH EXAMPLE
-TODO
+.nf
+CURL *curl = curl_easy_init();
+if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
+
+ /* Perform the request */
+ res = curl_easy_perform(curl);
+
+ if(!res) {
+ /* check the size */
+ double dl;
+ res = curl_easy_getinfo(curl, CURLINFO_SIZE_DOWNLOAD, &dl);
+ if(!res) {
+ printf("Downloaded %.0f bytes\n", cl);
+ }
+ }
+}
+.fi
.SH AVAILABILITY
Added in 7.4.1
.SH RETURN VALUE
diff --git a/docs/libcurl/opts/CURLINFO_SIZE_UPLOAD.3 b/docs/libcurl/opts/CURLINFO_SIZE_UPLOAD.3
index 034c6df45..85597c571 100644
--- a/docs/libcurl/opts/CURLINFO_SIZE_UPLOAD.3
+++ b/docs/libcurl/opts/CURLINFO_SIZE_UPLOAD.3
@@ -5,7 +5,7 @@
.\" * | (__| |_| | _ <| |___
.\" * \___|\___/|_| \_\_____|
.\" *
-.\" * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
+.\" * Copyright (C) 1998 - 2017, 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
@@ -33,7 +33,23 @@ uploaded.
.SH PROTOCOLS
All
.SH EXAMPLE
-TODO
+.nf
+CURL *curl = curl_easy_init();
+if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
+
+ /* Perform the request */
+ res = curl_easy_perform(curl);
+
+ if(!res) {
+ double ul;
+ res = curl_easy_getinfo(curl, CURLINFO_SIZE_UPLOAD, &ul);
+ if(!res) {
+ printf("Uploaded %.0f bytes\n", ul);
+ }
+ }
+}
+.fi
.SH AVAILABILITY
Added in 7.4.1
.SH RETURN VALUE
diff --git a/docs/libcurl/opts/CURLINFO_SPEED_DOWNLOAD.3 b/docs/libcurl/opts/CURLINFO_SPEED_DOWNLOAD.3
index ef1c739e8..aec253bf0 100644
--- a/docs/libcurl/opts/CURLINFO_SPEED_DOWNLOAD.3
+++ b/docs/libcurl/opts/CURLINFO_SPEED_DOWNLOAD.3
@@ -5,7 +5,7 @@
.\" * | (__| |_| | _ <| |___
.\" * \___|\___/|_| \_\_____|
.\" *
-.\" * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
+.\" * Copyright (C) 1998 - 2017, 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
@@ -32,7 +32,23 @@ Pass a pointer to a double to receive the average download speed that curl
measured for the complete download. Measured in bytes/second.
.SH PROTOCOLS
.SH EXAMPLE
-TODO
+.nf
+CURL *curl = curl_easy_init();
+if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
+
+ /* Perform the request */
+ res = curl_easy_perform(curl);
+
+ if(!res) {
+ double speed;
+ res = curl_easy_getinfo(curl, CURLINFO_SPEED_DOWNLOAD, &speed);
+ if(!res) {
+ printf("Download speed %.0f bytes/sec\n", ul);
+ }
+ }
+}
+.fi
.SH AVAILABILITY
Added in 7.4.1
.SH RETURN VALUE
diff --git a/docs/libcurl/opts/CURLINFO_SPEED_UPLOAD.3 b/docs/libcurl/opts/CURLINFO_SPEED_UPLOAD.3
index f79ea1f1e..75c56d9e1 100644
--- a/docs/libcurl/opts/CURLINFO_SPEED_UPLOAD.3
+++ b/docs/libcurl/opts/CURLINFO_SPEED_UPLOAD.3
@@ -5,7 +5,7 @@
.\" * | (__| |_| | _ <| |___
.\" * \___|\___/|_| \_\_____|
.\" *
-.\" * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
+.\" * Copyright (C) 1998 - 2017, 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
@@ -32,7 +32,23 @@ Pass a pointer to a double to receive the average upload speed that curl
measured for the complete upload. Measured in bytes/second.
.SH PROTOCOLS
.SH EXAMPLE
-TODO
+.nf
+CURL *curl = curl_easy_init();
+if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
+
+ /* Perform the request */
+ res = curl_easy_perform(curl);
+
+ if(!res) {
+ double speed;
+ res = curl_easy_getinfo(curl, CURLINFO_SPEED_UPLOAD, &speed);
+ if(!res) {
+ printf("Upload speed %.0f bytes/sec\n", ul);
+ }
+ }
+}
+.fi
.SH AVAILABILITY
Added in
.SH RETURN VALUE
diff --git a/docs/libcurl/opts/CURLINFO_STARTTRANSFER_TIME.3 b/docs/libcurl/opts/CURLINFO_STARTTRANSFER_TIME.3
index 546436481..fa2e6c53b 100644
--- a/docs/libcurl/opts/CURLINFO_STARTTRANSFER_TIME.3
+++ b/docs/libcurl/opts/CURLINFO_STARTTRANSFER_TIME.3
@@ -5,7 +5,7 @@
.\" * | (__| |_| | _ <| |___
.\" * \___|\___/|_| \_\_____|
.\" *
-.\" * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
+.\" * Copyright (C) 1998 - 2017, 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,22 @@ See also the TIMES overview in the \fIcurl_easy_getinfo(3)\fP man page.
.SH PROTOCOLS
All
.SH EXAMPLE
-TODO
+.nf
+curl = curl_easy_init();
+if(curl) {
+ double start;
+ curl_easy_setopt(curl, CURLOPT_URL, url);
+ res = curl_easy_perform(curl);
+ if(CURLE_OK == res) {
+ res = curl_easy_getinfo(curl, CURLINFO_STARTTRANSFER_TIME, &start);
+ if(CURLE_OK == res) {
+ printf("Time: %.1f", start);
+ }
+ }
+ /* always cleanup */
+ curl_easy_cleanup(curl);
+}
+.fi
.SH AVAILABILITY
Added in 7.9.2
.SH RETURN VALUE
diff --git a/docs/libcurl/opts/CURLINFO_TOTAL_TIME.3 b/docs/libcurl/opts/CURLINFO_TOTAL_TIME.3
index b068a8b8a..dea83d88e 100644
--- a/docs/libcurl/opts/CURLINFO_TOTAL_TIME.3
+++ b/docs/libcurl/opts/CURLINFO_TOTAL_TIME.3
@@ -5,7 +5,7 @@
.\" * | (__| |_| | _ <| |___
.\" * \___|\___/|_| \_\_____|
.\" *
-.\" * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
+.\" * Copyright (C) 1998 - 2017, 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,22 @@ See also the TIMES overview in the \fIcurl_easy_getinfo(3)\fP man page.
.SH PROTOCOLS
All
.SH EXAMPLE
-TODO
+.nf
+curl = curl_easy_init();
+if(curl) {
+ double total;
+ curl_easy_setopt(curl, CURLOPT_URL, url);
+ res = curl_easy_perform(curl);
+ if(CURLE_OK == res) {
+ res = curl_easy_getinfo(curl, CURLINFO_TOTAL_TIME, &total);
+ if(CURLE_OK == res) {
+ printf("Time: %.1f", total);
+ }
+ }
+ /* always cleanup */
+ curl_easy_cleanup(curl);
+}
+.fi
.SH AVAILABILITY
Added in 7.4.1
.SH RETURN VALUE
diff --git a/docs/libcurl/opts/CURLOPT_FTP_ACCOUNT.3 b/docs/libcurl/opts/CURLOPT_FTP_ACCOUNT.3
index 5422a6bfe..8218038a1 100644
--- a/docs/libcurl/opts/CURLOPT_FTP_ACCOUNT.3
+++ b/docs/libcurl/opts/CURLOPT_FTP_ACCOUNT.3
@@ -5,7 +5,7 @@
.\" * | (__| |_| | _ <| |___
.\" * \___|\___/|_| \_\_____|
.\" *
-.\" * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+.\" * Copyright (C) 1998 - 2017, 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
@@ -39,7 +39,18 @@ NULL
.SH PROTOCOLS
FTP
.SH EXAMPLE
-TODO
+.nf
+CURL *curl = curl_easy_init();
+if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/foo.bin");
+
+ curl_easy_setopt(curl, CURLOPT_FTP_ACCOUNT, "human-resources");
+
+ ret = curl_easy_perform(curl);
+
+ curl_easy_cleanup(curl);
+}
+.fi
.SH AVAILABILITY
Added in 7.13.0
.SH RETURN VALUE
diff --git a/docs/libcurl/opts/CURLOPT_FTP_ALTERNATIVE_TO_USER.3 b/docs/libcurl/opts/CURLOPT_FTP_ALTERNATIVE_TO_USER.3
index cd444b6ae..a9723b5f6 100644
--- a/docs/libcurl/opts/CURLOPT_FTP_ALTERNATIVE_TO_USER.3
+++ b/docs/libcurl/opts/CURLOPT_FTP_ALTERNATIVE_TO_USER.3
@@ -5,7 +5,7 @@
.\" * | (__| |_| | _ <| |___
.\" * \___|\___/|_| \_\_____|
.\" *
-.\" * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+.\" * Copyright (C) 1998 - 2014, 2017, 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
@@ -43,7 +43,18 @@ NULL
.SH PROTOCOLS
FTP
.SH EXAMPLE
-TODO
+.nf
+CURL *curl = curl_easy_init();
+if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/foo.bin");
+
+ curl_easy_setopt(curl, CURLOPT_FTP_ALTERNATIVE_TO_USER, "two users");
+
+ ret = curl_easy_perform(curl);
+
+ curl_easy_cleanup(curl);
+}
+.fi
.SH AVAILABILITY
Added in 7.15.5
.SH RETURN VALUE
diff --git a/docs/libcurl/opts/CURLOPT_FTP_CREATE_MISSING_DIRS.3 b/docs/libcurl/opts/CURLOPT_FTP_CREATE_MISSING_DIRS.3
index d28a646ef..f57873605 100644
--- a/docs/libcurl/opts/CURLOPT_FTP_CREATE_MISSING_DIRS.3
+++ b/docs/libcurl/opts/CURLOPT_FTP_CREATE_MISSING_DIRS.3
@@ -5,7 +5,7 @@
.\" * | (__| |_| | _ <| |___
.\" * \___|\___/|_| \_\_____|
.\" *
-.\" * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+.\" * Copyright (C) 1998 - 2014, 2017, 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
@@ -59,7 +59,18 @@ CURLFTP_CREATE_DIR_NONE (0)
.SH PROTOCOLS
FTP and SFTP
.SH EXAMPLE
-TODO
+.nf
+CURL *curl = curl_easy_init();
+if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/non-existing/new.txt");
+ curl_easy_setopt(curl, CURLOPT_FTP_CREATE_MISSING_DIRS,
+ CURLFTP_CREATE_DIR_RETRY);
+
+ ret = curl_easy_perform(curl);
+
+ curl_easy_cleanup(curl);
+}
+.fi
.SH AVAILABILITY
Added in 7.10.7. SFTP support added in 7.16.3. The retry option was added in
7.19.4.
diff --git a/docs/libcurl/opts/CURLOPT_FTP_FILEMETHOD.3 b/docs/libcurl/opts/CURLOPT_FTP_FILEMETHOD.3
index 280e8f1dc..381145bc3 100644
--- a/docs/libcurl/opts/CURLOPT_FTP_FILEMETHOD.3
+++ b/docs/libcurl/opts/CURLOPT_FTP_FILEMETHOD.3
@@ -5,7 +5,7 @@
.\" * | (__| |_| | _ <| |___
.\" * \___|\___/|_| \_\_____|
.\" *
-.\" * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+.\" * Copyright (C) 1998 - 2017, 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
@@ -53,7 +53,18 @@ CURLFTPMETHOD_MULTICWD
.SH PROTOCOLS
FTP
.SH EXAMPLE
-TODO
+.nf
+CURL *curl = curl_easy_init();
+if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/1/2/3/4/new.txt");
+ curl_easy_setopt(curl, CURLOPT_FTP_FILEMETHOD,
+ CURLFTPMETHOD_SINGLECWD);
+
+ ret = curl_easy_perform(curl);
+
+ curl_easy_cleanup(curl);
+}
+.fi
.SH AVAILABILITY
Added in 7.15.1
.SH RETURN VALUE
diff --git a/docs/libcurl/opts/CURLOPT_FTP_RESPONSE_TIMEOUT.3 b/docs/libcurl/opts/CURLOPT_FTP_RESPONSE_TIMEOUT.3
index 45ec304c8..cc8cc7b21 100644
--- a/docs/libcurl/opts/CURLOPT_FTP_RESPONSE_TIMEOUT.3
+++ b/docs/libcurl/opts/CURLOPT_FTP_RESPONSE_TIMEOUT.3
@@ -5,7 +5,7 @@
.\" * | (__| |_| | _ <| |___
.\" * \___|\___/|_| \_\_____|
.\" *
-.\" * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+.\" * Copyright (C) 1998 - 2017, 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
@@ -40,7 +40,17 @@ None
.SH PROTOCOLS
FTP
.SH EXAMPLE
-TODO
+.nf
+CURL *curl = curl_easy_init();
+if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/slow.txt");
+ /* wait no more than 23 seconds */
+ curl_easy_setopt(curl, CURLOPT_FTP_RESPONSE_TIMEOUT, 23L);
+ ret = curl_easy_perform(curl);
+
+ curl_easy_cleanup(curl);
+}
+.fi
.SH AVAILABILITY
Added in 7.10.8
.SH RETURN VALUE
diff --git a/docs/libcurl/opts/CURLOPT_FTP_SKIP_PASV_IP.3 b/docs/libcurl/opts/CURLOPT_FTP_SKIP_PASV_IP.3
index b60c3b105..9d468a551 100644
--- a/docs/libcurl/opts/CURLOPT_FTP_SKIP_PASV_IP.3
+++ b/docs/libcurl/opts/CURLOPT_FTP_SKIP_PASV_IP.3
@@ -5,7 +5,7 @@
.\" * | (__| |_| | _ <| |___
.\" * \___|\___/|_| \_\_____|
.\" *
-.\" * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+.\" * Copyright (C) 1998 - 2017, 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
@@ -43,7 +43,18 @@ This option has no effect if PORT, EPRT or EPSV is used instead of PASV.
.SH PROTOCOLS
FTP
.SH EXAMPLE
-TODO
+.nf
+CURL *curl = curl_easy_init();
+if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/file.txt");
+
+ /* please ignore the IP in the PASV response */
+ curl_easy_setopt(curl, CURLOPT_FTP_SKIP_PASV_IP, 1L);
+ ret = curl_easy_perform(curl);
+
+ curl_easy_cleanup(curl);
+}
+.fi
.SH AVAILABILITY
Added in 7.14.2
.SH RETURN VALUE
diff --git a/docs/libcurl/opts/CURLOPT_FTP_USE_EPSV.3 b/docs/libcurl/opts/CURLOPT_FTP_USE_EPSV.3
index af7a45e95..970e08a83 100644
--- a/docs/libcurl/opts/CURLOPT_FTP_USE_EPSV.3
+++ b/docs/libcurl/opts/CURLOPT_FTP_USE_EPSV.3
@@ -5,7 +5,7 @@
.\" * | (__| |_| | _ <| |___
.\" * \___|\___/|_| \_\_____|
.\" *
-.\" * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+.\" * Copyright (C) 1998 - 2014, 2017, 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
@@ -39,7 +39,19 @@ If the server is an IPv6 host, this option will have no effect as of 7.12.3.
.SH PROTOCOLS
FTP
.SH EXAMPLE
-TODO
+.nf
+CURL *curl = curl_easy_init();
+if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/old-server/file.txt");
+
+ /* let's shut off this modern feature */
+ curl_easy_setopt(curl, CURLOPT_FTP_USE_EPSV, 0L);
+
+ ret = curl_easy_perform(curl);
+
+ curl_easy_cleanup(curl);
+}
+.fi
.SH AVAILABILITY
Along with FTP
.SH RETURN VALUE
diff --git a/docs/libcurl/opts/CURLOPT_FTP_USE_PRET.3 b/docs/libcurl/opts/CURLOPT_FTP_USE_PRET.3
index 10f713bb9..53b33e50d 100644
--- a/docs/libcurl/opts/CURLOPT_FTP_USE_PRET.3
+++ b/docs/libcurl/opts/CURLOPT_FTP_USE_PRET.3
@@ -5,7 +5,7 @@
.\" * | (__| |_| | _ <| |___
.\" * \___|\___/|_| \_\_____|
.\" *
-.\" * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+.\" * Copyright (C) 1998 - 2017, 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,19 @@ no effect when using the active FTP transfers mode.
.SH PROTOCOLS
FTP
.SH EXAMPLE
-TODO
+.nf
+CURL *curl = curl_easy_init();
+if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/old-server/file.txt");
+
+ /* a drftpd server, do it! */
+ curl_easy_setopt(curl, CURLOPT_FTP_USE_PRET, 1L);
+
+ ret = curl_easy_perform(curl);
+
+ curl_easy_cleanup(curl);
+}
+.fi
.SH AVAILABILITY
Added in 7.20.0
.SH RETURN VALUE
diff --git a/docs/libcurl/opts/CURLOPT_LOW_SPEED_LIMIT.3 b/docs/libcurl/opts/CURLOPT_LOW_SPEED_LIMIT.3
index 890ea720f..e93453f94 100644
--- a/docs/libcurl/opts/CURLOPT_LOW_SPEED_LIMIT.3
+++ b/docs/libcurl/opts/CURLOPT_LOW_SPEED_LIMIT.3
@@ -5,7 +5,7 @@
.\" * | (__| |_| | _ <| |___
.\" * \___|\___/|_| \_\_____|
.\" *
-.\" * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+.\" * Copyright (C) 1998 - 2017, 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,21 @@ slow and abort.
.SH PROTOCOLS
All
.SH EXAMPLE
-TODO
+.nf
+curl = curl_easy_init();
+if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, url);
+ /* abort if slower than 30 bytes/sec during 60 seconds */
+ curl_easy_setopt(curl, CURLOPT_LOW_SPEED_TIME, 60L);
+ curl_easy_setopt(curl, CURLOPT_LOW_SPEED_LIMIT, 30L);
+ res = curl_easy_perform(curl);
+ if(CURLE_OPERATION_TIMEDOUT == res) {
+ printf("Timeout!\n");
+ }
+ /* always cleanup */
+ curl_easy_cleanup(curl);
+}
+.fi
.SH AVAILABILITY
Always
.SH RETURN VALUE
diff --git a/docs/libcurl/opts/CURLOPT_LOW_SPEED_TIME.3 b/docs/libcurl/opts/CURLOPT_LOW_SPEED_TIME.3
index ed3b8296c..758dc6eb2 100644
--- a/docs/libcurl/opts/CURLOPT_LOW_SPEED_TIME.3
+++ b/docs/libcurl/opts/CURLOPT_LOW_SPEED_TIME.3
@@ -5,7 +5,7 @@
.\" * | (__| |_| | _ <| |___
.\" * \___|\___/|_| \_\_____|
.\" *
-.\" * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+.\" * Copyright (C) 1998 - 2017, 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,21 @@ library to consider it too slow and abort.
.SH PROTOCOLS
All
.SH EXAMPLE
-TODO
+.nf
+curl = curl_easy_init();
+if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, url);
+ /* abort if slower than 30 bytes/sec during 60 seconds */
+ curl_easy_setopt(curl, CURLOPT_LOW_SPEED_TIME, 60L);
+ curl_easy_setopt(curl, CURLOPT_LOW_SPEED_LIMIT, 30L);
+ res = curl_easy_perform(curl);
+ if(CURLE_OPERATION_TIMEDOUT == res) {
+ printf("Timeout!\n");
+ }
+ /* always cleanup */
+ curl_easy_cleanup(curl);
+}
+.fi
.SH AVAILABILITY
Always
.SH RETURN VALUE