docs/opts: 24 more man pages now have examples
authorDaniel Stenberg <daniel@haxx.se>
Fri, 5 May 2017 15:26:08 +0000 (17:26 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 5 May 2017 15:26:08 +0000 (17:26 +0200)
24 files changed:
docs/libcurl/opts/CURLINFO_LOCAL_IP.3
docs/libcurl/opts/CURLINFO_PRIMARY_PORT.3
docs/libcurl/opts/CURLINFO_PRIVATE.3
docs/libcurl/opts/CURLINFO_REDIRECT_COUNT.3
docs/libcurl/opts/CURLINFO_REQUEST_SIZE.3
docs/libcurl/opts/CURLOPT_AUTOREFERER.3
docs/libcurl/opts/CURLOPT_BUFFERSIZE.3
docs/libcurl/opts/CURLOPT_COOKIEFILE.3
docs/libcurl/opts/CURLOPT_COOKIEJAR.3
docs/libcurl/opts/CURLOPT_COOKIESESSION.3
docs/libcurl/opts/CURLOPT_CUSTOMREQUEST.3
docs/libcurl/opts/CURLOPT_DIRLISTONLY.3
docs/libcurl/opts/CURLOPT_DNS_CACHE_TIMEOUT.3
docs/libcurl/opts/CURLOPT_HEADERDATA.3
docs/libcurl/opts/CURLOPT_INTERFACE.3
docs/libcurl/opts/CURLOPT_IPRESOLVE.3
docs/libcurl/opts/CURLOPT_PASSWORD.3
docs/libcurl/opts/CURLOPT_PORT.3
docs/libcurl/opts/CURLOPT_POST.3
docs/libcurl/opts/CURLOPT_POSTQUOTE.3
docs/libcurl/opts/CURLOPT_PREQUOTE.3
docs/libcurl/opts/CURLOPT_QUOTE.3
docs/libcurl/opts/CURLOPT_USERNAME.3
docs/libcurl/opts/CURLOPT_USERPWD.3

index b2228e2230c35a00ed2c5d39781961f2787e3a26..e342fd2b333c4fe3257f801393006d99ca86ca93 100644 (file)
@@ -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,24 @@ corresponding CURL handle.
 .SH PROTOCOLS
 All
 .SH EXAMPLE
-TODO
+.nf
+{
+  char *ip;
+
+  curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
+
+  /* Perform the request, res will get the return code */
+  res = curl_easy_perform(curl);
+  /* Check for errors */
+  if((res == CURLE_OK) &&
+     !curl_easy_getinfo(curl, CURLINFO_LOCAL_IP, &ip) && ip) {
+    printf("Local IP: %s\\n", ip);
+  }
+
+  /* always cleanup */
+  curl_easy_cleanup(curl);
+}
+.fi
 .SH AVAILABILITY
 Added in 7.21.0
 .SH RETURN VALUE
index 45ed6a689cf4ff4b539592aecb973994a30bb1a5..69f2907ffceba1457f2c0f9a40efc58658a203e7 100644 (file)
@@ -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,21 @@ connection done with this \fBcurl\fP handle.
 .SH PROTOCOLS
 All
 .SH EXAMPLE
-TODO
+.nf
+CURL *curl = curl_easy_init();
+if(curl) {
+  CURLcode res;
+  curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
+  res = curl_easy_perform(curl);
+  if(res == CURLE_OK) {
+    long port;
+    res = curl_easy_getinfo(curl, CURLINFO_PRIMARY_PORT, &port);
+    if(!res)
+      printf("Connected to remote port: %ld\n", port);
+  }
+  curl_easy_cleanup(curl);
+}
+.fi
 .SH AVAILABILITY
 Added in 7.21.0
 .SH RETURN VALUE
index a7fe9d53871c95e358b3a466b5c0b271cf6f4b97..03418e3648ddcea22fb38e05dff3a255e05f4fa5 100644 (file)
@@ -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 @@ pointer, although effectively being a 'void *'.
 .SH PROTOCOLS
 All
 .SH EXAMPLE
-TODO
+.nf
+CURL *curl = curl_easy_init();
+if(curl) {
+  void *pointer = 0x2345454;
+  curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/foo.bin");
+
+  /* set the private pointer */
+  curl_easy_setopt(curl, CURLOPT_PRIVATE, pointer);
+  ret = curl_easy_perform(curl);
+
+  /* extract the private pointer again */
+  ret = curl_easy_getinfo(curl, CURLINFO_PRIVATE, &pointer);
+
+  curl_easy_cleanup(curl);
+}
+.fi
 .SH AVAILABILITY
 Added in 7.10.3
 .SH RETURN VALUE
index ee1ebbb62d6b3201fb573f32ace3475cc43d3001..61d79830b80f88702462f18b7366dec4966790ce 100644 (file)
@@ -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,20 @@ actually followed.
 .SH PROTOCOLS
 HTTP(S)
 .SH EXAMPLE
-TODO
+.nf
+CURL *curl = curl_easy_init();
+if(curl) {
+  CURLcode res;
+  curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
+  curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
+  res = curl_easy_perform(curl);
+  if(res == CURLE_OK) {
+    long redirects;
+    curl_easy_getinfo(curl, CURLINFO_REDIRECT_COUNT, &redirects);
+  }
+  curl_easy_cleanup(curl);
+}
+.fi
 .SH AVAILABILITY
 Added in 7.9.7
 .SH RETURN VALUE
index 6f857353aceb6b61c910c9f44096b0dad82a2033..ca2f9a907ac162574ce23726a37ebd63190b5a33 100644 (file)
@@ -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
@@ -34,7 +34,21 @@ than one request if \fICURLOPT_FOLLOWLOCATION(3)\fP is enabled.
 .SH PROTOCOLS
 All
 .SH EXAMPLE
-TODO
+.nf
+CURL *curl = curl_easy_init();
+if(curl) {
+  CURLcode res;
+  curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
+  res = curl_easy_perform(curl);
+  if(res == CURLE_OK) {
+    long req;
+    res = curl_easy_getinfo(curl, CURLINFO_REQUEST_SIZE, &req);
+    if(!res)
+      printf("Request size: %ld bytes\n", req);
+  }
+  curl_easy_cleanup(curl);
+}
+.fi
 .SH AVAILABILITY
 Added in 7.4.1
 .SH RETURN VALUE
index e6a3a085dd994032bfd2fc6089c9588b45ff0d57..4d8a1c04dc08b3056d95561aa8e56e91ffe9d30b 100644 (file)
@@ -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,22 @@ a Location: redirect.
 .SH PROTOCOLS
 HTTP
 .SH EXAMPLE
-TODO
+.nf
+CURL *curl = curl_easy_init();
+if(curl) {
+  curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/foo.bin");
+
+  /* follow redirects */
+  curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
+
+  /* set Referer: automatically when following redirects */
+  curl_easy_setopt(curl, CURLOPT_AUTOREFERER, 1L);
+
+  ret = curl_easy_perform(curl);
+
+  curl_easy_cleanup(curl);
+}
+.fi
 .SH AVAILABILITY
 Along with HTTP
 .SH RETURN VALUE
index dc5bf74f2a4f584e531c225d4018187ecd2ee51f..5d9b065af76746c83ee636e226376d44c70a979f 100644 (file)
@@ -43,7 +43,19 @@ CURL_MAX_WRITE_SIZE (16kB)
 .SH PROTOCOLS
 All
 .SH EXAMPLE
-TODO
+.nf
+CURL *curl = curl_easy_init();
+if(curl) {
+  curl_easy_setopt(curl, CURLOPT_URL, "sftp://example.com/foo.bin");
+
+  /* ask libcurl to allocate a larger receive buffer */
+  curl_easy_setopt(curl, CURLOPT_BUFFERSIZE, 120000L);
+
+  ret = curl_easy_perform(curl);
+
+  curl_easy_cleanup(curl);
+}
+.fi
 .SH AVAILABILITY
 Added in 7.10.  Growing the buffer was added in 7.53.0.
 .SH RETURN VALUE
index ba2d1e350c8ad0dd47eded83d146bf8dc9bd05c1..457d94470b2284df88c43ceb0ad50819a273018b 100644 (file)
@@ -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
@@ -61,7 +61,19 @@ NULL
 .SH PROTOCOLS
 HTTP
 .SH EXAMPLE
-TODO
+.nf
+CURL *curl = curl_easy_init();
+if(curl) {
+  curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/foo.bin");
+
+  /* get cookies from an existing file */
+  curl_easy_setopt(curl, CURLOPT_COOKIEFILE, "/tmp/cookies.txt");
+
+  ret = curl_easy_perform(curl);
+
+  curl_easy_cleanup(curl);
+}
+.fi
 .SH AVAILABILITY
 As long as HTTP is supported
 .SH RETURN VALUE
index 3c1f541037a362ee9a66bc3598151fe6a1c57fca..d4f7ccdad5ebdc50cd53478940b1285d46bbed57 100644 (file)
@@ -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
@@ -54,7 +54,20 @@ NULL
 .SH PROTOCOLS
 HTTP
 .SH EXAMPLE
-TODO
+.nf
+CURL *curl = curl_easy_init();
+if(curl) {
+  curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/foo.bin");
+
+  /* export cookies to this file when closing the handle */
+  curl_easy_setopt(curl, CURLOPT_COOKIEJAR, "/tmp/cookies.txt");
+
+  ret = curl_easy_perform(curl);
+
+  /* close the handle, write the cookies! */
+  curl_easy_cleanup(curl);
+}
+.fi
 .SH AVAILABILITY
 Along with HTTP
 .SH RETURN VALUE
index ecc3757eebbd3e2e6c1e53d5645f6256feca2018..c4c015f826629d23f3b5c4e9dc4e91839f77db34 100644 (file)
@@ -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
@@ -42,7 +42,22 @@ browser up, more or less.
 .SH PROTOCOLS
 HTTP
 .SH EXAMPLE
-TODO
+.nf
+CURL *curl = curl_easy_init();
+if(curl) {
+  curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/foo.bin");
+
+  /* new "session", don't load session cookies */
+  curl_easy_setopt(curl, CURLOPT_COOKIESESSION, 1L);
+
+  /* get the (non session) cookies from this file */
+  curl_easy_setopt(curl, CURLOPT_COOKIEFILE, "/tmp/cookies.txt");
+
+  ret = curl_easy_perform(curl);
+
+  curl_easy_cleanup(curl);
+}
+.fi
 .SH AVAILABILITY
 Along with HTTP
 .SH RETURN VALUE
index 2bd3517997252f2f8d5afde36a95dbfb01cdf64f..b20d6836cc4e742238c39cf6eea430322007d1b5 100644 (file)
@@ -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
@@ -88,7 +88,19 @@ NULL
 .SH PROTOCOLS
 HTTP, FTP, IMAP, POP3 and SMTP
 .SH EXAMPLE
-TODO
+.nf
+CURL *curl = curl_easy_init();
+if(curl) {
+  curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/foo.bin");
+
+  /* DELETE the given path */
+  curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "DELETE");
+
+  ret = curl_easy_perform(curl);
+
+  curl_easy_cleanup(curl);
+}
+.fi
 .SH AVAILABILITY
 IMAP is supported since 7.30.0, POP3 since 7.26.0 and SMTP since 7.34.0.
 .SH RETURN VALUE
