| Daniel Stenberg | 13bf964 | 2001-08-23 11:11:13 +0000 | [diff] [blame^] | 1 | Updated: August 23, 2001 (http://curl.haxx.se/docs/faq.shtml) |
| Daniel Stenberg | 7c37c6a | 2000-05-22 17:35:35 +0000 | [diff] [blame] | 2 | _ _ ____ _ |
| 3 | ___| | | | _ \| | |
| 4 | / __| | | | |_) | | |
| 5 | | (__| |_| | _ <| |___ |
| 6 | \___|\___/|_| \_\_____| |
| 7 | |
| 8 | FAQ |
| 9 | |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 10 | 1. Philosophy |
| 11 | 1.1 What is cURL? |
| 12 | 1.2 What is libcurl? |
| 13 | 1.3 What is cURL not? |
| 14 | 1.4 When will you make curl do XXXX ? |
| Daniel Stenberg | a0eb52b | 2001-03-23 15:28:13 +0000 | [diff] [blame] | 15 | 1.5 Who makes cURL? |
| 16 | 1.6 What do you get for making cURL? |
| Daniel Stenberg | c528dc5 | 2001-08-07 11:17:37 +0000 | [diff] [blame] | 17 | 1.7 What about CURL from curl.com? |
| Daniel Stenberg | 7c37c6a | 2000-05-22 17:35:35 +0000 | [diff] [blame] | 18 | |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 19 | 2. Install Related Problems |
| 20 | 2.1 configure doesn't find OpenSSL even when it is installed |
| 21 | 2.1.1. native linker doesn't find openssl |
| 22 | 2.1.2. only the libssl lib is missing |
| 23 | 2.2 Does curl work/build with other SSL libraries? |
| 24 | 2.3 Where can I find a copy of LIBEAY32.DLL? |
| 25 | 2.4 Does cURL support Socks (RFC 1928) ? |
| Daniel Stenberg | 7c37c6a | 2000-05-22 17:35:35 +0000 | [diff] [blame] | 26 | |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 27 | 3. Usage Problems |
| 28 | 3.1 curl: (1) SSL is disabled, https: not supported |
| 29 | 3.2 How do I tell curl to resume a transfer? |
| 30 | 3.3 Why doesn't my posting using -F work? |
| 31 | 3.4 How do I tell curl to run custom FTP commands? |
| 32 | 3.5 How can I disable the Pragma: nocache header? |
| 33 | 3.6 Does curl support javascript, ASP, XML, XHTML or HTML version Y? |
| 34 | 3.7 Can I use curl to delete/rename a file through FTP? |
| 35 | 3.8 How do I tell curl to follow HTTP redirects? |
| Daniel Stenberg | 4c48599 | 2001-04-22 15:45:27 +0000 | [diff] [blame] | 36 | 3.9 How do I use curl in PHP, Perl, Tcl, Ruby or Java? |
| Daniel Stenberg | 147a673 | 2001-03-08 09:25:09 +0000 | [diff] [blame] | 37 | 3.10 What about SOAP, WebDAV, XML-RPC or similar protocols over HTTP? |
| Daniel Stenberg | 88d14e9 | 2001-05-29 14:02:20 +0000 | [diff] [blame] | 38 | 3.11 How do I POST with a different Content-Type? |
| Daniel Stenberg | 7c37c6a | 2000-05-22 17:35:35 +0000 | [diff] [blame] | 39 | |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 40 | 4. Running Problems |
| 41 | 4.1 Problems connecting to SSL servers. |
| Daniel Stenberg | e26ee09 | 2001-01-15 10:26:37 +0000 | [diff] [blame] | 42 | 4.2 Why do I get problems when I use & or % in the URL? |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 43 | 4.3 How can I use {, }, [ or ] to specify multiple URLs? |
| 44 | 4.4 Why do I get downloaded data even though the web page doesn't exist? |
| 45 | 4.5 Why do I get return code XXX from a HTTP server? |
| 46 | 4.5.1 "400 Bad Request" |
| 47 | 4.5.2 "401 Unauthorized" |
| 48 | 4.5.3 "403 Forbidden" |
| 49 | 4.5.4 "404 Not Found" |
| 50 | 4.5.5 "405 Method Not Allowed" |
| 51 | 4.6 Can you tell me what error code 142 means? |
| Daniel Stenberg | 4c48599 | 2001-04-22 15:45:27 +0000 | [diff] [blame] | 52 | 4.7 How do I keep user names and passwords secret in Curl command lines? |
| Daniel Stenberg | 09ba856 | 2000-10-27 12:25:00 +0000 | [diff] [blame] | 53 | 4.8 I found a bug! |
| Daniel Stenberg | 2c10037 | 2000-12-19 07:30:51 +0000 | [diff] [blame] | 54 | 4.9 Curl can't authenticate to the server that requires NTLM? |
| Daniel Stenberg | 7c37c6a | 2000-05-22 17:35:35 +0000 | [diff] [blame] | 55 | |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 56 | 5. libcurl Issues |
| Daniel Stenberg | 7d09e51 | 2001-01-11 12:52:07 +0000 | [diff] [blame] | 57 | 5.1 Is libcurl thread-safe? |
| Daniel Stenberg | a40b55d | 2000-11-22 07:27:26 +0000 | [diff] [blame] | 58 | 5.2 How can I receive all data into a large memory chunk? |
| Daniel Stenberg | 2c10037 | 2000-12-19 07:30:51 +0000 | [diff] [blame] | 59 | 5.3 How do I fetch multiple files with libcurl? |
| Daniel Stenberg | 910fc85 | 2000-12-30 11:48:51 +0000 | [diff] [blame] | 60 | 5.4 Does libcurl do Winsock initing on win32 systems? |
| Daniel Stenberg | 5d7b32d | 2001-02-04 20:08:42 +0000 | [diff] [blame] | 61 | 5.5 Does CURLOPT_FILE and CURLOPT_INFILE work on win32 ? |
| Daniel Stenberg | 4c48599 | 2001-04-22 15:45:27 +0000 | [diff] [blame] | 62 | 5.6 What about Keep-Alive or persistent connections? |
| Daniel Stenberg | 7c37c6a | 2000-05-22 17:35:35 +0000 | [diff] [blame] | 63 | |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 64 | 6. License Issues |
| 65 | 6.1 I have a GPL program, can I use the libcurl library? |
| 66 | 6.2 I have a closed-source program, can I use the libcurl library? |
| Daniel Stenberg | 31b8eea | 2000-08-23 07:27:00 +0000 | [diff] [blame] | 67 | 6.3 I have a BSD licensed program, can I use the libcurl library? |
| 68 | 6.4 I have a program that uses LGPL libraries, can I use libcurl? |
| 69 | 6.5 Can I modify curl/libcurl for my program and keep the changes secret? |
| 70 | 6.6 Can you please change the curl/libcurl license to XXXX? |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 71 | |
| 72 | ============================================================================== |
| 73 | |
| 74 | 1. Philosophy |
| 75 | |
| 76 | 1.1 What is cURL? |
| 77 | |
| 78 | cURL (or simply just 'curl') is a command line tool for getting or sending |
| 79 | files using URL syntax. The name is a play on 'Client for URLs', originally |
| Daniel Stenberg | 09ba856 | 2000-10-27 12:25:00 +0000 | [diff] [blame] | 80 | with URL spelled in uppercase to make it obvious it deals with URLs. The |
| 81 | fact it can also be pronounced 'see URL' also helped. |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 82 | |
| Daniel Stenberg | 4c48599 | 2001-04-22 15:45:27 +0000 | [diff] [blame] | 83 | Curl supports a range of common Internet protocols, currently including |
| Daniel Stenberg | 7d09e51 | 2001-01-11 12:52:07 +0000 | [diff] [blame] | 84 | HTTP, HTTPS, FTP, GOPHER, LDAP, DICT, TELNET and FILE. |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 85 | |
| Daniel Stenberg | 8e7b261 | 2001-03-22 11:23:48 +0000 | [diff] [blame] | 86 | We spell it cURL or just curl. We pronounce it with an initial k sound: |
| 87 | [kurl]. |
| Daniel Stenberg | 887e728 | 2001-01-03 09:13:07 +0000 | [diff] [blame] | 88 | |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 89 | 1.2 What is libcurl? |
| 90 | |
| Daniel Stenberg | bc5954f | 2001-03-23 08:16:24 +0000 | [diff] [blame] | 91 | libcurl is a reliable and portable library which provides you with an easy |
| Daniel Stenberg | 4c48599 | 2001-04-22 15:45:27 +0000 | [diff] [blame] | 92 | interface to a range of common Internet protocols. |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 93 | |
| Daniel Stenberg | bc5954f | 2001-03-23 08:16:24 +0000 | [diff] [blame] | 94 | You can use libcurl for free in your application even if it is commercial |
| 95 | or closed-source. |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 96 | |
| 97 | 1.3 What is cURL not? |
| Daniel Stenberg | e9640b6 | 2000-08-02 07:17:56 +0000 | [diff] [blame] | 98 | |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 99 | Curl is *not*, I repeat, *not* a wget clone even though that is a very |
| 100 | common misconception. Never, during curl's development, have I intended curl |
| 101 | to replace wget or compete on its market. Curl is targeted at single-shot |
| 102 | file transfers. |
| Daniel Stenberg | ef34ad2 | 2000-06-02 12:45:23 +0000 | [diff] [blame] | 103 | |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 104 | Curl is not a web site mirroring program. If you wanna use curl to mirror |
| 105 | something: fine, go ahead and write a script that wraps around curl to make |
| 106 | it reality (like curlmirror.pl does). |
| Daniel Stenberg | ef34ad2 | 2000-06-02 12:45:23 +0000 | [diff] [blame] | 107 | |
| Daniel Stenberg | 4c48599 | 2001-04-22 15:45:27 +0000 | [diff] [blame] | 108 | Curl is not an FTP site mirroring program. Sure, get and send FTP with curl |
| 109 | but if you want systematic and sequential behavior you should write a |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 110 | script (or write a new program that interfaces libcurl) and do it. |
| 111 | |
| 112 | Curl is not a PHP tool, even though it works perfectly well when used from |
| 113 | or with PHP. |
| 114 | |
| Daniel Stenberg | 31b8eea | 2000-08-23 07:27:00 +0000 | [diff] [blame] | 115 | Curl is not a single-OS program. Curl exists, compiles, builds and runs |
| Daniel Stenberg | c59baa0 | 2001-02-12 10:05:09 +0000 | [diff] [blame] | 116 | under a wide range of operating systems, including all modern Unixes (and a |
| 117 | bunch of older ones too), Windows, Amiga, BeOS, OS/2, OS X, QNX etc. |
| Daniel Stenberg | 31b8eea | 2000-08-23 07:27:00 +0000 | [diff] [blame] | 118 | |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 119 | 1.4 When will you make curl do XXXX ? |
| 120 | |
| Daniel Stenberg | 11d718b | 2001-03-13 11:47:30 +0000 | [diff] [blame] | 121 | We love suggestions of what to change in order to make curl and libcurl |
| 122 | better. We do however believe in a few rules when it comes to the future of |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 123 | curl: |
| 124 | |
| Daniel Stenberg | 11d718b | 2001-03-13 11:47:30 +0000 | [diff] [blame] | 125 | * Curl is to remain a command line tool. If you want GUIs or fancy scripting |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 126 | capabilities, you're free to write another tool that uses libcurl and that |
| Daniel Stenberg | 11d718b | 2001-03-13 11:47:30 +0000 | [diff] [blame] | 127 | offers this. There's no point in having a single tool that does every |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 128 | imaginable thing. That's also one of the great advantages of having the |
| Daniel Stenberg | 11d718b | 2001-03-13 11:47:30 +0000 | [diff] [blame] | 129 | core of curl as a library. |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 130 | |
| Daniel Stenberg | 11d718b | 2001-03-13 11:47:30 +0000 | [diff] [blame] | 131 | * We do not add things to curl that other small and available tools already |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 132 | do very fine at the side. Curl's output is fine to pipe into another |
| 133 | program or redirect to another file for the next program to interpret. |
| 134 | |
| Daniel Stenberg | 11d718b | 2001-03-13 11:47:30 +0000 | [diff] [blame] | 135 | * We focus on protocol related issues and improvements. If you wanna do more |
| Daniel Stenberg | 5f8e93d | 2000-10-25 07:41:58 +0000 | [diff] [blame] | 136 | magic with the supported protocols than curl currently does, chances are |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 137 | big I will agree. If you wanna add more protocols, I may very well |
| 138 | agree. |
| 139 | |
| Daniel Stenberg | 11d718b | 2001-03-13 11:47:30 +0000 | [diff] [blame] | 140 | * If you want someone else to make all the work while you wait for us to |
| 141 | implement it for you, that is not a very friendly attitude. We spend a |
| 142 | considerable time already on maintaining and developing curl. In order to |
| 143 | get more out of us, you should consider trading in some of your time and |
| 144 | efforts in return. |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 145 | |
| 146 | * If you write the code, chances are bigger that it will get into curl |
| 147 | faster. |
| 148 | |
| Daniel Stenberg | a0eb52b | 2001-03-23 15:28:13 +0000 | [diff] [blame] | 149 | 1.5 Who makes cURL? |
| 150 | |
| 151 | cURL and libcurl are not made by any single individual. Sure, Daniel |
| 152 | Stenberg writes the major parts, but various people's submissions are |
| 153 | important and crucial. Anyone can post their changes and improvements and |
| 154 | have them inserted in the main sources (of course on the condition that |
| 155 | developers agree on that the fixes are good). |
| 156 | |
| 157 | The list of contributors in the bottom of the man page is only a small part |
| 158 | of all the people that every day provide us with bug reports, suggestions, |
| 159 | ideas and source code. |
| 160 | |
| 161 | curl is developed by a community, with Daniel at the wheel. |
| 162 | |
| 163 | 1.6 What do you get for making cURL? |
| 164 | |
| 165 | Project cURL is entirely free and open, without any commercial interests or |
| 166 | money involved. No person gets paid in any way for developing curl. We all |
| Daniel Stenberg | 4c48599 | 2001-04-22 15:45:27 +0000 | [diff] [blame] | 167 | do this voluntarily on our spare time. |
| Daniel Stenberg | a0eb52b | 2001-03-23 15:28:13 +0000 | [diff] [blame] | 168 | |
| 169 | We get some help from companies. Contactor Data hosts the curl web site and |
| 170 | the main mailing list, Haxx owns the curl web site's domain and |
| 171 | sourceforge.net hosts several project tools we take advantage from like the |
| 172 | bug tracker, mailing lists and more. |
| 173 | |
| Daniel Stenberg | c528dc5 | 2001-08-07 11:17:37 +0000 | [diff] [blame] | 174 | If you feel you want to show support our project with a donation, a very |
| 175 | nice way of doing that would be to buy "gift certificates" at useful online |
| 176 | shopping sites, such as amazon.com or thinkgeek.com. |
| 177 | |
| 178 | 1.7 What about CURL from curl.com? |
| 179 | |
| 180 | During the summer 2001, curl.com has been busy advertising their client-side |
| 181 | programming language for the web, named CURL. |
| 182 | |
| Daniel Stenberg | 81b6ebc | 2001-08-07 18:02:37 +0000 | [diff] [blame] | 183 | We are in no way associated with curl.com or their CURL programming |
| 184 | language. |
| Daniel Stenberg | c528dc5 | 2001-08-07 11:17:37 +0000 | [diff] [blame] | 185 | |
| Daniel Stenberg | 81b6ebc | 2001-08-07 18:02:37 +0000 | [diff] [blame] | 186 | Our project name curl has been in effective use since 1998. We were not the |
| Daniel Stenberg | 4045cd5 | 2001-08-07 21:21:24 +0000 | [diff] [blame] | 187 | first computer related project to use the name "curl" and do not claim any |
| Daniel Stenberg | 81b6ebc | 2001-08-07 18:02:37 +0000 | [diff] [blame] | 188 | first-hand rights to the name. |
| Daniel Stenberg | c528dc5 | 2001-08-07 11:17:37 +0000 | [diff] [blame] | 189 | |
| Daniel Stenberg | 81b6ebc | 2001-08-07 18:02:37 +0000 | [diff] [blame] | 190 | We recognize that we will be living in parallel with curl.com and wish them |
| 191 | every success. |
| Daniel Stenberg | c528dc5 | 2001-08-07 11:17:37 +0000 | [diff] [blame] | 192 | |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 193 | 2. Install Related Problems |
| 194 | |
| 195 | 2.1. configure doesn't find OpenSSL even when it is installed |
| Daniel Stenberg | 7c37c6a | 2000-05-22 17:35:35 +0000 | [diff] [blame] | 196 | |
| Daniel Stenberg | ef34ad2 | 2000-06-02 12:45:23 +0000 | [diff] [blame] | 197 | This may be because of several reasons. |
| Daniel Stenberg | 7c37c6a | 2000-05-22 17:35:35 +0000 | [diff] [blame] | 198 | |
| Daniel Stenberg | 09ba856 | 2000-10-27 12:25:00 +0000 | [diff] [blame] | 199 | 2.1.1. native linker doesn't find openssl |
| Daniel Stenberg | 7c37c6a | 2000-05-22 17:35:35 +0000 | [diff] [blame] | 200 | |
| Daniel Stenberg | bfb1690 | 2000-08-17 11:42:59 +0000 | [diff] [blame] | 201 | Affected platforms: |
| 202 | Solaris (native cc compiler) |
| 203 | HPUX (native cc compiler) |
| 204 | SGI IRIX (native cc compiler) |
| Daniel Stenberg | 13962ad | 2000-09-28 10:26:44 +0000 | [diff] [blame] | 205 | SCO UNIX (native cc compiler) |
| Daniel Stenberg | 7c37c6a | 2000-05-22 17:35:35 +0000 | [diff] [blame] | 206 | |
| Daniel Stenberg | ef34ad2 | 2000-06-02 12:45:23 +0000 | [diff] [blame] | 207 | When configuring curl, I specify --with-ssl. OpenSSL is installed in |
| 208 | /usr/local/ssl Configure reports SSL in /usr/local/ssl, but fails to find |
| 209 | CRYPTO_lock in -lcrypto |
| Daniel Stenberg | 7c37c6a | 2000-05-22 17:35:35 +0000 | [diff] [blame] | 210 | |
| Daniel Stenberg | ef34ad2 | 2000-06-02 12:45:23 +0000 | [diff] [blame] | 211 | Cause: The cc for this test places the -L/usr/local/ssl/lib AFTER |
| 212 | -lcrypto, so ld can't find the library. This is due to a bug in the GNU |
| 213 | autoconf tool. |
| 214 | |
| 215 | Workaround: Specifying "LDFLAGS=-L/usr/local/ssl/lib" in front of |
| 216 | ./configure places the -L/usr/local/ssl/lib early enough in the command |
| 217 | line to make things work |
| 218 | |
| Daniel Stenberg | bfb1690 | 2000-08-17 11:42:59 +0000 | [diff] [blame] | 219 | Solution submitted by: Bob Allison <allisonb@users.sourceforge.net> |
| Daniel Stenberg | ef34ad2 | 2000-06-02 12:45:23 +0000 | [diff] [blame] | 220 | |
| Daniel Stenberg | 09ba856 | 2000-10-27 12:25:00 +0000 | [diff] [blame] | 221 | 2.1.2. only the libssl lib is missing |
| Daniel Stenberg | ef34ad2 | 2000-06-02 12:45:23 +0000 | [diff] [blame] | 222 | |
| 223 | If all include files and the libcrypto lib is present, with only the |
| 224 | libssl being missing according to configure, this is mostly likely because |
| 225 | a few functions are left out from the libssl. |
| 226 | |
| 227 | If the function names missing include RSA or RSAREF you can be certain |
| Daniel Stenberg | 4c48599 | 2001-04-22 15:45:27 +0000 | [diff] [blame] | 228 | that this is because libssl requires the RSA and RSAREF libs to build. |
| Daniel Stenberg | ef34ad2 | 2000-06-02 12:45:23 +0000 | [diff] [blame] | 229 | |
| 230 | See the INSTALL file section that explains how to add those libs to |
| 231 | configure. Make sure that you remove the config.cache file before you |
| 232 | rerun configure with the new flags. |
| 233 | |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 234 | 2.2. Does curl work/build with other SSL libraries? |
| Daniel Stenberg | e9640b6 | 2000-08-02 07:17:56 +0000 | [diff] [blame] | 235 | |
| Daniel Stenberg | 11d718b | 2001-03-13 11:47:30 +0000 | [diff] [blame] | 236 | Curl has been written to use OpenSSL, although there should not be much |
| Daniel Stenberg | 26d1aac | 2001-02-16 13:41:09 +0000 | [diff] [blame] | 237 | problems using a different library. If anyone does "port" curl to use a |
| Daniel Stenberg | 11d718b | 2001-03-13 11:47:30 +0000 | [diff] [blame] | 238 | different SSL library, we are of course very interested in getting the |
| 239 | patch! |
| Daniel Stenberg | e9640b6 | 2000-08-02 07:17:56 +0000 | [diff] [blame] | 240 | |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 241 | 2.3. Where can I find a copy of LIBEAY32.DLL? |
| Daniel Stenberg | e9640b6 | 2000-08-02 07:17:56 +0000 | [diff] [blame] | 242 | |
| 243 | That is an OpenSSL binary built for Windows. |
| 244 | |
| 245 | Curl uses OpenSSL to do the SSL stuff. The LIBEAY32.DLL is what curl needs |
| Daniel Stenberg | 11d718b | 2001-03-13 11:47:30 +0000 | [diff] [blame] | 246 | on a windows machine to do https://. Check out the curl web site to find |
| Daniel Stenberg | 4c48599 | 2001-04-22 15:45:27 +0000 | [diff] [blame] | 247 | accurate and up-to-date pointers to recent OpenSSL DLLs and other binary |
| Daniel Stenberg | e9640b6 | 2000-08-02 07:17:56 +0000 | [diff] [blame] | 248 | packages. |
| 249 | |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 250 | 2.4. Does cURL support Socks (RFC 1928) ? |
| Daniel Stenberg | e9640b6 | 2000-08-02 07:17:56 +0000 | [diff] [blame] | 251 | |
| Daniel Stenberg | 4c48599 | 2001-04-22 15:45:27 +0000 | [diff] [blame] | 252 | No. Nobody has wanted it that badly yet. We appreciate patches that bring |
| Daniel Stenberg | 11d718b | 2001-03-13 11:47:30 +0000 | [diff] [blame] | 253 | this functionality. |
| Daniel Stenberg | e9640b6 | 2000-08-02 07:17:56 +0000 | [diff] [blame] | 254 | |
| 255 | |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 256 | 3. Usage problems |
| Daniel Stenberg | e9640b6 | 2000-08-02 07:17:56 +0000 | [diff] [blame] | 257 | |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 258 | 3.1. curl: (1) SSL is disabled, https: not supported |
| Daniel Stenberg | e9640b6 | 2000-08-02 07:17:56 +0000 | [diff] [blame] | 259 | |
| 260 | If you get this output when trying to get anything from a https:// server, |
| 261 | it means that the configure script couldn't find all libs and include files |
| 262 | it requires for SSL to work. If the configure script fails to find them, |
| 263 | curl is simply built without SSL support. |
| 264 | |
| 265 | To get the https:// support into a curl that was previously built but that |
| 266 | reports that https:// is not supported, you should dig through the document |
| 267 | and logs and check out why the configure script doesn't find the SSL libs |
| 268 | and/or include files. |
| 269 | |
| 270 | Also, check out the other paragraph in this FAQ labeled "configure doesn't |
| 271 | find OpenSSL even when it is installed". |
| 272 | |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 273 | 3.2. How do I tell curl to resume a transfer? |
| Daniel Stenberg | e9640b6 | 2000-08-02 07:17:56 +0000 | [diff] [blame] | 274 | |
| Daniel Stenberg | 11d718b | 2001-03-13 11:47:30 +0000 | [diff] [blame] | 275 | Curl supports resumed transfers both ways on both FTP and HTTP. |
| Daniel Stenberg | e9640b6 | 2000-08-02 07:17:56 +0000 | [diff] [blame] | 276 | |
| Daniel Stenberg | 887e728 | 2001-01-03 09:13:07 +0000 | [diff] [blame] | 277 | Try the -C option. |
| Daniel Stenberg | e9640b6 | 2000-08-02 07:17:56 +0000 | [diff] [blame] | 278 | |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 279 | 3.3. Why doesn't my posting using -F work? |
| Daniel Stenberg | e9640b6 | 2000-08-02 07:17:56 +0000 | [diff] [blame] | 280 | |
| 281 | You can't simply use -F or -d at your choice. The web server that will |
| 282 | receive your post assumes one of the formats. If the form you're trying to |
| Daniel Stenberg | c59baa0 | 2001-02-12 10:05:09 +0000 | [diff] [blame] | 283 | "fake" sets the type to 'multipart/form-data', then and only then you must |
| Daniel Stenberg | e9640b6 | 2000-08-02 07:17:56 +0000 | [diff] [blame] | 284 | use the -F type. In all the most common cases, you should use -d which then |
| 285 | causes a posting with the type 'application/x-www-form-urlencoded'. |
| 286 | |
| Daniel Stenberg | 4c48599 | 2001-04-22 15:45:27 +0000 | [diff] [blame] | 287 | This is described in some detail in the MANUAL and TheArtOfHttpScripting |
| 288 | documents, and if you don't understand it the first time, read it again |
| 289 | before you post questions about this to the mailing list. Also, try reading |
| 290 | through the mailing list archives for old postings and questions regarding |
| 291 | this. |
| Daniel Stenberg | e9640b6 | 2000-08-02 07:17:56 +0000 | [diff] [blame] | 292 | |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 293 | 3.4. How do I tell curl to run custom FTP commands? |
| Daniel Stenberg | e9640b6 | 2000-08-02 07:17:56 +0000 | [diff] [blame] | 294 | |
| 295 | You can tell curl to perform optional commands both before and/or after a |
| 296 | file transfer. Study the -Q/--quote option. |
| 297 | |
| 298 | Since curl is used for file transfers, you don't use curl to just perform |
| Daniel Stenberg | 4c48599 | 2001-04-22 15:45:27 +0000 | [diff] [blame] | 299 | FTP commands without transferring anything. Therefore you must always specify |
| Daniel Stenberg | e9640b6 | 2000-08-02 07:17:56 +0000 | [diff] [blame] | 300 | a URL to transfer to/from even when doing custom FTP commands. |
| 301 | |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 302 | 3.5. How can I disable the Pragma: nocache header? |
| Daniel Stenberg | e9640b6 | 2000-08-02 07:17:56 +0000 | [diff] [blame] | 303 | |
| 304 | You can change all internally generated headers by adding a replacement with |
| 305 | the -H/--header option. By adding a header with empty contents you safely |
| 306 | disable that one. Use -H "Pragma:" to disable that specific header. |
| 307 | |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 308 | 3.6. Does curl support javascript, ASP, XML, XHTML or HTML version Y? |
| Daniel Stenberg | e9640b6 | 2000-08-02 07:17:56 +0000 | [diff] [blame] | 309 | |
| 310 | To curl, all contents are alike. It doesn't matter how the page was |
| Daniel Stenberg | 4c48599 | 2001-04-22 15:45:27 +0000 | [diff] [blame] | 311 | generated. It may be ASP, PHP, Perl, shell-script, SSI or plain |
| Daniel Stenberg | e9640b6 | 2000-08-02 07:17:56 +0000 | [diff] [blame] | 312 | HTML-files. There's no difference to curl and it doesn't even know what kind |
| 313 | of language that generated the page. |
| 314 | |
| 315 | Javascript is slightly different since that is code embedded in the HTML |
| 316 | that is sent for the client to interpret and curl has no javascript |
| 317 | interpreter. |
| 318 | |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 319 | 3.7. Can I use curl to delete/rename a file through FTP? |
| Daniel Stenberg | e9640b6 | 2000-08-02 07:17:56 +0000 | [diff] [blame] | 320 | |
| Daniel Stenberg | 4c48599 | 2001-04-22 15:45:27 +0000 | [diff] [blame] | 321 | Yes. You specify custom FTP commands with -Q/--quote. |
| Daniel Stenberg | e9640b6 | 2000-08-02 07:17:56 +0000 | [diff] [blame] | 322 | |
| 323 | One example would be to delete a file after you have downloaded it: |
| 324 | |
| 325 | curl -O ftp://download.com/coolfile -Q '-DELE coolfile' |
| 326 | |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 327 | 3.8 How do I tell curl to follow HTTP redirects? |
| Daniel Stenberg | e9640b6 | 2000-08-02 07:17:56 +0000 | [diff] [blame] | 328 | |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 329 | Curl does not follow so-called redirects by default. The Location: header |
| 330 | that informs the client about this is only interpreted if you're using the |
| 331 | -L/--location option. As in: |
| Daniel Stenberg | e9640b6 | 2000-08-02 07:17:56 +0000 | [diff] [blame] | 332 | |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 333 | curl -L http://redirector.com |
| 334 | |
| Daniel Stenberg | 4c48599 | 2001-04-22 15:45:27 +0000 | [diff] [blame] | 335 | 3.9 How do I use curl in PHP, Perl, Tcl, Ruby or Java? |
| Daniel Stenberg | 368e352 | 2001-01-29 10:16:21 +0000 | [diff] [blame] | 336 | |
| Daniel Stenberg | 4c48599 | 2001-04-22 15:45:27 +0000 | [diff] [blame] | 337 | There exist many language-interfaces for curl that integrates it better with |
| 338 | various languages. If you are fluid in a script language, you may very well |
| 339 | opt to use such an interface instead of using the command line tool. |
| 340 | |
| 341 | At the time of writing, there are bindings for the five language mentioned |
| 342 | above, but chances are there are even more by the time you read this. Or you |
| Daniel Stenberg | cab90bf | 2001-05-30 08:01:35 +0000 | [diff] [blame] | 343 | may be able you write your own wrapper for a not-yet supported language! |
| Daniel Stenberg | 4c48599 | 2001-04-22 15:45:27 +0000 | [diff] [blame] | 344 | |
| 345 | Find out more about which languages that support curl directly, and how to |
| 346 | install and use them, in the libcurl section of the curl web site: |
| 347 | |
| 348 | http://curl.haxx.se/libcurl/ |
| 349 | |
| Daniel Stenberg | 368e352 | 2001-01-29 10:16:21 +0000 | [diff] [blame] | 350 | PHP4 has the ability to use libcurl as an internal module if built with that |
| 351 | option enabled. You then get a set of extra functions that can be used |
| 352 | within your PHP programs. You find all details about those functions in the |
| 353 | curl section in the PHP manual, see the online version at: |
| 354 | |
| 355 | http://www.php.net/manual/ref.curl.php |
| 356 | |
| 357 | PHP also offers the option to run a command line, and then you can of course |
| 358 | invoke the curl tool using a command line. This is the way to use curl if |
| 359 | you're using PHP3 or PHP4 built without curl module support. |
| 360 | |
| Daniel Stenberg | 147a673 | 2001-03-08 09:25:09 +0000 | [diff] [blame] | 361 | 3.10 What about SOAP, WebDAV, XML-RPC or similar protocols over HTTP? |
| Daniel Stenberg | c59baa0 | 2001-02-12 10:05:09 +0000 | [diff] [blame] | 362 | |
| 363 | Curl adheres to the HTTP spec, which basically means you can play with *any* |
| Daniel Stenberg | 4c48599 | 2001-04-22 15:45:27 +0000 | [diff] [blame] | 364 | protocol that is built on top of HTTP. Protocols such as SOAP, WEBDAV and |
| Daniel Stenberg | c59baa0 | 2001-02-12 10:05:09 +0000 | [diff] [blame] | 365 | XML-RPC are all such ones. You can use -X to set custom requests and -H to |
| 366 | set custom headers (or replace internally generated ones). |
| 367 | |
| 368 | Using libcurl or PHP's curl modules is just as fine and you'd just use the |
| 369 | proper library options to do the same. |
| 370 | |
| Daniel Stenberg | 88d14e9 | 2001-05-29 14:02:20 +0000 | [diff] [blame] | 371 | 3.11 How do I POST with a different Content-Type? |
| 372 | |
| 373 | You can always replace the internally generated headers with -H/--header. |
| 374 | To make a simple HTTP POST with text/xml as content-type, do something like: |
| 375 | |
| 376 | curl -d "datatopost" -H "Content-Type: text/xml" [URL] |
| 377 | |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 378 | 4. Running Problems |
| 379 | |
| 380 | 4.1. Problems connecting to SSL servers. |
| Daniel Stenberg | e9640b6 | 2000-08-02 07:17:56 +0000 | [diff] [blame] | 381 | |
| Daniel Stenberg | 11d718b | 2001-03-13 11:47:30 +0000 | [diff] [blame] | 382 | It took a very long time before we could sort out why curl had problems to |
| 383 | connect to certain SSL servers when using SSLeay or OpenSSL v0.9+. The |
| 384 | error sometimes showed up similar to: |
| Daniel Stenberg | e9640b6 | 2000-08-02 07:17:56 +0000 | [diff] [blame] | 385 | |
| 386 | 16570:error:1407D071:SSL routines:SSL2_READ:bad mac decode:s2_pkt.c:233: |
| 387 | |
| 388 | It turned out to be because many older SSL servers don't deal with SSLv3 |
| 389 | requests properly. To correct this problem, tell curl to select SSLv2 from |
| 390 | the command line (-2/--sslv2). |
| 391 | |
| Daniel Stenberg | 11d718b | 2001-03-13 11:47:30 +0000 | [diff] [blame] | 392 | There has also been examples where the remote server didn't like the SSLv2 |
| Daniel Stenberg | e9640b6 | 2000-08-02 07:17:56 +0000 | [diff] [blame] | 393 | request and instead you had to force curl to use SSLv3 with -3/--sslv3. |
| 394 | |
| Daniel Stenberg | e26ee09 | 2001-01-15 10:26:37 +0000 | [diff] [blame] | 395 | 4.2. Why do I get problems when I use & or % in the URL? |
| Daniel Stenberg | 2947010 | 2000-06-02 13:32:01 +0000 | [diff] [blame] | 396 | |
| Daniel Stenberg | 11d718b | 2001-03-13 11:47:30 +0000 | [diff] [blame] | 397 | In general unix shells, the & letter is treated special and when used, it |
| Daniel Stenberg | c3c7739 | 2000-07-31 22:42:34 +0000 | [diff] [blame] | 398 | runs the specified command in the background. To safely send the & as a part |
| Daniel Stenberg | 4c48599 | 2001-04-22 15:45:27 +0000 | [diff] [blame] | 399 | of a URL, you should quote the entire URL by using single (') or double (") |
| Daniel Stenberg | c3c7739 | 2000-07-31 22:42:34 +0000 | [diff] [blame] | 400 | quotes around it. |
| Daniel Stenberg | 2947010 | 2000-06-02 13:32:01 +0000 | [diff] [blame] | 401 | |
| Daniel Stenberg | c3c7739 | 2000-07-31 22:42:34 +0000 | [diff] [blame] | 402 | An example that would invoke a remote CGI that uses &-letters could be: |
| Daniel Stenberg | 8f03732 | 2000-06-06 14:09:01 +0000 | [diff] [blame] | 403 | |
| Daniel Stenberg | edcd5df | 2000-06-06 14:13:36 +0000 | [diff] [blame] | 404 | curl 'http://www.altavista.com/cgi-bin/query?text=yes&q=curl' |
| Daniel Stenberg | 8f03732 | 2000-06-06 14:09:01 +0000 | [diff] [blame] | 405 | |
| Daniel Stenberg | e26ee09 | 2001-01-15 10:26:37 +0000 | [diff] [blame] | 406 | In win32, the standard DOS shell treats the %-letter specially and you may |
| 407 | need to quote the string properly when % is used in it. |
| 408 | |
| Daniel Stenberg | 1b77c18 | 2001-01-29 10:24:51 +0000 | [diff] [blame] | 409 | Also note that if you want the literal %-letter to be part of the data you |
| 410 | pass in a POST using -d/--data you must encode it as '%25'. |
| 411 | |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 412 | 4.3. How can I use {, }, [ or ] to specify multiple URLs? |
| Daniel Stenberg | 2947010 | 2000-06-02 13:32:01 +0000 | [diff] [blame] | 413 | |
| Daniel Stenberg | c3c7739 | 2000-07-31 22:42:34 +0000 | [diff] [blame] | 414 | Because those letters have a special meaning to the shell, and to be used in |
| 415 | a URL specified to curl you must quote them. |
| Daniel Stenberg | 2947010 | 2000-06-02 13:32:01 +0000 | [diff] [blame] | 416 | |
| Daniel Stenberg | c3c7739 | 2000-07-31 22:42:34 +0000 | [diff] [blame] | 417 | An example that downloads two URLs (sequentially) would do: |
| Daniel Stenberg | 8f03732 | 2000-06-06 14:09:01 +0000 | [diff] [blame] | 418 | |
| Daniel Stenberg | edcd5df | 2000-06-06 14:13:36 +0000 | [diff] [blame] | 419 | curl '{curl,www}.haxx.se' |
| Daniel Stenberg | 8f03732 | 2000-06-06 14:09:01 +0000 | [diff] [blame] | 420 | |
| Daniel Stenberg | e26ee09 | 2001-01-15 10:26:37 +0000 | [diff] [blame] | 421 | To be able to use those letters as actual parts of the URL (without using |
| Daniel Stenberg | 11d718b | 2001-03-13 11:47:30 +0000 | [diff] [blame] | 422 | them for the curl URL "globbing" system), use the -g/--globoff option (curl |
| 423 | 7.6 and later): |
| Daniel Stenberg | e26ee09 | 2001-01-15 10:26:37 +0000 | [diff] [blame] | 424 | |
| 425 | curl -g 'www.site.com/weirdname[].html' |
| 426 | |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 427 | 4.4. Why do I get downloaded data even though the web page doesn't exist? |
| Daniel Stenberg | 2947010 | 2000-06-02 13:32:01 +0000 | [diff] [blame] | 428 | |
| Daniel Stenberg | c3c7739 | 2000-07-31 22:42:34 +0000 | [diff] [blame] | 429 | Curl asks remote servers for the page you specify. If the page doesn't exist |
| 430 | at the server, the HTTP protocol defines how the server should respond and |
| 431 | that means that headers and a "page" will be returned. That's simply how |
| 432 | HTTP works. |
| Daniel Stenberg | 2947010 | 2000-06-02 13:32:01 +0000 | [diff] [blame] | 433 | |
| Daniel Stenberg | c3c7739 | 2000-07-31 22:42:34 +0000 | [diff] [blame] | 434 | By using the --fail option you can tell curl explicitly to not get any data |
| 435 | if the HTTP return code doesn't say success. |
| Daniel Stenberg | 8f03732 | 2000-06-06 14:09:01 +0000 | [diff] [blame] | 436 | |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 437 | 4.5 Why do I get return code XXX from a HTTP server? |
| Daniel Stenberg | 2947010 | 2000-06-02 13:32:01 +0000 | [diff] [blame] | 438 | |
| Daniel Stenberg | 11d718b | 2001-03-13 11:47:30 +0000 | [diff] [blame] | 439 | RFC2616 clearly explains the return codes. This is a short transcript. Go |
| 440 | read the RFC for exact details: |
| Daniel Stenberg | 2947010 | 2000-06-02 13:32:01 +0000 | [diff] [blame] | 441 | |
| Daniel Stenberg | 09ba856 | 2000-10-27 12:25:00 +0000 | [diff] [blame] | 442 | 4.5.1 "400 Bad Request" |
| Daniel Stenberg | 2947010 | 2000-06-02 13:32:01 +0000 | [diff] [blame] | 443 | |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 444 | The request could not be understood by the server due to malformed |
| 445 | syntax. The client SHOULD NOT repeat the request without modifications. |
| 446 | |
| Daniel Stenberg | 09ba856 | 2000-10-27 12:25:00 +0000 | [diff] [blame] | 447 | 4.5.2 "401 Unauthorized" |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 448 | |
| 449 | The request requires user authentication. |
| 450 | |
| Daniel Stenberg | 09ba856 | 2000-10-27 12:25:00 +0000 | [diff] [blame] | 451 | 4.5.3 "403 Forbidden" |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 452 | |
| 453 | The server understood the request, but is refusing to fulfill it. |
| 454 | Authorization will not help and the request SHOULD NOT be repeated. |
| 455 | |
| Daniel Stenberg | 09ba856 | 2000-10-27 12:25:00 +0000 | [diff] [blame] | 456 | 4.5.4 "404 Not Found" |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 457 | |
| 458 | The server has not found anything matching the Request-URI. No indication |
| 459 | is given of whether the condition is temporary or permanent. |
| 460 | |
| Daniel Stenberg | 09ba856 | 2000-10-27 12:25:00 +0000 | [diff] [blame] | 461 | 4.5.5 "405 Method Not Allowed" |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 462 | |
| 463 | The method specified in the Request-Line is not allowed for the resource |
| 464 | identified by the Request-URI. The response MUST include an Allow header |
| 465 | containing a list of valid methods for the requested resource. |
| 466 | |
| 467 | 4.6. Can you tell me what error code 142 means? |
| Daniel Stenberg | 2947010 | 2000-06-02 13:32:01 +0000 | [diff] [blame] | 468 | |
| Daniel Stenberg | c3c7739 | 2000-07-31 22:42:34 +0000 | [diff] [blame] | 469 | All error codes that are larger than the highest documented error code means |
| Daniel Stenberg | 13bf964 | 2001-08-23 11:11:13 +0000 | [diff] [blame^] | 470 | that curl has exited due to a crash. This is a serious error, and we |
| 471 | appriciate a detailed bug report from you that describes how we could go |
| 472 | ahead and repeat this! |
| Daniel Stenberg | 2947010 | 2000-06-02 13:32:01 +0000 | [diff] [blame] | 473 | |
| Daniel Stenberg | 4c48599 | 2001-04-22 15:45:27 +0000 | [diff] [blame] | 474 | 4.7. How do I keep user names and passwords secret in Curl command lines? |
| Daniel Stenberg | 2947010 | 2000-06-02 13:32:01 +0000 | [diff] [blame] | 475 | |
| Daniel Stenberg | 11d718b | 2001-03-13 11:47:30 +0000 | [diff] [blame] | 476 | This problem has two sides: |
| Daniel Stenberg | 2947010 | 2000-06-02 13:32:01 +0000 | [diff] [blame] | 477 | |
| Daniel Stenberg | c3c7739 | 2000-07-31 22:42:34 +0000 | [diff] [blame] | 478 | The first part is to avoid having clear-text passwords in the command line |
| 479 | so that they don't appear in 'ps' outputs and similar. That is easily |
| Daniel Stenberg | 4c48599 | 2001-04-22 15:45:27 +0000 | [diff] [blame] | 480 | avoided by using the "-K" option to tell curl to read parameters from a |
| Daniel Stenberg | c3c7739 | 2000-07-31 22:42:34 +0000 | [diff] [blame] | 481 | file or stdin to which you can pass the secret info. |
| Daniel Stenberg | 2947010 | 2000-06-02 13:32:01 +0000 | [diff] [blame] | 482 | |
| Daniel Stenberg | c3c7739 | 2000-07-31 22:42:34 +0000 | [diff] [blame] | 483 | To keep the passwords in your account secret from the rest of the world is |
| 484 | not a task that curl addresses. You could of course encrypt them somehow to |
| 485 | at least hide them from being read by human eyes, but that is not what |
| 486 | anyone would call security. |
| Daniel Stenberg | 2947010 | 2000-06-02 13:32:01 +0000 | [diff] [blame] | 487 | |
| Daniel Stenberg | 887e728 | 2001-01-03 09:13:07 +0000 | [diff] [blame] | 488 | Also note that regular HTTP and FTP passwords are sent in clear across the |
| 489 | network. All it takes for anyone to fetch them is to listen on the network. |
| Daniel Stenberg | 4c48599 | 2001-04-22 15:45:27 +0000 | [diff] [blame] | 490 | Eavesdropping is very easy. |
| Daniel Stenberg | 887e728 | 2001-01-03 09:13:07 +0000 | [diff] [blame] | 491 | |
| Daniel Stenberg | 09ba856 | 2000-10-27 12:25:00 +0000 | [diff] [blame] | 492 | 4.8 I found a bug! |
| 493 | |
| Daniel Stenberg | 4c48599 | 2001-04-22 15:45:27 +0000 | [diff] [blame] | 494 | It is not a bug if the behavior is documented. Read the docs first. |
| Daniel Stenberg | 09ba856 | 2000-10-27 12:25:00 +0000 | [diff] [blame] | 495 | |
| 496 | If it is a problem with a binary you've downloaded or a package for your |
| 497 | particular platform, try contacting the person who built the package/archive |
| 498 | you have. |
| 499 | |
| 500 | If there is a bug, post a bug report in the Curl Bug Track System over at |
| Daniel Stenberg | 9012f8c | 2001-01-15 10:28:41 +0000 | [diff] [blame] | 501 | http://sourceforge.net/bugs/?group_id=976 |
| Daniel Stenberg | 09ba856 | 2000-10-27 12:25:00 +0000 | [diff] [blame] | 502 | |
| 503 | Always include as many details you can think of, including curl version, |
| 504 | operating system name and version and complete instructions how to repeat |
| 505 | the bug. |
| 506 | |
| Daniel Stenberg | 2c10037 | 2000-12-19 07:30:51 +0000 | [diff] [blame] | 507 | 4.9. Curl can't authenticate to the server that requires NTLM? |
| 508 | |
| 509 | NTLM is a Microsoft proprietary protocol. Unfortunately, curl does not |
| Daniel Stenberg | c59baa0 | 2001-02-12 10:05:09 +0000 | [diff] [blame] | 510 | currently support that. Proprietary formats are evil. You should not use |
| 511 | such ones. |
| Daniel Stenberg | 2947010 | 2000-06-02 13:32:01 +0000 | [diff] [blame] | 512 | |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 513 | 5. libcurl Issues |
| Daniel Stenberg | 2947010 | 2000-06-02 13:32:01 +0000 | [diff] [blame] | 514 | |
| Daniel Stenberg | 7d09e51 | 2001-01-11 12:52:07 +0000 | [diff] [blame] | 515 | 5.1. Is libcurl thread-safe? |
| Daniel Stenberg | 2947010 | 2000-06-02 13:32:01 +0000 | [diff] [blame] | 516 | |
| Daniel Stenberg | 7d09e51 | 2001-01-11 12:52:07 +0000 | [diff] [blame] | 517 | Yes. |
| 518 | |
| 519 | We have written the libcurl code specificly adjusted for multi-threaded |
| 520 | programs. libcurl will use thread-safe functions instead of non-safe ones if |
| 521 | your system has such. |
| Daniel Stenberg | 2947010 | 2000-06-02 13:32:01 +0000 | [diff] [blame] | 522 | |
| Daniel Stenberg | 4c48599 | 2001-04-22 15:45:27 +0000 | [diff] [blame] | 523 | We would appreciate some kind of report or README file from those who have |
| Daniel Stenberg | 11d718b | 2001-03-13 11:47:30 +0000 | [diff] [blame] | 524 | used libcurl in a threaded environment. |
| Daniel Stenberg | 2947010 | 2000-06-02 13:32:01 +0000 | [diff] [blame] | 525 | |
| Daniel Stenberg | a40b55d | 2000-11-22 07:27:26 +0000 | [diff] [blame] | 526 | 5.2 How can I receive all data into a large memory chunk? |
| 527 | |
| Daniel Stenberg | a84af98 | 2001-05-15 13:09:27 +0000 | [diff] [blame] | 528 | [ See also the examples/getinmemory.c source ] |
| 529 | |
| Daniel Stenberg | a40b55d | 2000-11-22 07:27:26 +0000 | [diff] [blame] | 530 | You are in full control of the callback function that gets called every time |
| 531 | there is data received from the remote server. You can make that callback do |
| Daniel Stenberg | 4c48599 | 2001-04-22 15:45:27 +0000 | [diff] [blame] | 532 | whatever you want. You do not have to write the received data to a file. |
| Daniel Stenberg | a40b55d | 2000-11-22 07:27:26 +0000 | [diff] [blame] | 533 | |
| 534 | One solution to this problem could be to have a pointer to a struct that you |
| 535 | pass to the callback function. You set the pointer using the |
| 536 | curl_easy_setopt(CURLOPT_FILE) function. Then that pointer will be passed to |
| 537 | the callback instead of a FILE * to a file: |
| 538 | |
| 539 | /* imaginary struct */ |
| 540 | struct MemoryStruct { |
| 541 | char *memory; |
| 542 | size_t size; |
| 543 | }; |
| 544 | |
| 545 | /* imaginary callback function */ |
| 546 | size_t |
| 547 | WriteMemoryCallback(void *ptr, size_t size, size_t nmemb, void *data) |
| 548 | { |
| 549 | register int realsize = size * nmemb; |
| 550 | struct MemoryStruct *mem = (struct MemoryStruct *)data; |
| 551 | |
| 552 | mem->memory = (char *)realloc(mem->memory, mem->size + realsize + 1); |
| 553 | if (mem->memory) { |
| 554 | memcpy(&(mem->memory[mem->size]), ptr, realsize); |
| 555 | mem->size += realsize; |
| 556 | mem->memory[mem->size] = 0; |
| 557 | } |
| 558 | return realsize; |
| 559 | } |
| 560 | |
| Daniel Stenberg | 2c10037 | 2000-12-19 07:30:51 +0000 | [diff] [blame] | 561 | 5.3 How do I fetch multiple files with libcurl? |
| Daniel Stenberg | ec5ac82 | 2000-12-14 08:37:09 +0000 | [diff] [blame] | 562 | |
| Daniel Stenberg | 5dd0a8a | 2001-03-06 14:37:37 +0000 | [diff] [blame] | 563 | Starting with version 7.7, curl and libcurl will have excellent support for |
| Daniel Stenberg | 11d718b | 2001-03-13 11:47:30 +0000 | [diff] [blame] | 564 | transferring multiple files. You should just repeatedly set new URLs with |
| 565 | curl_easy_setopt() and then transfer it with curl_easy_perform(). The handle |
| 566 | you get from curl_easy_init() is not only reusable starting with libcurl |
| 567 | 7.7, but also you're encouraged to reuse it if you can, as that will enable |
| Daniel Stenberg | 4c48599 | 2001-04-22 15:45:27 +0000 | [diff] [blame] | 568 | libcurl to use persistent connections. |
| Daniel Stenberg | 5dd0a8a | 2001-03-06 14:37:37 +0000 | [diff] [blame] | 569 | |
| Daniel Stenberg | 11d718b | 2001-03-13 11:47:30 +0000 | [diff] [blame] | 570 | For libcurl prior to 7.7, there was no multiple file support. The only |
| 571 | available way to do multiple requests was to init/perform/cleanup for each |
| 572 | transfer. |
| Daniel Stenberg | a40b55d | 2000-11-22 07:27:26 +0000 | [diff] [blame] | 573 | |
| Daniel Stenberg | bc5954f | 2001-03-23 08:16:24 +0000 | [diff] [blame] | 574 | 5.4 Does libcurl do Winsock initialization on win32 systems? |
| Daniel Stenberg | 910fc85 | 2000-12-30 11:48:51 +0000 | [diff] [blame] | 575 | |
| 576 | No. |
| 577 | |
| 578 | On win32 systems, you need to init the winsock stuff manually, libcurl will |
| 579 | not do that for you. WSAStartup() and WSACleanup() should be used |
| 580 | accordingly. The reason for this is of course that a single application may |
| 581 | use several different libraries and parts, and there's no reason for every |
| 582 | single library to do this. |
| 583 | |
| Daniel Stenberg | 5d7b32d | 2001-02-04 20:08:42 +0000 | [diff] [blame] | 584 | 5.5 Does CURLOPT_FILE and CURLOPT_INFILE work on win32 ? |
| Daniel Stenberg | 41084e5 | 2001-01-22 08:42:00 +0000 | [diff] [blame] | 585 | |
| 586 | Yes, but you cannot open a FILE * and pass the pointer to a DLL and have |
| Daniel Stenberg | 5d7b32d | 2001-02-04 20:08:42 +0000 | [diff] [blame] | 587 | that DLL use the FILE *. If you set CURLOPT_FILE you must also use |
| 588 | CURLOPT_WRITEFUNCTION as well to set a function that writes the file, even |
| 589 | if that simply writes the data to the specified FILE*. Similarly, if you use |
| 590 | CURLOPT_INFILE you must also specify CURLOPT_READFUNCTION. |
| Daniel Stenberg | 41084e5 | 2001-01-22 08:42:00 +0000 | [diff] [blame] | 591 | |
| Daniel Stenberg | 5d7b32d | 2001-02-04 20:08:42 +0000 | [diff] [blame] | 592 | (Provided by Joel DeYoung and Bob Schader) |
| Daniel Stenberg | 41084e5 | 2001-01-22 08:42:00 +0000 | [diff] [blame] | 593 | |
| Daniel Stenberg | 4c48599 | 2001-04-22 15:45:27 +0000 | [diff] [blame] | 594 | 5.6 What about Keep-Alive or persistent connections? |
| Daniel Stenberg | 6dc5c6f | 2001-01-27 20:51:31 +0000 | [diff] [blame] | 595 | |
| Daniel Stenberg | 5dd0a8a | 2001-03-06 14:37:37 +0000 | [diff] [blame] | 596 | Starting with version 7.7, curl and libcurl will have excellent support for |
| Daniel Stenberg | 4c48599 | 2001-04-22 15:45:27 +0000 | [diff] [blame] | 597 | persistent connections when transferring several files from the same server. |
| Daniel Stenberg | 11d718b | 2001-03-13 11:47:30 +0000 | [diff] [blame] | 598 | Curl will attempt to reuse connections for all URLs specified on the same |
| 599 | command line/config file, and libcurl will reuse connections for all |
| 600 | transfers that are made using the same libcurl handle. |
| Daniel Stenberg | 5dd0a8a | 2001-03-06 14:37:37 +0000 | [diff] [blame] | 601 | |
| Daniel Stenberg | 4c48599 | 2001-04-22 15:45:27 +0000 | [diff] [blame] | 602 | Previous versions had no persistent connection support. |
| Daniel Stenberg | 6dc5c6f | 2001-01-27 20:51:31 +0000 | [diff] [blame] | 603 | |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 604 | 6. License Issues |
| Daniel Stenberg | c3c7739 | 2000-07-31 22:42:34 +0000 | [diff] [blame] | 605 | |
| Daniel Stenberg | 0d181b5 | 2001-01-04 12:43:53 +0000 | [diff] [blame] | 606 | Curl and libcurl are released under a MIT/X derivate license *or* the MPL, |
| 607 | the Mozilla Public License. To get a really good answer to your license |
| 608 | conflict questions, you should study the MPL and MIT/X licenses and the |
| 609 | license you are about to use and check for clashes yourself. This section is |
| 610 | just a brief summary for the cases we get the most questions. (Parts of this |
| 611 | section was much enhanced by Bjorn Reese.) |
| Daniel Stenberg | c3c7739 | 2000-07-31 22:42:34 +0000 | [diff] [blame] | 612 | |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 613 | 6.1. I have a GPL program, can I use the libcurl library? |
| Daniel Stenberg | c3c7739 | 2000-07-31 22:42:34 +0000 | [diff] [blame] | 614 | |
| Daniel Stenberg | 0d181b5 | 2001-01-04 12:43:53 +0000 | [diff] [blame] | 615 | Yes! |
| Daniel Stenberg | 7d1ef96 | 2000-08-14 06:31:59 +0000 | [diff] [blame] | 616 | |
| Daniel Stenberg | 0d181b5 | 2001-01-04 12:43:53 +0000 | [diff] [blame] | 617 | Since libcurl may be distributed under the MIT/X derivate license, it can be |
| 618 | used together with GPL in any software. |
| Daniel Stenberg | c3c7739 | 2000-07-31 22:42:34 +0000 | [diff] [blame] | 619 | |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 620 | 6.2. I have a closed-source program, can I use the libcurl library? |
| Daniel Stenberg | c3c7739 | 2000-07-31 22:42:34 +0000 | [diff] [blame] | 621 | |
| Daniel Stenberg | c59baa0 | 2001-02-12 10:05:09 +0000 | [diff] [blame] | 622 | Yes! |
| Daniel Stenberg | 0d181b5 | 2001-01-04 12:43:53 +0000 | [diff] [blame] | 623 | |
| Daniel Stenberg | c59baa0 | 2001-02-12 10:05:09 +0000 | [diff] [blame] | 624 | libcurl does not put any restrictions on the program that uses the library. |
| Daniel Stenberg | c3c7739 | 2000-07-31 22:42:34 +0000 | [diff] [blame] | 625 | |
| Daniel Stenberg | 31b8eea | 2000-08-23 07:27:00 +0000 | [diff] [blame] | 626 | 6.3. I have a BSD licensed program, can I use the libcurl library? |
| 627 | |
| Daniel Stenberg | c59baa0 | 2001-02-12 10:05:09 +0000 | [diff] [blame] | 628 | Yes! |
| Daniel Stenberg | 0d181b5 | 2001-01-04 12:43:53 +0000 | [diff] [blame] | 629 | |
| Daniel Stenberg | c59baa0 | 2001-02-12 10:05:09 +0000 | [diff] [blame] | 630 | libcurl does not put any restrictions on the program that uses the library. |
| Daniel Stenberg | 31b8eea | 2000-08-23 07:27:00 +0000 | [diff] [blame] | 631 | |
| 632 | 6.4. I have a program that uses LGPL libraries, can I use libcurl? |
| Daniel Stenberg | c3c7739 | 2000-07-31 22:42:34 +0000 | [diff] [blame] | 633 | |
| Daniel Stenberg | c59baa0 | 2001-02-12 10:05:09 +0000 | [diff] [blame] | 634 | Yes! |
| Daniel Stenberg | c3c7739 | 2000-07-31 22:42:34 +0000 | [diff] [blame] | 635 | |
| Daniel Stenberg | c59baa0 | 2001-02-12 10:05:09 +0000 | [diff] [blame] | 636 | The LGPL license doesn't clash with other licenses. |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 637 | |
| Daniel Stenberg | 31b8eea | 2000-08-23 07:27:00 +0000 | [diff] [blame] | 638 | 6.5. Can I modify curl/libcurl for my program and keep the changes secret? |
| Daniel Stenberg | c3c7739 | 2000-07-31 22:42:34 +0000 | [diff] [blame] | 639 | |
| Daniel Stenberg | c59baa0 | 2001-02-12 10:05:09 +0000 | [diff] [blame] | 640 | Yes! |
| Daniel Stenberg | 0d181b5 | 2001-01-04 12:43:53 +0000 | [diff] [blame] | 641 | |
| 642 | The MIT/X derivate license practically allows you to do almost anything with |
| 643 | the sources, on the condition that the copyright texts in the sources are |
| 644 | left intact. |
| Daniel Stenberg | c3c7739 | 2000-07-31 22:42:34 +0000 | [diff] [blame] | 645 | |
| Daniel Stenberg | 31b8eea | 2000-08-23 07:27:00 +0000 | [diff] [blame] | 646 | 6.6. Can you please change the curl/libcurl license to XXXX? |
| Daniel Stenberg | c3c7739 | 2000-07-31 22:42:34 +0000 | [diff] [blame] | 647 | |
| Daniel Stenberg | c59baa0 | 2001-02-12 10:05:09 +0000 | [diff] [blame] | 648 | No. |
| 649 | |
| Daniel Stenberg | 11d718b | 2001-03-13 11:47:30 +0000 | [diff] [blame] | 650 | We have carefully picked this license after years of development and |
| 651 | discussions and a large amount of people have contributed with source code |
| 652 | knowing that this is the license we use. This license puts the restrictions |
| 653 | we want on curl/libcurl and it does not spread to other programs or |
| 654 | libraries that use it. The recent dual license modification should make it |
| 655 | possible for everyone to use libcurl or curl in their projects, no matter |
| 656 | what license they already have in use. |