Skip to content

Commit

Permalink
CURLOPT_*.3: added lots of small example sections
Browse files Browse the repository at this point in the history
  • Loading branch information
bagder committed Mar 17, 2015
1 parent 6105029 commit 8c41f36
Show file tree
Hide file tree
Showing 11 changed files with 157 additions and 22 deletions.
13 changes: 11 additions & 2 deletions docs/libcurl/opts/CURLOPT_COOKIE.3
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
14 changes: 12 additions & 2 deletions docs/libcurl/opts/CURLOPT_IGNORE_CONTENT_LENGTH.3
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
17 changes: 15 additions & 2 deletions docs/libcurl/opts/CURLOPT_INFILESIZE.3
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
17 changes: 15 additions & 2 deletions docs/libcurl/opts/CURLOPT_INFILESIZE_LARGE.3
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
16 changes: 14 additions & 2 deletions docs/libcurl/opts/CURLOPT_READDATA.3
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
14 changes: 12 additions & 2 deletions docs/libcurl/opts/CURLOPT_REFERER.3
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
14 changes: 12 additions & 2 deletions docs/libcurl/opts/CURLOPT_SSL_VERIFYHOST.3
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
14 changes: 12 additions & 2 deletions docs/libcurl/opts/CURLOPT_SSL_VERIFYPEER.3
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
20 changes: 18 additions & 2 deletions docs/libcurl/opts/CURLOPT_TCP_KEEPALIVE.3
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
20 changes: 18 additions & 2 deletions docs/libcurl/opts/CURLOPT_TCP_KEEPIDLE.3
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
20 changes: 18 additions & 2 deletions docs/libcurl/opts/CURLOPT_TCP_KEEPINTVL.3
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 8c41f36

Please sign in to comment.