index 07b8ac380ee9c049e77571ddef3a8b3713965a03..203e247b7386181b98c110e4ec35a7fd73eb99e1 100644 (file)
@@ -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
@@ -51,7 +51,19 @@ will effectively break that feature then.
 .SH PROTOCOLS
 FTP, SFTP and POP3
 .SH EXAMPLE
-TODO
+.nf
+CURL *curl = curl_easy_init();
+if(curl) {
+  curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/dir/");
+
+  /* list only */
+  curl_easy_setopt(curl, CURLOPT_DIRLISTONLY, 1L);
+
+  ret = curl_easy_perform(curl);
+
+  curl_easy_cleanup(curl);
+}
+.fi
 .SH AVAILABILITY
 This option was known as CURLOPT_FTPLISTONLY up to 7.16.4. POP3 is supported
 since 7.21.5.
index 060741016a541ba19aa59ebc64dc19e40e6c4e65..f672e604852d71f5b4aba5229b4bf978f94e81c9 100644 (file)
@@ -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
@@ -47,7 +47,23 @@ address for a certain small amount of time into the future.
 .SH PROTOCOLS
 All
 .SH EXAMPLE
-TODO
+.nf
+CURL *curl = curl_easy_init();
+if(curl) {
+  curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/foo.bin");
+
+  /* only reuse addresses for a very short time */
+  curl_easy_setopt(curl, CURLOPT_DNS_CACHE_TIMEOUT, 2L);
+
+  ret = curl_easy_perform(curl);
+
+  /* in this second request, the cache will not be used if more than
+     two seconds have passed since the previous name resolve */
+  ret = curl_easy_perform(curl);
+
+  curl_easy_cleanup(curl);
+}
+.fi
 .SH AVAILABILITY
 Always
 .SH RETURN VALUE
