blob: 0fad2edbae59fd240566bed435b5f84a80a16b92 [file] [log] [blame]
Daniel Stenbergc59baa02001-02-12 10:05:09 +00001Updated: February 12, 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 Stenberg7c37c6a2000-05-22 17:35:35 +000015
Daniel Stenbergc3318b42000-08-17 14:06:42 +000016 2. Install Related Problems
17 2.1 configure doesn't find OpenSSL even when it is installed
18 2.1.1. native linker doesn't find openssl
19 2.1.2. only the libssl lib is missing
20 2.2 Does curl work/build with other SSL libraries?
21 2.3 Where can I find a copy of LIBEAY32.DLL?
22 2.4 Does cURL support Socks (RFC 1928) ?
Daniel Stenberg7c37c6a2000-05-22 17:35:35 +000023
Daniel Stenbergc3318b42000-08-17 14:06:42 +000024 3. Usage Problems
25 3.1 curl: (1) SSL is disabled, https: not supported
26 3.2 How do I tell curl to resume a transfer?
27 3.3 Why doesn't my posting using -F work?
28 3.4 How do I tell curl to run custom FTP commands?
29 3.5 How can I disable the Pragma: nocache header?
30 3.6 Does curl support javascript, ASP, XML, XHTML or HTML version Y?
31 3.7 Can I use curl to delete/rename a file through FTP?
32 3.8 How do I tell curl to follow HTTP redirects?
Daniel Stenbergbd0bd352001-01-29 10:16:47 +000033 3.9 How do I use curl in PHP?
Daniel Stenbergc59baa02001-02-12 10:05:09 +000034 3.10 What about SOAP, WEBDAV, XML-RPC or similar protocols over HTTP?
Daniel Stenberg7c37c6a2000-05-22 17:35:35 +000035
Daniel Stenbergc3318b42000-08-17 14:06:42 +000036 4. Running Problems
37 4.1 Problems connecting to SSL servers.
Daniel Stenberge26ee092001-01-15 10:26:37 +000038 4.2 Why do I get problems when I use & or % in the URL?
Daniel Stenbergc3318b42000-08-17 14:06:42 +000039 4.3 How can I use {, }, [ or ] to specify multiple URLs?
40 4.4 Why do I get downloaded data even though the web page doesn't exist?
41 4.5 Why do I get return code XXX from a HTTP server?
42 4.5.1 "400 Bad Request"
43 4.5.2 "401 Unauthorized"
44 4.5.3 "403 Forbidden"
45 4.5.4 "404 Not Found"
46 4.5.5 "405 Method Not Allowed"
47 4.6 Can you tell me what error code 142 means?
Daniel Stenberg09ba8562000-10-27 12:25:00 +000048 4.7 How do I keep usernames and passwords secret in Curl command lines?
49 4.8 I found a bug!
Daniel Stenberg2c100372000-12-19 07:30:51 +000050 4.9 Curl can't authenticate to the server that requires NTLM?
Daniel Stenberg7c37c6a2000-05-22 17:35:35 +000051
Daniel Stenbergc3318b42000-08-17 14:06:42 +000052 5. libcurl Issues
Daniel Stenberg7d09e512001-01-11 12:52:07 +000053 5.1 Is libcurl thread-safe?
Daniel Stenberga40b55d2000-11-22 07:27:26 +000054 5.2 How can I receive all data into a large memory chunk?
Daniel Stenberg2c100372000-12-19 07:30:51 +000055 5.3 How do I fetch multiple files with libcurl?
Daniel Stenberg910fc852000-12-30 11:48:51 +000056 5.4 Does libcurl do Winsock initing on win32 systems?
Daniel Stenberg5d7b32d2001-02-04 20:08:42 +000057 5.5 Does CURLOPT_FILE and CURLOPT_INFILE work on win32 ?
Daniel Stenberg6dc5c6f2001-01-27 20:51:31 +000058 5.6 What about Keep-Alive or persistant connections?
Daniel Stenberg7c37c6a2000-05-22 17:35:35 +000059
Daniel Stenbergc3318b42000-08-17 14:06:42 +000060 6. License Issues
61 6.1 I have a GPL program, can I use the libcurl library?
62 6.2 I have a closed-source program, can I use the libcurl library?
Daniel Stenberg31b8eea2000-08-23 07:27:00 +000063 6.3 I have a BSD licensed program, can I use the libcurl library?
64 6.4 I have a program that uses LGPL libraries, can I use libcurl?
65 6.5 Can I modify curl/libcurl for my program and keep the changes secret?
66 6.6 Can you please change the curl/libcurl license to XXXX?
Daniel Stenbergc3318b42000-08-17 14:06:42 +000067
68==============================================================================
69
701. Philosophy
71
72 1.1 What is cURL?
73
74 cURL (or simply just 'curl') is a command line tool for getting or sending
75 files using URL syntax. The name is a play on 'Client for URLs', originally
Daniel Stenberg09ba8562000-10-27 12:25:00 +000076 with URL spelled in uppercase to make it obvious it deals with URLs. The
77 fact it can also be pronounced 'see URL' also helped.
Daniel Stenbergc3318b42000-08-17 14:06:42 +000078
79 Curl supports a range of common internet protocols, currently including
Daniel Stenberg7d09e512001-01-11 12:52:07 +000080 HTTP, HTTPS, FTP, GOPHER, LDAP, DICT, TELNET and FILE.
Daniel Stenbergc3318b42000-08-17 14:06:42 +000081
Daniel Stenberg7d09e512001-01-11 12:52:07 +000082 We spell it cURL or just curl.
Daniel Stenberg887e7282001-01-03 09:13:07 +000083
Daniel Stenbergc3318b42000-08-17 14:06:42 +000084 1.2 What is libcurl?
85
Daniel Stenberga3eb91f2001-01-15 14:59:07 +000086 libcurl is a reliable, higly portable multiprotocol file transfer library.
Daniel Stenbergc3318b42000-08-17 14:06:42 +000087
88 Any application is free to use libcurl, even commercial or closed-source
Daniel Stenberg9012f8c2001-01-15 10:28:41 +000089 ones.
Daniel Stenbergc3318b42000-08-17 14:06:42 +000090
91 1.3 What is cURL not?
Daniel Stenberge9640b62000-08-02 07:17:56 +000092
Daniel Stenbergc3318b42000-08-17 14:06:42 +000093 Curl is *not*, I repeat, *not* a wget clone even though that is a very
94 common misconception. Never, during curl's development, have I intended curl
95 to replace wget or compete on its market. Curl is targeted at single-shot
96 file transfers.
Daniel Stenbergef34ad22000-06-02 12:45:23 +000097
Daniel Stenbergc3318b42000-08-17 14:06:42 +000098 Curl is not a web site mirroring program. If you wanna use curl to mirror
99 something: fine, go ahead and write a script that wraps around curl to make
100 it reality (like curlmirror.pl does).
Daniel Stenbergef34ad22000-06-02 12:45:23 +0000101
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000102 Curl is not an ftp site mirroring program. Sure, get and send ftp with curl
103 but if you want systematic and sequential behaviour you should write a
104 script (or write a new program that interfaces libcurl) and do it.
105
106 Curl is not a PHP tool, even though it works perfectly well when used from
107 or with PHP.
108
Daniel Stenberg31b8eea2000-08-23 07:27:00 +0000109 Curl is not a single-OS program. Curl exists, compiles, builds and runs
Daniel Stenbergc59baa02001-02-12 10:05:09 +0000110 under a wide range of operating systems, including all modern Unixes (and a
111 bunch of older ones too), Windows, Amiga, BeOS, OS/2, OS X, QNX etc.
Daniel Stenberg31b8eea2000-08-23 07:27:00 +0000112
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000113 1.4 When will you make curl do XXXX ?
114
115 I love suggestions of what to change in order to make curl and libcurl
116 better. I do however believe in a few rules when it comes to the future of
117 curl:
118
119 * It is to remain a command line tool. If you want GUIs or fancy scripting
120 capabilities, you're free to write another tool that uses libcurl and that
121 offers this. There's no point in having one single tool that does every
122 imaginable thing. That's also one of the great advantages of having the
123 core of curl as a library: libcurl.
124
125 * I do not add things to curl that other small and available tools already
126 do very fine at the side. Curl's output is fine to pipe into another
127 program or redirect to another file for the next program to interpret.
128
129 * I focus on protocol related issues and improvements. If you wanna do more
Daniel Stenberg5f8e93d2000-10-25 07:41:58 +0000130 magic with the supported protocols than curl currently does, chances are
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000131 big I will agree. If you wanna add more protocols, I may very well
132 agree.
133
134 * If you want me to make all the work while you wait for me to implement it
135 for you, that is not a very friendly attitude. I spend a considerable time
136 already on maintaining and developing curl. In order to get more out of
137 me, I trust you will offer some of your time and efforts in return.
138
139 * If you write the code, chances are bigger that it will get into curl
140 faster.
141
1422. Install Related Problems
143
144 2.1. configure doesn't find OpenSSL even when it is installed
Daniel Stenberg7c37c6a2000-05-22 17:35:35 +0000145
Daniel Stenbergef34ad22000-06-02 12:45:23 +0000146 This may be because of several reasons.
Daniel Stenberg7c37c6a2000-05-22 17:35:35 +0000147
Daniel Stenberg09ba8562000-10-27 12:25:00 +0000148 2.1.1. native linker doesn't find openssl
Daniel Stenberg7c37c6a2000-05-22 17:35:35 +0000149
Daniel Stenbergbfb16902000-08-17 11:42:59 +0000150 Affected platforms:
151 Solaris (native cc compiler)
152 HPUX (native cc compiler)
153 SGI IRIX (native cc compiler)
Daniel Stenberg13962ad2000-09-28 10:26:44 +0000154 SCO UNIX (native cc compiler)
Daniel Stenberg7c37c6a2000-05-22 17:35:35 +0000155
Daniel Stenbergef34ad22000-06-02 12:45:23 +0000156 When configuring curl, I specify --with-ssl. OpenSSL is installed in
157 /usr/local/ssl Configure reports SSL in /usr/local/ssl, but fails to find
158 CRYPTO_lock in -lcrypto
Daniel Stenberg7c37c6a2000-05-22 17:35:35 +0000159
Daniel Stenbergef34ad22000-06-02 12:45:23 +0000160 Cause: The cc for this test places the -L/usr/local/ssl/lib AFTER
161 -lcrypto, so ld can't find the library. This is due to a bug in the GNU
162 autoconf tool.
163
164 Workaround: Specifying "LDFLAGS=-L/usr/local/ssl/lib" in front of
165 ./configure places the -L/usr/local/ssl/lib early enough in the command
166 line to make things work
167
Daniel Stenbergbfb16902000-08-17 11:42:59 +0000168 Solution submitted by: Bob Allison <allisonb@users.sourceforge.net>
Daniel Stenbergef34ad22000-06-02 12:45:23 +0000169
Daniel Stenberg09ba8562000-10-27 12:25:00 +0000170 2.1.2. only the libssl lib is missing
Daniel Stenbergef34ad22000-06-02 12:45:23 +0000171
172 If all include files and the libcrypto lib is present, with only the
173 libssl being missing according to configure, this is mostly likely because
174 a few functions are left out from the libssl.
175
176 If the function names missing include RSA or RSAREF you can be certain
177 that this is because libssl requires the RSA and RSASEF libs to build.
178
179 See the INSTALL file section that explains how to add those libs to
180 configure. Make sure that you remove the config.cache file before you
181 rerun configure with the new flags.
182
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000183 2.2. Does curl work/build with other SSL libraries?
Daniel Stenberge9640b62000-08-02 07:17:56 +0000184
185 Curl has been written to use OpenSSL, although I doubt there would be much
186 problems using a different library. I just don't know any other free one and
187 that has limited my possibilities to develop against anything else.
188
189 If anyone does "port" curl to use a commercial SSL library, I am of course
190 very interested in getting the patch!
191
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000192 2.3. Where can I find a copy of LIBEAY32.DLL?
Daniel Stenberge9640b62000-08-02 07:17:56 +0000193
194 That is an OpenSSL binary built for Windows.
195
196 Curl uses OpenSSL to do the SSL stuff. The LIBEAY32.DLL is what curl needs
197 on a windows machine to do https://. Check out the curl web page to find
198 accurate and up-to-date pointers to recent OpenSSL DDLs and other binary
199 packages.
200
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000201 2.4. Does cURL support Socks (RFC 1928) ?
Daniel Stenberge9640b62000-08-02 07:17:56 +0000202
203 No. Nobody has wanted it that badly yet. I would appriciate patches that
204 brings this functionality.
205
206
Daniel Stenbergc3318b42000-08-17 14:06:42 +00002073. Usage problems
Daniel Stenberge9640b62000-08-02 07:17:56 +0000208
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000209 3.1. curl: (1) SSL is disabled, https: not supported
Daniel Stenberge9640b62000-08-02 07:17:56 +0000210
211 If you get this output when trying to get anything from a https:// server,
212 it means that the configure script couldn't find all libs and include files
213 it requires for SSL to work. If the configure script fails to find them,
214 curl is simply built without SSL support.
215
216 To get the https:// support into a curl that was previously built but that
217 reports that https:// is not supported, you should dig through the document
218 and logs and check out why the configure script doesn't find the SSL libs
219 and/or include files.
220
221 Also, check out the other paragraph in this FAQ labeled "configure doesn't
222 find OpenSSL even when it is installed".
223
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000224 3.2. How do I tell curl to resume a transfer?
Daniel Stenberge9640b62000-08-02 07:17:56 +0000225
226 Curl supports resume both ways on FTP, download ways on HTTP.
227
Daniel Stenberg887e7282001-01-03 09:13:07 +0000228 Try the -C option.
Daniel Stenberge9640b62000-08-02 07:17:56 +0000229
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000230 3.3. Why doesn't my posting using -F work?
Daniel Stenberge9640b62000-08-02 07:17:56 +0000231
232 You can't simply use -F or -d at your choice. The web server that will
233 receive your post assumes one of the formats. If the form you're trying to
Daniel Stenbergc59baa02001-02-12 10:05:09 +0000234 "fake" sets the type to 'multipart/form-data', then and only then you must
Daniel Stenberge9640b62000-08-02 07:17:56 +0000235 use the -F type. In all the most common cases, you should use -d which then
236 causes a posting with the type 'application/x-www-form-urlencoded'.
237
238 I have described this in some detail in the README.curl file, and if you
239 don't understand it the first time, read it again before you post questions
240 about this to the mailing list. I would also suggest that you read through
241 the mailing list archives for old postings and questions regarding this.
242
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000243 3.4. How do I tell curl to run custom FTP commands?
Daniel Stenberge9640b62000-08-02 07:17:56 +0000244
245 You can tell curl to perform optional commands both before and/or after a
246 file transfer. Study the -Q/--quote option.
247
248 Since curl is used for file transfers, you don't use curl to just perform
249 ftp commands without transfering anything. Therefore you must always specify
250 a URL to transfer to/from even when doing custom FTP commands.
251
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000252 3.5. How can I disable the Pragma: nocache header?
Daniel Stenberge9640b62000-08-02 07:17:56 +0000253
254 You can change all internally generated headers by adding a replacement with
255 the -H/--header option. By adding a header with empty contents you safely
256 disable that one. Use -H "Pragma:" to disable that specific header.
257
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000258 3.6. Does curl support javascript, ASP, XML, XHTML or HTML version Y?
Daniel Stenberge9640b62000-08-02 07:17:56 +0000259
260 To curl, all contents are alike. It doesn't matter how the page was
261 generated. It may be ASP, PHP, perl, shell-script, SSI or plain
262 HTML-files. There's no difference to curl and it doesn't even know what kind
263 of language that generated the page.
264
265 Javascript is slightly different since that is code embedded in the HTML
266 that is sent for the client to interpret and curl has no javascript
267 interpreter.
268
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000269 3.7. Can I use curl to delete/rename a file through FTP?
Daniel Stenberge9640b62000-08-02 07:17:56 +0000270
271 Yes. You specify custom ftp commands with -Q/--quote.
272
273 One example would be to delete a file after you have downloaded it:
274
275 curl -O ftp://download.com/coolfile -Q '-DELE coolfile'
276
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000277 3.8 How do I tell curl to follow HTTP redirects?
Daniel Stenberge9640b62000-08-02 07:17:56 +0000278
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000279 Curl does not follow so-called redirects by default. The Location: header
280 that informs the client about this is only interpreted if you're using the
281 -L/--location option. As in:
Daniel Stenberge9640b62000-08-02 07:17:56 +0000282
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000283 curl -L http://redirector.com
284
Daniel Stenbergbd0bd352001-01-29 10:16:47 +0000285 3.9 How do I use curl in PHP?
Daniel Stenberg368e3522001-01-29 10:16:21 +0000286
287 PHP4 has the ability to use libcurl as an internal module if built with that
288 option enabled. You then get a set of extra functions that can be used
289 within your PHP programs. You find all details about those functions in the
290 curl section in the PHP manual, see the online version at:
291
292 http://www.php.net/manual/ref.curl.php
293
294 PHP also offers the option to run a command line, and then you can of course
295 invoke the curl tool using a command line. This is the way to use curl if
296 you're using PHP3 or PHP4 built without curl module support.
297
Daniel Stenbergc59baa02001-02-12 10:05:09 +0000298 3.10 What about SOAP, WEBDAV, XML-RPC or similar protocols over HTTP?
299
300 Curl adheres to the HTTP spec, which basically means you can play with *any*
301 protocol that is built ontop of HTTP. Protocols such as SOAP, WEBDAV and
302 XML-RPC are all such ones. You can use -X to set custom requests and -H to
303 set custom headers (or replace internally generated ones).
304
305 Using libcurl or PHP's curl modules is just as fine and you'd just use the
306 proper library options to do the same.
307
Daniel Stenbergc3318b42000-08-17 14:06:42 +00003084. Running Problems
309
310 4.1. Problems connecting to SSL servers.
Daniel Stenberge9640b62000-08-02 07:17:56 +0000311
312 It took a very long time before I could sort out why curl had problems
313 to connect to certain SSL servers when using SSLeay or OpenSSL v0.9+.
314 The error sometimes showed up similar to:
315
316 16570:error:1407D071:SSL routines:SSL2_READ:bad mac decode:s2_pkt.c:233:
317
318 It turned out to be because many older SSL servers don't deal with SSLv3
319 requests properly. To correct this problem, tell curl to select SSLv2 from
320 the command line (-2/--sslv2).
321
322 I have also seen examples where the remote server didn't like the SSLv2
323 request and instead you had to force curl to use SSLv3 with -3/--sslv3.
324
Daniel Stenberge26ee092001-01-15 10:26:37 +0000325 4.2. Why do I get problems when I use & or % in the URL?
Daniel Stenberg29470102000-06-02 13:32:01 +0000326
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000327 In general unix shells, the & letter is treated special and when used it
328 runs the specified command in the background. To safely send the & as a part
329 of a URL, you should qoute the entire URL by using single (') or double (")
330 quotes around it.
Daniel Stenberg29470102000-06-02 13:32:01 +0000331
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000332 An example that would invoke a remote CGI that uses &-letters could be:
Daniel Stenberg8f037322000-06-06 14:09:01 +0000333
Daniel Stenbergedcd5df2000-06-06 14:13:36 +0000334 curl 'http://www.altavista.com/cgi-bin/query?text=yes&q=curl'
Daniel Stenberg8f037322000-06-06 14:09:01 +0000335
Daniel Stenberge26ee092001-01-15 10:26:37 +0000336 In win32, the standard DOS shell treats the %-letter specially and you may
337 need to quote the string properly when % is used in it.
338
Daniel Stenberg1b77c182001-01-29 10:24:51 +0000339 Also note that if you want the literal %-letter to be part of the data you
340 pass in a POST using -d/--data you must encode it as '%25'.
341
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000342 4.3. How can I use {, }, [ or ] to specify multiple URLs?
Daniel Stenberg29470102000-06-02 13:32:01 +0000343
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000344 Because those letters have a special meaning to the shell, and to be used in
345 a URL specified to curl you must quote them.
Daniel Stenberg29470102000-06-02 13:32:01 +0000346
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000347 An example that downloads two URLs (sequentially) would do:
Daniel Stenberg8f037322000-06-06 14:09:01 +0000348
Daniel Stenbergedcd5df2000-06-06 14:13:36 +0000349 curl '{curl,www}.haxx.se'
Daniel Stenberg8f037322000-06-06 14:09:01 +0000350
Daniel Stenberge26ee092001-01-15 10:26:37 +0000351 To be able to use those letters as actual parts of the URL (without using
352 them for the curl URL "globbing" system), use the -g/--globoff option
353 (included in curl 7.6 and later):
354
355 curl -g 'www.site.com/weirdname[].html'
356
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000357 4.4. Why do I get downloaded data even though the web page doesn't exist?
Daniel Stenberg29470102000-06-02 13:32:01 +0000358
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000359 Curl asks remote servers for the page you specify. If the page doesn't exist
360 at the server, the HTTP protocol defines how the server should respond and
361 that means that headers and a "page" will be returned. That's simply how
362 HTTP works.
Daniel Stenberg29470102000-06-02 13:32:01 +0000363
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000364 By using the --fail option you can tell curl explicitly to not get any data
365 if the HTTP return code doesn't say success.
Daniel Stenberg8f037322000-06-06 14:09:01 +0000366
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000367 4.5 Why do I get return code XXX from a HTTP server?
Daniel Stenberg29470102000-06-02 13:32:01 +0000368
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000369 RFC2616 clearly explains the return codes. I'll make a short transcript
370 here. Go read the RFC for exact details:
Daniel Stenberg29470102000-06-02 13:32:01 +0000371
Daniel Stenberg09ba8562000-10-27 12:25:00 +0000372 4.5.1 "400 Bad Request"
Daniel Stenberg29470102000-06-02 13:32:01 +0000373
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000374 The request could not be understood by the server due to malformed
375 syntax. The client SHOULD NOT repeat the request without modifications.
376
Daniel Stenberg09ba8562000-10-27 12:25:00 +0000377 4.5.2 "401 Unauthorized"
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000378
379 The request requires user authentication.
380
Daniel Stenberg09ba8562000-10-27 12:25:00 +0000381 4.5.3 "403 Forbidden"
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000382
383 The server understood the request, but is refusing to fulfill it.
384 Authorization will not help and the request SHOULD NOT be repeated.
385
Daniel Stenberg09ba8562000-10-27 12:25:00 +0000386 4.5.4 "404 Not Found"
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000387
388 The server has not found anything matching the Request-URI. No indication
389 is given of whether the condition is temporary or permanent.
390
Daniel Stenberg09ba8562000-10-27 12:25:00 +0000391 4.5.5 "405 Method Not Allowed"
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000392
393 The method specified in the Request-Line is not allowed for the resource
394 identified by the Request-URI. The response MUST include an Allow header
395 containing a list of valid methods for the requested resource.
396
397 4.6. Can you tell me what error code 142 means?
Daniel Stenberg29470102000-06-02 13:32:01 +0000398
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000399 All error codes that are larger than the highest documented error code means
Daniel Stenberg887e7282001-01-03 09:13:07 +0000400 that curl has existed due to a timeout. There was no nice way for curl to
401 abort from such a condition and that's why it got this undocumented
402 error. This should not occur in releases after 7.4.1.
Daniel Stenberg29470102000-06-02 13:32:01 +0000403
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000404 4.7. How do I keep usernames and passwords secret in Curl command lines?
Daniel Stenberg29470102000-06-02 13:32:01 +0000405
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000406 I see this problem as two parts:
Daniel Stenberg29470102000-06-02 13:32:01 +0000407
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000408 The first part is to avoid having clear-text passwords in the command line
409 so that they don't appear in 'ps' outputs and similar. That is easily
410 avoided by using the "-K" option tho tell curl to read parameters from a
411 file or stdin to which you can pass the secret info.
Daniel Stenberg29470102000-06-02 13:32:01 +0000412
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000413 To keep the passwords in your account secret from the rest of the world is
414 not a task that curl addresses. You could of course encrypt them somehow to
415 at least hide them from being read by human eyes, but that is not what
416 anyone would call security.
Daniel Stenberg29470102000-06-02 13:32:01 +0000417
Daniel Stenberg887e7282001-01-03 09:13:07 +0000418 Also note that regular HTTP and FTP passwords are sent in clear across the
419 network. All it takes for anyone to fetch them is to listen on the network.
420 Evesdropping is very easy.
421
Daniel Stenberg09ba8562000-10-27 12:25:00 +0000422 4.8 I found a bug!
423
424 It is not a bug if the behaviour is documented. Read the docs first.
425
426 If it is a problem with a binary you've downloaded or a package for your
427 particular platform, try contacting the person who built the package/archive
428 you have.
429
430 If there is a bug, post a bug report in the Curl Bug Track System over at
Daniel Stenberg9012f8c2001-01-15 10:28:41 +0000431 http://sourceforge.net/bugs/?group_id=976
Daniel Stenberg09ba8562000-10-27 12:25:00 +0000432
433 Always include as many details you can think of, including curl version,
434 operating system name and version and complete instructions how to repeat
435 the bug.
436
Daniel Stenberg2c100372000-12-19 07:30:51 +0000437 4.9. Curl can't authenticate to the server that requires NTLM?
438
439 NTLM is a Microsoft proprietary protocol. Unfortunately, curl does not
Daniel Stenbergc59baa02001-02-12 10:05:09 +0000440 currently support that. Proprietary formats are evil. You should not use
441 such ones.
Daniel Stenberg29470102000-06-02 13:32:01 +0000442
Daniel Stenbergc3318b42000-08-17 14:06:42 +00004435. libcurl Issues
Daniel Stenberg29470102000-06-02 13:32:01 +0000444
Daniel Stenberg7d09e512001-01-11 12:52:07 +0000445 5.1. Is libcurl thread-safe?
Daniel Stenberg29470102000-06-02 13:32:01 +0000446
Daniel Stenberg7d09e512001-01-11 12:52:07 +0000447 Yes.
448
449 We have written the libcurl code specificly adjusted for multi-threaded
450 programs. libcurl will use thread-safe functions instead of non-safe ones if
451 your system has such.
Daniel Stenberg29470102000-06-02 13:32:01 +0000452
Daniel Stenberge9640b62000-08-02 07:17:56 +0000453 I am very interested in once and for all getting some kind of report or
454 README file from those who have used libcurl in a threaded environment,
455 since I haven't and I get this question more and more frequently!
Daniel Stenberg29470102000-06-02 13:32:01 +0000456
Daniel Stenberga40b55d2000-11-22 07:27:26 +0000457 5.2 How can I receive all data into a large memory chunk?
458
459 You are in full control of the callback function that gets called every time
460 there is data received from the remote server. You can make that callback do
461 whatever you want. You do not have to write the receivied data to a file.
462
463 One solution to this problem could be to have a pointer to a struct that you
464 pass to the callback function. You set the pointer using the
465 curl_easy_setopt(CURLOPT_FILE) function. Then that pointer will be passed to
466 the callback instead of a FILE * to a file:
467
468 /* imaginary struct */
469 struct MemoryStruct {
470 char *memory;
471 size_t size;
472 };
473
474 /* imaginary callback function */
475 size_t
476 WriteMemoryCallback(void *ptr, size_t size, size_t nmemb, void *data)
477 {
478 register int realsize = size * nmemb;
479 struct MemoryStruct *mem = (struct MemoryStruct *)data;
480
481 mem->memory = (char *)realloc(mem->memory, mem->size + realsize + 1);
482 if (mem->memory) {
483 memcpy(&(mem->memory[mem->size]), ptr, realsize);
484 mem->size += realsize;
485 mem->memory[mem->size] = 0;
486 }
487 return realsize;
488 }
489
Daniel Stenberg2c100372000-12-19 07:30:51 +0000490 5.3 How do I fetch multiple files with libcurl?
Daniel Stenbergec5ac822000-12-14 08:37:09 +0000491
492 The easy interface of libcurl does not support multiple requests using the
493 same connection. The only available way to do multiple requests is to
494 init/perform/cleanup for each request.
Daniel Stenberga40b55d2000-11-22 07:27:26 +0000495
Daniel Stenberg910fc852000-12-30 11:48:51 +0000496 5.4 Does libcurl do Winsock initing on win32 systems?
497
498 No.
499
500 On win32 systems, you need to init the winsock stuff manually, libcurl will
501 not do that for you. WSAStartup() and WSACleanup() should be used
502 accordingly. The reason for this is of course that a single application may
503 use several different libraries and parts, and there's no reason for every
504 single library to do this.
505
Daniel Stenberg5d7b32d2001-02-04 20:08:42 +0000506 5.5 Does CURLOPT_FILE and CURLOPT_INFILE work on win32 ?
Daniel Stenberg41084e52001-01-22 08:42:00 +0000507
508 Yes, but you cannot open a FILE * and pass the pointer to a DLL and have
Daniel Stenberg5d7b32d2001-02-04 20:08:42 +0000509 that DLL use the FILE *. If you set CURLOPT_FILE you must also use
510 CURLOPT_WRITEFUNCTION as well to set a function that writes the file, even
511 if that simply writes the data to the specified FILE*. Similarly, if you use
512 CURLOPT_INFILE you must also specify CURLOPT_READFUNCTION.
Daniel Stenberg41084e52001-01-22 08:42:00 +0000513
Daniel Stenberg5d7b32d2001-02-04 20:08:42 +0000514 (Provided by Joel DeYoung and Bob Schader)
Daniel Stenberg41084e52001-01-22 08:42:00 +0000515
Daniel Stenberg6dc5c6f2001-01-27 20:51:31 +0000516 5.6 What about Keep-Alive or persistant connections?
517
518 This is closely related to issue 5.3. Since libcurl has no real support
519 for doing multiple file transfers, there's no support for Keep-Alive or
520 persistant connections either.
521
522 This is of course subject to change as soon as libcurl gets support for
523 multiple files. Feel free to join in and make this change happen sooner!
524
Daniel Stenbergc3318b42000-08-17 14:06:42 +00005256. License Issues
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000526
Daniel Stenbergc59baa02001-02-12 10:05:09 +0000527 NOTE: This section concerns curl 7.5.2 or later!
Daniel Stenberg0d181b52001-01-04 12:43:53 +0000528
529 Curl and libcurl are released under a MIT/X derivate license *or* the MPL,
530 the Mozilla Public License. To get a really good answer to your license
531 conflict questions, you should study the MPL and MIT/X licenses and the
532 license you are about to use and check for clashes yourself. This section is
533 just a brief summary for the cases we get the most questions. (Parts of this
534 section was much enhanced by Bjorn Reese.)
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000535
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000536 6.1. I have a GPL program, can I use the libcurl library?
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000537
Daniel Stenberg0d181b52001-01-04 12:43:53 +0000538 Yes!
Daniel Stenberg7d1ef962000-08-14 06:31:59 +0000539
Daniel Stenberg0d181b52001-01-04 12:43:53 +0000540 Since libcurl may be distributed under the MIT/X derivate license, it can be
541 used together with GPL in any software.
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000542
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000543 6.2. I have a closed-source program, can I use the libcurl library?
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000544
Daniel Stenbergc59baa02001-02-12 10:05:09 +0000545 Yes!
Daniel Stenberg0d181b52001-01-04 12:43:53 +0000546
Daniel Stenbergc59baa02001-02-12 10:05:09 +0000547 libcurl does not put any restrictions on the program that uses the library.
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000548
Daniel Stenberg31b8eea2000-08-23 07:27:00 +0000549 6.3. I have a BSD licensed program, can I use the libcurl library?
550
Daniel Stenbergc59baa02001-02-12 10:05:09 +0000551 Yes!
Daniel Stenberg0d181b52001-01-04 12:43:53 +0000552
Daniel Stenbergc59baa02001-02-12 10:05:09 +0000553 libcurl does not put any restrictions on the program that uses the library.
Daniel Stenberg31b8eea2000-08-23 07:27:00 +0000554
555 6.4. I have a program that uses LGPL libraries, can I use libcurl?
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000556
Daniel Stenbergc59baa02001-02-12 10:05:09 +0000557 Yes!
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000558
Daniel Stenbergc59baa02001-02-12 10:05:09 +0000559 The LGPL license doesn't clash with other licenses.
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000560
Daniel Stenberg31b8eea2000-08-23 07:27:00 +0000561 6.5. Can I modify curl/libcurl for my program and keep the changes secret?
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000562
Daniel Stenbergc59baa02001-02-12 10:05:09 +0000563 Yes!
Daniel Stenberg0d181b52001-01-04 12:43:53 +0000564
565 The MIT/X derivate license practically allows you to do almost anything with
566 the sources, on the condition that the copyright texts in the sources are
567 left intact.
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000568
Daniel Stenberg31b8eea2000-08-23 07:27:00 +0000569 6.6. Can you please change the curl/libcurl license to XXXX?
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000570
Daniel Stenbergc59baa02001-02-12 10:05:09 +0000571 No.
572
573 We carefully picked this license years ago and a large amount of people have
574 contributed with source code knowing that this is the license we use. This
575 license puts the restrictions we want on curl/libcurl and it does not spread
576 to other programs or libraries that use it. The recent dual license
577 modification should make it possible for everyone to use libcurl or curl in
578 their projects, no matter what license they already have in use.