minor update edits
[platform/upstream/curl.git] / docs / libcurl / libcurl.3
1 .\" You can view this file with:
2 .\" nroff -man [file]
3 .\" $Id$
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) transferred you have
25 the 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 transfer 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. See further deails in the \fIlibcurl-multi(3)\fP man page.
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, including these:
43 .RS
44 .IP curl_version_info()
45 gets detailed libcurl (and other used libraries) version info
46 .IP curl_getdate()
47 converts a date string to time_t
48 .IP curl_easy_getinfo()
49 get information about a performed transfer
50 .IP curl_formadd()
51 helps building an HTTP form POST
52 .IP curl_formfree()
53 free a list built with \fIcurl_formadd(3)\fP
54 .IP curl_slist_append()
55 builds a linked list
56 .IP curl_slist_free_all()
57 frees a whole curl_slist
58 .RE
59
60 .SH "LINKING WITH LIBCURL"
61 On unix-like machines, there's a tool named curl-config that gets installed
62 with the rest of the curl stuff when 'make install' is performed.
63
64 curl-config is added to make it easier for applications to link with libcurl
65 and developers to learn about libcurl and how to use it.
66
67 Run 'curl-config --libs' to get the (additional) linker options you need to
68 link with the particular version of libcurl you've installed. See the
69 \fIcurl-config(1)\fP man page for further details.
70
71 Unix-like operating system that ship libcurl as part of their distributions
72 often don't provide the curl-config tool, but simply install the library and
73 headers in the common path for this purpose.
74
75 .SH "LIBCURL SYMBOL NAMES"
76 All public functions in the libcurl interface are prefixed with 'curl_' (with
77 a lowercase c). You can find other functions in the library source code, but
78 other prefixes indicate that the functions are private and may change without
79 further notice in the next release.
80
81 Only use documented functions and functionality!
82 .SH "PORTABILITY"
83 libcurl works
84 .B exactly
85 the same, on any of the platforms it compiles and builds on.
86 .SH "THREADS"
87 Never ever call curl-functions simultaneously using the same handle from
88 several threads. libcurl is thread-safe and can be used in any number of
89 threads, but you must use separate curl handles if you want to use libcurl in
90 more than one thread simultaneously.
91 .SH "PERSISTENT CONNECTIONS"
92 Persistent connections means that libcurl can re-use the same connection for
93 several transfers, if the conditions are right.
94
95 libcurl will \fBalways\fP attempt to use persistent connections. Whenever you
96 use \fIcurl_easy_perform(3)\fP or \fIcurl_multi_perform(3)\fP, libcurl will
97 attempt to use an existing connection to do the transfer, and if none exists
98 it'll open a new one that will be subject for re-use on a possible following
99 call to \fIcurl_easy_perform(3)\fP or \fIcurl_multi_perform(3)\fP.
100
101 To allow libcurl to take full advantage of persistent connections, you should
102 do as many of your file transfers as possible using the same curl handle. When
103 you call \fIcurl_easy_cleanup(3)\fP, all the possibly open connections held by
104 libcurl will be closed and forgotten.
105
106 Note that the options set with \fIcurl_easy_setopt(3)\fP will be used in on
107 every repeated \fIcurl_easy_perform(3)\fP call.