index c865c860f848af63439ab35c4c68112a9d0dc0e7..73dcc2bb92a37ea565c90056d04a03ac12029eca 100644 (file)
@@ -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
@@ -41,7 +41,35 @@ NULL
 .SH PROTOCOLS
 All
 .SH EXAMPLE
-TODO
+.nf
+struct my_info {
+  int shoesize;
+  char *secret;
+};
+
+static size_t header_callback(char *buffer, size_t size,
+                              size_t nitems, void *userdata)
+{
+  struct my_info *i = (struct my_info *)userdata;
+
+  /* now this callback can access the my_info struct */
+
+  return nitems * size;
+}
+
+CURL *curl = curl_easy_init();
+if(curl) {
+  struct my_info my = { 10, "the cookies are in the cupboard" };
+  curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
+
+  curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, header_callback);
+
+  /* pass in custom data to the callback */
+  curl_easy_setopt(curl, CURLOPT_HEADERDATA, &my);
+
+  curl_easy_perform(curl);
+}
+.fi
 .SH AVAILABILITY
 Always
 .SH RETURN VALUE
index 8b7aff0c573a1c0f75006bb255f4ab7293a56b48..16e542adb26d9ce18d508b25087768a887cfa4ed 100644 (file)
@@ -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
@@ -48,7 +48,18 @@ NULL, use whatever the TCP stack finds suitable
 .SH PROTOCOLS
 All
 .SH EXAMPLE
