blob: 0a4fe4384fd1a44f90623a2d6e16b99d1329f23e [file] [log] [blame]
Daniel Stenbergeea22872004-03-16 07:56:51 +00001 _ _ ____ _
2 ___| | | | _ \| |
3 / __| | | | |_) | |
4 | (__| |_| | _ <| |___
Daniel Stenberg7c37c6a2000-05-22 17:35:35 +00005 \___|\___/|_| \_\_____|
6
7FAQ
8
Daniel Stenbergc3318b42000-08-17 14:06:42 +00009 1. Philosophy
10 1.1 What is cURL?
11 1.2 What is libcurl?
Daniel Stenbergc3688002004-10-04 12:54:58 +000012 1.3 What is curl not?
Daniel Stenbergc3318b42000-08-17 14:06:42 +000013 1.4 When will you make curl do XXXX ?
Daniel Stenbergc3688002004-10-04 12:54:58 +000014 1.5 Who makes curl?
15 1.6 What do you get for making curl?
Daniel Stenbergc528dc52001-08-07 11:17:37 +000016 1.7 What about CURL from curl.com?
Antoine Pietrib341b762022-01-27 02:12:50 +010017 1.8 I have a problem, who do I mail?
Daniel Stenberg9a44fa82005-11-02 09:34:53 +000018 1.9 Where do I buy commercial support for curl?
19 1.10 How many are using curl?
Daniel Stenberga28464a2021-10-31 16:34:44 +010020 1.11 Why do you not update ca-bundle.crt
Antoine Pietrib341b762022-01-27 02:12:50 +010021 1.12 I have a problem, who can I chat with?
Daniel Stenberg59842d42010-08-18 16:54:11 +020022 1.13 curl's ECCN number?
Daniel Stenberga5f96b42010-10-06 20:03:13 +020023 1.14 How do I submit my patch?
Daniel Stenbergf81d3562015-05-26 19:13:09 +020024 1.15 How do I port libcurl to my OS?
Daniel Stenberg7c37c6a2000-05-22 17:35:35 +000025
Daniel Stenbergc3318b42000-08-17 14:06:42 +000026 2. Install Related Problems
Daniel Stenberg490879e2020-11-05 13:06:00 +010027 2.1 configure fails when using static libraries
Daniel Stenbergc3318b42000-08-17 14:06:42 +000028 2.2 Does curl work/build with other SSL libraries?
Dan Fandrich5c9fff92009-01-30 18:28:29 +000029 2.4 Does curl support SOCKS (RFC 1928) ?
Daniel Stenberg7c37c6a2000-05-22 17:35:35 +000030
Daniel Stenbergc3318b42000-08-17 14:06:42 +000031 3. Usage Problems
32 3.1 curl: (1) SSL is disabled, https: not supported
33 3.2 How do I tell curl to resume a transfer?
Daniel Stenberga28464a2021-10-31 16:34:44 +010034 3.3 Why does my posting using -F not work?
Daniel Stenbergc3318b42000-08-17 14:06:42 +000035 3.4 How do I tell curl to run custom FTP commands?
Dan Fandrichb3740f02011-06-02 18:41:57 -070036 3.5 How can I disable the Accept: */* header?
Daniel Stenberg48bc73c2002-05-21 13:53:32 +000037 3.6 Does curl support ASP, XML, XHTML or HTML version Y?
Daniel Stenbergc3318b42000-08-17 14:06:42 +000038 3.7 Can I use curl to delete/rename a file through FTP?
39 3.8 How do I tell curl to follow HTTP redirects?
Daniel Stenberg98871d12002-05-22 22:14:03 +000040 3.9 How do I use curl in my favorite programming language?
Daniel Stenberg147a6732001-03-08 09:25:09 +000041 3.10 What about SOAP, WebDAV, XML-RPC or similar protocols over HTTP?
Daniel Stenberg88d14e92001-05-29 14:02:20 +000042 3.11 How do I POST with a different Content-Type?
dbrowndan84086b32019-05-23 15:05:29 -070043 3.12 Why do FTP-specific features over HTTP proxy fail?
44 3.13 Why do my single/double quotes fail?
Dan Fandrich5c9fff92009-01-30 18:28:29 +000045 3.14 Does curl support Javascript or PAC (automated proxy config)?
Daniel Stenbergf3e5d4a2003-12-22 17:24:21 +000046 3.15 Can I do recursive fetches with curl?
Daniel Stenbergedd16d92004-08-12 11:39:00 +000047 3.16 What certificates do I need when I use SSL?
Daniel Stenberg951fdeb2004-12-21 09:37:55 +000048 3.17 How do I list the root dir of an FTP server?
Daniel Stenberge9eb5232005-04-05 14:36:37 +000049 3.18 Can I use curl to send a POST/PUT and not wait for a response?
Daniel Stenberg64f12a32010-09-07 19:05:07 +020050 3.19 How do I get HTTP from a host using a specific IP address?
Daniel Stenberg3f7b7de2011-03-07 22:27:26 +010051 3.20 How to SFTP from my user's home directory?
Daniel Stenberg0d0f8082011-03-08 11:15:59 +010052 3.21 Protocol xxx not supported or disabled in libcurl
Daniel Stenberg0ed4a092013-01-21 14:33:12 +010053 3.22 curl -X gives me HTTP problems
Daniel Stenberg7c37c6a2000-05-22 17:35:35 +000054
Daniel Stenbergc3318b42000-08-17 14:06:42 +000055 4. Running Problems
Daniel Stenberge26ee092001-01-15 10:26:37 +000056 4.2 Why do I get problems when I use & or % in the URL?
Daniel Stenbergc3318b42000-08-17 14:06:42 +000057 4.3 How can I use {, }, [ or ] to specify multiple URLs?
Daniel Stenberga28464a2021-10-31 16:34:44 +010058 4.4 Why do I get downloaded data even though the web page does not exist?
Daniel Stenberg3a4182d2022-03-29 13:58:11 +020059 4.5 Why do I get return code XXX from an HTTP server?
Daniel Stenbergc3318b42000-08-17 14:06:42 +000060 4.5.1 "400 Bad Request"
61 4.5.2 "401 Unauthorized"
62 4.5.3 "403 Forbidden"
63 4.5.4 "404 Not Found"
64 4.5.5 "405 Method Not Allowed"
Daniel Stenbergd60029d2001-12-19 23:25:04 +000065 4.5.6 "301 Moved Permanently"
Daniel Stenbergc3318b42000-08-17 14:06:42 +000066 4.6 Can you tell me what error code 142 means?
Daniel Stenberg490879e2020-11-05 13:06:00 +010067 4.7 How do I keep user names and passwords secret in curl command lines?
Daniel Stenberge30b2062021-12-09 12:03:35 +010068 4.8 I found a bug
Daniel Stenberga28464a2021-10-31 16:34:44 +010069 4.9 curl cannot authenticate to the server that requires NTLM?
Daniel Stenberge30b2062021-12-09 12:03:35 +010070 4.10 My HTTP request using HEAD, PUT or DELETE does not work
dbrowndan84086b32019-05-23 15:05:29 -070071 4.11 Why do my HTTP range requests return the full document?
Daniel Stenberg16077112002-11-20 19:17:43 +000072 4.12 Why do I get "certificate verify failed" ?
Daniel Stenberg1dc0ce92005-06-13 18:33:40 +000073 4.13 Why is curl -R on Windows one hour off?
Daniel Stenberge30b2062021-12-09 12:03:35 +010074 4.14 Redirects work in browser but not with curl
Daniel Stenberga28464a2021-10-31 16:34:44 +010075 4.15 FTPS does not work
Daniel Stenberge30b2062021-12-09 12:03:35 +010076 4.16 My HTTP POST or PUT requests are slow
Daniel Stenberg2afb88e2009-02-23 21:21:00 +000077 4.17 Non-functional connect timeouts on Windows
Daniel Stenbergb8012ea2009-11-07 21:52:41 +000078 4.18 file:// URLs containing drive letters (Windows, NetWare)
Daniel Stenberga28464a2021-10-31 16:34:44 +010079 4.19 Why does not curl return an error when the network cable is unplugged?
Daniel Stenberge30b2062021-12-09 12:03:35 +010080 4.20 curl does not return error for HTTP non-200 responses
Daniel Stenberg7c37c6a2000-05-22 17:35:35 +000081
Daniel Stenbergc3318b42000-08-17 14:06:42 +000082 5. libcurl Issues
Daniel Stenberg7d09e512001-01-11 12:52:07 +000083 5.1 Is libcurl thread-safe?
Daniel Stenberga40b55d2000-11-22 07:27:26 +000084 5.2 How can I receive all data into a large memory chunk?
Daniel Stenberg2c100372000-12-19 07:30:51 +000085 5.3 How do I fetch multiple files with libcurl?
Dan Fandrich2a264d42020-12-12 09:59:10 -080086 5.4 Does libcurl do Winsock initialization on win32 systems?
Daniel Stenberg7e3cd822003-12-08 13:59:35 +000087 5.5 Does CURLOPT_WRITEDATA and CURLOPT_READDATA work on win32 ?
Daniel Stenberg4c485992001-04-22 15:45:27 +000088 5.6 What about Keep-Alive or persistent connections?
Daniel Stenberge30b2062021-12-09 12:03:35 +010089 5.7 Link errors when building libcurl on Windows
Daniel Stenberg9754b202010-08-11 09:15:43 +020090 5.8 libcurl.so.X: open failed: No such file or directory
Daniel Stenberg1d323362004-08-12 14:09:10 +000091 5.9 How does libcurl resolve host names?
Daniel Stenberge9eb5232005-04-05 14:36:37 +000092 5.10 How do I prevent libcurl from writing the response to stdout?
Daniel Stenberg6e8e0412005-04-05 14:38:38 +000093 5.11 How do I make libcurl not receive the whole HTTP response?
Daniel Stenbergb5d50e92005-04-11 13:39:55 +000094 5.12 Can I make libcurl fake or hide my real IP address?
Daniel Stenberg24602ed2007-12-10 10:28:56 +000095 5.13 How do I stop an ongoing transfer?
Daniel Stenberg22059852008-09-24 07:39:42 +000096 5.14 Using C++ non-static functions for callbacks?
Yang Tsea07bc792010-02-14 19:40:18 +000097 5.15 How do I get an FTP directory listing?
Daniel Stenberge30b2062021-12-09 12:03:35 +010098 5.16 I want a different time-out
Daniel Stenbergdbf93a82013-01-03 10:15:02 +010099 5.17 Can I write a server with libcurl?
Daniel Stenberg1495f422014-05-08 09:30:35 +0200100 5.18 Does libcurl use threads?
Daniel Stenberg7c37c6a2000-05-22 17:35:35 +0000101
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000102 6. License Issues
103 6.1 I have a GPL program, can I use the libcurl library?
104 6.2 I have a closed-source program, can I use the libcurl library?
Daniel Stenberg31b8eea2000-08-23 07:27:00 +0000105 6.3 I have a BSD licensed program, can I use the libcurl library?
106 6.4 I have a program that uses LGPL libraries, can I use libcurl?
107 6.5 Can I modify curl/libcurl for my program and keep the changes secret?
108 6.6 Can you please change the curl/libcurl license to XXXX?
Dan Fandrich5c9fff92009-01-30 18:28:29 +0000109 6.7 What are my obligations when using libcurl in my commercial apps?
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000110
Daniel Stenberg9ac76292004-08-18 11:18:36 +0000111 7. PHP/CURL Issues
112 7.1 What is PHP/CURL?
Daniel Stenberge38a7882011-03-17 11:30:29 +0100113 7.2 Who wrote PHP/CURL?
Daniel Stenberg9ac76292004-08-18 11:18:36 +0000114 7.3 Can I perform multiple requests using the same handle?
Daniel Stenberg6d496952017-05-12 19:58:06 +0200115 7.4 Does PHP/CURL have dependencies?
Daniel Stenberg9ac76292004-08-18 11:18:36 +0000116
Daniel Stenberg352b07f2021-09-13 17:21:38 +0200117 8. Development
118 8.1 Why does curl use C89?
119 8.2 Will curl be rewritten?
120
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000121==============================================================================
122
1231. Philosophy
124
125 1.1 What is cURL?
126
Daniel Stenbergc3688002004-10-04 12:54:58 +0000127 cURL is the name of the project. The name is a play on 'Client for URLs',
128 originally with URL spelled in uppercase to make it obvious it deals with
Daniel Stenberge28628f2021-12-08 10:12:19 +0100129 URLs. The fact it can also be read as 'see URL' also helped, it works as
Dan Fandrichec2ad572005-04-13 19:31:00 +0000130 an abbreviation for "Client URL Request Library" or why not the recursive
Daniel Stenberg490879e2020-11-05 13:06:00 +0100131 version: "curl URL Request Library".
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000132
Daniel Stenbergc3688002004-10-04 12:54:58 +0000133 The cURL project produces two products:
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000134
Daniel Stenbergc3688002004-10-04 12:54:58 +0000135 libcurl
136
Daniel Stenberge30b2062021-12-09 12:03:35 +0100137 A client-side URL transfer library, supporting DICT, FILE, FTP, FTPS,
138 GOPHER, GOPHERS, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, MQTT, POP3, POP3S,
139 RTMP, RTMPS, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNET and TFTP.
Daniel Stenbergac20f522010-08-18 19:43:06 +0200140
Daniel Stenberg7ac16812009-01-14 22:52:18 +0000141 libcurl supports HTTPS certificates, HTTP POST, HTTP PUT, FTP uploading,
Michael Osipov37f0e8a2014-08-02 13:51:18 +0100142 Kerberos, SPNEGO, HTTP form based upload, proxies, cookies, user+password
Daniel Stenberge30b2062021-12-09 12:03:35 +0100143 authentication, file transfer resume, http proxy tunneling and more.
Daniel Stenbergc3688002004-10-04 12:54:58 +0000144
145 libcurl is highly portable, it builds and works identically on numerous
Michael Osipov37f0e8a2014-08-02 13:51:18 +0100146 platforms, including Solaris, NetBSD, FreeBSD, OpenBSD, Darwin, HP-UX,
Daniel Stenberg90dd1fc2022-01-16 23:35:00 +0100147 IRIX, AIX, Tru64, Linux, UnixWare, HURD, Windows, Amiga, OS/2, macOS,
148 Ultrix, QNX, OpenVMS, RISC OS, Novell NetWare, DOS, Symbian, OSF, Android,
149 Minix, IBM TPF and more...
Daniel Stenbergc3688002004-10-04 12:54:58 +0000150
151 libcurl is free, thread-safe, IPv6 compatible, feature rich, well
152 supported and fast.
Gisle Vanem51a87fa2004-11-24 15:14:42 +0000153
Daniel Stenbergc3688002004-10-04 12:54:58 +0000154 curl
155
Daniel Stenberg7aa79dc2021-09-15 14:33:05 +0200156 A command line tool for getting or sending data using URL syntax.
Daniel Stenbergc3688002004-10-04 12:54:58 +0000157
Daniel Stenbergac20f522010-08-18 19:43:06 +0200158 Since curl uses libcurl, curl supports the same wide range of common
159 Internet protocols that libcurl does.
Daniel Stenbergc3688002004-10-04 12:54:58 +0000160
Daniel Stenberg17932a82014-09-19 10:01:45 +0200161 We pronounce curl with an initial k sound. It rhymes with words like girl
162 and earl. This is a short WAV file to help you:
163
Viktor Szakats13ef6232017-08-08 19:22:34 +0000164 https://media.merriam-webster.com/soundc11/c/curl0001.wav
Daniel Stenberg887e7282001-01-03 09:13:07 +0000165
Daniel Stenbergf83be112005-05-18 10:12:08 +0000166 There are numerous sub-projects and related projects that also use the word
167 curl in the project names in various combinations, but you should take
Daniel Stenberg073ef0b2003-05-09 07:07:13 +0000168 notice that this FAQ is directed at the command-line tool named curl (and
Daniel Stenbergeea22872004-03-16 07:56:51 +0000169 libcurl the library), and may therefore not be valid for other curl-related
Daniel Stenbergf83be112005-05-18 10:12:08 +0000170 projects. (There is however a small section for the PHP/CURL in this FAQ.)
Daniel Stenberg073ef0b2003-05-09 07:07:13 +0000171
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000172 1.2 What is libcurl?
173
Daniel Stenberg5ad23d52021-10-20 09:24:18 +0200174 libcurl is a reliable and portable library for doing Internet data transfers
175 using one or more of its supported Internet protocols.
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000176
Daniel Stenberge30b2062021-12-09 12:03:35 +0100177 You can use libcurl freely in your application, be it open source,
Daniel Stenbergeea22872004-03-16 07:56:51 +0000178 commercial or closed-source.
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000179
Daniel Stenberg9a44fa82005-11-02 09:34:53 +0000180 libcurl is most probably the most portable, most powerful and most often
181 used C-based multi-platform file transfer library on this planet - be it
182 open source or commercial.
183
Daniel Stenbergc3688002004-10-04 12:54:58 +0000184 1.3 What is curl not?
Daniel Stenbergef34ad22000-06-02 12:45:23 +0000185
Daniel Stenberge30b2062021-12-09 12:03:35 +0100186 curl is not a wget clone. That is a common misconception. Never, during
Daniel Stenbergeea22872004-03-16 07:56:51 +0000187 curl's development, have we intended curl to replace wget or compete on its
Daniel Stenberg490879e2020-11-05 13:06:00 +0100188 market. curl is targeted at single-shot file transfers.
Daniel Stenbergeea22872004-03-16 07:56:51 +0000189
Daniel Stenberg490879e2020-11-05 13:06:00 +0100190 curl is not a website mirroring program. If you want to use curl to mirror
191 something: fine, go ahead and write a script that wraps around curl or use
192 libcurl to make it reality.
Daniel Stenbergef34ad22000-06-02 12:45:23 +0000193
Daniel Stenberg490879e2020-11-05 13:06:00 +0100194 curl is not an FTP site mirroring program. Sure, get and send FTP with curl
Daniel Stenberg4c485992001-04-22 15:45:27 +0000195 but if you want systematic and sequential behavior you should write a
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000196 script (or write a new program that interfaces libcurl) and do it.
197
Daniel Stenberg490879e2020-11-05 13:06:00 +0100198 curl is not a PHP tool, even though it works perfectly well when used from
Daniel Stenbergc3688002004-10-04 12:54:58 +0000199 or with PHP (when using the PHP/CURL module).
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000200
Daniel Stenberg490879e2020-11-05 13:06:00 +0100201 curl is not a program for a single operating system. curl exists, compiles,
Daniel Stenberg890b34d2007-02-11 09:55:17 +0000202 builds and runs under a wide range of operating systems, including all
Daniel Stenberg90dd1fc2022-01-16 23:35:00 +0100203 modern Unixes (and a bunch of older ones too), Windows, Amiga, OS/2, macOS,
204 QNX etc.
Daniel Stenberg31b8eea2000-08-23 07:27:00 +0000205
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000206 1.4 When will you make curl do XXXX ?
207
Daniel Stenberg11d718b2001-03-13 11:47:30 +0000208 We love suggestions of what to change in order to make curl and libcurl
209 better. We do however believe in a few rules when it comes to the future of
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000210 curl:
211
Daniel Stenberg490879e2020-11-05 13:06:00 +0100212 curl -- the command line tool -- is to remain a non-graphical command line
Daniel Stenberg1a911f72013-08-24 17:13:46 +0200213 tool. If you want GUIs or fancy scripting capabilities, you should look for
214 another tool that uses libcurl.
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000215
Daniel Stenberg1a911f72013-08-24 17:13:46 +0200216 We do not add things to curl that other small and available tools already do
Daniel Stenberg92efb3d2021-11-01 13:43:11 +0100217 well at the side. curl's output can be piped into another program or
railsnewbie257cd6b99e2017-01-11 23:48:22 -0600218 redirected to another file for the next program to interpret.
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000219
Viktor Szakats7e35eb72018-02-23 23:29:01 +0000220 We focus on protocol related issues and improvements. If you want to do more
Daniel Stenberg92efb3d2021-11-01 13:43:11 +0100221 magic with the supported protocols than curl currently does, chances are
222 good we will agree. If you want to add more protocols, we may agree.
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000223
railsnewbie257cd6b99e2017-01-11 23:48:22 -0600224 If you want someone else to do all the work while you wait for us to
Daniel Stenberg92efb3d2021-11-01 13:43:11 +0100225 implement it for you, that is not a friendly attitude. We spend a
Daniel Stenberg1a911f72013-08-24 17:13:46 +0200226 considerable time already on maintaining and developing curl. In order to
227 get more out of us, you should consider trading in some of your time and
railsnewbie257cd6b99e2017-01-11 23:48:22 -0600228 effort in return. Simply go to the GitHub repo which resides at
Viktor Szakats20dcd192016-02-03 18:34:16 +0100229 https://github.com/curl/curl, fork the project, and create pull requests
paulehoffman53d1e422016-01-24 14:27:08 -0800230 with your proposed changes.
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000231
railsnewbie257cd6b99e2017-01-11 23:48:22 -0600232 If you write the code, chances are better that it will get into curl faster.
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000233
Daniel Stenbergc3688002004-10-04 12:54:58 +0000234 1.5 Who makes curl?
Daniel Stenberga0eb52b2001-03-23 15:28:13 +0000235
Daniel Stenbergf83be112005-05-18 10:12:08 +0000236 curl and libcurl are not made by any single individual. Daniel Stenberg is
237 project leader and main developer, but other persons' submissions are
Daniel Stenbergd16c7572002-08-08 11:54:11 +0000238 important and crucial. Anyone can contribute and post their changes and
239 improvements and have them inserted in the main sources (of course on the
railsnewbie257cd6b99e2017-01-11 23:48:22 -0600240 condition that developers agree that the fixes are good).
Daniel Stenberga0eb52b2001-03-23 15:28:13 +0000241
Daniel Stenbergdb2d52a2007-12-10 11:33:46 +0000242 The full list of all contributors is found in the docs/THANKS file.
Daniel Stenberga0eb52b2001-03-23 15:28:13 +0000243
244 curl is developed by a community, with Daniel at the wheel.
245
Daniel Stenbergc3688002004-10-04 12:54:58 +0000246 1.6 What do you get for making curl?
Daniel Stenberga0eb52b2001-03-23 15:28:13 +0000247
Daniel Stenbergd63b3902020-09-07 17:08:07 +0200248 Project cURL is entirely free and open. We do this voluntarily, mostly in
Daniel Stenberge30b2062021-12-09 12:03:35 +0100249 our spare time. Companies may pay individual developers to work on curl.
250 This is not controlled by nor supervised in any way by the curl project.
Daniel Stenberga0eb52b2001-03-23 15:28:13 +0000251
Daniel Stenbergd63b3902020-09-07 17:08:07 +0200252 We get help from companies. Haxx provides website, bandwidth, mailing lists
253 etc, GitHub hosts the primary git repository and other services like the bug
254 tracker at https://github.com/curl/curl. Also again, some companies have
255 sponsored certain parts of the development in the past and I hope some will
256 continue to do so in the future.
Daniel Stenberga0eb52b2001-03-23 15:28:13 +0000257
Daniel Stenbergf83be112005-05-18 10:12:08 +0000258 If you want to support our project, consider a donation or a banner-program
railsnewbie257cd6b99e2017-01-11 23:48:22 -0600259 or even better: by helping us with coding, documenting or testing etc.
Daniel Stenbergc528dc52001-08-07 11:17:37 +0000260
Daniel Stenberg4d2f8002020-11-04 14:02:01 +0100261 See also: https://curl.se/sponsors.html
Daniel Stenbergd63b3902020-09-07 17:08:07 +0200262
Daniel Stenbergc528dc52001-08-07 11:17:37 +0000263 1.7 What about CURL from curl.com?
264
railsnewbie257cd6b99e2017-01-11 23:48:22 -0600265 During the summer of 2001, curl.com was busy advertising their client-side
Daniel Stenbergc528dc52001-08-07 11:17:37 +0000266 programming language for the web, named CURL.
267
Daniel Stenberg81b6ebc2001-08-07 18:02:37 +0000268 We are in no way associated with curl.com or their CURL programming
Daniel Stenbergeea22872004-03-16 07:56:51 +0000269 language.
Daniel Stenbergc528dc52001-08-07 11:17:37 +0000270
Daniel Stenberg81b6ebc2001-08-07 18:02:37 +0000271 Our project name curl has been in effective use since 1998. We were not the
Daniel Stenberg4045cd52001-08-07 21:21:24 +0000272 first computer related project to use the name "curl" and do not claim any
Daniel Stenberg1a911f72013-08-24 17:13:46 +0200273 rights to the name.
Daniel Stenbergc528dc52001-08-07 11:17:37 +0000274
Daniel Stenberg81b6ebc2001-08-07 18:02:37 +0000275 We recognize that we will be living in parallel with curl.com and wish them
276 every success.
Daniel Stenbergc528dc52001-08-07 11:17:37 +0000277
Antoine Pietrib341b762022-01-27 02:12:50 +0100278 1.8 I have a problem, who do I mail?
Daniel Stenberg8eaa7fe2002-04-27 18:12:26 +0000279
Daniel Stenbergdb5c9cd2003-02-25 08:52:32 +0000280 Please do not mail any single individual unless you really need to. Keep
281 curl-related questions on a suitable mailing list. All available mailing
282 lists are listed in the MANUAL document and online at
Daniel Stenberg4d2f8002020-11-04 14:02:01 +0100283 https://curl.se/mail/
Daniel Stenberg8eaa7fe2002-04-27 18:12:26 +0000284
Daniel Stenbergdb5c9cd2003-02-25 08:52:32 +0000285 Keeping curl-related questions and discussions on mailing lists allows
railsnewbie257cd6b99e2017-01-11 23:48:22 -0600286 others to join in and help, to share their ideas, to contribute their
287 suggestions and to spread their wisdom. Keeping discussions on public mailing
Daniel Stenbergdb5c9cd2003-02-25 08:52:32 +0000288 lists also allows for others to learn from this (both current and future
289 users thanks to the web based archives of the mailing lists), thus saving us
290 from having to repeat ourselves even more. Thanks for respecting this.
Daniel Stenberg8eaa7fe2002-04-27 18:12:26 +0000291
Daniel Stenberg0b8f57b2005-08-07 14:36:55 +0000292 If you have found or simply suspect a security problem in curl or libcurl,
Daniel Stenbergab2f27c2021-09-09 14:46:38 +0200293 submit all the details at https://hackerone.one/curl. On there we keep the
294 issue private while we investigate, confirm it, work and validate a fix and
295 agree on a time schedule for publication etc. That way we produce a fix in a
296 timely manner before the flaw is announced to the world, reducing the impact
Antoine Pietrib341b762022-01-27 02:12:50 +0100297 the problem risks having on existing users.
Daniel Stenbergab2f27c2021-09-09 14:46:38 +0200298
299 Security issues can also be taking to the curl security team by emailing
300 security at curl.se (closed list of receivers, mails are not disclosed).
Daniel Stenberg0b8f57b2005-08-07 14:36:55 +0000301
Daniel Stenberg9a44fa82005-11-02 09:34:53 +0000302 1.9 Where do I buy commercial support for curl?
303
304 curl is fully open source. It means you can hire any skilled engineer to fix
305 your curl-related problems.
306
H3RSKO3d221402020-08-16 16:36:10 -0400307 We list available alternatives on the curl website:
Daniel Stenberg4d2f8002020-11-04 14:02:01 +0100308 https://curl.se/support.html
Daniel Stenberg9a44fa82005-11-02 09:34:53 +0000309
310 1.10 How many are using curl?
311
312 It is impossible to tell.
313
Daniel Stenberga28464a2021-10-31 16:34:44 +0100314 We do not know how many users that knowingly have installed and use curl.
Daniel Stenberg9a44fa82005-11-02 09:34:53 +0000315
Daniel Stenberga28464a2021-10-31 16:34:44 +0100316 We do not know how many users that use curl without knowing that they are in
Daniel Stenberg9a44fa82005-11-02 09:34:53 +0000317 fact using it.
318
Daniel Stenberga28464a2021-10-31 16:34:44 +0100319 We do not know how many users that downloaded or installed curl and then
Daniel Stenberg9a44fa82005-11-02 09:34:53 +0000320 never use it.
321
Daniel Gustafssonafbf7d22020-11-05 09:36:24 +0100322 In 2020, we estimate that curl runs in roughly ten billion installations
Daniel Stenbergd63b3902020-09-07 17:08:07 +0200323 world wide.
Daniel Stenberg9a44fa82005-11-02 09:34:53 +0000324
Daniel Stenberga28464a2021-10-31 16:34:44 +0100325 1.11 Why do you not update ca-bundle.crt
Daniel Stenberg15bf1682008-02-07 15:43:36 +0000326
Daniel Stenberga28464a2021-10-31 16:34:44 +0100327 In the cURL project we have decided not to attempt to keep this file updated
Daniel Stenbergd63b3902020-09-07 17:08:07 +0200328 (or even present) since deciding what to add to a ca cert bundle is an
Daniel Stenberga28464a2021-10-31 16:34:44 +0100329 undertaking we have not been ready to accept, and the one we can get from
Daniel Stenberg074bd2a2008-02-18 11:39:11 +0000330 Mozilla is perfectly fine so there's no need to duplicate that work.
Daniel Stenberg15bf1682008-02-07 15:43:36 +0000331
332 Today, with many services performed over HTTPS, every operating system
333 should come with a default ca cert bundle that can be deemed somewhat
334 trustworthy and that collection (if reasonably updated) should be deemed to
Daniel Stenberg074bd2a2008-02-18 11:39:11 +0000335 be a lot better than a private curl version.
Daniel Stenberg15bf1682008-02-07 15:43:36 +0000336
Daniel Stenberg074bd2a2008-02-18 11:39:11 +0000337 If you want the most recent collection of ca certs that Mozilla Firefox
338 uses, we recommend that you extract the collection yourself from Mozilla
339 Firefox (by running 'make ca-bundle), or by using our online service setup
Daniel Stenberg4d2f8002020-11-04 14:02:01 +0100340 for this purpose: https://curl.se/docs/caextract.html
Daniel Stenberg15bf1682008-02-07 15:43:36 +0000341
Antoine Pietrib341b762022-01-27 02:12:50 +0100342 1.12 I have a problem who, can I chat with?
Daniel Stenberg8740d142009-06-09 09:02:39 +0000343
344 There's a bunch of friendly people hanging out in the #curl channel on the
Daniel Stenberga28464a2021-10-31 16:34:44 +0100345 IRC network libera.chat. If you are polite and nice, chances are good that
Daniel Stenbergb03b82a2021-05-24 00:21:00 +0200346 you can get -- or provide -- help instantly.
Daniel Stenberg8740d142009-06-09 09:02:39 +0000347
Daniel Stenberg59842d42010-08-18 16:54:11 +0200348 1.13 curl's ECCN number?
349
350 The US government restricts exports of software that contains or uses
351 cryptography. When doing so, the Export Control Classification Number (ECCN)
352 is used to identify the level of export control etc.
353
Daniel Stenbergb8235962016-01-04 18:59:29 +0100354 Apache Software Foundation gives a good explanation of ECCNs at
355 https://www.apache.org/dev/crypto.html
Daniel Stenberg59842d42010-08-18 16:54:11 +0200356
357 We believe curl's number might be ECCN 5D002, another possibility is
Daniel Stenbergb8235962016-01-04 18:59:29 +0100358 5D992. It seems necessary to write them (the authority that administers ECCN
359 numbers), asking to confirm.
Daniel Stenberg59842d42010-08-18 16:54:11 +0200360
Daniel Stenbergb8235962016-01-04 18:59:29 +0100361 Comprehensible explanations of the meaning of such numbers and how to obtain
362 them (resp.) are here
Daniel Stenberg59842d42010-08-18 16:54:11 +0200363
Viktor Szakats13ef6232017-08-08 19:22:34 +0000364 https://www.bis.doc.gov/licensing/exportingbasics.htm
365 https://www.bis.doc.gov/licensing/do_i_needaneccn.html
Daniel Stenberg59842d42010-08-18 16:54:11 +0200366
367 An incomprehensible description of the two numbers above is here
Viktor Szakatsf0783612018-09-22 07:58:05 +0000368 https://www.bis.doc.gov/index.php/documents/new-encryption/1653-ccl5-pt2-3
Daniel Stenberg59842d42010-08-18 16:54:11 +0200369
Daniel Stenberga5f96b42010-10-06 20:03:13 +0200370 1.14 How do I submit my patch?
371
Daniel Stenbergd63b3902020-09-07 17:08:07 +0200372 We strongly encourage you to submit changes and improvements directly as
Daniel Stenberga28464a2021-10-31 16:34:44 +0100373 "pull requests" on GitHub: https://github.com/curl/curl/pulls
Daniel Stenberga5f96b42010-10-06 20:03:13 +0200374
Daniel Stenberga28464a2021-10-31 16:34:44 +0100375 If you for any reason cannot or will not deal with GitHub, send your patch to
376 the curl-library mailing list. We are many subscribers there and there are
Daniel Stenbergd63b3902020-09-07 17:08:07 +0200377 lots of people who can review patches, comment on them and "receive" them
378 properly.
Daniel Stenberga5f96b42010-10-06 20:03:13 +0200379
Daniel Stenberg490879e2020-11-05 13:06:00 +0100380 Lots of more details are found in the CONTRIBUTE.md and INTERNALS.md
381 documents.
Daniel Stenberga5f96b42010-10-06 20:03:13 +0200382
Daniel Stenbergf81d3562015-05-26 19:13:09 +0200383 1.15 How do I port libcurl to my OS?
384
385 Here's a rough step-by-step:
386
387 1. copy a suitable lib/config-*.h file as a start to lib/config-[youros].h
388
389 2. edit lib/config-[youros].h to match your OS and setup
390
391 3. edit lib/curl_setup.h to include config-[youros].h when your OS is
392 detected by the preprocessor, in the style others already exist
393
394 4. compile lib/*.c and make them into a library
395
Daniel Stenberg8eaa7fe2002-04-27 18:12:26 +0000396
Daniel Stenbergc3318b42000-08-17 14:06:42 +00003972. Install Related Problems
398
Daniel Stenberg490879e2020-11-05 13:06:00 +0100399 2.1 configure fails when using static libraries
Daniel Stenberg7c37c6a2000-05-22 17:35:35 +0000400
Daniel Stenberg490879e2020-11-05 13:06:00 +0100401 You may find that configure fails to properly detect the entire dependency
402 chain of libraries when you provide static versions of the libraries that
403 configure checks for.
Daniel Stenberg7c37c6a2000-05-22 17:35:35 +0000404
Daniel Stenberg490879e2020-11-05 13:06:00 +0100405 The reason why static libraries is much harder to deal with is that for them
Daniel Stenberga28464a2021-10-31 16:34:44 +0100406 we do not get any help but the script itself must know or check what more
Daniel Stenberg490879e2020-11-05 13:06:00 +0100407 libraries that are needed (with shared libraries, that dependency "chain" is
Daniel Stenberg92efb3d2021-11-01 13:43:11 +0100408 handled automatically). This is a error-prone process and one that also
Daniel Stenberg490879e2020-11-05 13:06:00 +0100409 tends to vary over time depending on the release versions of the involved
410 components and may also differ between operating systems.
Daniel Stenberg7c37c6a2000-05-22 17:35:35 +0000411
Daniel Stenberg92efb3d2021-11-01 13:43:11 +0100412 For that reason, configure does few attempts to actually figure this out and
413 you are instead encouraged to set LIBS and LDFLAGS accordingly when you
414 invoke configure, and point out the needed libraries and set the necessary
415 flags yourself.
Daniel Stenberg7c37c6a2000-05-22 17:35:35 +0000416
Daniel Stenberg490879e2020-11-05 13:06:00 +0100417 2.2 Does curl work with other SSL libraries?
Daniel Stenberg7c37c6a2000-05-22 17:35:35 +0000418
Daniel Stenberg490879e2020-11-05 13:06:00 +0100419 curl has been written to use a generic SSL function layer internally, and
Daniel Stenberg045c7342013-01-23 13:17:36 +0100420 that SSL functionality can then be provided by one out of many different SSL
421 backends.
422
423 curl can be built to use one of the following SSL alternatives: OpenSSL,
Daniel Stenberg223f26c2022-01-09 22:28:48 +0100424 libressl, BoringSSL, GnuTLS, wolfSSL, NSS, mbedTLS, Secure
Michael Forney9b879162019-11-07 20:17:18 -0800425 Transport (native iOS/OS X), Schannel (native Windows), GSKit (native IBM
Jacob Hoffman-Andrews246399a2020-12-12 23:55:09 -0800426 i), BearSSL, or Rustls. They all have their pros and cons, and we try to
427 maintain a comparison of them here: https://curl.se/docs/ssl-compared.html
Daniel Stenberge9640b62000-08-02 07:17:56 +0000428
Dan Fandrich5c9fff92009-01-30 18:28:29 +0000429 2.4 Does curl support SOCKS (RFC 1928) ?
Daniel Stenberge9640b62000-08-02 07:17:56 +0000430
Daniel Stenberg844cbc72007-07-29 22:17:39 +0000431 Yes, SOCKS 4 and 5 are supported.
Daniel Stenberge9640b62000-08-02 07:17:56 +0000432
Daniel Stenbergc3318b42000-08-17 14:06:42 +00004333. Usage problems
Daniel Stenberge9640b62000-08-02 07:17:56 +0000434
Daniel Stenberg811edcd2004-08-10 08:41:41 +0000435 3.1 curl: (1) SSL is disabled, https: not supported
Daniel Stenberge9640b62000-08-02 07:17:56 +0000436
Daniel Stenberg3a4182d2022-03-29 13:58:11 +0200437 If you get this output when trying to get anything from an https:// server,
Daniel Stenberga28464a2021-10-31 16:34:44 +0100438 it means that the instance of curl/libcurl that you are using was built
Daniel Stenberg0d0f8082011-03-08 11:15:59 +0100439 without support for this protocol.
440
Daniel Stenberga28464a2021-10-31 16:34:44 +0100441 This could have happened if the configure script that was run at build time
442 could not find all libs and include files curl requires for SSL to work. If
Daniel Stenberg0d0f8082011-03-08 11:15:59 +0100443 the configure script fails to find them, curl is simply built without SSL
444 support.
Daniel Stenberge9640b62000-08-02 07:17:56 +0000445
446 To get the https:// support into a curl that was previously built but that
447 reports that https:// is not supported, you should dig through the document
Daniel Stenberga28464a2021-10-31 16:34:44 +0100448 and logs and check out why the configure script does not find the SSL libs
Daniel Stenberge9640b62000-08-02 07:17:56 +0000449 and/or include files.
450
Daniel Stenberga28464a2021-10-31 16:34:44 +0100451 Also, check out the other paragraph in this FAQ labeled "configure does not
Daniel Stenberge9640b62000-08-02 07:17:56 +0000452 find OpenSSL even when it is installed".
453
Daniel Stenberg811edcd2004-08-10 08:41:41 +0000454 3.2 How do I tell curl to resume a transfer?
Daniel Stenberge9640b62000-08-02 07:17:56 +0000455
Daniel Stenberg490879e2020-11-05 13:06:00 +0100456 curl supports resumed transfers both ways on both FTP and HTTP.
Daniel Stenberg887e7282001-01-03 09:13:07 +0000457 Try the -C option.
Daniel Stenberge9640b62000-08-02 07:17:56 +0000458
Daniel Stenberga28464a2021-10-31 16:34:44 +0100459 3.3 Why does my posting using -F not work?
Daniel Stenberge9640b62000-08-02 07:17:56 +0000460
Daniel Stenberga28464a2021-10-31 16:34:44 +0100461 You cannot arbitrarily use -F or -d, the choice between -F or -d depends on
Daniel Stenberg490879e2020-11-05 13:06:00 +0100462 the HTTP operation you need curl to do and what the web server that will
463 receive your post expects.
railsnewbie257cd6b99e2017-01-11 23:48:22 -0600464
Daniel Stenberga28464a2021-10-31 16:34:44 +0100465 If the form you are trying to submit uses the type 'multipart/form-data',
Daniel Stenberg490879e2020-11-05 13:06:00 +0100466 then and only then you must use the -F type. In all the most common cases,
467 you should use -d which then causes a posting with the type
railsnewbie257cd6b99e2017-01-11 23:48:22 -0600468 'application/x-www-form-urlencoded'.
Daniel Stenberge9640b62000-08-02 07:17:56 +0000469
Daniel Stenberg4c485992001-04-22 15:45:27 +0000470 This is described in some detail in the MANUAL and TheArtOfHttpScripting
Daniel Stenberga28464a2021-10-31 16:34:44 +0100471 documents, and if you do not understand it the first time, read it again
Daniel Stenberg4c485992001-04-22 15:45:27 +0000472 before you post questions about this to the mailing list. Also, try reading
473 through the mailing list archives for old postings and questions regarding
474 this.
Daniel Stenberge9640b62000-08-02 07:17:56 +0000475
Daniel Stenberg811edcd2004-08-10 08:41:41 +0000476 3.4 How do I tell curl to run custom FTP commands?
Daniel Stenberge9640b62000-08-02 07:17:56 +0000477
478 You can tell curl to perform optional commands both before and/or after a
479 file transfer. Study the -Q/--quote option.
480
Daniel Stenberga28464a2021-10-31 16:34:44 +0100481 Since curl is used for file transfers, you do not normally use curl to
Daniel Stenberg68e2c9a2012-11-25 19:44:49 +0100482 perform FTP commands without transferring anything. Therefore you must
483 always specify a URL to transfer to/from even when doing custom FTP
484 commands, or use -I which implies the "no body" option sent to libcurl.
Daniel Stenberge9640b62000-08-02 07:17:56 +0000485
Dan Fandrichb3740f02011-06-02 18:41:57 -0700486 3.5 How can I disable the Accept: */* header?
Daniel Stenberge9640b62000-08-02 07:17:56 +0000487
488 You can change all internally generated headers by adding a replacement with
489 the -H/--header option. By adding a header with empty contents you safely
Dan Fandrichb3740f02011-06-02 18:41:57 -0700490 disable that one. Use -H "Accept:" to disable that specific header.
Daniel Stenberge9640b62000-08-02 07:17:56 +0000491
Daniel Stenberg811edcd2004-08-10 08:41:41 +0000492 3.6 Does curl support ASP, XML, XHTML or HTML version Y?
Daniel Stenberge9640b62000-08-02 07:17:56 +0000493
Daniel Stenberga28464a2021-10-31 16:34:44 +0100494 To curl, all contents are alike. It does not matter how the page was
Daniel Stenberg07f97802013-02-08 09:58:23 +0100495 generated. It may be ASP, PHP, Perl, shell-script, SSI or plain HTML
Daniel Stenberga28464a2021-10-31 16:34:44 +0100496 files. There's no difference to curl and it does not even know what kind of
Daniel Stenberg07f97802013-02-08 09:58:23 +0100497 language that generated the page.
Daniel Stenberge9640b62000-08-02 07:17:56 +0000498
Daniel Stenberg20807382002-05-21 14:00:55 +0000499 See also item 3.14 regarding javascript.
Daniel Stenberge9640b62000-08-02 07:17:56 +0000500
Daniel Stenberg811edcd2004-08-10 08:41:41 +0000501 3.7 Can I use curl to delete/rename a file through FTP?
Daniel Stenberge9640b62000-08-02 07:17:56 +0000502
Daniel Stenberg4c485992001-04-22 15:45:27 +0000503 Yes. You specify custom FTP commands with -Q/--quote.
Daniel Stenberge9640b62000-08-02 07:17:56 +0000504
505 One example would be to delete a file after you have downloaded it:
506
507 curl -O ftp://download.com/coolfile -Q '-DELE coolfile'
508
Daniel Stenberg33b9daa2007-06-26 21:53:46 +0000509 or rename a file after upload:
510
511 curl -T infile ftp://upload.com/dir/ -Q "-RNFR infile" -Q "-RNTO newname"
512
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000513 3.8 How do I tell curl to follow HTTP redirects?
Daniel Stenberge9640b62000-08-02 07:17:56 +0000514
Daniel Stenberg490879e2020-11-05 13:06:00 +0100515 curl does not follow so-called redirects by default. The Location: header
Daniel Stenberga28464a2021-10-31 16:34:44 +0100516 that informs the client about this is only interpreted if you are using the
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000517 -L/--location option. As in:
Daniel Stenberge9640b62000-08-02 07:17:56 +0000518
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000519 curl -L http://redirector.com
520
Daniel Stenberg09cb9c72005-08-26 13:22:39 +0000521 Not all redirects are HTTP ones, see 4.14
522
Daniel Stenberg98871d12002-05-22 22:14:03 +0000523 3.9 How do I use curl in my favorite programming language?
Daniel Stenberg368e3522001-01-29 10:16:21 +0000524
dbrowndan84086b32019-05-23 15:05:29 -0700525 Many programming languages have interfaces/bindings that allow you to use
526 curl without having to use the command line tool. If you are fluent in such
527 a language, you may prefer to use one of these interfaces instead.
Daniel Stenberg4c485992001-04-22 15:45:27 +0000528
Daniel Stenberg4c485992001-04-22 15:45:27 +0000529 Find out more about which languages that support curl directly, and how to
H3RSKO3d221402020-08-16 16:36:10 -0400530 install and use them, in the libcurl section of the curl website:
Daniel Stenberg4d2f8002020-11-04 14:02:01 +0100531 https://curl.se/libcurl/
Daniel Stenberg368e3522001-01-29 10:16:21 +0000532
Daniel Stenberg832e8272011-06-13 19:02:38 +0200533 All the various bindings to libcurl are made by other projects and people,
534 outside of the cURL project. The cURL project itself only produces libcurl
Daniel Stenberga28464a2021-10-31 16:34:44 +0100535 with its plain C API. If you do not find anywhere else to ask you can ask
Daniel Stenberg832e8272011-06-13 19:02:38 +0200536 about bindings on the curl-library list too, but be prepared that people on
537 that list may not know anything about bindings.
538
Daniel Stenberge30b2062021-12-09 12:03:35 +0100539 In December 2021, there were interfaces available for the following
Daniel Stenberg1640bb62019-02-28 09:09:51 +0100540 languages: Ada95, Basic, C, C++, Ch, Cocoa, D, Delphi, Dylan, Eiffel,
541 Euphoria, Falcon, Ferite, Gambas, glib/GTK+, Go, Guile, Harbour, Haskell,
542 Java, Julia, Lisp, Lua, Mono, .NET, node.js, Object-Pascal, OCaml, Pascal,
543 Perl, PHP, PostgreSQL, Python, R, Rexx, Ring, RPG, Ruby, Rust, Scheme,
544 Scilab, S-Lang, Smalltalk, SP-Forth, SPL, Tcl, Visual Basic, Visual FoxPro,
545 Q, wxwidgets, XBLite and Xoho. By the time you read this, additional ones
Daniel Stenberge30b2062021-12-09 12:03:35 +0100546 may have appeared.
Daniel Stenberg368e3522001-01-29 10:16:21 +0000547
Daniel Stenberg147a6732001-03-08 09:25:09 +0000548 3.10 What about SOAP, WebDAV, XML-RPC or similar protocols over HTTP?
Daniel Stenbergc59baa02001-02-12 10:05:09 +0000549
Daniel Stenberg490879e2020-11-05 13:06:00 +0100550 curl adheres to the HTTP spec, which basically means you can play with *any*
Daniel Stenberg4c485992001-04-22 15:45:27 +0000551 protocol that is built on top of HTTP. Protocols such as SOAP, WEBDAV and
Daniel Stenbergc59baa02001-02-12 10:05:09 +0000552 XML-RPC are all such ones. You can use -X to set custom requests and -H to
553 set custom headers (or replace internally generated ones).
554
Daniel Stenberga28464a2021-10-31 16:34:44 +0100555 Using libcurl is of course just as good and you would just use the proper
Daniel Stenbergdb5c9cd2003-02-25 08:52:32 +0000556 library options to do the same.
Daniel Stenbergc59baa02001-02-12 10:05:09 +0000557
Daniel Stenberg88d14e92001-05-29 14:02:20 +0000558 3.11 How do I POST with a different Content-Type?
559
560 You can always replace the internally generated headers with -H/--header.
561 To make a simple HTTP POST with text/xml as content-type, do something like:
562
563 curl -d "datatopost" -H "Content-Type: text/xml" [URL]
564
dbrowndan84086b32019-05-23 15:05:29 -0700565 3.12 Why do FTP-specific features over HTTP proxy fail?
Daniel Stenberg7d3daa52001-10-23 10:12:00 +0000566
Daniel Stenberg3a4182d2022-03-29 13:58:11 +0200567 Because when you use an HTTP proxy, the protocol spoken on the network will
568 be HTTP, even if you specify an FTP URL. This effectively means that you
Daniel Stenberga28464a2021-10-31 16:34:44 +0100569 normally cannot use FTP-specific features such as FTP upload and FTP quote
Daniel Stenberg7d3daa52001-10-23 10:12:00 +0000570 etc.
571
572 There is one exception to this rule, and that is if you can "tunnel through"
Daniel Stenberg271f96f2001-11-20 08:03:01 +0000573 the given HTTP proxy. Proxy tunneling is enabled with a special option (-p)
Daniel Stenberg97a8c982001-12-21 08:10:34 +0000574 and is generally not available as proxy admins usually disable tunneling to
railsnewbie257cd6b99e2017-01-11 23:48:22 -0600575 ports other than 443 (which is used for HTTPS access through proxies).
Daniel Stenberg7d3daa52001-10-23 10:12:00 +0000576
dbrowndan84086b32019-05-23 15:05:29 -0700577 3.13 Why do my single/double quotes fail?
Daniel Stenberg6b1a1a62002-03-11 08:29:26 +0000578
579 To specify a command line option that includes spaces, you might need to
580 put the entire option within quotes. Like in:
581
582 curl -d " with spaces " url.com
Daniel Stenbergeea22872004-03-16 07:56:51 +0000583
Daniel Stenberg6b1a1a62002-03-11 08:29:26 +0000584 or perhaps
585
586 curl -d ' with spaces ' url.com
587
588 Exactly what kind of quotes and how to do this is entirely up to the shell
Daniel Stenberg98871d12002-05-22 22:14:03 +0000589 or command line interpreter that you are using. For most unix shells, you
Daniel Stenberg6b1a1a62002-03-11 08:29:26 +0000590 can more or less pick either single (') or double (") quotes. For
Daniel Stenberga28464a2021-10-31 16:34:44 +0100591 Windows/DOS prompts I believe you are forced to use double (") quotes.
Daniel Stenberg6b1a1a62002-03-11 08:29:26 +0000592
Daniel Stenberg98871d12002-05-22 22:14:03 +0000593 Please study the documentation for your particular environment. Examples in
railsnewbie257cd6b99e2017-01-11 23:48:22 -0600594 the curl docs will use a mix of both of these as shown above. You must
Daniel Stenberg6b1a1a62002-03-11 08:29:26 +0000595 adjust them to work in your environment.
596
Daniel Stenberg61f62842002-03-11 08:39:00 +0000597 Remember that curl works and runs on more operating systems than most single
Daniel Stenberg6b1a1a62002-03-11 08:29:26 +0000598 individuals have ever tried.
599
Dan Fandrich5c9fff92009-01-30 18:28:29 +0000600 3.14 Does curl support Javascript or PAC (automated proxy config)?
Daniel Stenberg48bc73c2002-05-21 13:53:32 +0000601
Daniel Stenberg490879e2020-11-05 13:06:00 +0100602 Many web pages do magic stuff using embedded Javascript. curl and libcurl
Daniel Stenberg48bc73c2002-05-21 13:53:32 +0000603 have no built-in support for that, so it will be treated just like any other
604 contents.
605
Jan-Piet Mens09c80742022-01-30 12:57:24 +0100606 .pac files are a Netscape invention and are sometimes used by organizations
Daniel Stenberg48bc73c2002-05-21 13:53:32 +0000607 to allow them to differentiate which proxies to use. The .pac contents is
Dan Fandrich5c9fff92009-01-30 18:28:29 +0000608 just a Javascript program that gets invoked by the browser and that returns
Daniel Stenberga28464a2021-10-31 16:34:44 +0100609 the name of the proxy to connect to. Since curl does not support Javascript,
610 it cannot support .pac proxy configuration either.
Daniel Stenberg48bc73c2002-05-21 13:53:32 +0000611
Dan Fandrichea1f30e2009-11-03 19:07:19 +0000612 Some workarounds usually suggested to overcome this Javascript dependency:
Daniel Stenberg48bc73c2002-05-21 13:53:32 +0000613
Daniel Stenberg1a911f72013-08-24 17:13:46 +0200614 Depending on the Javascript complexity, write up a script that translates it
615 to another language and execute that.
Daniel Stenberg48bc73c2002-05-21 13:53:32 +0000616
Daniel Stenberg1a911f72013-08-24 17:13:46 +0200617 Read the Javascript code and rewrite the same logic in another language.
Daniel Stenberg48bc73c2002-05-21 13:53:32 +0000618
Daniel Stenberg1a911f72013-08-24 17:13:46 +0200619 Implement a Javascript interpreter, people have successfully used the
620 Mozilla Javascript engine in the past.
Daniel Stenberg48bc73c2002-05-21 13:53:32 +0000621
Daniel Stenberg1a911f72013-08-24 17:13:46 +0200622 Ask your admins to stop this, for a static proxy setup or similar.
Daniel Stenberg48bc73c2002-05-21 13:53:32 +0000623
Daniel Stenbergf3e5d4a2003-12-22 17:24:21 +0000624 3.15 Can I do recursive fetches with curl?
625
626 No. curl itself has no code that performs recursive operations, such as
Daniel Stenberg811edcd2004-08-10 08:41:41 +0000627 those performed by wget and similar tools.
Daniel Stenbergf3e5d4a2003-12-22 17:24:21 +0000628
railsnewbie257cd6b99e2017-01-11 23:48:22 -0600629 There exists wrapper scripts with that functionality (for example the
Daniel Stenbergf3e5d4a2003-12-22 17:24:21 +0000630 curlmirror perl script), and you can write programs based on libcurl to do
631 it, but the command line tool curl itself cannot.
Daniel Stenberg6b1a1a62002-03-11 08:29:26 +0000632
Daniel Stenbergedd16d92004-08-12 11:39:00 +0000633 3.16 What certificates do I need when I use SSL?
Daniel Stenberg43563562004-08-12 11:02:01 +0000634
635 There are three different kinds of "certificates" to keep track of when we
636 talk about using SSL-based protocols (HTTPS or FTPS) using curl or libcurl.
637
Daniel Stenberg1a911f72013-08-24 17:13:46 +0200638 CLIENT CERTIFICATE
Daniel Stenberg43563562004-08-12 11:02:01 +0000639
Daniel Stenberg6d496952017-05-12 19:58:06 +0200640 The server you communicate with may require that you can provide this in
Daniel Stenberge30b2062021-12-09 12:03:35 +0100641 order to prove that you actually are who you claim to be. If the server
Daniel Stenberga28464a2021-10-31 16:34:44 +0100642 does not require this, you do not need a client certificate.
Daniel Stenberg64f12a32010-09-07 19:05:07 +0200643
Daniel Stenberg1a911f72013-08-24 17:13:46 +0200644 A client certificate is always used together with a private key, and the
645 private key has a pass phrase that protects it.
Daniel Stenberg43563562004-08-12 11:02:01 +0000646
Daniel Stenberg1a911f72013-08-24 17:13:46 +0200647 SERVER CERTIFICATE
Daniel Stenberg43563562004-08-12 11:02:01 +0000648
Daniel Stenberg1a911f72013-08-24 17:13:46 +0200649 The server you communicate with has a server certificate. You can and should
650 verify this certificate to make sure that you are truly talking to the real
651 server and not a server impersonating it.
652
653 CERTIFICATE AUTHORITY CERTIFICATE ("CA cert")
654
655 You often have several CA certs in a CA cert bundle that can be used to
656 verify a server certificate that was signed by one of the authorities in the
657 bundle. curl does not come with a CA cert bundle but most curl installs
658 provide one. You can also override the default.
659
660 The server certificate verification process is made by using a Certificate
661 Authority certificate ("CA cert") that was used to sign the server
662 certificate. Server certificate verification is enabled by default in curl
663 and libcurl and is often the reason for problems as explained in FAQ entry
664 4.12 and the SSLCERTS document
Daniel Stenberg4d2f8002020-11-04 14:02:01 +0100665 (https://curl.se/docs/sslcerts.html). Server certificates that are
Daniel Stenberg1a911f72013-08-24 17:13:46 +0200666 "self-signed" or otherwise signed by a CA that you do not have a CA cert
667 for, cannot be verified. If the verification during a connect fails, you are
668 refused access. You then need to explicitly disable the verification to
669 connect to the server.
Daniel Stenberg9a44fa82005-11-02 09:34:53 +0000670
Daniel Stenberg951fdeb2004-12-21 09:37:55 +0000671 3.17 How do I list the root dir of an FTP server?
672
673 There are two ways. The way defined in the RFC is to use an encoded slash
674 in the first path part. List the "/tmp" dir like this:
675
676 curl ftp://ftp.sunet.se/%2ftmp/
677
678 or the not-quite-kosher-but-more-readable way, by simply starting the path
679 section of the URL with a slash:
680
681 curl ftp://ftp.sunet.se//tmp/
682
Daniel Stenberge9eb5232005-04-05 14:36:37 +0000683 3.18 Can I use curl to send a POST/PUT and not wait for a response?
Yang Tsea07bc792010-02-14 19:40:18 +0000684
Daniel Stenberge9eb5232005-04-05 14:36:37 +0000685 No.
686
Daniel Stenberge30b2062021-12-09 12:03:35 +0100687 You can easily write your own program using libcurl to do such stunts.
Daniel Stenberg9a44fa82005-11-02 09:34:53 +0000688
Daniel Stenberg64f12a32010-09-07 19:05:07 +0200689 3.19 How do I get HTTP from a host using a specific IP address?
690
Daniel Stenberga28464a2021-10-31 16:34:44 +0100691 For example, you may be trying out a website installation that is not yet in
Daniel Stenberg64f12a32010-09-07 19:05:07 +0200692 the DNS. Or you have a site using multiple IP addresses for a given host
693 name and you want to address a specific one out of the set.
694
695 Set a custom Host: header that identifies the server name you want to reach
696 but use the target IP address in the URL:
697
698 curl --header "Host: www.example.com" http://127.0.0.1/
699
Daniel Stenberg50d88bf2011-12-07 23:08:15 +0100700 You can also opt to add faked host name entries to curl with the --resolve
701 option. That has the added benefit that things like redirects will also work
702 properly. The above operation would instead be done as:
703
704 curl --resolve www.example.com:80:127.0.0.1 http://www.example.com/
705
Daniel Stenberg3f7b7de2011-03-07 22:27:26 +0100706 3.20 How to SFTP from my user's home directory?
707
708 Contrary to how FTP works, SFTP and SCP URLs specify the exact directory to
Daniel Stenberga28464a2021-10-31 16:34:44 +0100709 work with. It means that if you do not specify that you want the user's home
Daniel Stenberg3f7b7de2011-03-07 22:27:26 +0100710 directory, you get the actual root directory.
711
712 To specify a file in your user's home directory, you need to use the correct
Daniel Stenberg1640bb62019-02-28 09:09:51 +0100713 URL syntax which for SFTP might look similar to:
Daniel Stenberg3f7b7de2011-03-07 22:27:26 +0100714
715 curl -O -u user:password sftp://example.com/~/file.txt
716
717 and for SCP it is just a different protocol prefix:
718
719 curl -O -u user:password scp://example.com/~/file.txt
720
Daniel Stenberg0d0f8082011-03-08 11:15:59 +0100721 3.21 Protocol xxx not supported or disabled in libcurl
722
723 When passing on a URL to curl to use, it may respond that the particular
724 protocol is not supported or disabled. The particular way this error message
Daniel Stenberga28464a2021-10-31 16:34:44 +0100725 is phrased is because curl does not make a distinction internally of whether
Dan Fandrich31c6e7a2013-04-15 22:26:18 +0200726 a particular protocol is not supported (i.e. never got any code added that
Daniel Stenberg0d0f8082011-03-08 11:15:59 +0100727 knows how to speak that protocol) or if it was explicitly disabled. curl can
728 be built to only support a given set of protocols, and the rest would then
729 be disabled or not supported.
730
731 Note that this error will also occur if you pass a wrongly spelled protocol
732 part as in "htpt://example.com" or as in the less evident case if you prefix
733 the protocol part with a space as in " http://example.com/".
734
Daniel Stenberg0ed4a092013-01-21 14:33:12 +0100735 3.22 curl -X gives me HTTP problems
736
737 In normal circumstances, -X should hardly ever be used.
738
739 By default you use curl without explicitly saying which request method to
Daniel Stenberg3a4182d2022-03-29 13:58:11 +0200740 use when the URL identifies an HTTP transfer. If you just pass in a URL like
Daniel Stenberg0ed4a092013-01-21 14:33:12 +0100741 "curl http://example.com" it will use GET. If you use -d or -F curl will use
742 POST, -I will cause a HEAD and -T will make it a PUT.
743
Daniel Stenberga28464a2021-10-31 16:34:44 +0100744 If for whatever reason you are not happy with these default choices that curl
Daniel Stenberg0ed4a092013-01-21 14:33:12 +0100745 does for you, you can override those request methods by specifying -X
746 [WHATEVER]. This way you can for example send a DELETE by doing "curl -X
747 DELETE [URL]".
748
749 It is thus pointless to do "curl -XGET [URL]" as GET would be used
750 anyway. In the same vein it is pointless to do "curl -X POST -d data
751 [URL]"... But you can make a fun and somewhat rare request that sends a
752 request-body in a GET request with something like "curl -X GET -d data
753 [URL]"
754
Daniel Stenberga28464a2021-10-31 16:34:44 +0100755 Note that -X does not actually change curl's behavior as it only modifies the
Daniel Stenberg7b534842015-02-02 15:38:29 +0100756 actual string sent in the request, but that may of course trigger a
757 different set of events.
Daniel Stenberg0ed4a092013-01-21 14:33:12 +0100758
759 Accordingly, by using -XPOST on a command line that for example would follow
760 a 303 redirect, you will effectively prevent curl from behaving
761 correctly. Be aware.
762
Daniel Stenberg811edcd2004-08-10 08:41:41 +0000763
Daniel Stenbergc3318b42000-08-17 14:06:42 +00007644. Running Problems
765
Daniel Stenberg811edcd2004-08-10 08:41:41 +0000766 4.2 Why do I get problems when I use & or % in the URL?
Daniel Stenberg29470102000-06-02 13:32:01 +0000767
Daniel Stenberg07d46882009-02-13 09:12:52 +0000768 In general unix shells, the & symbol is treated specially and when used, it
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000769 runs the specified command in the background. To safely send the & as a part
Daniel Stenberg4c485992001-04-22 15:45:27 +0000770 of a URL, you should quote the entire URL by using single (') or double (")
Dan Fandrich5c9fff92009-01-30 18:28:29 +0000771 quotes around it. Similar problems can also occur on some shells with other
Daniel Stenberge30b2062021-12-09 12:03:35 +0100772 characters, including ?*!$~(){}<>\|;`. When in doubt, quote the URL.
Daniel Stenberg29470102000-06-02 13:32:01 +0000773
Daniel Stenberg07d46882009-02-13 09:12:52 +0000774 An example that would invoke a remote CGI that uses &-symbols could be:
Daniel Stenberg8f037322000-06-06 14:09:01 +0000775
Daniel Stenbergedcd5df2000-06-06 14:13:36 +0000776 curl 'http://www.altavista.com/cgi-bin/query?text=yes&q=curl'
Daniel Stenberg8f037322000-06-06 14:09:01 +0000777
Daniel Stenberg1a911f72013-08-24 17:13:46 +0200778 In Windows, the standard DOS shell treats the percent sign specially and you
779 need to use TWO percent signs for each single one you want to use in the
780 URL.
Daniel Stenberge26ee092001-01-15 10:26:37 +0000781
Daniel Stenberg1a911f72013-08-24 17:13:46 +0200782 If you want a literal percent sign to be part of the data you pass in a POST
783 using -d/--data you must encode it as '%25' (which then also needs the
784 percent sign doubled on Windows machines).
Daniel Stenberg1b77c182001-01-29 10:24:51 +0000785
Daniel Stenberg811edcd2004-08-10 08:41:41 +0000786 4.3 How can I use {, }, [ or ] to specify multiple URLs?
Daniel Stenberg29470102000-06-02 13:32:01 +0000787
railsnewbie257cd6b99e2017-01-11 23:48:22 -0600788 Because those letters have a special meaning to the shell, to be used in
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000789 a URL specified to curl you must quote them.
Daniel Stenberg29470102000-06-02 13:32:01 +0000790
railsnewbie257cd6b99e2017-01-11 23:48:22 -0600791 An example that downloads two URLs (sequentially) would be:
Daniel Stenberg8f037322000-06-06 14:09:01 +0000792
Daniel Stenbergedcd5df2000-06-06 14:13:36 +0000793 curl '{curl,www}.haxx.se'
Daniel Stenberg8f037322000-06-06 14:09:01 +0000794
railsnewbie257cd6b99e2017-01-11 23:48:22 -0600795 To be able to use those characters as actual parts of the URL (without using
Daniel Stenbergdb5c9cd2003-02-25 08:52:32 +0000796 them for the curl URL "globbing" system), use the -g/--globoff option:
Daniel Stenberge26ee092001-01-15 10:26:37 +0000797
798 curl -g 'www.site.com/weirdname[].html'
799
Daniel Stenberga28464a2021-10-31 16:34:44 +0100800 4.4 Why do I get downloaded data even though the web page does not exist?
Daniel Stenberg29470102000-06-02 13:32:01 +0000801
Daniel Stenberga28464a2021-10-31 16:34:44 +0100802 curl asks remote servers for the page you specify. If the page does not exist
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000803 at the server, the HTTP protocol defines how the server should respond and
Daniel Stenberga28464a2021-10-31 16:34:44 +0100804 that means that headers and a "page" will be returned. That is simply how
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000805 HTTP works.
Daniel Stenberg29470102000-06-02 13:32:01 +0000806
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000807 By using the --fail option you can tell curl explicitly to not get any data
Daniel Stenberga28464a2021-10-31 16:34:44 +0100808 if the HTTP return code does not say success.
Daniel Stenberg8f037322000-06-06 14:09:01 +0000809
Daniel Stenberg3a4182d2022-03-29 13:58:11 +0200810 4.5 Why do I get return code XXX from an HTTP server?
Daniel Stenberg29470102000-06-02 13:32:01 +0000811
Daniel Stenberg11d718b2001-03-13 11:47:30 +0000812 RFC2616 clearly explains the return codes. This is a short transcript. Go
813 read the RFC for exact details:
Daniel Stenberg29470102000-06-02 13:32:01 +0000814
Daniel Stenberg09ba8562000-10-27 12:25:00 +0000815 4.5.1 "400 Bad Request"
Daniel Stenberg29470102000-06-02 13:32:01 +0000816
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000817 The request could not be understood by the server due to malformed
818 syntax. The client SHOULD NOT repeat the request without modifications.
819
Daniel Stenberg09ba8562000-10-27 12:25:00 +0000820 4.5.2 "401 Unauthorized"
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000821
822 The request requires user authentication.
823
Daniel Stenberg09ba8562000-10-27 12:25:00 +0000824 4.5.3 "403 Forbidden"
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000825
Viktor Szakatsff9d7f42018-10-08 19:37:40 +0000826 The server understood the request, but is refusing to fulfill it.
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000827 Authorization will not help and the request SHOULD NOT be repeated.
828
Daniel Stenberg09ba8562000-10-27 12:25:00 +0000829 4.5.4 "404 Not Found"
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000830
831 The server has not found anything matching the Request-URI. No indication
Antoine Pietrib341b762022-01-27 02:12:50 +0100832 is given as to whether the condition is temporary or permanent.
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000833
Daniel Stenberg09ba8562000-10-27 12:25:00 +0000834 4.5.5 "405 Method Not Allowed"
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000835
836 The method specified in the Request-Line is not allowed for the resource
837 identified by the Request-URI. The response MUST include an Allow header
838 containing a list of valid methods for the requested resource.
839
Daniel Stenbergd60029d2001-12-19 23:25:04 +0000840 4.5.6 "301 Moved Permanently"
Daniel Stenbergeea22872004-03-16 07:56:51 +0000841
Daniel Stenberg98871d12002-05-22 22:14:03 +0000842 If you get this return code and an HTML output similar to this:
Daniel Stenbergd60029d2001-12-19 23:25:04 +0000843
844 <H1>Moved Permanently</H1> The document has moved <A
845 HREF="http://same_url_now_with_a_trailing_slash/">here</A>.
846
dbrowndan84086b32019-05-23 15:05:29 -0700847 it might be because you requested a directory URL but without the trailing
Daniel Stenbergd60029d2001-12-19 23:25:04 +0000848 slash. Try the same operation again _with_ the trailing URL, or use the
849 -L/--location option to follow the redirection.
850
Daniel Stenberg811edcd2004-08-10 08:41:41 +0000851 4.6 Can you tell me what error code 142 means?
Daniel Stenberg29470102000-06-02 13:32:01 +0000852
Daniel Stenberg8b5f0ab2004-12-21 21:35:00 +0000853 All curl error codes are described at the end of the man page, in the
854 section called "EXIT CODES".
855
856 Error codes that are larger than the highest documented error code means
Daniel Stenberg13bf9642001-08-23 11:11:13 +0000857 that curl has exited due to a crash. This is a serious error, and we
Daniel Stenberg25fe47f2001-11-14 20:13:38 +0000858 appreciate a detailed bug report from you that describes how we could go
Daniel Stenberge30b2062021-12-09 12:03:35 +0100859 ahead and repeat this.
Daniel Stenberg29470102000-06-02 13:32:01 +0000860
Daniel Stenberg490879e2020-11-05 13:06:00 +0100861 4.7 How do I keep user names and passwords secret in curl command lines?
Daniel Stenberg29470102000-06-02 13:32:01 +0000862
Daniel Stenberg11d718b2001-03-13 11:47:30 +0000863 This problem has two sides:
Daniel Stenberg29470102000-06-02 13:32:01 +0000864
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000865 The first part is to avoid having clear-text passwords in the command line
Daniel Stenberga28464a2021-10-31 16:34:44 +0100866 so that they do not appear in 'ps' outputs and similar. That is easily
Daniel Stenbergeea22872004-03-16 07:56:51 +0000867 avoided by using the "-K" option to tell curl to read parameters from a file
868 or stdin to which you can pass the secret info. curl itself will also
869 attempt to "hide" the given password by blanking out the option - this
Daniel Stenberga28464a2021-10-31 16:34:44 +0100870 does not work on all platforms.
Daniel Stenberg29470102000-06-02 13:32:01 +0000871
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000872 To keep the passwords in your account secret from the rest of the world is
873 not a task that curl addresses. You could of course encrypt them somehow to
874 at least hide them from being read by human eyes, but that is not what
875 anyone would call security.
Daniel Stenberg29470102000-06-02 13:32:01 +0000876
Daniel Stenbergeea22872004-03-16 07:56:51 +0000877 Also note that regular HTTP (using Basic authentication) and FTP passwords
dbrowndan84086b32019-05-23 15:05:29 -0700878 are sent as cleartext across the network. All it takes for anyone to fetch
Daniel Stenberg92efb3d2021-11-01 13:43:11 +0100879 them is to listen on the network. Eavesdropping is easy. Use more secure
Daniel Stenbergeea22872004-03-16 07:56:51 +0000880 authentication methods (like Digest, Negotiate or even NTLM) or consider the
881 SSL-based alternatives HTTPS and FTPS.
Daniel Stenberg887e7282001-01-03 09:13:07 +0000882
Daniel Stenberge30b2062021-12-09 12:03:35 +0100883 4.8 I found a bug
Daniel Stenberg09ba8562000-10-27 12:25:00 +0000884
Daniel Stenberg4c485992001-04-22 15:45:27 +0000885 It is not a bug if the behavior is documented. Read the docs first.
Daniel Stenberge30b2062021-12-09 12:03:35 +0100886 Especially check out the KNOWN_BUGS file, it may be a documented bug.
Daniel Stenberg09ba8562000-10-27 12:25:00 +0000887
Daniel Stenberga28464a2021-10-31 16:34:44 +0100888 If it is a problem with a binary you have downloaded or a package for your
Daniel Stenberg09ba8562000-10-27 12:25:00 +0000889 particular platform, try contacting the person who built the package/archive
890 you have.
891
Daniel Stenberg8eaa7fe2002-04-27 18:12:26 +0000892 If there is a bug, read the BUGS document first. Then report it as described
893 in there.
Daniel Stenberg09ba8562000-10-27 12:25:00 +0000894
Daniel Stenberga28464a2021-10-31 16:34:44 +0100895 4.9 curl cannot authenticate to the server that requires NTLM?
Daniel Stenberg2c100372000-12-19 07:30:51 +0000896
Bill Nagel497e7c92016-07-07 08:40:45 -0700897 NTLM support requires OpenSSL, GnuTLS, mbedTLS, NSS, Secure Transport, or
898 Microsoft Windows libraries at build-time to provide this functionality.
Daniel Stenberg3a552b12003-06-26 11:35:48 +0000899
900 NTLM is a Microsoft proprietary protocol. Proprietary formats are evil. You
901 should not use such ones.
Daniel Stenberg29470102000-06-02 13:32:01 +0000902
Daniel Stenberge30b2062021-12-09 12:03:35 +0100903 4.10 My HTTP request using HEAD, PUT or DELETE does not work
Daniel Stenbergbc743752002-05-15 21:40:29 +0000904
905 Many web servers allow or demand that the administrator configures the
906 server properly for these requests to work on the web server.
907
908 Some servers seem to support HEAD only on certain kinds of URLs.
909
910 To fully grasp this, try the documentation for the particular server
Daniel Stenberga28464a2021-10-31 16:34:44 +0100911 software you are trying to interact with. This is not anything curl can do
Daniel Stenbergbc743752002-05-15 21:40:29 +0000912 anything about.
913
dbrowndan84086b32019-05-23 15:05:29 -0700914 4.11 Why do my HTTP range requests return the full document?
Daniel Stenberg522b85a2002-11-12 20:00:02 +0000915
916 Because the range may not be supported by the server, or the server may
917 choose to ignore it and return the full document anyway.
Daniel Stenbergbc743752002-05-15 21:40:29 +0000918
Daniel Stenberg16077112002-11-20 19:17:43 +0000919 4.12 Why do I get "certificate verify failed" ?
920
Daniel Stenberg3864ad32020-11-06 09:16:06 +0100921 When you invoke curl and get an error 60 error back it means that curl
Daniel Stenberga28464a2021-10-31 16:34:44 +0100922 could not verify that the server's certificate was good. curl verifies the
Daniel Stenberg3864ad32020-11-06 09:16:06 +0100923 certificate using the CA cert bundle and verifying for which names the
Dan Fandrich2a264d42020-12-12 09:59:10 -0800924 certificate has been granted.
Daniel Stenberg16077112002-11-20 19:17:43 +0000925
Dan Fandrich2a264d42020-12-12 09:59:10 -0800926 To completely disable the certificate verification, use -k. This does
Daniel Stenberg3864ad32020-11-06 09:16:06 +0100927 however enable man-in-the-middle attacks and makes the transfer INSECURE.
Antoine Pietrib341b762022-01-27 02:12:50 +0100928 We strongly advise against doing this for more than experiments.
Daniel Stenberg16077112002-11-20 19:17:43 +0000929
Daniel Stenberg3864ad32020-11-06 09:16:06 +0100930 If you get this failure with a CA cert bundle installed and used, the
Bruno Baguette0d380a82021-11-26 08:23:34 +0100931 server's certificate might not be signed by one of the CA's in your CA
Daniel Stenberg3864ad32020-11-06 09:16:06 +0100932 store. It might for example be self-signed. You then correct this problem by
933 obtaining a valid CA cert for the server. Or again, decrease the security by
934 disabling this check.
Daniel Stenberg16077112002-11-20 19:17:43 +0000935
Daniel Stenberg3864ad32020-11-06 09:16:06 +0100936 At times, you find that the verification works in your favorite browser but
937 fails in curl. When this happens, the reason is usually that the server
938 sends an incomplete cert chain. The server is mandated to send all
Daniel Stenberga28464a2021-10-31 16:34:44 +0100939 "intermediate certificates" but does not. This typically works with browsers
Daniel Stenberg3864ad32020-11-06 09:16:06 +0100940 anyway since they A) cache such certs and B) supports AIA which downloads
941 such missing certificates on demand. This is a server misconfiguration. A
942 good way to figure out if this is the case it to use the SSL Labs server
943 test and check the certificate chain: https://www.ssllabs.com/ssltest/
Daniel Stenberg16077112002-11-20 19:17:43 +0000944
Daniel Stenberg3864ad32020-11-06 09:16:06 +0100945 Details are also in the SSLCERTS.md document, found online here:
946 https://curl.se/docs/sslcerts.html
Daniel Stenberg16077112002-11-20 19:17:43 +0000947
Daniel Stenberg1dc0ce92005-06-13 18:33:40 +0000948 4.13 Why is curl -R on Windows one hour off?
949
Jay Satiroee3c83f2016-11-11 02:48:52 -0500950 Since curl 7.53.0 this issue should be fixed as long as curl was built with
951 any modern compiler that allows for a 64-bit curl_off_t type. For older
952 compilers or prior curl versions it may set a time that appears one hour off.
953 This happens due to a flaw in how Windows stores and uses file modification
954 times and it is not easily worked around. For more details read this:
Viktor Szakats62a71af2018-03-12 18:17:05 +0000955 https://www.codeproject.com/Articles/1144/Beating-the-Daylight-Savings-Time-bug-and-getting
Daniel Stenberg1dc0ce92005-06-13 18:33:40 +0000956
Daniel Stenberge30b2062021-12-09 12:03:35 +0100957 4.14 Redirects work in browser but not with curl
Daniel Stenberg09cb9c72005-08-26 13:22:39 +0000958
railsnewbie257cd6b99e2017-01-11 23:48:22 -0600959 curl supports HTTP redirects well (see item 3.8). Browsers generally support
Daniel Stenberg1a911f72013-08-24 17:13:46 +0200960 at least two other ways to perform redirects that curl does not:
Daniel Stenberg09cb9c72005-08-26 13:22:39 +0000961
Daniel Stenberg3a4182d2022-03-29 13:58:11 +0200962 Meta tags. You can write an HTML tag that will cause the browser to redirect
Daniel Stenberg1a911f72013-08-24 17:13:46 +0200963 to another given URL after a certain time.
Daniel Stenberg09cb9c72005-08-26 13:22:39 +0000964
Daniel Stenberg3a4182d2022-03-29 13:58:11 +0200965 Javascript. You can write a Javascript program embedded in an HTML page that
Daniel Stenberg1a911f72013-08-24 17:13:46 +0200966 redirects the browser to another given URL.
Daniel Stenberg09cb9c72005-08-26 13:22:39 +0000967
968 There is no way to make curl follow these redirects. You must either
dbrowndan84086b32019-05-23 15:05:29 -0700969 manually figure out what the page is set to do, or write a script that parses
970 the results and fetches the new URL.
Daniel Stenberg09cb9c72005-08-26 13:22:39 +0000971
Daniel Stenberga28464a2021-10-31 16:34:44 +0100972 4.15 FTPS does not work
Daniel Stenberg844cbc72007-07-29 22:17:39 +0000973
974 curl supports FTPS (sometimes known as FTP-SSL) both implicit and explicit
975 mode.
976
977 When a URL is used that starts with FTPS://, curl assumes implicit SSL on
978 the control connection and will therefore immediately connect and try to
979 speak SSL. FTPS:// connections default to port 990.
980
Daniel Stenberg3a4182d2022-03-29 13:58:11 +0200981 To use explicit FTPS, you use an FTP:// URL and the --ftp-ssl option (or one
Daniel Stenberg1640bb62019-02-28 09:09:51 +0100982 of its related flavors). This is the most common method, and the one
railsnewbie257cd6b99e2017-01-11 23:48:22 -0600983 mandated by RFC4217. This kind of connection will then of course use the
Daniel Stenberg844cbc72007-07-29 22:17:39 +0000984 standard FTP port 21 by default.
985
Daniel Stenberge30b2062021-12-09 12:03:35 +0100986 4.16 My HTTP POST or PUT requests are slow
Daniel Stenberg95df5d02008-09-24 07:50:46 +0000987
988 libcurl makes all POST and PUT requests (except for POST requests with a
Daniel Stenberg92efb3d2021-11-01 13:43:11 +0100989 tiny request body) use the "Expect: 100-continue" header. This header
Daniel Stenberg95df5d02008-09-24 07:50:46 +0000990 allows the server to deny the operation early so that libcurl can bail out
railsnewbie257cd6b99e2017-01-11 23:48:22 -0600991 before having to send any data. This is useful in authentication
Daniel Stenberg95df5d02008-09-24 07:50:46 +0000992 cases and others.
993
Daniel Stenberga28464a2021-10-31 16:34:44 +0100994 However, many servers do not implement the Expect: stuff properly and if the
995 server does not respond (positively) within 1 second libcurl will continue
Daniel Stenberg95df5d02008-09-24 07:50:46 +0000996 and send off the data anyway.
997
998 You can disable libcurl's use of the Expect: header the same way you disable
999 any header, using -H / CURLOPT_HTTPHEADER, or by forcing it to use HTTP 1.0.
Daniel Stenberg811edcd2004-08-10 08:41:41 +00001000
Daniel Stenberg2afb88e2009-02-23 21:21:00 +00001001 4.17 Non-functional connect timeouts
1002
1003 In most Windows setups having a timeout longer than 21 seconds make no
1004 difference, as it will only send 3 TCP SYN packets and no more. The second
1005 packet sent three seconds after the first and the third six seconds after
Daniel Stenberge30b2062021-12-09 12:03:35 +01001006 the second. No more than three packets are sent, no matter how long the
Daniel Stenberg2afb88e2009-02-23 21:21:00 +00001007 timeout is set.
1008
1009 See option TcpMaxConnectRetransmissions on this page:
Viktor Szakats45f21e02015-06-16 00:47:26 +02001010 https://support.microsoft.com/en-us/kb/175523/en-us
Daniel Stenberg2afb88e2009-02-23 21:21:00 +00001011
1012 Also, even on non-Windows systems there may run a firewall or anti-virus
1013 software or similar that accepts the connection but does not actually do
1014 anything else. This will make (lib)curl to consider the connection connected
Daniel Stenberga28464a2021-10-31 16:34:44 +01001015 and thus the connect timeout will not trigger.
Daniel Stenberg2afb88e2009-02-23 21:21:00 +00001016
Daniel Stenbergb8012ea2009-11-07 21:52:41 +00001017 4.18 file:// URLs containing drive letters (Windows, NetWare)
1018
Daniel Stenberg0f199632016-10-18 13:59:54 +02001019 When using curl to try to download a local file, one might use a URL
Daniel Stenbergb8012ea2009-11-07 21:52:41 +00001020 in this format:
1021
1022 file://D:/blah.txt
1023
Daniel Stenberga28464a2021-10-31 16:34:44 +01001024 you will find that even if D:\blah.txt does exist, curl returns a 'file
Daniel Stenbergb8012ea2009-11-07 21:52:41 +00001025 not found' error.
1026
Viktor Szakats45f21e02015-06-16 00:47:26 +02001027 According to RFC 1738 (https://www.ietf.org/rfc/rfc1738.txt),
Daniel Stenbergb8012ea2009-11-07 21:52:41 +00001028 file:// URLs must contain a host component, but it is ignored by
1029 most implementations. In the above example, 'D:' is treated as the
Daniel Stenberg0f199632016-10-18 13:59:54 +02001030 host component, and is taken away. Thus, curl tries to open '/blah.txt'.
Daniel Stenbergb8012ea2009-11-07 21:52:41 +00001031 If your system is installed to drive C:, that will resolve to 'C:\blah.txt',
Daniel Stenberga28464a2021-10-31 16:34:44 +01001032 and if that does not exist you will get the not found error.
Daniel Stenbergb8012ea2009-11-07 21:52:41 +00001033
1034 To fix this problem, use file:// URLs with *three* leading slashes:
1035
1036 file:///D:/blah.txt
1037
1038 Alternatively, if it makes more sense, specify 'localhost' as the host
1039 component:
1040
1041 file://localhost/D:/blah.txt
1042
Daniel Stenberg0f199632016-10-18 13:59:54 +02001043 In either case, curl should now be looking for the correct file.
Daniel Stenberg2afb88e2009-02-23 21:21:00 +00001044
Daniel Stenberga28464a2021-10-31 16:34:44 +01001045 4.19 Why does not curl return an error when the network cable is unplugged?
Dan Fandrich7d166b02010-07-21 15:15:07 -07001046
Dan Fandrich31c6e7a2013-04-15 22:26:18 +02001047 Unplugging a cable is not an error situation. The TCP/IP protocol stack
Dan Fandrich7d166b02010-07-21 15:15:07 -07001048 was designed to be fault tolerant, so even though there may be a physical
Daniel Stenberga28464a2021-10-31 16:34:44 +01001049 break somewhere the connection should not be affected, just possibly
Daniel Stenberge30b2062021-12-09 12:03:35 +01001050 delayed. Eventually, the physical break will be fixed or the data will be
Dan Fandrich31c6e7a2013-04-15 22:26:18 +02001051 re-routed around the physical problem through another path.
Dan Fandrich7d166b02010-07-21 15:15:07 -07001052
1053 In such cases, the TCP/IP stack is responsible for detecting when the
1054 network connection is irrevocably lost. Since with some protocols it is
Daniel Stenberg14f92f22016-01-25 11:11:29 +01001055 perfectly legal for the client to wait indefinitely for data, the stack may
Dan Fandrich7d166b02010-07-21 15:15:07 -07001056 never report a problem, and even when it does, it can take up to 20 minutes
Daniel Stenberge30b2062021-12-09 12:03:35 +01001057 for it to detect an issue. The curl option --keepalive-time enables
Dan Fandrich7d166b02010-07-21 15:15:07 -07001058 keep-alive support in the TCP/IP stack which makes it periodically probe the
1059 connection to make sure it is still available to send data. That should
1060 reliably detect any TCP/IP network failure.
1061
Daniel Stenberge30b2062021-12-09 12:03:35 +01001062 TCP keep alive will not detect the network going down before the TCP/IP
Dan Fandrich7d166b02010-07-21 15:15:07 -07001063 connection is established (e.g. during a DNS lookup) or using protocols that
Daniel Stenberge30b2062021-12-09 12:03:35 +01001064 do not use TCP. To handle those situations, curl offers a number of timeouts
Dan Fandrich7d166b02010-07-21 15:15:07 -07001065 on its own. --speed-limit/--speed-time will abort if the data transfer rate
1066 falls too low, and --connect-timeout and --max-time can be used to put an
1067 overall timeout on the connection phase or the entire transfer.
1068
Dan Fandrich31c6e7a2013-04-15 22:26:18 +02001069 A libcurl-using application running in a known physical environment (e.g.
1070 an embedded device with only a single network connection) may want to act
Daniel Stenberge30b2062021-12-09 12:03:35 +01001071 immediately if its lone network connection goes down. That can be achieved
Dan Fandrich31c6e7a2013-04-15 22:26:18 +02001072 by having the application monitor the network connection on its own using an
Daniel Stenberg1640bb62019-02-28 09:09:51 +01001073 OS-specific mechanism, then signaling libcurl to abort (see also item 5.13).
Daniel Stenberg889de6b2014-08-28 11:39:39 +02001074
Daniel Stenberge30b2062021-12-09 12:03:35 +01001075 4.20 curl does not return error for HTTP non-200 responses
Daniel Stenberg889de6b2014-08-28 11:39:39 +02001076
1077 Correct. Unless you use -f (--fail).
1078
Daniel Stenberga28464a2021-10-31 16:34:44 +01001079 When doing HTTP transfers, curl will perform exactly what you are asking it
Daniel Stenberg889de6b2014-08-28 11:39:39 +02001080 to do and if successful it will not return an error. You can use curl to
1081 test your web server's "file not found" page (that gets 404 back), you can
railsnewbie257cd6b99e2017-01-11 23:48:22 -06001082 use it to check your authentication protected web pages (that gets a 401
Daniel Stenberg889de6b2014-08-28 11:39:39 +02001083 back) and so on.
1084
1085 The specific HTTP response code does not constitute a problem or error for
1086 curl. It simply sends and delivers HTTP as you asked and if that worked,
1087 everything is fine and dandy. The response code is generally providing more
Daniel Stenberga28464a2021-10-31 16:34:44 +01001088 higher level error information that curl does not care about. The error was
Daniel Stenberg889de6b2014-08-28 11:39:39 +02001089 not in the HTTP transfer.
1090
1091 If you want your command line to treat error codes in the 400 and up range
1092 as errors and thus return a non-zero value and possibly show an error
1093 message, curl has a dedicated option for that: -f (CURLOPT_FAILONERROR in
1094 libcurl speak).
1095
Daniel Stenbergaccbbd72014-08-28 11:42:00 +02001096 You can also use the -w option and the variable %{response_code} to extract
railsnewbie257cd6b99e2017-01-11 23:48:22 -06001097 the exact response code that was returned in the response.
Daniel Stenbergaccbbd72014-08-28 11:42:00 +02001098
Daniel Stenbergc3318b42000-08-17 14:06:42 +000010995. libcurl Issues
Daniel Stenberg29470102000-06-02 13:32:01 +00001100
Daniel Stenberg811edcd2004-08-10 08:41:41 +00001101 5.1 Is libcurl thread-safe?
Daniel Stenberg29470102000-06-02 13:32:01 +00001102
Daniel Stenberg7d09e512001-01-11 12:52:07 +00001103 Yes.
1104
Dan Fandrichec2ad572005-04-13 19:31:00 +00001105 We have written the libcurl code specifically adjusted for multi-threaded
Daniel Stenberg7d09e512001-01-11 12:52:07 +00001106 programs. libcurl will use thread-safe functions instead of non-safe ones if
Daniel Stenberge30b2062021-12-09 12:03:35 +01001107 your system has such. Note that you must never share the same handle in
Dan Fandrich31c6e7a2013-04-15 22:26:18 +02001108 multiple threads.
1109
Jay Satirobefa21f2016-05-05 14:34:27 -04001110 There may be some exceptions to thread safety depending on how libcurl was
1111 built. Please review the guidelines for thread safety to learn more:
Daniel Stenberg4d2f8002020-11-04 14:02:01 +01001112 https://curl.se/libcurl/c/threadsafe.html
Daniel Stenberg7f70dbc2007-02-12 22:32:37 +00001113
Daniel Stenberga40b55d2000-11-22 07:27:26 +00001114 5.2 How can I receive all data into a large memory chunk?
1115
Daniel Stenberga84af982001-05-15 13:09:27 +00001116 [ See also the examples/getinmemory.c source ]
1117
Daniel Stenberga40b55d2000-11-22 07:27:26 +00001118 You are in full control of the callback function that gets called every time
1119 there is data received from the remote server. You can make that callback do
Daniel Stenberg4c485992001-04-22 15:45:27 +00001120 whatever you want. You do not have to write the received data to a file.
Daniel Stenberga40b55d2000-11-22 07:27:26 +00001121
1122 One solution to this problem could be to have a pointer to a struct that you
1123 pass to the callback function. You set the pointer using the
Daniel Stenberg9a44fa82005-11-02 09:34:53 +00001124 CURLOPT_WRITEDATA option. Then that pointer will be passed to the callback
1125 instead of a FILE * to a file:
Daniel Stenberga40b55d2000-11-22 07:27:26 +00001126
1127 /* imaginary struct */
1128 struct MemoryStruct {
1129 char *memory;
1130 size_t size;
1131 };
1132
1133 /* imaginary callback function */
1134 size_t
1135 WriteMemoryCallback(void *ptr, size_t size, size_t nmemb, void *data)
1136 {
Daniel Stenberg811edcd2004-08-10 08:41:41 +00001137 size_t realsize = size * nmemb;
Daniel Stenberga40b55d2000-11-22 07:27:26 +00001138 struct MemoryStruct *mem = (struct MemoryStruct *)data;
Daniel Stenbergeea22872004-03-16 07:56:51 +00001139
Daniel Stenberga40b55d2000-11-22 07:27:26 +00001140 mem->memory = (char *)realloc(mem->memory, mem->size + realsize + 1);
1141 if (mem->memory) {
1142 memcpy(&(mem->memory[mem->size]), ptr, realsize);
1143 mem->size += realsize;
1144 mem->memory[mem->size] = 0;
1145 }
1146 return realsize;
1147 }
1148
Daniel Stenberg2c100372000-12-19 07:30:51 +00001149 5.3 How do I fetch multiple files with libcurl?
Daniel Stenbergec5ac822000-12-14 08:37:09 +00001150
Daniel Stenbergdb5c9cd2003-02-25 08:52:32 +00001151 libcurl has excellent support for transferring multiple files. You should
1152 just repeatedly set new URLs with curl_easy_setopt() and then transfer it
1153 with curl_easy_perform(). The handle you get from curl_easy_init() is not
Daniel Stenberga28464a2021-10-31 16:34:44 +01001154 only reusable, but you are even encouraged to reuse it if you can, as that
Daniel Stenbergdb5c9cd2003-02-25 08:52:32 +00001155 will enable libcurl to use persistent connections.
Daniel Stenberga40b55d2000-11-22 07:27:26 +00001156
Daniel Stenbergbc5954f2001-03-23 08:16:24 +00001157 5.4 Does libcurl do Winsock initialization on win32 systems?
Daniel Stenberg910fc852000-12-30 11:48:51 +00001158
Daniel Stenbergdb5c9cd2003-02-25 08:52:32 +00001159 Yes, if told to in the curl_global_init() call.
Daniel Stenberg910fc852000-12-30 11:48:51 +00001160
Daniel Stenberg7e3cd822003-12-08 13:59:35 +00001161 5.5 Does CURLOPT_WRITEDATA and CURLOPT_READDATA work on win32 ?
Daniel Stenberg41084e52001-01-22 08:42:00 +00001162
1163 Yes, but you cannot open a FILE * and pass the pointer to a DLL and have
Daniel Stenberg7e3cd822003-12-08 13:59:35 +00001164 that DLL use the FILE * (as the DLL and the client application cannot access
1165 each others' variable memory areas). If you set CURLOPT_WRITEDATA you must
1166 also use CURLOPT_WRITEFUNCTION as well to set a function that writes the
1167 file, even if that simply writes the data to the specified FILE *.
1168 Similarly, if you use CURLOPT_READDATA you must also specify
1169 CURLOPT_READFUNCTION.
Daniel Stenberg41084e52001-01-22 08:42:00 +00001170
Daniel Stenberg4c485992001-04-22 15:45:27 +00001171 5.6 What about Keep-Alive or persistent connections?
Daniel Stenberg6dc5c6f2001-01-27 20:51:31 +00001172
Daniel Stenbergdb5c9cd2003-02-25 08:52:32 +00001173 curl and libcurl have excellent support for persistent connections when
Daniel Stenberg490879e2020-11-05 13:06:00 +01001174 transferring several files from the same server. curl will attempt to reuse
Daniel Stenbergdb5c9cd2003-02-25 08:52:32 +00001175 connections for all URLs specified on the same command line/config file, and
1176 libcurl will reuse connections for all transfers that are made using the
1177 same libcurl handle.
Daniel Stenberg6dc5c6f2001-01-27 20:51:31 +00001178
Daniel Stenberg6d496952017-05-12 19:58:06 +02001179 When you use the easy interface the connection cache is kept within the easy
1180 handle. If you instead use the multi interface, the connection cache will be
1181 kept within the multi handle and will be shared among all the easy handles
railsnewbie257cd6b99e2017-01-11 23:48:22 -06001182 that are used within the same multi handle.
Daniel Stenbergc9a82f32011-06-21 08:44:42 +02001183
Daniel Stenberge30b2062021-12-09 12:03:35 +01001184 5.7 Link errors when building libcurl on Windows
Daniel Stenbergdd82d692002-10-08 07:16:17 +00001185
1186 You need to make sure that your project, and all the libraries (both static
1187 and dynamic) that it links against, are compiled/linked against the same run
1188 time library.
1189
1190 This is determined by the /MD, /ML, /MT (and their corresponding /M?d)
1191 options to the command line compiler. /MD (linking against MSVCRT dll) seems
1192 to be the most commonly used option.
1193
Gisle Vanem51a87fa2004-11-24 15:14:42 +00001194 When building an application that uses the static libcurl library, you must
1195 add -DCURL_STATICLIB to your CFLAGS. Otherwise the linker will look for
Daniel Stenberga28464a2021-10-31 16:34:44 +01001196 dynamic import symbols. If you are using Visual Studio, you need to instead
Daniel Stenberg6ce76e62010-09-08 23:23:19 +02001197 add CURL_STATICLIB in the "Preprocessor Definitions" section.
1198
Antoine Pietrib341b762022-01-27 02:12:50 +01001199 If you get a linker error like "unknown symbol __imp__curl_easy_init ..." you
Daniel Stenberge30b2062021-12-09 12:03:35 +01001200 have linked against the wrong (static) library. If you want to use the
Daniel Stenberga28464a2021-10-31 16:34:44 +01001201 libcurl.dll and import lib, you do not need any extra CFLAGS, but use one of
Daniel Stenberg6ce76e62010-09-08 23:23:19 +02001202 the import libraries below. These are the libraries produced by the various
1203 lib/Makefile.* files:
Gisle Vanem51a87fa2004-11-24 15:14:42 +00001204
Daniel Stenberg77110862011-03-14 13:31:05 +01001205 Target: static lib. import lib for libcurl*.dll.
1206 -----------------------------------------------------------
1207 MingW: libcurl.a libcurldll.a
1208 MSVC (release): libcurl.lib libcurl_imp.lib
1209 MSVC (debug): libcurld.lib libcurld_imp.lib
1210 Borland: libcurl.lib libcurl_imp.lib
Gisle Vanem51a87fa2004-11-24 15:14:42 +00001211
Daniel Stenberg9754b202010-08-11 09:15:43 +02001212 5.8 libcurl.so.X: open failed: No such file or directory
Daniel Stenberg811edcd2004-08-10 08:41:41 +00001213
1214 This is an error message you might get when you try to run a program linked
Daniel Stenberg3a4182d2022-03-29 13:58:11 +02001215 with a shared version of libcurl and your runtime linker (ld.so) could not
Daniel Stenberg9754b202010-08-11 09:15:43 +02001216 find the shared library named libcurl.so.X. (Where X is the number of the
1217 current libcurl ABI, typically 3 or 4).
Daniel Stenberg811edcd2004-08-10 08:41:41 +00001218
Daniel Stenberg9754b202010-08-11 09:15:43 +02001219 You need to make sure that ld.so finds libcurl.so.X. You can do that
Daniel Stenberge30b2062021-12-09 12:03:35 +01001220 multiple ways, and it differs somewhat between different operating systems.
1221 They are usually:
Daniel Stenberg811edcd2004-08-10 08:41:41 +00001222
1223 * Add an option to the linker command line that specify the hard-coded path
Daniel Stenberg3a4182d2022-03-29 13:58:11 +02001224 the runtime linker should check for the lib (usually -R)
Daniel Stenberg811edcd2004-08-10 08:41:41 +00001225
1226 * Set an environment variable (LD_LIBRARY_PATH for example) where ld.so
1227 should check for libs
1228
Daniel Stenberga28464a2021-10-31 16:34:44 +01001229 * Adjust the system's config to check for libs in the directory where you have
Daniel Stenberg811edcd2004-08-10 08:41:41 +00001230 put the dir (like Linux's /etc/ld.so.conf)
1231
1232 'man ld.so' and 'man ld' will tell you more details
1233
Daniel Stenberg1d323362004-08-12 14:09:10 +00001234 5.9 How does libcurl resolve host names?
1235
Daniel Stenberge30b2062021-12-09 12:03:35 +01001236 libcurl supports a large number of name resolve functions. One of them is
1237 picked at build-time and will be used unconditionally. Thus, if you want to
1238 change name resolver function you must rebuild libcurl and tell it to use a
1239 different function.
Daniel Stenberg1d323362004-08-12 14:09:10 +00001240
Daniel Stenberg6d496952017-05-12 19:58:06 +02001241 - The non-IPv6 resolver that can use one of four different host name resolve
railsnewbie257cd6b99e2017-01-11 23:48:22 -06001242 calls (depending on what your system supports):
Daniel Stenberg1d323362004-08-12 14:09:10 +00001243
Daniel Stenberg77110862011-03-14 13:31:05 +01001244 A - gethostbyname()
1245 B - gethostbyname_r() with 3 arguments
1246 C - gethostbyname_r() with 5 arguments
1247 D - gethostbyname_r() with 6 arguments
Daniel Stenberg1d323362004-08-12 14:09:10 +00001248
Steve Holme151ae592014-12-27 11:09:01 +00001249 - The IPv6-resolver that uses getaddrinfo()
Daniel Stenberg1d323362004-08-12 14:09:10 +00001250
1251 - The c-ares based name resolver that uses the c-ares library for resolves.
Daniel Stenbergfa811932011-04-14 23:12:27 +02001252 Using this offers asynchronous name resolves.
Daniel Stenberg1d323362004-08-12 14:09:10 +00001253
Daniel Stenberg18a9ee62010-06-30 15:52:58 +02001254 - The threaded resolver (default option on Windows). It uses:
Daniel Stenberg1d323362004-08-12 14:09:10 +00001255
Steve Holme151ae592014-12-27 11:09:01 +00001256 A - gethostbyname() on plain IPv4 hosts
1257 B - getaddrinfo() on IPv6 enabled hosts
Daniel Stenbergdd82d692002-10-08 07:16:17 +00001258
Daniel Stenberge9eb5232005-04-05 14:36:37 +00001259 Also note that libcurl never resolves or reverse-lookups addresses given as
1260 pure numbers, such as 127.0.0.1 or ::1.
1261
1262 5.10 How do I prevent libcurl from writing the response to stdout?
1263
1264 libcurl provides a default built-in write function that writes received data
Daniel Stenberg9a44fa82005-11-02 09:34:53 +00001265 to stdout. Set the CURLOPT_WRITEFUNCTION to receive the data, or possibly
1266 set CURLOPT_WRITEDATA to a different FILE * handle.
Daniel Stenberge9eb5232005-04-05 14:36:37 +00001267
Daniel Stenberg6e8e0412005-04-05 14:38:38 +00001268 5.11 How do I make libcurl not receive the whole HTTP response?
1269
1270 You make the write callback (or progress callback) return an error and
1271 libcurl will then abort the transfer.
1272
Daniel Stenbergb5d50e92005-04-11 13:39:55 +00001273 5.12 Can I make libcurl fake or hide my real IP address?
1274
Daniel Stenberg1a911f72013-08-24 17:13:46 +02001275 No. libcurl operates on a higher level. Besides, faking IP address would
railsnewbie257cd6b99e2017-01-11 23:48:22 -06001276 imply sending IP packets with a made-up source address, and then you normally
Daniel Stenberg1a911f72013-08-24 17:13:46 +02001277 get a problem with receiving the packet sent back as they would then not be
Daniel Stenberge30b2062021-12-09 12:03:35 +01001278 routed to you.
Daniel Stenbergb5d50e92005-04-11 13:39:55 +00001279
1280 If you use a proxy to access remote sites, the sites will not see your local
1281 IP address but instead the address of the proxy.
1282
1283 Also note that on many networks NATs or other IP-munging techniques are used
1284 that makes you see and use a different IP address locally than what the
Daniel Stenberg1a911f72013-08-24 17:13:46 +02001285 remote server will see you coming from. You may also consider using
Viktor Szakats45f21e02015-06-16 00:47:26 +02001286 https://www.torproject.org/ .
Daniel Stenbergb5d50e92005-04-11 13:39:55 +00001287
Daniel Stenberg24602ed2007-12-10 10:28:56 +00001288 5.13 How do I stop an ongoing transfer?
1289
Daniel Stenberg4b837a72011-01-24 22:18:43 +01001290 With the easy interface you make sure to return the correct error code from
1291 one of the callbacks, but none of them are instant. There is no function you
1292 can call from another thread or similar that will stop it immediately.
Dan Fandrichb3740f02011-06-02 18:41:57 -07001293 Instead, you need to make sure that one of the callbacks you use returns an
Daniel Stenberge30b2062021-12-09 12:03:35 +01001294 appropriate value that will stop the transfer. Suitable callbacks that you
Dan Fandrichb3740f02011-06-02 18:41:57 -07001295 can do this with include the progress callback, the read callback and the
1296 write callback.
Daniel Stenberg24602ed2007-12-10 10:28:56 +00001297
Daniel Stenberga28464a2021-10-31 16:34:44 +01001298 If you are using the multi interface, you can also stop a transfer by
Dan Fandrichb3740f02011-06-02 18:41:57 -07001299 removing the particular easy handle from the multi stack at any moment you
Daniel Stenberg9ca812f2013-02-04 22:46:51 +01001300 think the transfer is done or when you wish to abort the transfer.
Daniel Stenberge9eb5232005-04-05 14:36:37 +00001301
Daniel Stenberg22059852008-09-24 07:39:42 +00001302 5.14 Using C++ non-static functions for callbacks?
1303
Daniel Stenberga28464a2021-10-31 16:34:44 +01001304 libcurl is a C library, it does not know anything about C++ member functions.
Daniel Stenberg22059852008-09-24 07:39:42 +00001305
railsnewbie257cd6b99e2017-01-11 23:48:22 -06001306 You can overcome this "limitation" with relative ease using a static
Daniel Stenberg22059852008-09-24 07:39:42 +00001307 member function that is passed a pointer to the class:
1308
1309 // f is the pointer to your object.
Stephen Brokenshire2a1d5382016-10-01 16:36:50 +01001310 static size_t YourClass::func(void *buffer, size_t sz, size_t n, void *f)
Daniel Stenberg22059852008-09-24 07:39:42 +00001311 {
1312 // Call non-static member function.
1313 static_cast<YourClass*>(f)->nonStaticFunction();
1314 }
1315
1316 // This is how you pass pointer to the static function:
Stephen Brokenshire2a1d5382016-10-01 16:36:50 +01001317 curl_easy_setopt(hcurl, CURLOPT_WRITEFUNCTION, YourClass::func);
Daniel Stenberg22059852008-09-24 07:39:42 +00001318 curl_easy_setopt(hcurl, CURLOPT_WRITEDATA, this);
1319
Yang Tsea07bc792010-02-14 19:40:18 +00001320 5.15 How do I get an FTP directory listing?
Daniel Stenberg8740d142009-06-09 09:02:39 +00001321
1322 If you end the FTP URL you request with a slash, libcurl will provide you
1323 with a directory listing of that given directory. You can also set
1324 CURLOPT_CUSTOMREQUEST to alter what exact listing command libcurl would use
1325 to list the files.
1326
Jay Satirof9eed592016-07-09 03:05:55 -04001327 The follow-up question tends to be how is a program supposed to parse the
1328 directory listing. How does it know what's a file and what's a dir and what's
1329 a symlink etc. If the FTP server supports the MLSD command then it will
1330 return data in a machine-readable format that can be parsed for type. The
1331 types are specified by RFC3659 section 7.5.1. If MLSD is not supported then
Daniel Stenberga28464a2021-10-31 16:34:44 +01001332 you have to work with what you are given. The LIST output format is entirely
1333 at the server's own liking and the NLST output does not reveal any types and
1334 in many cases does not even include all the directory entries. Also, both LIST
Jay Satirof9eed592016-07-09 03:05:55 -04001335 and NLST tend to hide unix-style hidden files (those that start with a dot)
1336 by default so you need to do "LIST -a" or similar to see them.
Daniel Stenberg8740d142009-06-09 09:02:39 +00001337
Jay Satirof9eed592016-07-09 03:05:55 -04001338 Example - List only directories.
1339 ftp.funet.fi supports MLSD and ftp.kernel.org does not:
1340
1341 curl -s ftp.funet.fi/pub/ -X MLSD | \
1342 perl -lne 'print if s/(?:^|;)type=dir;[^ ]+ (.+)$/$1/'
1343
1344 curl -s ftp.kernel.org/pub/linux/kernel/ | \
1345 perl -lne 'print if s/^d[-rwx]{9}(?: +[^ ]+){7} (.+)$/$1/'
1346
1347 If you need to parse LIST output in libcurl one such existing
Viktor Szakatsd49881c2016-02-03 05:09:25 +01001348 list parser is available at https://cr.yp.to/ftpparse.html Versions of
Dan Fandrich7d166b02010-07-21 15:15:07 -07001349 libcurl since 7.21.0 also provide the ability to specify a wildcard to
1350 download multiple files from one FTP directory.
Daniel Stenberg8740d142009-06-09 09:02:39 +00001351
Daniel Stenberge30b2062021-12-09 12:03:35 +01001352 5.16 I want a different time-out
Daniel Stenberge8ab9a02012-09-28 15:50:18 +02001353
Daniel Stenberge30b2062021-12-09 12:03:35 +01001354 Sometimes users realize that CURLOPT_TIMEOUT and CURLOPT_CONNECTIMEOUT are
1355 not sufficiently advanced or flexible to cover all the various use cases and
1356 scenarios applications end up with.
Daniel Stenberge8ab9a02012-09-28 15:50:18 +02001357
1358 libcurl offers many more ways to time-out operations. A common alternative
1359 is to use the CURLOPT_LOW_SPEED_LIMIT and CURLOPT_LOW_SPEED_TIME options to
1360 specify the lowest possible speed to accept before to consider the transfer
1361 timed out.
1362
1363 The most flexible way is by writing your own time-out logic and using
Daniel Stenberg7f555dc2017-10-09 16:13:27 +02001364 CURLOPT_XFERINFOFUNCTION (perhaps in combination with other callbacks) and
Daniel Stenberge8ab9a02012-09-28 15:50:18 +02001365 use that to figure out exactly when the right condition is met when the
1366 transfer should get stopped.
1367
Daniel Stenbergdbf93a82013-01-03 10:15:02 +01001368 5.17 Can I write a server with libcurl?
1369
1370 No. libcurl offers no functions or building blocks to build any kind of
Daniel Stenberg3a4182d2022-03-29 13:58:11 +02001371 Internet protocol server. libcurl is only a client-side library. For server
Daniel Stenbergdbf93a82013-01-03 10:15:02 +01001372 libraries, you need to continue your search elsewhere but there exist many
Daniel Stenberge30b2062021-12-09 12:03:35 +01001373 good open source ones out there for most protocols you could want a server
1374 for. There are also really good stand-alone servers that have been tested
1375 and proven for many years. There's no need for you to reinvent them.
Daniel Stenbergdbf93a82013-01-03 10:15:02 +01001376
Daniel Stenberg1495f422014-05-08 09:30:35 +02001377 5.18 Does libcurl use threads?
1378
1379 Put simply: no, libcurl will execute in the same thread you call it in. All
1380 callbacks will be called in the same thread as the one you call libcurl in.
1381
1382 If you want to avoid your thread to be blocked by the libcurl call, you make
Daniel Stenberge30b2062021-12-09 12:03:35 +01001383 sure you use the non-blocking multi API which will do transfers
1384 asynchronously - still in the same single thread.
Daniel Stenberg1495f422014-05-08 09:30:35 +02001385
1386 libcurl will potentially internally use threads for name resolving, if it
Daniel Stenberga28464a2021-10-31 16:34:44 +01001387 was built to work like that, but in those cases it will create the child
Daniel Stenberg1495f422014-05-08 09:30:35 +02001388 threads by itself and they will only be used and then killed internally by
1389 libcurl and never exposed to the outside.
Daniel Stenberg8740d142009-06-09 09:02:39 +00001390
Daniel Stenbergc3318b42000-08-17 14:06:42 +000013916. License Issues
Daniel Stenbergc3c77392000-07-31 22:42:34 +00001392
Daniel Stenberg92efb3d2021-11-01 13:43:11 +01001393 curl and libcurl are released under a MIT/X derivative license. The license
1394 is liberal and should not impose a problem for your project. This section is
1395 just a brief summary for the cases we get the most questions. (Parts of this
1396 section was much enhanced by Bjorn Reese.)
Daniel Stenbergc3c77392000-07-31 22:42:34 +00001397
Daniel Stenberg9a44fa82005-11-02 09:34:53 +00001398 We are not lawyers and this is not legal advice. You should probably consult
Dan Fandrichc28443c2010-12-08 10:16:25 -08001399 one if you want true and accurate legal insights without our prejudice. Note
1400 especially that this section concerns the libcurl license only; compiling in
1401 features of libcurl that depend on other libraries (e.g. OpenSSL) may affect
1402 the licensing obligations of your application.
Daniel Stenberg9a44fa82005-11-02 09:34:53 +00001403
Daniel Stenberg811edcd2004-08-10 08:41:41 +00001404 6.1 I have a GPL program, can I use the libcurl library?
Daniel Stenbergc3c77392000-07-31 22:42:34 +00001405
Daniel Stenberge30b2062021-12-09 12:03:35 +01001406 Yes
Daniel Stenberg7d1ef962000-08-14 06:31:59 +00001407
Daniel Stenberge30b2062021-12-09 12:03:35 +01001408 Since libcurl may be distributed under the MIT/X derivative license, it can
1409 be used together with GPL in any software.
Daniel Stenbergc3c77392000-07-31 22:42:34 +00001410
Daniel Stenberg811edcd2004-08-10 08:41:41 +00001411 6.2 I have a closed-source program, can I use the libcurl library?
Daniel Stenbergc3c77392000-07-31 22:42:34 +00001412
Daniel Stenberge30b2062021-12-09 12:03:35 +01001413 Yes
Daniel Stenberg0d181b52001-01-04 12:43:53 +00001414
Daniel Stenbergc59baa02001-02-12 10:05:09 +00001415 libcurl does not put any restrictions on the program that uses the library.
Daniel Stenbergc3c77392000-07-31 22:42:34 +00001416
Daniel Stenberg811edcd2004-08-10 08:41:41 +00001417 6.3 I have a BSD licensed program, can I use the libcurl library?
Daniel Stenberg31b8eea2000-08-23 07:27:00 +00001418
Daniel Stenberge30b2062021-12-09 12:03:35 +01001419 Yes
Daniel Stenberg0d181b52001-01-04 12:43:53 +00001420
Daniel Stenbergc59baa02001-02-12 10:05:09 +00001421 libcurl does not put any restrictions on the program that uses the library.
Daniel Stenberg31b8eea2000-08-23 07:27:00 +00001422
Daniel Stenberg811edcd2004-08-10 08:41:41 +00001423 6.4 I have a program that uses LGPL libraries, can I use libcurl?
Daniel Stenbergc3c77392000-07-31 22:42:34 +00001424
Daniel Stenberge30b2062021-12-09 12:03:35 +01001425 Yes
Daniel Stenbergc3c77392000-07-31 22:42:34 +00001426
Daniel Stenberga28464a2021-10-31 16:34:44 +01001427 The LGPL license does not clash with other licenses.
Daniel Stenbergc3318b42000-08-17 14:06:42 +00001428
Daniel Stenberg811edcd2004-08-10 08:41:41 +00001429 6.5 Can I modify curl/libcurl for my program and keep the changes secret?
Daniel Stenbergc3c77392000-07-31 22:42:34 +00001430
Daniel Stenberge30b2062021-12-09 12:03:35 +01001431 Yes
Daniel Stenberg0d181b52001-01-04 12:43:53 +00001432
Daniel Stenberge30b2062021-12-09 12:03:35 +01001433 The MIT/X derivative license practically allows you to do almost anything
1434 with the sources, on the condition that the copyright texts in the sources
1435 are left intact.
Daniel Stenbergc3c77392000-07-31 22:42:34 +00001436
Daniel Stenberg811edcd2004-08-10 08:41:41 +00001437 6.6 Can you please change the curl/libcurl license to XXXX?
Daniel Stenbergc3c77392000-07-31 22:42:34 +00001438
Daniel Stenbergc59baa02001-02-12 10:05:09 +00001439 No.
1440
Daniel Stenberg11d718b2001-03-13 11:47:30 +00001441 We have carefully picked this license after years of development and
1442 discussions and a large amount of people have contributed with source code
1443 knowing that this is the license we use. This license puts the restrictions
1444 we want on curl/libcurl and it does not spread to other programs or
Daniel Stenberg3a552b12003-06-26 11:35:48 +00001445 libraries that use it. It should be possible for everyone to use libcurl or
1446 curl in their projects, no matter what license they already have in use.
Daniel Stenberg9ac76292004-08-18 11:18:36 +00001447
Dan Fandrich5c9fff92009-01-30 18:28:29 +00001448 6.7 What are my obligations when using libcurl in my commercial apps?
Daniel Stenberg9a44fa82005-11-02 09:34:53 +00001449
1450 Next to none. All you need to adhere to is the MIT-style license (stated in
1451 the COPYING file) which basically says you have to include the copyright
1452 notice in "all copies" and that you may not use the copyright holder's name
1453 when promoting your software.
1454
1455 You do not have to release any of your source code.
1456
1457 You do not have to reveal or make public any changes to the libcurl source
1458 code.
1459
Daniel Stenberg819dfdd2011-01-29 23:52:40 +01001460 You do not have to broadcast to the world that you are using libcurl within
Daniel Stenberg9a44fa82005-11-02 09:34:53 +00001461 your app.
1462
Daniel Stenberg819dfdd2011-01-29 23:52:40 +01001463 All we ask is that you disclose "the copyright notice and this permission
1464 notice" somewhere. Most probably like in the documentation or in the section
1465 where other third party dependencies already are mentioned and acknowledged.
1466
Daniel Stenberg4d2f8002020-11-04 14:02:01 +01001467 As can be seen here: https://curl.se/docs/companies.html and elsewhere,
Daniel Stenberg819dfdd2011-01-29 23:52:40 +01001468 more and more companies are discovering the power of libcurl and take
1469 advantage of it even in commercial environments.
Daniel Stenberg9a44fa82005-11-02 09:34:53 +00001470
1471
Daniel Stenberg9ac76292004-08-18 11:18:36 +000014727. PHP/CURL Issues
1473
1474 7.1 What is PHP/CURL?
1475
1476 The module for PHP that makes it possible for PHP programs to access curl-
Daniel Stenbergb6c876b2005-07-30 23:37:05 +00001477 functions from within PHP.
1478
1479 In the cURL project we call this module PHP/CURL to differentiate it from
1480 curl the command line tool and libcurl the library. The PHP team however
1481 does not refer to it like this (for unknown reasons). They call it plain
Daniel Stenberg844cbc72007-07-29 22:17:39 +00001482 CURL (often using all caps) or sometimes ext/curl, but both cause much
1483 confusion to users which in turn gives us a higher question load.
Daniel Stenberg9ac76292004-08-18 11:18:36 +00001484
Daniel Stenberge38a7882011-03-17 11:30:29 +01001485 7.2 Who wrote PHP/CURL?
Daniel Stenberg9ac76292004-08-18 11:18:36 +00001486
MaxGiting05cd55f2015-11-18 23:00:24 -05001487 PHP/CURL was initially written by Sterling Hughes.
Daniel Stenberg9ac76292004-08-18 11:18:36 +00001488
1489 7.3 Can I perform multiple requests using the same handle?
1490
Daniel Stenbergee400f92004-08-19 06:31:29 +00001491 Yes - at least in PHP version 4.3.8 and later (this has been known to not
1492 work in earlier versions, but the exact version when it started to work is
1493 unknown to me).
Daniel Stenberg9ac76292004-08-18 11:18:36 +00001494
Daniel Stenbergee400f92004-08-19 06:31:29 +00001495 After a transfer, you just set new options in the handle and make another
MaxGiting05cd55f2015-11-18 23:00:24 -05001496 transfer. This will make libcurl re-use the same connection if it can.
1497
1498 7.4 Does PHP/CURL have dependencies?
1499
1500 PHP/CURL is a module that comes with the regular PHP package. It depends on
1501 and uses libcurl, so you need to have libcurl installed properly before
1502 PHP/CURL can be used.
Daniel Stenberg352b07f2021-09-13 17:21:38 +02001503
15048. Development
1505
1506 8.1 Why does curl use C89?
1507
Daniel Stenberga28464a2021-10-31 16:34:44 +01001508 As with everything in curl, there's a history and we keep using what we have
Daniel Stenberg352b07f2021-09-13 17:21:38 +02001509 used before until someone brings up the subject and argues for and works on
1510 changing it.
1511
1512 We started out using C89 in the 1990s because that was the only way to write
1513 a truly portable C program and have it run as widely as possible. C89 was for
1514 a long time even necessary to make things work on otherwise considered modern
Daniel Stenberga28464a2021-10-31 16:34:44 +01001515 platforms such as Windows. Today, we do not really know how many users that
Daniel Stenberg352b07f2021-09-13 17:21:38 +02001516 still require the use of a C89 compiler.
1517
1518 We will continue to use C89 for as long as nobody brings up a strong enough
Daniel Stenberga28464a2021-10-31 16:34:44 +01001519 reason for us to change our minds. The core developers of the project do not
Daniel Stenberg352b07f2021-09-13 17:21:38 +02001520 feel restricted by this and we are not convinced that going C99 will offer us
1521 enough of a benefit to warrant the risk of cutting off a share of users.
1522
1523 8.2 Will curl be rewritten?
1524
1525 In one go: no. Little by little over time? Maybe.
1526
1527 Over the years, new languages and clever operating environments come and go.
1528 Every now and then the urge apparently arises to request that we rewrite curl
1529 in another language.
1530
1531 Some the most important properties in curl are maintaining the API and ABI
1532 for libcurl and keeping the behavior for the command line tool. As long as we
1533 can do that, everything else is up for discussion. To maintain the ABI, we
1534 probably have to maintain a certain amount of code in C, and to remain rock
1535 stable, we will never risk anything by rewriting a lot of things in one go.
1536 That said, we can certainly offer more and more optional backends written in
1537 other languages, as long as those backends can be plugged in at build-time.
Daniel Stenberg3a4182d2022-03-29 13:58:11 +02001538 Backends can be written in any language, but should probably provide APIs
Daniel Stenberg352b07f2021-09-13 17:21:38 +02001539 usable from C to ease integration and transition.