blob: 155ea45a83310a7de8ad3a7c8cd9dd06345a67e5 [file] [log] [blame]
Daniel Stenberg81f22462001-11-27 13:33:21 +00001Updated: November 27, 2001 (http://curl.haxx.se/docs/faq.shtml)
Daniel Stenberg7c37c6a2000-05-22 17:35:35 +00002 _ _ ____ _
3 ___| | | | _ \| |
4 / __| | | | |_) | |
5 | (__| |_| | _ <| |___
6 \___|\___/|_| \_\_____|
7
8FAQ
9
Daniel Stenbergc3318b42000-08-17 14:06:42 +000010 1. Philosophy
11 1.1 What is cURL?
12 1.2 What is libcurl?
13 1.3 What is cURL not?
14 1.4 When will you make curl do XXXX ?
Daniel Stenberga0eb52b2001-03-23 15:28:13 +000015 1.5 Who makes cURL?
16 1.6 What do you get for making cURL?
Daniel Stenbergc528dc52001-08-07 11:17:37 +000017 1.7 What about CURL from curl.com?
Daniel Stenberg7c37c6a2000-05-22 17:35:35 +000018
Daniel Stenbergc3318b42000-08-17 14:06:42 +000019 2. Install Related Problems
20 2.1 configure doesn't find OpenSSL even when it is installed
21 2.1.1. native linker doesn't find openssl
22 2.1.2. only the libssl lib is missing
23 2.2 Does curl work/build with other SSL libraries?
24 2.3 Where can I find a copy of LIBEAY32.DLL?
25 2.4 Does cURL support Socks (RFC 1928) ?
Daniel Stenberg7c37c6a2000-05-22 17:35:35 +000026
Daniel Stenbergc3318b42000-08-17 14:06:42 +000027 3. Usage Problems
28 3.1 curl: (1) SSL is disabled, https: not supported
29 3.2 How do I tell curl to resume a transfer?
30 3.3 Why doesn't my posting using -F work?
31 3.4 How do I tell curl to run custom FTP commands?
32 3.5 How can I disable the Pragma: nocache header?
33 3.6 Does curl support javascript, ASP, XML, XHTML or HTML version Y?
34 3.7 Can I use curl to delete/rename a file through FTP?
35 3.8 How do I tell curl to follow HTTP redirects?
Daniel Stenberg4c485992001-04-22 15:45:27 +000036 3.9 How do I use curl in PHP, Perl, Tcl, Ruby or Java?
Daniel Stenberg147a6732001-03-08 09:25:09 +000037 3.10 What about SOAP, WebDAV, XML-RPC or similar protocols over HTTP?
Daniel Stenberg88d14e92001-05-29 14:02:20 +000038 3.11 How do I POST with a different Content-Type?
Daniel Stenberg6513dce2001-11-27 13:34:59 +000039 3.12 Why do FTP specific features over HTTP proxy fail?
Daniel Stenberg7c37c6a2000-05-22 17:35:35 +000040
Daniel Stenbergc3318b42000-08-17 14:06:42 +000041 4. Running Problems
42 4.1 Problems connecting to SSL servers.
Daniel Stenberge26ee092001-01-15 10:26:37 +000043 4.2 Why do I get problems when I use & or % in the URL?
Daniel Stenbergc3318b42000-08-17 14:06:42 +000044 4.3 How can I use {, }, [ or ] to specify multiple URLs?
45 4.4 Why do I get downloaded data even though the web page doesn't exist?
46 4.5 Why do I get return code XXX from a HTTP server?
47 4.5.1 "400 Bad Request"
48 4.5.2 "401 Unauthorized"
49 4.5.3 "403 Forbidden"
50 4.5.4 "404 Not Found"
51 4.5.5 "405 Method Not Allowed"
52 4.6 Can you tell me what error code 142 means?
Daniel Stenberg4c485992001-04-22 15:45:27 +000053 4.7 How do I keep user names and passwords secret in Curl command lines?
Daniel Stenberg09ba8562000-10-27 12:25:00 +000054 4.8 I found a bug!
Daniel Stenberg2c100372000-12-19 07:30:51 +000055 4.9 Curl can't authenticate to the server that requires NTLM?
Daniel Stenberg7c37c6a2000-05-22 17:35:35 +000056
Daniel Stenbergc3318b42000-08-17 14:06:42 +000057 5. libcurl Issues
Daniel Stenberg7d09e512001-01-11 12:52:07 +000058 5.1 Is libcurl thread-safe?
Daniel Stenberga40b55d2000-11-22 07:27:26 +000059 5.2 How can I receive all data into a large memory chunk?
Daniel Stenberg2c100372000-12-19 07:30:51 +000060 5.3 How do I fetch multiple files with libcurl?
Daniel Stenberg910fc852000-12-30 11:48:51 +000061 5.4 Does libcurl do Winsock initing on win32 systems?
Daniel Stenberg5d7b32d2001-02-04 20:08:42 +000062 5.5 Does CURLOPT_FILE and CURLOPT_INFILE work on win32 ?
Daniel Stenberg4c485992001-04-22 15:45:27 +000063 5.6 What about Keep-Alive or persistent connections?
Daniel Stenberg7c37c6a2000-05-22 17:35:35 +000064
Daniel Stenbergc3318b42000-08-17 14:06:42 +000065 6. License Issues
66 6.1 I have a GPL program, can I use the libcurl library?
67 6.2 I have a closed-source program, can I use the libcurl library?
Daniel Stenberg31b8eea2000-08-23 07:27:00 +000068 6.3 I have a BSD licensed program, can I use the libcurl library?
69 6.4 I have a program that uses LGPL libraries, can I use libcurl?
70 6.5 Can I modify curl/libcurl for my program and keep the changes secret?
71 6.6 Can you please change the curl/libcurl license to XXXX?
Daniel Stenbergc3318b42000-08-17 14:06:42 +000072
73==============================================================================
74
751. Philosophy
76
77 1.1 What is cURL?
78
79 cURL (or simply just 'curl') is a command line tool for getting or sending
80 files using URL syntax. The name is a play on 'Client for URLs', originally
Daniel Stenberg09ba8562000-10-27 12:25:00 +000081 with URL spelled in uppercase to make it obvious it deals with URLs. The
82 fact it can also be pronounced 'see URL' also helped.
Daniel Stenbergc3318b42000-08-17 14:06:42 +000083
Daniel Stenberg4c485992001-04-22 15:45:27 +000084 Curl supports a range of common Internet protocols, currently including
Daniel Stenbergd73d28a2001-08-23 11:12:07 +000085 HTTP, HTTPS, FTP, FTPS, GOPHER, LDAP, DICT, TELNET and FILE.
Daniel Stenbergc3318b42000-08-17 14:06:42 +000086
Daniel Stenberg8e7b2612001-03-22 11:23:48 +000087 We spell it cURL or just curl. We pronounce it with an initial k sound:
88 [kurl].
Daniel Stenberg887e7282001-01-03 09:13:07 +000089
Daniel Stenbergc3318b42000-08-17 14:06:42 +000090 1.2 What is libcurl?
91
Daniel Stenbergbc5954f2001-03-23 08:16:24 +000092 libcurl is a reliable and portable library which provides you with an easy
Daniel Stenberg4c485992001-04-22 15:45:27 +000093 interface to a range of common Internet protocols.
Daniel Stenbergc3318b42000-08-17 14:06:42 +000094
Daniel Stenbergbc5954f2001-03-23 08:16:24 +000095 You can use libcurl for free in your application even if it is commercial
96 or closed-source.
Daniel Stenbergc3318b42000-08-17 14:06:42 +000097
98 1.3 What is cURL not?
Daniel Stenberge9640b62000-08-02 07:17:56 +000099
Daniel Stenberg7d24ce92001-11-01 09:12:35 +0000100 Curl is *not* a wget clone even though that is a very common misconception.
101 Never, during curl's development, have we intended curl to replace wget or
102 compete on its market. Curl is targeted at single-shot file transfers.
Daniel Stenbergef34ad22000-06-02 12:45:23 +0000103
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000104 Curl is not a web site mirroring program. If you wanna use curl to mirror
105 something: fine, go ahead and write a script that wraps around curl to make
106 it reality (like curlmirror.pl does).
Daniel Stenbergef34ad22000-06-02 12:45:23 +0000107
Daniel Stenberg4c485992001-04-22 15:45:27 +0000108 Curl is not an FTP site mirroring program. Sure, get and send FTP with curl
109 but if you want systematic and sequential behavior you should write a
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000110 script (or write a new program that interfaces libcurl) and do it.
111
112 Curl is not a PHP tool, even though it works perfectly well when used from
113 or with PHP.
114
Daniel Stenberg31b8eea2000-08-23 07:27:00 +0000115 Curl is not a single-OS program. Curl exists, compiles, builds and runs
Daniel Stenbergc59baa02001-02-12 10:05:09 +0000116 under a wide range of operating systems, including all modern Unixes (and a
117 bunch of older ones too), Windows, Amiga, BeOS, OS/2, OS X, QNX etc.
Daniel Stenberg31b8eea2000-08-23 07:27:00 +0000118
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000119 1.4 When will you make curl do XXXX ?
120
Daniel Stenberg11d718b2001-03-13 11:47:30 +0000121 We love suggestions of what to change in order to make curl and libcurl
122 better. We do however believe in a few rules when it comes to the future of
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000123 curl:
124
Daniel Stenberg11d718b2001-03-13 11:47:30 +0000125 * Curl is to remain a command line tool. If you want GUIs or fancy scripting
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000126 capabilities, you're free to write another tool that uses libcurl and that
Daniel Stenberg11d718b2001-03-13 11:47:30 +0000127 offers this. There's no point in having a single tool that does every
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000128 imaginable thing. That's also one of the great advantages of having the
Daniel Stenberg11d718b2001-03-13 11:47:30 +0000129 core of curl as a library.
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000130
Daniel Stenberg11d718b2001-03-13 11:47:30 +0000131 * We do not add things to curl that other small and available tools already
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000132 do very fine at the side. Curl's output is fine to pipe into another
133 program or redirect to another file for the next program to interpret.
134
Daniel Stenberg11d718b2001-03-13 11:47:30 +0000135 * We focus on protocol related issues and improvements. If you wanna do more
Daniel Stenberg5f8e93d2000-10-25 07:41:58 +0000136 magic with the supported protocols than curl currently does, chances are
Daniel Stenberg7d24ce92001-11-01 09:12:35 +0000137 big we will agree. If you wanna add more protocols, we may very well
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000138 agree.
139
Daniel Stenberg11d718b2001-03-13 11:47:30 +0000140 * If you want someone else to make all the work while you wait for us to
141 implement it for you, that is not a very friendly attitude. We spend a
142 considerable time already on maintaining and developing curl. In order to
143 get more out of us, you should consider trading in some of your time and
144 efforts in return.
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000145
146 * If you write the code, chances are bigger that it will get into curl
147 faster.
148
Daniel Stenberga0eb52b2001-03-23 15:28:13 +0000149 1.5 Who makes cURL?
150
151 cURL and libcurl are not made by any single individual. Sure, Daniel
152 Stenberg writes the major parts, but various people's submissions are
153 important and crucial. Anyone can post their changes and improvements and
154 have them inserted in the main sources (of course on the condition that
155 developers agree on that the fixes are good).
156
Daniel Stenberg81f22462001-11-27 13:33:21 +0000157 The list of contributors in the docs/THANKS file is only a small part of all
158 the people that every day provide us with bug reports, suggestions, ideas
159 and source code.
Daniel Stenberga0eb52b2001-03-23 15:28:13 +0000160
161 curl is developed by a community, with Daniel at the wheel.
162
163 1.6 What do you get for making cURL?
164
165 Project cURL is entirely free and open, without any commercial interests or
166 money involved. No person gets paid in any way for developing curl. We all
Daniel Stenberg4c485992001-04-22 15:45:27 +0000167 do this voluntarily on our spare time.
Daniel Stenberga0eb52b2001-03-23 15:28:13 +0000168
169 We get some help from companies. Contactor Data hosts the curl web site and
170 the main mailing list, Haxx owns the curl web site's domain and
171 sourceforge.net hosts several project tools we take advantage from like the
172 bug tracker, mailing lists and more.
173
Daniel Stenbergd3706812001-11-27 13:37:29 +0000174 If you want to support our project with a donation or similar, one way of
Daniel Stenberg25fe47f2001-11-14 20:13:38 +0000175 doing that would be to buy "gift certificates" at useful online shopping
176 sites, such as amazon.com or thinkgeek.com. Another way would be to sponsor
177 us through a banner-program or by simply helping us coding, documenting,
178 testing etc.
Daniel Stenbergc528dc52001-08-07 11:17:37 +0000179
180 1.7 What about CURL from curl.com?
181
182 During the summer 2001, curl.com has been busy advertising their client-side
183 programming language for the web, named CURL.
184
Daniel Stenberg81b6ebc2001-08-07 18:02:37 +0000185 We are in no way associated with curl.com or their CURL programming
186 language.
Daniel Stenbergc528dc52001-08-07 11:17:37 +0000187
Daniel Stenberg81b6ebc2001-08-07 18:02:37 +0000188 Our project name curl has been in effective use since 1998. We were not the
Daniel Stenberg4045cd52001-08-07 21:21:24 +0000189 first computer related project to use the name "curl" and do not claim any
Daniel Stenberg81b6ebc2001-08-07 18:02:37 +0000190 first-hand rights to the name.
Daniel Stenbergc528dc52001-08-07 11:17:37 +0000191
Daniel Stenberg81b6ebc2001-08-07 18:02:37 +0000192 We recognize that we will be living in parallel with curl.com and wish them
193 every success.
Daniel Stenbergc528dc52001-08-07 11:17:37 +0000194
Daniel Stenbergc3318b42000-08-17 14:06:42 +00001952. Install Related Problems
196
197 2.1. configure doesn't find OpenSSL even when it is installed
Daniel Stenberg7c37c6a2000-05-22 17:35:35 +0000198
Daniel Stenbergef34ad22000-06-02 12:45:23 +0000199 This may be because of several reasons.
Daniel Stenberg7c37c6a2000-05-22 17:35:35 +0000200
Daniel Stenberg09ba8562000-10-27 12:25:00 +0000201 2.1.1. native linker doesn't find openssl
Daniel Stenberg7c37c6a2000-05-22 17:35:35 +0000202
Daniel Stenbergbfb16902000-08-17 11:42:59 +0000203 Affected platforms:
204 Solaris (native cc compiler)
205 HPUX (native cc compiler)
206 SGI IRIX (native cc compiler)
Daniel Stenberg13962ad2000-09-28 10:26:44 +0000207 SCO UNIX (native cc compiler)
Daniel Stenberg7c37c6a2000-05-22 17:35:35 +0000208
Daniel Stenbergef34ad22000-06-02 12:45:23 +0000209 When configuring curl, I specify --with-ssl. OpenSSL is installed in
210 /usr/local/ssl Configure reports SSL in /usr/local/ssl, but fails to find
211 CRYPTO_lock in -lcrypto
Daniel Stenberg7c37c6a2000-05-22 17:35:35 +0000212
Daniel Stenbergef34ad22000-06-02 12:45:23 +0000213 Cause: The cc for this test places the -L/usr/local/ssl/lib AFTER
214 -lcrypto, so ld can't find the library. This is due to a bug in the GNU
215 autoconf tool.
216
217 Workaround: Specifying "LDFLAGS=-L/usr/local/ssl/lib" in front of
218 ./configure places the -L/usr/local/ssl/lib early enough in the command
219 line to make things work
220
Daniel Stenbergbfb16902000-08-17 11:42:59 +0000221 Solution submitted by: Bob Allison <allisonb@users.sourceforge.net>
Daniel Stenbergef34ad22000-06-02 12:45:23 +0000222
Daniel Stenberg09ba8562000-10-27 12:25:00 +0000223 2.1.2. only the libssl lib is missing
Daniel Stenbergef34ad22000-06-02 12:45:23 +0000224
225 If all include files and the libcrypto lib is present, with only the
226 libssl being missing according to configure, this is mostly likely because
227 a few functions are left out from the libssl.
228
229 If the function names missing include RSA or RSAREF you can be certain
Daniel Stenberg4c485992001-04-22 15:45:27 +0000230 that this is because libssl requires the RSA and RSAREF libs to build.
Daniel Stenbergef34ad22000-06-02 12:45:23 +0000231
232 See the INSTALL file section that explains how to add those libs to
233 configure. Make sure that you remove the config.cache file before you
234 rerun configure with the new flags.
235
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000236 2.2. Does curl work/build with other SSL libraries?
Daniel Stenberge9640b62000-08-02 07:17:56 +0000237
Daniel Stenberg11d718b2001-03-13 11:47:30 +0000238 Curl has been written to use OpenSSL, although there should not be much
Daniel Stenberg26d1aac2001-02-16 13:41:09 +0000239 problems using a different library. If anyone does "port" curl to use a
Daniel Stenberg11d718b2001-03-13 11:47:30 +0000240 different SSL library, we are of course very interested in getting the
241 patch!
Daniel Stenberge9640b62000-08-02 07:17:56 +0000242
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000243 2.3. Where can I find a copy of LIBEAY32.DLL?
Daniel Stenberge9640b62000-08-02 07:17:56 +0000244
245 That is an OpenSSL binary built for Windows.
246
247 Curl uses OpenSSL to do the SSL stuff. The LIBEAY32.DLL is what curl needs
Daniel Stenberg11d718b2001-03-13 11:47:30 +0000248 on a windows machine to do https://. Check out the curl web site to find
Daniel Stenberg4c485992001-04-22 15:45:27 +0000249 accurate and up-to-date pointers to recent OpenSSL DLLs and other binary
Daniel Stenberge9640b62000-08-02 07:17:56 +0000250 packages.
251
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000252 2.4. Does cURL support Socks (RFC 1928) ?
Daniel Stenberge9640b62000-08-02 07:17:56 +0000253
Daniel Stenberg4c485992001-04-22 15:45:27 +0000254 No. Nobody has wanted it that badly yet. We appreciate patches that bring
Daniel Stenberg11d718b2001-03-13 11:47:30 +0000255 this functionality.
Daniel Stenberge9640b62000-08-02 07:17:56 +0000256
257
Daniel Stenbergc3318b42000-08-17 14:06:42 +00002583. Usage problems
Daniel Stenberge9640b62000-08-02 07:17:56 +0000259
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000260 3.1. curl: (1) SSL is disabled, https: not supported
Daniel Stenberge9640b62000-08-02 07:17:56 +0000261
262 If you get this output when trying to get anything from a https:// server,
263 it means that the configure script couldn't find all libs and include files
264 it requires for SSL to work. If the configure script fails to find them,
265 curl is simply built without SSL support.
266
267 To get the https:// support into a curl that was previously built but that
268 reports that https:// is not supported, you should dig through the document
269 and logs and check out why the configure script doesn't find the SSL libs
270 and/or include files.
271
272 Also, check out the other paragraph in this FAQ labeled "configure doesn't
273 find OpenSSL even when it is installed".
274
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000275 3.2. How do I tell curl to resume a transfer?
Daniel Stenberge9640b62000-08-02 07:17:56 +0000276
Daniel Stenberg11d718b2001-03-13 11:47:30 +0000277 Curl supports resumed transfers both ways on both FTP and HTTP.
Daniel Stenberge9640b62000-08-02 07:17:56 +0000278
Daniel Stenberg887e7282001-01-03 09:13:07 +0000279 Try the -C option.
Daniel Stenberge9640b62000-08-02 07:17:56 +0000280
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000281 3.3. Why doesn't my posting using -F work?
Daniel Stenberge9640b62000-08-02 07:17:56 +0000282
283 You can't simply use -F or -d at your choice. The web server that will
284 receive your post assumes one of the formats. If the form you're trying to
Daniel Stenbergc59baa02001-02-12 10:05:09 +0000285 "fake" sets the type to 'multipart/form-data', then and only then you must
Daniel Stenberge9640b62000-08-02 07:17:56 +0000286 use the -F type. In all the most common cases, you should use -d which then
287 causes a posting with the type 'application/x-www-form-urlencoded'.
288
Daniel Stenberg4c485992001-04-22 15:45:27 +0000289 This is described in some detail in the MANUAL and TheArtOfHttpScripting
290 documents, and if you don't understand it the first time, read it again
291 before you post questions about this to the mailing list. Also, try reading
292 through the mailing list archives for old postings and questions regarding
293 this.
Daniel Stenberge9640b62000-08-02 07:17:56 +0000294
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000295 3.4. How do I tell curl to run custom FTP commands?
Daniel Stenberge9640b62000-08-02 07:17:56 +0000296
297 You can tell curl to perform optional commands both before and/or after a
298 file transfer. Study the -Q/--quote option.
299
300 Since curl is used for file transfers, you don't use curl to just perform
Daniel Stenberg4c485992001-04-22 15:45:27 +0000301 FTP commands without transferring anything. Therefore you must always specify
Daniel Stenberge9640b62000-08-02 07:17:56 +0000302 a URL to transfer to/from even when doing custom FTP commands.
303
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000304 3.5. How can I disable the Pragma: nocache header?
Daniel Stenberge9640b62000-08-02 07:17:56 +0000305
306 You can change all internally generated headers by adding a replacement with
307 the -H/--header option. By adding a header with empty contents you safely
308 disable that one. Use -H "Pragma:" to disable that specific header.
309
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000310 3.6. Does curl support javascript, ASP, XML, XHTML or HTML version Y?
Daniel Stenberge9640b62000-08-02 07:17:56 +0000311
312 To curl, all contents are alike. It doesn't matter how the page was
Daniel Stenberg4c485992001-04-22 15:45:27 +0000313 generated. It may be ASP, PHP, Perl, shell-script, SSI or plain
Daniel Stenberge9640b62000-08-02 07:17:56 +0000314 HTML-files. There's no difference to curl and it doesn't even know what kind
315 of language that generated the page.
316
317 Javascript is slightly different since that is code embedded in the HTML
318 that is sent for the client to interpret and curl has no javascript
319 interpreter.
320
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000321 3.7. Can I use curl to delete/rename a file through FTP?
Daniel Stenberge9640b62000-08-02 07:17:56 +0000322
Daniel Stenberg4c485992001-04-22 15:45:27 +0000323 Yes. You specify custom FTP commands with -Q/--quote.
Daniel Stenberge9640b62000-08-02 07:17:56 +0000324
325 One example would be to delete a file after you have downloaded it:
326
327 curl -O ftp://download.com/coolfile -Q '-DELE coolfile'
328
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000329 3.8 How do I tell curl to follow HTTP redirects?
Daniel Stenberge9640b62000-08-02 07:17:56 +0000330
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000331 Curl does not follow so-called redirects by default. The Location: header
332 that informs the client about this is only interpreted if you're using the
333 -L/--location option. As in:
Daniel Stenberge9640b62000-08-02 07:17:56 +0000334
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000335 curl -L http://redirector.com
336
Daniel Stenberg4c485992001-04-22 15:45:27 +0000337 3.9 How do I use curl in PHP, Perl, Tcl, Ruby or Java?
Daniel Stenberg368e3522001-01-29 10:16:21 +0000338
Daniel Stenberg4c485992001-04-22 15:45:27 +0000339 There exist many language-interfaces for curl that integrates it better with
340 various languages. If you are fluid in a script language, you may very well
341 opt to use such an interface instead of using the command line tool.
342
343 At the time of writing, there are bindings for the five language mentioned
344 above, but chances are there are even more by the time you read this. Or you
Daniel Stenbergcab90bf2001-05-30 08:01:35 +0000345 may be able you write your own wrapper for a not-yet supported language!
Daniel Stenberg4c485992001-04-22 15:45:27 +0000346
347 Find out more about which languages that support curl directly, and how to
348 install and use them, in the libcurl section of the curl web site:
349
350 http://curl.haxx.se/libcurl/
351
Daniel Stenberg368e3522001-01-29 10:16:21 +0000352 PHP4 has the ability to use libcurl as an internal module if built with that
353 option enabled. You then get a set of extra functions that can be used
354 within your PHP programs. You find all details about those functions in the
355 curl section in the PHP manual, see the online version at:
356
357 http://www.php.net/manual/ref.curl.php
358
359 PHP also offers the option to run a command line, and then you can of course
360 invoke the curl tool using a command line. This is the way to use curl if
361 you're using PHP3 or PHP4 built without curl module support.
362
Daniel Stenberg147a6732001-03-08 09:25:09 +0000363 3.10 What about SOAP, WebDAV, XML-RPC or similar protocols over HTTP?
Daniel Stenbergc59baa02001-02-12 10:05:09 +0000364
365 Curl adheres to the HTTP spec, which basically means you can play with *any*
Daniel Stenberg4c485992001-04-22 15:45:27 +0000366 protocol that is built on top of HTTP. Protocols such as SOAP, WEBDAV and
Daniel Stenbergc59baa02001-02-12 10:05:09 +0000367 XML-RPC are all such ones. You can use -X to set custom requests and -H to
368 set custom headers (or replace internally generated ones).
369
370 Using libcurl or PHP's curl modules is just as fine and you'd just use the
371 proper library options to do the same.
372
Daniel Stenberg88d14e92001-05-29 14:02:20 +0000373 3.11 How do I POST with a different Content-Type?
374
375 You can always replace the internally generated headers with -H/--header.
376 To make a simple HTTP POST with text/xml as content-type, do something like:
377
378 curl -d "datatopost" -H "Content-Type: text/xml" [URL]
379
Daniel Stenberg50e9f8f2001-10-23 10:12:28 +0000380 3.12 Why do FTP specific features over HTTP proxy fail?
Daniel Stenberg7d3daa52001-10-23 10:12:00 +0000381
382 Because when you use a HTTP proxy, the protocol spoken on the network will
383 be HTTP, even if you specify a FTP URL. This effectively means that you
384 normally can't use FTP specific features such as ftp upload and ftp quote
385 etc.
386
387 There is one exception to this rule, and that is if you can "tunnel through"
Daniel Stenberg271f96f2001-11-20 08:03:01 +0000388 the given HTTP proxy. Proxy tunneling is enabled with a special option (-p)
Daniel Stenberg7d3daa52001-10-23 10:12:00 +0000389 and is generally not available as proxy admins usuable disable tunneling to
390 other ports than 443 (which is used for HTTPS access through proxies).
391
Daniel Stenbergc3318b42000-08-17 14:06:42 +00003924. Running Problems
393
394 4.1. Problems connecting to SSL servers.
Daniel Stenberge9640b62000-08-02 07:17:56 +0000395
Daniel Stenberg11d718b2001-03-13 11:47:30 +0000396 It took a very long time before we could sort out why curl had problems to
397 connect to certain SSL servers when using SSLeay or OpenSSL v0.9+. The
398 error sometimes showed up similar to:
Daniel Stenberge9640b62000-08-02 07:17:56 +0000399
400 16570:error:1407D071:SSL routines:SSL2_READ:bad mac decode:s2_pkt.c:233:
401
402 It turned out to be because many older SSL servers don't deal with SSLv3
403 requests properly. To correct this problem, tell curl to select SSLv2 from
404 the command line (-2/--sslv2).
405
Daniel Stenberg11d718b2001-03-13 11:47:30 +0000406 There has also been examples where the remote server didn't like the SSLv2
Daniel Stenberge9640b62000-08-02 07:17:56 +0000407 request and instead you had to force curl to use SSLv3 with -3/--sslv3.
408
Daniel Stenberge26ee092001-01-15 10:26:37 +0000409 4.2. Why do I get problems when I use & or % in the URL?
Daniel Stenberg29470102000-06-02 13:32:01 +0000410
Daniel Stenberg11d718b2001-03-13 11:47:30 +0000411 In general unix shells, the & letter is treated special and when used, it
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000412 runs the specified command in the background. To safely send the & as a part
Daniel Stenberg4c485992001-04-22 15:45:27 +0000413 of a URL, you should quote the entire URL by using single (') or double (")
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000414 quotes around it.
Daniel Stenberg29470102000-06-02 13:32:01 +0000415
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000416 An example that would invoke a remote CGI that uses &-letters could be:
Daniel Stenberg8f037322000-06-06 14:09:01 +0000417
Daniel Stenbergedcd5df2000-06-06 14:13:36 +0000418 curl 'http://www.altavista.com/cgi-bin/query?text=yes&q=curl'
Daniel Stenberg8f037322000-06-06 14:09:01 +0000419
Daniel Stenberge26ee092001-01-15 10:26:37 +0000420 In win32, the standard DOS shell treats the %-letter specially and you may
421 need to quote the string properly when % is used in it.
422
Daniel Stenberg1b77c182001-01-29 10:24:51 +0000423 Also note that if you want the literal %-letter to be part of the data you
424 pass in a POST using -d/--data you must encode it as '%25'.
425
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000426 4.3. How can I use {, }, [ or ] to specify multiple URLs?
Daniel Stenberg29470102000-06-02 13:32:01 +0000427
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000428 Because those letters have a special meaning to the shell, and to be used in
429 a URL specified to curl you must quote them.
Daniel Stenberg29470102000-06-02 13:32:01 +0000430
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000431 An example that downloads two URLs (sequentially) would do:
Daniel Stenberg8f037322000-06-06 14:09:01 +0000432
Daniel Stenbergedcd5df2000-06-06 14:13:36 +0000433 curl '{curl,www}.haxx.se'
Daniel Stenberg8f037322000-06-06 14:09:01 +0000434
Daniel Stenberge26ee092001-01-15 10:26:37 +0000435 To be able to use those letters as actual parts of the URL (without using
Daniel Stenberg11d718b2001-03-13 11:47:30 +0000436 them for the curl URL "globbing" system), use the -g/--globoff option (curl
437 7.6 and later):
Daniel Stenberge26ee092001-01-15 10:26:37 +0000438
439 curl -g 'www.site.com/weirdname[].html'
440
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000441 4.4. Why do I get downloaded data even though the web page doesn't exist?
Daniel Stenberg29470102000-06-02 13:32:01 +0000442
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000443 Curl asks remote servers for the page you specify. If the page doesn't exist
444 at the server, the HTTP protocol defines how the server should respond and
445 that means that headers and a "page" will be returned. That's simply how
446 HTTP works.
Daniel Stenberg29470102000-06-02 13:32:01 +0000447
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000448 By using the --fail option you can tell curl explicitly to not get any data
449 if the HTTP return code doesn't say success.
Daniel Stenberg8f037322000-06-06 14:09:01 +0000450
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000451 4.5 Why do I get return code XXX from a HTTP server?
Daniel Stenberg29470102000-06-02 13:32:01 +0000452
Daniel Stenberg11d718b2001-03-13 11:47:30 +0000453 RFC2616 clearly explains the return codes. This is a short transcript. Go
454 read the RFC for exact details:
Daniel Stenberg29470102000-06-02 13:32:01 +0000455
Daniel Stenberg09ba8562000-10-27 12:25:00 +0000456 4.5.1 "400 Bad Request"
Daniel Stenberg29470102000-06-02 13:32:01 +0000457
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000458 The request could not be understood by the server due to malformed
459 syntax. The client SHOULD NOT repeat the request without modifications.
460
Daniel Stenberg09ba8562000-10-27 12:25:00 +0000461 4.5.2 "401 Unauthorized"
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000462
463 The request requires user authentication.
464
Daniel Stenberg09ba8562000-10-27 12:25:00 +0000465 4.5.3 "403 Forbidden"
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000466
467 The server understood the request, but is refusing to fulfill it.
468 Authorization will not help and the request SHOULD NOT be repeated.
469
Daniel Stenberg09ba8562000-10-27 12:25:00 +0000470 4.5.4 "404 Not Found"
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000471
472 The server has not found anything matching the Request-URI. No indication
473 is given of whether the condition is temporary or permanent.
474
Daniel Stenberg09ba8562000-10-27 12:25:00 +0000475 4.5.5 "405 Method Not Allowed"
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000476
477 The method specified in the Request-Line is not allowed for the resource
478 identified by the Request-URI. The response MUST include an Allow header
479 containing a list of valid methods for the requested resource.
480
481 4.6. Can you tell me what error code 142 means?
Daniel Stenberg29470102000-06-02 13:32:01 +0000482
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000483 All error codes that are larger than the highest documented error code means
Daniel Stenberg13bf9642001-08-23 11:11:13 +0000484 that curl has exited due to a crash. This is a serious error, and we
Daniel Stenberg25fe47f2001-11-14 20:13:38 +0000485 appreciate a detailed bug report from you that describes how we could go
Daniel Stenberg13bf9642001-08-23 11:11:13 +0000486 ahead and repeat this!
Daniel Stenberg29470102000-06-02 13:32:01 +0000487
Daniel Stenberg4c485992001-04-22 15:45:27 +0000488 4.7. How do I keep user names and passwords secret in Curl command lines?
Daniel Stenberg29470102000-06-02 13:32:01 +0000489
Daniel Stenberg11d718b2001-03-13 11:47:30 +0000490 This problem has two sides:
Daniel Stenberg29470102000-06-02 13:32:01 +0000491
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000492 The first part is to avoid having clear-text passwords in the command line
493 so that they don't appear in 'ps' outputs and similar. That is easily
Daniel Stenberg4c485992001-04-22 15:45:27 +0000494 avoided by using the "-K" option to tell curl to read parameters from a
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000495 file or stdin to which you can pass the secret info.
Daniel Stenberg29470102000-06-02 13:32:01 +0000496
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000497 To keep the passwords in your account secret from the rest of the world is
498 not a task that curl addresses. You could of course encrypt them somehow to
499 at least hide them from being read by human eyes, but that is not what
500 anyone would call security.
Daniel Stenberg29470102000-06-02 13:32:01 +0000501
Daniel Stenberg887e7282001-01-03 09:13:07 +0000502 Also note that regular HTTP and FTP passwords are sent in clear across the
503 network. All it takes for anyone to fetch them is to listen on the network.
Daniel Stenberg4c485992001-04-22 15:45:27 +0000504 Eavesdropping is very easy.
Daniel Stenberg887e7282001-01-03 09:13:07 +0000505
Daniel Stenberg09ba8562000-10-27 12:25:00 +0000506 4.8 I found a bug!
507
Daniel Stenberg4c485992001-04-22 15:45:27 +0000508 It is not a bug if the behavior is documented. Read the docs first.
Daniel Stenberg09ba8562000-10-27 12:25:00 +0000509
510 If it is a problem with a binary you've downloaded or a package for your
511 particular platform, try contacting the person who built the package/archive
512 you have.
513
514 If there is a bug, post a bug report in the Curl Bug Track System over at
Daniel Stenberg9012f8c2001-01-15 10:28:41 +0000515 http://sourceforge.net/bugs/?group_id=976
Daniel Stenberg09ba8562000-10-27 12:25:00 +0000516
517 Always include as many details you can think of, including curl version,
518 operating system name and version and complete instructions how to repeat
519 the bug.
520
Daniel Stenberg2c100372000-12-19 07:30:51 +0000521 4.9. Curl can't authenticate to the server that requires NTLM?
522
523 NTLM is a Microsoft proprietary protocol. Unfortunately, curl does not
Daniel Stenbergc59baa02001-02-12 10:05:09 +0000524 currently support that. Proprietary formats are evil. You should not use
525 such ones.
Daniel Stenberg29470102000-06-02 13:32:01 +0000526
Daniel Stenbergc3318b42000-08-17 14:06:42 +00005275. libcurl Issues
Daniel Stenberg29470102000-06-02 13:32:01 +0000528
Daniel Stenberg7d09e512001-01-11 12:52:07 +0000529 5.1. Is libcurl thread-safe?
Daniel Stenberg29470102000-06-02 13:32:01 +0000530
Daniel Stenberg7d09e512001-01-11 12:52:07 +0000531 Yes.
532
533 We have written the libcurl code specificly adjusted for multi-threaded
534 programs. libcurl will use thread-safe functions instead of non-safe ones if
535 your system has such.
Daniel Stenberg29470102000-06-02 13:32:01 +0000536
Daniel Stenberg4c485992001-04-22 15:45:27 +0000537 We would appreciate some kind of report or README file from those who have
Daniel Stenberg11d718b2001-03-13 11:47:30 +0000538 used libcurl in a threaded environment.
Daniel Stenberg29470102000-06-02 13:32:01 +0000539
Daniel Stenberga40b55d2000-11-22 07:27:26 +0000540 5.2 How can I receive all data into a large memory chunk?
541
Daniel Stenberga84af982001-05-15 13:09:27 +0000542 [ See also the examples/getinmemory.c source ]
543
Daniel Stenberga40b55d2000-11-22 07:27:26 +0000544 You are in full control of the callback function that gets called every time
545 there is data received from the remote server. You can make that callback do
Daniel Stenberg4c485992001-04-22 15:45:27 +0000546 whatever you want. You do not have to write the received data to a file.
Daniel Stenberga40b55d2000-11-22 07:27:26 +0000547
548 One solution to this problem could be to have a pointer to a struct that you
549 pass to the callback function. You set the pointer using the
550 curl_easy_setopt(CURLOPT_FILE) function. Then that pointer will be passed to
551 the callback instead of a FILE * to a file:
552
553 /* imaginary struct */
554 struct MemoryStruct {
555 char *memory;
556 size_t size;
557 };
558
559 /* imaginary callback function */
560 size_t
561 WriteMemoryCallback(void *ptr, size_t size, size_t nmemb, void *data)
562 {
563 register int realsize = size * nmemb;
564 struct MemoryStruct *mem = (struct MemoryStruct *)data;
565
566 mem->memory = (char *)realloc(mem->memory, mem->size + realsize + 1);
567 if (mem->memory) {
568 memcpy(&(mem->memory[mem->size]), ptr, realsize);
569 mem->size += realsize;
570 mem->memory[mem->size] = 0;
571 }
572 return realsize;
573 }
574
Daniel Stenberg2c100372000-12-19 07:30:51 +0000575 5.3 How do I fetch multiple files with libcurl?
Daniel Stenbergec5ac822000-12-14 08:37:09 +0000576
Daniel Stenberg5dd0a8a2001-03-06 14:37:37 +0000577 Starting with version 7.7, curl and libcurl will have excellent support for
Daniel Stenberg11d718b2001-03-13 11:47:30 +0000578 transferring multiple files. You should just repeatedly set new URLs with
579 curl_easy_setopt() and then transfer it with curl_easy_perform(). The handle
580 you get from curl_easy_init() is not only reusable starting with libcurl
581 7.7, but also you're encouraged to reuse it if you can, as that will enable
Daniel Stenberg4c485992001-04-22 15:45:27 +0000582 libcurl to use persistent connections.
Daniel Stenberg5dd0a8a2001-03-06 14:37:37 +0000583
Daniel Stenberg11d718b2001-03-13 11:47:30 +0000584 For libcurl prior to 7.7, there was no multiple file support. The only
585 available way to do multiple requests was to init/perform/cleanup for each
586 transfer.
Daniel Stenberga40b55d2000-11-22 07:27:26 +0000587
Daniel Stenbergbc5954f2001-03-23 08:16:24 +0000588 5.4 Does libcurl do Winsock initialization on win32 systems?
Daniel Stenberg910fc852000-12-30 11:48:51 +0000589
Daniel Stenberg6d213e22001-11-01 14:51:02 +0000590 Yes (since 7.8.1) if told to in the curl_global_init() call.
Daniel Stenberg910fc852000-12-30 11:48:51 +0000591
Daniel Stenberg5d7b32d2001-02-04 20:08:42 +0000592 5.5 Does CURLOPT_FILE and CURLOPT_INFILE work on win32 ?
Daniel Stenberg41084e52001-01-22 08:42:00 +0000593
594 Yes, but you cannot open a FILE * and pass the pointer to a DLL and have
Daniel Stenberg5d7b32d2001-02-04 20:08:42 +0000595 that DLL use the FILE *. If you set CURLOPT_FILE you must also use
596 CURLOPT_WRITEFUNCTION as well to set a function that writes the file, even
597 if that simply writes the data to the specified FILE*. Similarly, if you use
598 CURLOPT_INFILE you must also specify CURLOPT_READFUNCTION.
Daniel Stenberg41084e52001-01-22 08:42:00 +0000599
Daniel Stenberg5d7b32d2001-02-04 20:08:42 +0000600 (Provided by Joel DeYoung and Bob Schader)
Daniel Stenberg41084e52001-01-22 08:42:00 +0000601
Daniel Stenberg4c485992001-04-22 15:45:27 +0000602 5.6 What about Keep-Alive or persistent connections?
Daniel Stenberg6dc5c6f2001-01-27 20:51:31 +0000603
Daniel Stenberg5dd0a8a2001-03-06 14:37:37 +0000604 Starting with version 7.7, curl and libcurl will have excellent support for
Daniel Stenberg4c485992001-04-22 15:45:27 +0000605 persistent connections when transferring several files from the same server.
Daniel Stenberg11d718b2001-03-13 11:47:30 +0000606 Curl will attempt to reuse connections for all URLs specified on the same
607 command line/config file, and libcurl will reuse connections for all
608 transfers that are made using the same libcurl handle.
Daniel Stenberg5dd0a8a2001-03-06 14:37:37 +0000609
Daniel Stenberg4c485992001-04-22 15:45:27 +0000610 Previous versions had no persistent connection support.
Daniel Stenberg6dc5c6f2001-01-27 20:51:31 +0000611
Daniel Stenbergc3318b42000-08-17 14:06:42 +00006126. License Issues
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000613
Daniel Stenberg0d181b52001-01-04 12:43:53 +0000614 Curl and libcurl are released under a MIT/X derivate license *or* the MPL,
615 the Mozilla Public License. To get a really good answer to your license
616 conflict questions, you should study the MPL and MIT/X licenses and the
617 license you are about to use and check for clashes yourself. This section is
618 just a brief summary for the cases we get the most questions. (Parts of this
619 section was much enhanced by Bjorn Reese.)
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000620
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000621 6.1. I have a GPL program, can I use the libcurl library?
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000622
Daniel Stenberg0d181b52001-01-04 12:43:53 +0000623 Yes!
Daniel Stenberg7d1ef962000-08-14 06:31:59 +0000624
Daniel Stenberg0d181b52001-01-04 12:43:53 +0000625 Since libcurl may be distributed under the MIT/X derivate license, it can be
626 used together with GPL in any software.
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000627
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000628 6.2. I have a closed-source program, can I use the libcurl library?
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000629
Daniel Stenbergc59baa02001-02-12 10:05:09 +0000630 Yes!
Daniel Stenberg0d181b52001-01-04 12:43:53 +0000631
Daniel Stenbergc59baa02001-02-12 10:05:09 +0000632 libcurl does not put any restrictions on the program that uses the library.
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000633
Daniel Stenberg31b8eea2000-08-23 07:27:00 +0000634 6.3. I have a BSD licensed program, can I use the libcurl library?
635
Daniel Stenbergc59baa02001-02-12 10:05:09 +0000636 Yes!
Daniel Stenberg0d181b52001-01-04 12:43:53 +0000637
Daniel Stenbergc59baa02001-02-12 10:05:09 +0000638 libcurl does not put any restrictions on the program that uses the library.
Daniel Stenberg31b8eea2000-08-23 07:27:00 +0000639
640 6.4. I have a program that uses LGPL libraries, can I use libcurl?
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000641
Daniel Stenbergc59baa02001-02-12 10:05:09 +0000642 Yes!
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000643
Daniel Stenbergc59baa02001-02-12 10:05:09 +0000644 The LGPL license doesn't clash with other licenses.
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000645
Daniel Stenberg31b8eea2000-08-23 07:27:00 +0000646 6.5. Can I modify curl/libcurl for my program and keep the changes secret?
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000647
Daniel Stenbergc59baa02001-02-12 10:05:09 +0000648 Yes!
Daniel Stenberg0d181b52001-01-04 12:43:53 +0000649
650 The MIT/X derivate license practically allows you to do almost anything with
651 the sources, on the condition that the copyright texts in the sources are
652 left intact.
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000653
Daniel Stenberg31b8eea2000-08-23 07:27:00 +0000654 6.6. Can you please change the curl/libcurl license to XXXX?
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000655
Daniel Stenbergc59baa02001-02-12 10:05:09 +0000656 No.
657
Daniel Stenberg11d718b2001-03-13 11:47:30 +0000658 We have carefully picked this license after years of development and
659 discussions and a large amount of people have contributed with source code
660 knowing that this is the license we use. This license puts the restrictions
661 we want on curl/libcurl and it does not spread to other programs or
662 libraries that use it. The recent dual license modification should make it
663 possible for everyone to use libcurl or curl in their projects, no matter
664 what license they already have in use.