-TODO
+.nf
+CURL *curl = curl_easy_init();
+if(curl) {
+  curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/foo.bin");
+
+  curl_easy_setopt(curl, CURLOPT_INTERFACE, "eth0");
+
+  ret = curl_easy_perform(curl);
+
+  curl_easy_cleanup(curl);
+}
+.fi
 .SH AVAILABILITY
 The "if!" and "host!" syntax was added in 7.24.0.
 .SH RETURN VALUE
index 817f34d5fd263e9efaf67a0a733ef5577b64ee27..a23d883fd9b3311fdef0ba08d5093aedd6552f62 100644 (file)
@@ -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
@@ -42,7 +42,20 @@ CURL_IPRESOLVE_WHATEVER
 .SH PROTOCOLS
 All
 .SH EXAMPLE
-TODO
+.nf
+CURL *curl = curl_easy_init();
+if(curl) {
+  curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/foo.bin");
+
+  /* resolve host name using IPv6-names only */
+  curl_easy_setopt(curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V6);
+
+  ret = curl_easy_perform(curl);
+
+  curl_easy_cleanup(curl);
+}
+.fi
+
 .SH AVAILABILITY
 Always
 .SH RETURN VALUE
index e9f6d06bcd931319a75a813e08ad559e2ee89e8f..3c5f7de40d4947c3ef34f35e3468984318e3f312 100644 (file)
@@ -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
@@ -41,7 +41,18 @@ blank
 .SH PROTOCOLS
 Most
 .SH EXAMPLE
-TODO
+.nf
+CURL *curl = curl_easy_init();
+if(curl) {
+  curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/foo.bin");
+
+  curl_easy_setopt(curl, CURLOPT_PASSWORD, "qwerty");
+
+  ret = curl_easy_perform(curl);
+
+  curl_easy_cleanup(curl);
+}
+.fi
 .SH AVAILABILITY
 Added in 7.19.1
 .SH RETURN VALUE
index f47b243abd3600b313ee42658c2c8af867c82018..9f872028adb4ed99901e43cfc0a67544bdbcb999 100644 (file)
@@ -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
@@ -42,7 +42,18 @@ By default this is 0 which makes it not used.
 .SH PROTOCOLS
 Used for all protocols that speak to a port number.
 .SH EXAMPLE
-TODO
+.nf
+CURL *curl = curl_easy_init();
+if(curl) {
+  curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/foo.bin");
+
+  curl_easy_setopt(curl, CURLOPT_PORT, 8080L);
+
+  ret = curl_easy_perform(curl);
+
+  curl_easy_cleanup(curl);
+}
+.fi
 .SH AVAILABILITY
 Always
 .SH RETURN VALUE
index 7754c7dc0be773ae3a568f633cd203210f9be5e0..5e4f0409b76c517210a3311709dd9288b73c4a0c 100644 (file)
@@ -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
@@ -68,7 +68,19 @@ re-used handle, you must explicitly set the new request type using
 .SH PROTOCOLS
 HTTP
 .SH EXAMPLE
