]> icculus.org git repositories - icculus/iodoom3.git/blob - neo/curl/docs/libcurl/libcurl.3
hello world
[icculus/iodoom3.git] / neo / curl / docs / libcurl / libcurl.3
1 .\" You can view this file with:
2 .\" nroff -man [file]
3 .\" $Id: libcurl.3,v 1.8 2004/03/15 12:41:24 bagder Exp $
4 .\"
5 .TH libcurl 3 "19 March 2002" "libcurl 7.9.6" "libcurl overview"
6 .SH NAME
7 libcurl \- client-side URL transfers
8 .SH DESCRIPTION
9 This is an overview on how to use libcurl in your C programs. There are
10 specific man pages for each function mentioned in here. There are also the
11 \fIlibcurl-easy(3)\fP man page, the \fIlibcurl-multi(3)\fP man page, the
12 \fIlibcurl-share(3)\fP man page and the \fIlibcurl-the-guide\fP document for
13 further reading on how to do programming with libcurl.
14
15 There exist more than a dozen custom bindings that bring libcurl access to
16 your favourite language. Look elsewhere for documentation on those.
17
18 All applications that use libcurl should call \fIcurl_global_init(3)\fP
19 exactly once before any libcurl function can be used. After all usage of
20 libcurl is complete, it \fBmust\fP call \fIcurl_global_cleanup(3)\fP. In
21 between those two calls, you can use libcurl as described below.
22
23 To transfer files, you always set up an "easy handle" using
24 \fIcurl_easy_init(3)\fP, but when you want the file(s) transfered you have the
25 option of using the "easy" interface, or the "multi" interface.
26
27 The easy interface is a synchronous interface with which you call
28 \fIcurl_easy_perform(3)\fP and let it perform the transfer. When it is
29 completed, the function return and you can continue. More details are found in
30 the \fIlibcurl-easy(3)\fP man page.
31
32 The multi interface on the other hand is an asynchronous interface, that you
33 call and that performs only a little piece of the tranfer on each invoke. It
34 is perfect if you want to do things while the transfer is in progress, or
35 similar. The multi interface allows you to select() on libcurl action, and
36 even to easily download multiple files simultaneously using a single thread.
37
38 You can have multiple easy handles share certain data, even if they are used
39 in different threads. This magic is setup using the share interface, as
40 described in the \fIlibcurl-share(3)\fP man page.
41
42 There is also a series of other helpful functions to use. They are:
43
44 .RS
45 .TP 10
46 .B curl_version()
47 displays the libcurl version
48 .TP
49 .B curl_getdate()
50 converts a date string to time_t
51 .TP
52 .B curl_getenv()
53 portable environment variable reader
54 .TP
55 .B curl_easy_getinfo()
56 get information about a performed transfer
57 .TP
58 .B curl_formadd()
59 helps building a HTTP form POST
60 .TP
61 .B curl_formfree()
62 free a list built with \fIcurl_formadd(3)\fP
63 .TP
64 .B curl_slist_append()
65 builds a linked list
66 .TP
67 .B curl_slist_free_all()
68 frees a whole curl_slist
69 .TP
70 .B curl_mprintf()
71 portable printf() functions
72 .TP
73 .B curl_strequal()
74 portable case insensitive string comparisons
75 .RE
76
77 .SH "LINKING WITH LIBCURL"
78 On unix-like machines, there's a tool named curl-config that gets installed
79 with the rest of the curl stuff when 'make install' is performed.
80
81 curl-config is added to make it easier for applications to link with libcurl
82 and developers to learn about libcurl and how to use it.
83
84 Run 'curl-config --libs' to get the (additional) linker options you need to
85 link with the particular version of libcurl you've installed.
86
87 For details, see the curl-config.1 man page.
88 .SH "LIBCURL SYMBOL NAMES"
89 All public functions in the libcurl interface are prefixed with 'curl_' (with
90 a lowercase c). You can find other functions in the library source code, but
91 other prefixes indicate the functions are private and may change without
92 further notice in the next release.
93
94 Only use documented functions and functionality!
95 .SH "PORTABILITY"
96 libcurl works
97 .B exactly
98 the same, on any of the platforms it compiles and builds on.
99 .SH "THREADS"
100 Never ever call curl-functions simultaneously using the same handle from
101 several threads. libcurl is thread-safe and can be used in any number of
102 threads, but you must use separate curl handles if you want to use libcurl in
103 more than one thread simultaneously.
104 .SH "PERSISTENT CONNECTIONS"
105 Persistent connections means that libcurl can re-use the same connection for
106 several transfers, if the conditions are right.
107
108 libcurl will \fBalways\fP attempt to use persistent connections. Whenever you
109 use \fIcurl_easy_perform(3)\fP or \fIcurl_multi_perform(3)\fP, libcurl will
110 attempt to use an existing connection to do the transfer, and if none exists
111 it'll open a new one that will be subject for re-use on a possible following
112 call to \fIcurl_easy_perform(3)\fP or \fIcurl_multi_perform(3)\fP.
113
114 To allow libcurl to take full advantage of persistent connections, you should
115 do as many of your file transfers as possible using the same curl handle. When
116 you call \fIcurl_easy_cleanup(3)\fP, all the possibly open connections held by
117 libcurl will be closed and forgotten.
118
119 Note that the options set with \fIcurl_easy_setopt(3)\fP will be used in on
120 every repeated \fIcurl_easy_perform(3)\fP call.