From 2e503441edc98dedb6c070be6b526e4264762586 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 4 Jan 2016 15:34:05 +0100 Subject: [PATCH] examples: added descriptions --- docs/examples/multi-app.c | 8 ++++++-- docs/examples/postinmemory.c | 6 +++++- docs/examples/postit2.c | 6 +++++- docs/examples/progressfunc.c | 7 ++++++- docs/examples/resolve.c | 7 ++++++- docs/examples/rtsp.c | 4 ++++ docs/examples/sampleconv.c | 11 +++++++---- docs/examples/sendrecv.c | 15 +++++++++++++-- docs/examples/sepheaders.c | 6 +++++- docs/examples/sessioninfo.c | 6 +++++- docs/examples/sftpget.c | 6 +++++- docs/examples/simplepost.c | 6 +++++- docs/examples/simplessl.c | 6 +++++- docs/examples/smooth-gtk-thread.c | 9 ++++++--- docs/examples/synctime.c | 6 +++++- docs/examples/threaded-ssl.c | 7 ++++++- docs/examples/url2file.c | 6 +++++- docs/examples/usercertinmem.c | 9 ++++++--- docs/examples/xmlstream.c | 9 ++++++--- 19 files changed, 111 insertions(+), 29 deletions(-) diff --git a/docs/examples/multi-app.c b/docs/examples/multi-app.c index b8258975e..065d48d92 100644 --- a/docs/examples/multi-app.c +++ b/docs/examples/multi-app.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -19,7 +19,11 @@ * KIND, either express or implied. * ***************************************************************************/ -/* This is an example application source code using the multi interface. */ +/* + * A basic application source code using the multi interface doing two + * transfers in parallel. */ +* + */ #include #include diff --git a/docs/examples/postinmemory.c b/docs/examples/postinmemory.c index 3afac4b2f..edeb84e69 100644 --- a/docs/examples/postinmemory.c +++ b/docs/examples/postinmemory.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2013, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -19,6 +19,10 @@ * KIND, either express or implied. * ***************************************************************************/ +/* + * Make a HTTP POST with data from memory and receive response in memory. + * + */ #include #include #include diff --git a/docs/examples/postit2.c b/docs/examples/postit2.c index 88ea78c86..0f8dd98bb 100644 --- a/docs/examples/postit2.c +++ b/docs/examples/postit2.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -19,6 +19,10 @@ * KIND, either express or implied. * ***************************************************************************/ +/* + * HTTP Multipart formpost with file upload and two additional parts. + * + */ /* Example code that uploads a file name 'foo' to a remote script that accepts * "HTML form based" (as described in RFC1738) uploads using HTTP POST. * diff --git a/docs/examples/progressfunc.c b/docs/examples/progressfunc.c index b2635bc8a..9789762e0 100644 --- a/docs/examples/progressfunc.c +++ b/docs/examples/progressfunc.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2013, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -19,6 +19,11 @@ * KIND, either express or implied. * ***************************************************************************/ +/* + * Use the progress callbacks, old and/or new one depending on avaiable + * libcurl version. + * + */ #include #include diff --git a/docs/examples/resolve.c b/docs/examples/resolve.c index 7b3e5656e..cc58bebba 100644 --- a/docs/examples/resolve.c +++ b/docs/examples/resolve.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -19,6 +19,11 @@ * KIND, either express or implied. * ***************************************************************************/ +/* + * Use CURLOPT_RESOLVE to feed custom IP addresses for given host name + port + * number combinations. + * + */ #include #include diff --git a/docs/examples/rtsp.c b/docs/examples/rtsp.c index fed343dfd..581f7339f 100644 --- a/docs/examples/rtsp.c +++ b/docs/examples/rtsp.c @@ -27,6 +27,10 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ +/* + * A basic RTSP transfer + * + */ #include #include diff --git a/docs/examples/sampleconv.c b/docs/examples/sampleconv.c index 3db316096..466c40cc7 100644 --- a/docs/examples/sampleconv.c +++ b/docs/examples/sampleconv.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -19,10 +19,13 @@ * KIND, either express or implied. * ***************************************************************************/ +/* + * This is a simple example showing how a program on a non-ASCII platform + * would invoke callbacks to do its own codeset conversions instead of + * using the built-in iconv functions in libcurl. + * + */ /* - This is a simple example showing how a program on a non-ASCII platform - would invoke callbacks to do its own codeset conversions instead of - using the built-in iconv functions in libcurl. The IBM-1047 EBCDIC codeset is used for this example but the code would be similar for other non-ASCII codesets. diff --git a/docs/examples/sendrecv.c b/docs/examples/sendrecv.c index 88fddf59f..9bc2371ca 100644 --- a/docs/examples/sendrecv.c +++ b/docs/examples/sendrecv.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2012, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -19,7 +19,10 @@ * KIND, either express or implied. * ***************************************************************************/ -/* An example of curl_easy_send() and curl_easy_recv() usage. */ +/* + * An example of curl_easy_send() and curl_easy_recv() usage. + * + */ #include #include @@ -66,6 +69,14 @@ int main(void) size_t iolen; curl_off_t nread; + /* A general note of caution here: if you're using curl_easy_recv() or + curl_easy_send() to implement HTTP or _any_ other protocol libcurl + supports "natively", you're doing it wrong and you should stop. + + This example uses HTTP only to show how to use this API, it does not + suggest that writing an application doing this is sensible. + */ + curl = curl_easy_init(); if(curl) { curl_easy_setopt(curl, CURLOPT_URL, "http://example.com"); diff --git a/docs/examples/sepheaders.c b/docs/examples/sepheaders.c index 7402e3542..94cbd909c 100644 --- a/docs/examples/sepheaders.c +++ b/docs/examples/sepheaders.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2014, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -19,6 +19,10 @@ * KIND, either express or implied. * ***************************************************************************/ +/* + * Simple HTTP GET that stores the headers in a separate file + * + */ #include #include #include diff --git a/docs/examples/sessioninfo.c b/docs/examples/sessioninfo.c index 2641c7139..94e8884c9 100644 --- a/docs/examples/sessioninfo.c +++ b/docs/examples/sessioninfo.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2013, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -19,6 +19,10 @@ * KIND, either express or implied. * ***************************************************************************/ +/* + * Uses the CURLINFO_TLS_SESSION data. + * + */ /* Note that this example currently requires cURL to be linked against GnuTLS (and this program must also be linked against -lgnutls). */ diff --git a/docs/examples/sftpget.c b/docs/examples/sftpget.c index 434299dc0..dec91fde9 100644 --- a/docs/examples/sftpget.c +++ b/docs/examples/sftpget.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2012, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -19,6 +19,10 @@ * KIND, either express or implied. * ***************************************************************************/ +/* + * Gets a file using an SFTP URL. + * + */ #include diff --git a/docs/examples/simplepost.c b/docs/examples/simplepost.c index 8657771f4..985d7397f 100644 --- a/docs/examples/simplepost.c +++ b/docs/examples/simplepost.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -19,6 +19,10 @@ * KIND, either express or implied. * ***************************************************************************/ +/* + * Very simple HTTP POST + * + */ #include #include #include diff --git a/docs/examples/simplessl.c b/docs/examples/simplessl.c index aefb79f62..509f1aaa0 100644 --- a/docs/examples/simplessl.c +++ b/docs/examples/simplessl.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2012, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -19,6 +19,10 @@ * KIND, either express or implied. * ***************************************************************************/ +/* + * Shows HTTPS usage with client certs and optional ssl engine use. + * + */ #include #include diff --git a/docs/examples/smooth-gtk-thread.c b/docs/examples/smooth-gtk-thread.c index 932f6e396..a367da05b 100644 --- a/docs/examples/smooth-gtk-thread.c +++ b/docs/examples/smooth-gtk-thread.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -19,9 +19,12 @@ * KIND, either express or implied. * ***************************************************************************/ -/* This is a multi threaded application that uses a progress bar to show +/* + * A multi threaded application that uses a progress bar to show * status. It uses Gtk+ to make a smooth pulse. - * + * + */ +/* * Written by Jud Bishop after studying the other examples provided with * libcurl. * diff --git a/docs/examples/synctime.c b/docs/examples/synctime.c index cd7d0731b..69535ca1c 100644 --- a/docs/examples/synctime.c +++ b/docs/examples/synctime.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2014, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -19,6 +19,10 @@ * KIND, either express or implied. * ***************************************************************************/ +/* + * Set your system time from a remote HTTP server's Date: header. + * + */ /* This example code only builds as-is on Windows. * * While Unix/Linux user, you do not need this software. diff --git a/docs/examples/threaded-ssl.c b/docs/examples/threaded-ssl.c index a7e9c2de1..d73766ac0 100644 --- a/docs/examples/threaded-ssl.c +++ b/docs/examples/threaded-ssl.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -19,6 +19,11 @@ * KIND, either express or implied. * ***************************************************************************/ +/* + * Show the required mutex callback setups for GnuTLS and OpenSSL when using + * libcurl multi-threaded. + * + */ /* A multi-threaded example that uses pthreads and fetches 4 remote files at * once over HTTPS. The lock callbacks and stuff assume OpenSSL or GnuTLS * (libgcrypt) so far. diff --git a/docs/examples/url2file.c b/docs/examples/url2file.c index adf696c9a..a357a3120 100644 --- a/docs/examples/url2file.c +++ b/docs/examples/url2file.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2012, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -19,6 +19,10 @@ * KIND, either express or implied. * ***************************************************************************/ +/* + * Download a given URL into a local file named page.out. + * + */ #include #include #include diff --git a/docs/examples/usercertinmem.c b/docs/examples/usercertinmem.c index dd56c6167..43716eaee 100644 --- a/docs/examples/usercertinmem.c +++ b/docs/examples/usercertinmem.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 2013, Daniel Stenberg, , et al. + * Copyright (C) 2013 - 2016, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -19,10 +19,13 @@ * KIND, either express or implied. * ***************************************************************************/ +/* /* Example using an in memory PEM user certificate and RSA key to retrieve an * https page. - * Written by Ishan SinghLevett, based on Theo Borm's cacertinmem.c. - * Note that to maintain simplicity this example does not use a CA certificate + * + */ +/* Written by Ishan SinghLevett, based on Theo Borm's cacertinmem.c. + * Note that to maintain simplicity this example does not use a CA certificate * for peer verification. However, some form of peer verification * must be used in real circumstances when a secure connection is required. */ diff --git a/docs/examples/xmlstream.c b/docs/examples/xmlstream.c index 819344502..1b3c6b6bd 100644 --- a/docs/examples/xmlstream.c +++ b/docs/examples/xmlstream.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2013, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -19,8 +19,11 @@ * KIND, either express or implied. * ***************************************************************************/ -/* Stream-parse a document using the streaming Expat parser. - * Written by David Strauss +/* + * Stream-parse a document using the streaming Expat parser. + * + */ +/* Written by David Strauss * * Expat => http://www.libexpat.org/ *