-TODO
+.nf
+CURL *curl = curl_easy_init();
+if(curl) {
+  curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/foo.bin");
+  curl_easy_setopt(curl, CURLOPT_POST, 1L);
+
+  /* set up the read callback with CURLOPT_READFUNCTION */
+
+  ret = curl_easy_perform(curl);
+
+  curl_easy_cleanup(curl);
+}
+.fi
 .SH AVAILABILITY
 Along with HTTP
 .SH RETURN VALUE
index 3283a1a4e1123c56921dc98f2a05ebc83c670044..8af7ffdd01abf1fd20d8d86daca8e1ff582e26f1 100644 (file)
@@ -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,23 @@ NULL
 .SH PROTOCOLS
 SFTP and FTP
 .SH EXAMPLE
-TODO
+.nf
+struct curl_slist *h = NULL;
+h = curl_slist_append(h, "RNFR source-name");
+h = curl_slist_append(h, "RNTO new-name");
+
+curl = curl_easy_init();
+if(curl) {
+  curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/foo.bin");
+
+  /* pass in the FTP commands to run after the transfer */
+  curl_easy_setopt(curl, CURLOPT_POSTQUOTE, headerlist);
+
+  ret = curl_easy_perform(curl);
+
+  curl_easy_cleanup(curl);
+}
+.fi
 .SH AVAILABILITY
 If support for the protocols are built-in.
 .SH RETURN VALUE
index 2e77e99c2379a8374aea1b5a2559428a1bbcd80a..e3ba1eb0e5ea6d74d44ca7fda5a0433f7555366e 100644 (file)
@@ -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,22 @@ NULL
 .SH PROTOCOLS
 FTP and SFTP
 .SH EXAMPLE
-TODO
+.nf
+struct curl_slist *h = NULL;
+h = curl_slist_append(h, "SYST");
+
+curl = curl_easy_init();
+if(curl) {
+  curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/foo.bin");
+
+  /* pass in the FTP commands to run */
+  curl_easy_setopt(curl, CURLOPT_PREQUOTE, headerlist);
+
+  ret = curl_easy_perform(curl);
+
+  curl_easy_cleanup(curl);
+}
+.fi
 .SH AVAILABILITY
 Along with the protocol support
 .SH RETURN VALUE
index 4dce76df3d66cfdc2109fbdaa8c6fd3f78af5b74..e02d2c7426abf76eec6e92f909182f98d8ddb4fd 100644 (file)
@@ -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
@@ -80,7 +80,23 @@ NULL
 .SH PROTOCOLS
 SFTP and FTP
 .SH EXAMPLE
-TODO
+.nf
+struct curl_slist *h = NULL;
+h = curl_slist_append(h, "RNFR source-name");
+h = curl_slist_append(h, "RNTO new-name");
+
+curl = curl_easy_init();
+if(curl) {
+  curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/foo.bin");
+
+  /* pass in the FTP commands to run before the transfer */
+  curl_easy_setopt(curl, CURLOPT_QUOTE, headerlist);
+
+  ret = curl_easy_perform(curl);
+
+  curl_easy_cleanup(curl);
+}
+.fi
 .SH AVAILABILITY
 SFTP support added in 7.16.3. *-prefix for SFTP added in 7.24.0
 .SH RETURN VALUE
index 1e4b90fd65c3f6940dfc590f609e30495121cc02..116b205da11f782b72bb646122a54cf8e6f8a5ab 100644 (file)
@@ -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
@@ -63,7 +63,18 @@ blank
 .SH PROTOCOLS
 Most
 .SH EXAMPLE
-TODO
+.nf
+CURL *curl = curl_easy_init();
+if(curl) {
+  curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/foo.bin");
+
+  curl_easy_setopt(curl, CURLOPT_USERNAME, "clark");
+
+  ret = curl_easy_perform(curl);
+
+  curl_easy_cleanup(curl);
+}
+.fi
 .SH AVAILABILITY
 Added in 7.19.1
 .SH RETURN VALUE
index ad574206347a1d856306e0913641669af3da3d89..c5b1f743ed8c2c4e6b4abf2e2c54dad0bd44943b 100644 (file)
@@ -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
@@ -69,7 +69,18 @@ NULL
 .SH PROTOCOLS
 Most
 .SH EXAMPLE
-TODO
+.nf
+CURL *curl = curl_easy_init();
+if(curl) {
+  curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/foo.bin");
+
+  curl_easy_setopt(curl, CURLOPT_USERPWD, "clark:kent");
+
+  ret = curl_easy_perform(curl);
+
+  curl_easy_cleanup(curl);
+}
+.fi
 .SH AVAILABILITY
 Always
 .SH RETURN VALUE