1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-22 16:18:48 -05:00
curl/docs/examples
Jay Satiro a607f8a20c examples: Don't call select() to sleep on windows
Windows does not support using select() for sleeping without a dummy
socket. Instead use Windows' Sleep() and sleep for 100ms which is the
minimum suggested value in the curl_multi_fdset() doc.

Prior to this change the multi examples would exit prematurely since
select() would error instead of sleeping when called without an fd.

Reported-by: Johan Lantz
Bug: http://curl.haxx.se/mail/lib-2014-11/0221.html
2014-11-15 21:27:20 +01:00
..
.gitignore examples: gitignore more binaries 2014-01-29 10:22:40 +01:00
10-at-a-time.c sources: update source headers 2011-03-10 12:04:33 +01:00
adddocsref.pl add URLs in comments for all libcurl function calls 2004-11-22 13:39:23 +00:00
anyauthput.c examples/anyauthput.c: fix Tru64 compilation issue 2012-12-10 15:42:12 +01:00
asiohiper.cpp examples: Updated asiohiper.cpp to remove connect from opensocket 2012-11-25 18:37:07 +01:00
cacertinmem.c Update instances of some obsolete CURLOPTs to their new names 2014-07-05 22:47:13 +02:00
certinfo.c examples/certinfo.c: fix compiler warning 2012-12-29 22:17:06 +01:00
chkspeed.c Added dns and connect time to output. 2013-04-01 14:54:01 +02:00
cookie_interface.c examples: fix compilation issues - commit 7332a7cafb follow-up 2012-12-05 12:59:14 +01:00
curlgtk.c examples: cleanup curl includes 2011-06-28 19:08:51 +02:00
curlx.c OpenSSL: remove reference to openssl internal struct 2012-01-04 23:02:36 +01:00
debug.c Updated date. 2013-01-30 18:14:00 +01:00
evhiperfifo.c examples: remove all use of CURLM_CALL_MULTI_PERFORM 2014-02-17 08:25:39 +01:00
externalsocket.c examples/externalsocket.c: fix SunPro compilation issue 2012-12-10 18:06:35 +01:00
fileupload.c Added error checking for samples. 2012-07-04 17:03:52 +02:00
fopen.c examples: Don't call select() to sleep on windows 2014-11-15 21:27:20 +01:00
ftp-wildcard.c ftp-wildcard.c: spell fix 2014-09-09 11:10:18 +02:00
ftpget.c examples: cleanup curl includes 2011-06-28 19:08:51 +02:00
ftpgetinfo.c examples: fix compilation issues - commit 23f8dca6fb follow-up 2012-12-05 11:43:40 +01:00
ftpgetresp.c Update instances of some obsolete CURLOPTs to their new names 2014-07-05 22:47:13 +02:00
ftpsget.c ftpsget: simple example showing a FTPS fetch 2012-08-27 14:50:09 +02:00
ftpupload.c Added error checking for samples. 2012-07-04 17:03:52 +02:00
ftpuploadresume.c MinGW64 has this prototype already. 2011-09-23 03:56:34 +02:00
getinfo.c sources: update source headers 2011-03-10 12:04:33 +01:00
getinmemory.c getinmemory: remove a comment 2013-09-29 00:16:21 +02:00
ghiper.c examples: remove all use of CURLM_CALL_MULTI_PERFORM 2014-02-17 08:25:39 +01:00
hiperfifo.c examples: remove all use of CURLM_CALL_MULTI_PERFORM 2014-02-17 08:25:39 +01:00
href_extractor.c example: use correct type (long) for CURLOPT_FOLLOWLOCATION 2014-07-03 22:47:28 +02:00
htmltidy.c sources: update source headers 2011-03-10 12:04:33 +01:00
htmltitle.cpp htmltitle: fix suggested build command 2013-02-10 18:54:56 +01:00
http-post.c Added curl_global_* functions. 2012-07-12 02:02:57 +02:00
httpcustomheader.c httpcustomheader.c: make use of more CURLOPT_HTTPHEADER features 2014-10-16 11:38:32 +02:00
httpput.c docs/examples/httpput.c: fix build for MSVC 2013-10-27 15:48:57 +01:00
https.c https.c example: remember to call curl_global_init() 2012-10-01 11:23:51 +02:00
imap-append.c imap-append.c: Fixed compilation errors on some platforms 2014-03-30 10:56:51 +01:00
imap-copy.c examples: Standardised username and password settings for all email examples 2014-01-04 18:12:02 +00:00
imap-create.c examples: Standardised username and password settings for all email examples 2014-01-04 18:12:02 +00:00
imap-delete.c examples: Standardised username and password settings for all email examples 2014-01-04 18:12:02 +00:00
imap-examine.c examples: Standardised username and password settings for all email examples 2014-01-04 18:12:02 +00:00
imap-fetch.c examples: Standardised username and password settings for all email examples 2014-01-04 18:12:02 +00:00
imap-list.c examples: Standardised username and password settings for all email examples 2014-01-04 18:12:02 +00:00
imap-lsub.c examples: Added IMAP LSUB example 2014-02-16 00:09:22 +00:00
imap-multi.c examples: Don't call select() to sleep on windows 2014-11-15 21:27:20 +01:00
imap-noop.c examples: Added IMAP NOOP example 2014-01-05 14:22:35 +00:00
imap-search.c examples: Standardised username and password settings for all email examples 2014-01-04 18:12:02 +00:00
imap-ssl.c examples: Added IMAP SSL and TLS examples 2014-01-05 11:26:41 +00:00
imap-store.c examples: Standardised username and password settings for all email examples 2014-01-04 18:12:02 +00:00
imap-tls.c examples: Added IMAP SSL and TLS examples 2014-01-05 11:26:41 +00:00
Makefile.am curl.h: stricter CURL_EXTERN linkage decorations logic 2013-03-12 00:27:47 +01:00
makefile.dj examples/makefile.dj: update email 2011-04-07 15:16:38 +02:00
Makefile.example source header: added to more files 2011-03-12 00:14:32 +01:00
Makefile.inc examples: Added IMAP LSUB example 2014-02-16 00:09:22 +00:00
Makefile.m32 Remove all traces of FBOpenSSL SPNEGO support 2014-07-16 17:26:08 +02:00
Makefile.netware Remove all traces of FBOpenSSL SPNEGO support 2014-07-16 17:26:08 +02:00
multi-app.c examples: Don't call select() to sleep on windows 2014-11-15 21:27:20 +01:00
multi-debugcallback.c examples: Don't call select() to sleep on windows 2014-11-15 21:27:20 +01:00
multi-double.c examples: Don't call select() to sleep on windows 2014-11-15 21:27:20 +01:00
multi-post.c examples: Don't call select() to sleep on windows 2014-11-15 21:27:20 +01:00
multi-single.c examples: Don't call select() to sleep on windows 2014-11-15 21:27:20 +01:00
multi-uv.c multi-uv.c: call curl_multi_info_read() better 2014-10-07 10:20:41 +02:00
multithread.c sources: update source headers 2011-03-10 12:04:33 +01:00
opensslthreadlock.c sources: update source headers 2011-03-10 12:04:33 +01:00
persistant.c Added error checking for samples. 2012-07-04 17:03:52 +02:00
pop3-dele.c pop3-dele.c: Added missing CURLOPT_NOBODY following feedback 2014-01-15 23:39:46 +00:00
pop3-list.c examples: Added return of error code in POP3 examples 2014-01-05 12:05:02 +00:00
pop3-multi.c examples: Don't call select() to sleep on windows 2014-11-15 21:27:20 +01:00
pop3-noop.c examples: Added POP3 NOOP example 2014-01-05 13:59:21 +00:00
pop3-retr.c examples: Added POP3 RETR example 2014-01-05 12:17:15 +00:00
pop3-ssl.c examples: Added POP3 TLS example 2014-01-05 14:26:51 +00:00
pop3-stat.c pop3-stat.c: Corrected small typo from commit 91d62e9abd 2014-01-05 13:56:49 +00:00
pop3-tls.c examples: Added POP3 TLS example 2014-01-05 14:26:51 +00:00
pop3-top.c examples: Added POP3 TOP example 2014-01-05 13:16:41 +00:00
pop3-uidl.c examples: Added POP3 UIDL example 2014-01-05 12:31:28 +00:00
post-callback.c examples: fix compilation issues - commit 23f8dca6fb follow-up 2012-12-05 11:43:40 +01:00
postinmemory.c postinmemory: new example 2013-09-29 00:12:30 +02:00
postit2.c Added error checking for samples. 2012-07-04 17:03:52 +02:00
progressfunc.c CURLOPT_XFERINFOFUNCTION: introducing a new progress callback 2013-07-18 23:44:06 +02:00
README xmlstream: XML stream parsing example source code 2013-05-19 11:19:28 +02:00
resolve.c resolve.c: new example showing off CURLOPT_RESOLVE 2011-08-23 16:31:10 +02:00
rtsp.c Update instances of some obsolete CURLOPTs to their new names 2014-07-05 22:47:13 +02:00
sampleconv.c sources: update source headers 2011-03-10 12:04:33 +01:00
sendrecv.c examples: fix compiler warnings 2012-04-13 17:59:49 +02:00
sepheaders.c Update instances of some obsolete CURLOPTs to their new names 2014-07-05 22:47:13 +02:00
sessioninfo.c curl_easy_getinfo: Post CURLINFO_TLS_SESSION tidy up 2013-11-30 11:08:56 +00:00
sftpget.c sftpget: SFTP is not "SSH FTP" 2012-08-27 14:42:56 +02:00
simple.c Fixed simple.c to work again unchanged. 2013-01-28 00:42:16 +01:00
simplepost.c Added error checking for samples. 2012-07-04 17:03:52 +02:00
simplessl.c Update instances of some obsolete CURLOPTs to their new names 2014-07-05 22:47:13 +02:00
smooth-gtk-thread.c examples: cleanup curl includes 2011-06-28 19:08:51 +02:00
smtp-expn.c examples: Added required libcurl version information to SMTP examples 2014-01-05 23:00:56 +00:00
smtp-mail.c examples: Updated SMTP MAIL example to return libcurl result code 2014-01-12 15:55:08 +00:00
smtp-multi.c examples: Don't call select() to sleep on windows 2014-11-15 21:27:20 +01:00
smtp-ssl.c examples: Synchronised comments between SMTP MAIL examples 2014-01-12 15:43:07 +00:00
smtp-tls.c examples: Synchronised comments between SMTP MAIL examples 2014-01-12 15:43:07 +00:00
smtp-vrfy.c examples: Added required libcurl version information to SMTP examples 2014-01-05 23:00:56 +00:00
synctime.c Fixed scanf format for WORD = unsigned short. 2011-09-23 03:21:50 +02:00
threaded-ssl.c sources: update source headers 2011-03-10 12:04:33 +01:00
url2file.c Update instances of some obsolete CURLOPTs to their new names 2014-07-05 22:47:13 +02:00
usercertinmem.c Update instances of some obsolete CURLOPTs to their new names 2014-07-05 22:47:13 +02:00
version-check.pl removed trailing whitespace 2011-12-30 03:36:18 +01:00
xmlstream.c xmlstream: XML stream parsing example source code 2013-05-19 11:19:28 +02:00

                                  _   _ ____  _
                              ___| | | |  _ \| |
                             / __| | | | |_) | |
                            | (__| |_| |  _ <| |___
                             \___|\___/|_| \_\_____|

This directory is for libcurl programming examples. They are meant to show
some simple steps on how you can build your own application to take full
advantage of libcurl.

If you end up with other small but still useful example sources, please mail
them for submission in future packages and on the web site.

BUILDING

The Makefile.example is an example makefile that could be used to build these
examples. Just edit the file according to your system and requirements first.

Most examples should build fine using a command line like this:

  $ `curl-config --cc --cflags --libs` -o example example.c

Some compilers don't like having the arguments in this order but instead
want you do reorganize them like:

  $ `curl-config --cc` -o example example.c `curl-config --cflags --libs`

*PLEASE* do not use the curl.haxx.se site as a test target for your libcurl
applications/experiments. Even if some of the examples use that site as a URL
at some places, it doesn't mean that the URLs work or that we expect you to
actually torture our web site with your tests!  Thanks.

EXAMPLES

anyauthput.c   - HTTP PUT using "any" authentication method
cacertinmem.c  - Use a built-in PEM certificate to retrieve a https page
cookie_interface.c - shows usage of simple cookie interface
curlgtk.c      - download using a GTK progress bar
curlx.c        - getting file info from the remote cert data
debug.c        - showing how to use the debug callback
fileupload.c   - uploading to a file:// URL
fopen.c        - fopen() layer that supports opening URLs and files
ftpget.c       - simple getting a file from FTP
ftpgetresp.c   - get the response strings from the FTP server
ftpupload.c    - upload a file to an FTP server
ftpuploadresume.c - resume an upload to an FTP server
getinfo.c      - get the Content-Type from the recent transfer
getinmemory.c  - download a file to memory only
ghiper.c       - curl_multi_socket() using code with glib-2
hiperfifo.c    - downloads all URLs written to the fifo, using
                 curl_multi_socket() and libevent
htmltidy.c     - download a document and use libtidy to parse the HTML
htmltitle.cc   - download a HTML file and extract the <title> tag from a HTML
                 page using libxml
http-post.c    - HTTP POST
httpput.c      - HTTP PUT a local file
https.c        - simple HTTPS transfer
imap.c         - simple IMAP transfer
multi-app.c    - a multi-interface app
multi-debugcallback.c - a multi-interface app using the debug callback
multi-double.c - a multi-interface app doing two simultaneous transfers
multi-post.c   - a multi-interface app doing a multipart formpost
multi-single.c - a multi-interface app getting a single file
multi-uv.c     - a multi-interface app using libuv
multithread.c  - an example using multi-treading transferring multiple files
opensslthreadlock.c - show how to do locking when using OpenSSL multi-threaded
persistant.c   - request two URLs with a persistent connection
pop3s.c        - POP3S transfer
pop3slist.c    - POP3S LIST
post-callback.c - send a HTTP POST using a callback
postit2.c      - send a HTTP multipart formpost
sampleconv.c   - 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
sepheaders.c   - download headers to a separate file
simple.c       - the most simple download a URL source
simplepost.c   - HTTP POST
simplessl.c    - HTTPS example with certificates many options set
synctime.c     - Sync local time by extracting date from remote HTTP servers
url2file.c     - download a document and store it in a file
xmlstream.c    - Stream-parse a document using the streaming Expat parser
10-at-a-time.c - Download many files simultaneously, 10 at a time.