| Daniel Stenberg | eea2287 | 2004-03-16 07:56:51 +0000 | [diff] [blame] | 1 | _ _ ____ _ |
| 2 | ___| | | | _ \| | |
| 3 | / __| | | | |_) | | |
| 4 | | (__| |_| | _ <| |___ |
| Daniel Stenberg | 7c37c6a | 2000-05-22 17:35:35 +0000 | [diff] [blame] | 5 | \___|\___/|_| \_\_____| |
| 6 | |
| 7 | FAQ |
| 8 | |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 9 | 1. Philosophy |
| 10 | 1.1 What is cURL? |
| 11 | 1.2 What is libcurl? |
| Daniel Stenberg | c368800 | 2004-10-04 12:54:58 +0000 | [diff] [blame] | 12 | 1.3 What is curl not? |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 13 | 1.4 When will you make curl do XXXX ? |
| Daniel Stenberg | c368800 | 2004-10-04 12:54:58 +0000 | [diff] [blame] | 14 | 1.5 Who makes curl? |
| 15 | 1.6 What do you get for making curl? |
| Daniel Stenberg | c528dc5 | 2001-08-07 11:17:37 +0000 | [diff] [blame] | 16 | 1.7 What about CURL from curl.com? |
| Antoine Pietri | b341b76 | 2022-01-27 02:12:50 +0100 | [diff] [blame] | 17 | 1.8 I have a problem, who do I mail? |
| Daniel Stenberg | 9a44fa8 | 2005-11-02 09:34:53 +0000 | [diff] [blame] | 18 | 1.9 Where do I buy commercial support for curl? |
| 19 | 1.10 How many are using curl? |
| Daniel Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 20 | 1.11 Why do you not update ca-bundle.crt |
| Antoine Pietri | b341b76 | 2022-01-27 02:12:50 +0100 | [diff] [blame] | 21 | 1.12 I have a problem, who can I chat with? |
| Daniel Stenberg | 59842d4 | 2010-08-18 16:54:11 +0200 | [diff] [blame] | 22 | 1.13 curl's ECCN number? |
| Daniel Stenberg | a5f96b4 | 2010-10-06 20:03:13 +0200 | [diff] [blame] | 23 | 1.14 How do I submit my patch? |
| Daniel Stenberg | f81d356 | 2015-05-26 19:13:09 +0200 | [diff] [blame] | 24 | 1.15 How do I port libcurl to my OS? |
| Daniel Stenberg | 7c37c6a | 2000-05-22 17:35:35 +0000 | [diff] [blame] | 25 | |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 26 | 2. Install Related Problems |
| Daniel Stenberg | 490879e | 2020-11-05 13:06:00 +0100 | [diff] [blame] | 27 | 2.1 configure fails when using static libraries |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 28 | 2.2 Does curl work/build with other SSL libraries? |
| Dan Fandrich | 5c9fff9 | 2009-01-30 18:28:29 +0000 | [diff] [blame] | 29 | 2.4 Does curl support SOCKS (RFC 1928) ? |
| Daniel Stenberg | 7c37c6a | 2000-05-22 17:35:35 +0000 | [diff] [blame] | 30 | |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 31 | 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 Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 34 | 3.3 Why does my posting using -F not work? |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 35 | 3.4 How do I tell curl to run custom FTP commands? |
| Dan Fandrich | b3740f0 | 2011-06-02 18:41:57 -0700 | [diff] [blame] | 36 | 3.5 How can I disable the Accept: */* header? |
| Daniel Stenberg | 48bc73c | 2002-05-21 13:53:32 +0000 | [diff] [blame] | 37 | 3.6 Does curl support ASP, XML, XHTML or HTML version Y? |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 38 | 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 Stenberg | 98871d1 | 2002-05-22 22:14:03 +0000 | [diff] [blame] | 40 | 3.9 How do I use curl in my favorite programming language? |
| Daniel Stenberg | 147a673 | 2001-03-08 09:25:09 +0000 | [diff] [blame] | 41 | 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] | 42 | 3.11 How do I POST with a different Content-Type? |
| dbrowndan | 84086b3 | 2019-05-23 15:05:29 -0700 | [diff] [blame] | 43 | 3.12 Why do FTP-specific features over HTTP proxy fail? |
| 44 | 3.13 Why do my single/double quotes fail? |
| Dan Fandrich | 5c9fff9 | 2009-01-30 18:28:29 +0000 | [diff] [blame] | 45 | 3.14 Does curl support Javascript or PAC (automated proxy config)? |
| Daniel Stenberg | f3e5d4a | 2003-12-22 17:24:21 +0000 | [diff] [blame] | 46 | 3.15 Can I do recursive fetches with curl? |
| Daniel Stenberg | edd16d9 | 2004-08-12 11:39:00 +0000 | [diff] [blame] | 47 | 3.16 What certificates do I need when I use SSL? |
| Daniel Stenberg | 951fdeb | 2004-12-21 09:37:55 +0000 | [diff] [blame] | 48 | 3.17 How do I list the root dir of an FTP server? |
| Daniel Stenberg | e9eb523 | 2005-04-05 14:36:37 +0000 | [diff] [blame] | 49 | 3.18 Can I use curl to send a POST/PUT and not wait for a response? |
| Daniel Stenberg | 64f12a3 | 2010-09-07 19:05:07 +0200 | [diff] [blame] | 50 | 3.19 How do I get HTTP from a host using a specific IP address? |
| Daniel Stenberg | 3f7b7de | 2011-03-07 22:27:26 +0100 | [diff] [blame] | 51 | 3.20 How to SFTP from my user's home directory? |
| Daniel Stenberg | 0d0f808 | 2011-03-08 11:15:59 +0100 | [diff] [blame] | 52 | 3.21 Protocol xxx not supported or disabled in libcurl |
| Daniel Stenberg | 0ed4a09 | 2013-01-21 14:33:12 +0100 | [diff] [blame] | 53 | 3.22 curl -X gives me HTTP problems |
| Daniel Stenberg | 7c37c6a | 2000-05-22 17:35:35 +0000 | [diff] [blame] | 54 | |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 55 | 4. Running Problems |
| Daniel Stenberg | e26ee09 | 2001-01-15 10:26:37 +0000 | [diff] [blame] | 56 | 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] | 57 | 4.3 How can I use {, }, [ or ] to specify multiple URLs? |
| Daniel Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 58 | 4.4 Why do I get downloaded data even though the web page does not exist? |
| Daniel Stenberg | 3a4182d | 2022-03-29 13:58:11 +0200 | [diff] [blame^] | 59 | 4.5 Why do I get return code XXX from an HTTP server? |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 60 | 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 Stenberg | d60029d | 2001-12-19 23:25:04 +0000 | [diff] [blame] | 65 | 4.5.6 "301 Moved Permanently" |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 66 | 4.6 Can you tell me what error code 142 means? |
| Daniel Stenberg | 490879e | 2020-11-05 13:06:00 +0100 | [diff] [blame] | 67 | 4.7 How do I keep user names and passwords secret in curl command lines? |
| Daniel Stenberg | e30b206 | 2021-12-09 12:03:35 +0100 | [diff] [blame] | 68 | 4.8 I found a bug |
| Daniel Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 69 | 4.9 curl cannot authenticate to the server that requires NTLM? |
| Daniel Stenberg | e30b206 | 2021-12-09 12:03:35 +0100 | [diff] [blame] | 70 | 4.10 My HTTP request using HEAD, PUT or DELETE does not work |
| dbrowndan | 84086b3 | 2019-05-23 15:05:29 -0700 | [diff] [blame] | 71 | 4.11 Why do my HTTP range requests return the full document? |
| Daniel Stenberg | 1607711 | 2002-11-20 19:17:43 +0000 | [diff] [blame] | 72 | 4.12 Why do I get "certificate verify failed" ? |
| Daniel Stenberg | 1dc0ce9 | 2005-06-13 18:33:40 +0000 | [diff] [blame] | 73 | 4.13 Why is curl -R on Windows one hour off? |
| Daniel Stenberg | e30b206 | 2021-12-09 12:03:35 +0100 | [diff] [blame] | 74 | 4.14 Redirects work in browser but not with curl |
| Daniel Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 75 | 4.15 FTPS does not work |
| Daniel Stenberg | e30b206 | 2021-12-09 12:03:35 +0100 | [diff] [blame] | 76 | 4.16 My HTTP POST or PUT requests are slow |
| Daniel Stenberg | 2afb88e | 2009-02-23 21:21:00 +0000 | [diff] [blame] | 77 | 4.17 Non-functional connect timeouts on Windows |
| Daniel Stenberg | b8012ea | 2009-11-07 21:52:41 +0000 | [diff] [blame] | 78 | 4.18 file:// URLs containing drive letters (Windows, NetWare) |
| Daniel Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 79 | 4.19 Why does not curl return an error when the network cable is unplugged? |
| Daniel Stenberg | e30b206 | 2021-12-09 12:03:35 +0100 | [diff] [blame] | 80 | 4.20 curl does not return error for HTTP non-200 responses |
| Daniel Stenberg | 7c37c6a | 2000-05-22 17:35:35 +0000 | [diff] [blame] | 81 | |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 82 | 5. libcurl Issues |
| Daniel Stenberg | 7d09e51 | 2001-01-11 12:52:07 +0000 | [diff] [blame] | 83 | 5.1 Is libcurl thread-safe? |
| Daniel Stenberg | a40b55d | 2000-11-22 07:27:26 +0000 | [diff] [blame] | 84 | 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] | 85 | 5.3 How do I fetch multiple files with libcurl? |
| Dan Fandrich | 2a264d4 | 2020-12-12 09:59:10 -0800 | [diff] [blame] | 86 | 5.4 Does libcurl do Winsock initialization on win32 systems? |
| Daniel Stenberg | 7e3cd82 | 2003-12-08 13:59:35 +0000 | [diff] [blame] | 87 | 5.5 Does CURLOPT_WRITEDATA and CURLOPT_READDATA work on win32 ? |
| Daniel Stenberg | 4c48599 | 2001-04-22 15:45:27 +0000 | [diff] [blame] | 88 | 5.6 What about Keep-Alive or persistent connections? |
| Daniel Stenberg | e30b206 | 2021-12-09 12:03:35 +0100 | [diff] [blame] | 89 | 5.7 Link errors when building libcurl on Windows |
| Daniel Stenberg | 9754b20 | 2010-08-11 09:15:43 +0200 | [diff] [blame] | 90 | 5.8 libcurl.so.X: open failed: No such file or directory |
| Daniel Stenberg | 1d32336 | 2004-08-12 14:09:10 +0000 | [diff] [blame] | 91 | 5.9 How does libcurl resolve host names? |
| Daniel Stenberg | e9eb523 | 2005-04-05 14:36:37 +0000 | [diff] [blame] | 92 | 5.10 How do I prevent libcurl from writing the response to stdout? |
| Daniel Stenberg | 6e8e041 | 2005-04-05 14:38:38 +0000 | [diff] [blame] | 93 | 5.11 How do I make libcurl not receive the whole HTTP response? |
| Daniel Stenberg | b5d50e9 | 2005-04-11 13:39:55 +0000 | [diff] [blame] | 94 | 5.12 Can I make libcurl fake or hide my real IP address? |
| Daniel Stenberg | 24602ed | 2007-12-10 10:28:56 +0000 | [diff] [blame] | 95 | 5.13 How do I stop an ongoing transfer? |
| Daniel Stenberg | 2205985 | 2008-09-24 07:39:42 +0000 | [diff] [blame] | 96 | 5.14 Using C++ non-static functions for callbacks? |
| Yang Tse | a07bc79 | 2010-02-14 19:40:18 +0000 | [diff] [blame] | 97 | 5.15 How do I get an FTP directory listing? |
| Daniel Stenberg | e30b206 | 2021-12-09 12:03:35 +0100 | [diff] [blame] | 98 | 5.16 I want a different time-out |
| Daniel Stenberg | dbf93a8 | 2013-01-03 10:15:02 +0100 | [diff] [blame] | 99 | 5.17 Can I write a server with libcurl? |
| Daniel Stenberg | 1495f42 | 2014-05-08 09:30:35 +0200 | [diff] [blame] | 100 | 5.18 Does libcurl use threads? |
| Daniel Stenberg | 7c37c6a | 2000-05-22 17:35:35 +0000 | [diff] [blame] | 101 | |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 102 | 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 Stenberg | 31b8eea | 2000-08-23 07:27:00 +0000 | [diff] [blame] | 105 | 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 Fandrich | 5c9fff9 | 2009-01-30 18:28:29 +0000 | [diff] [blame] | 109 | 6.7 What are my obligations when using libcurl in my commercial apps? |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 110 | |
| Daniel Stenberg | 9ac7629 | 2004-08-18 11:18:36 +0000 | [diff] [blame] | 111 | 7. PHP/CURL Issues |
| 112 | 7.1 What is PHP/CURL? |
| Daniel Stenberg | e38a788 | 2011-03-17 11:30:29 +0100 | [diff] [blame] | 113 | 7.2 Who wrote PHP/CURL? |
| Daniel Stenberg | 9ac7629 | 2004-08-18 11:18:36 +0000 | [diff] [blame] | 114 | 7.3 Can I perform multiple requests using the same handle? |
| Daniel Stenberg | 6d49695 | 2017-05-12 19:58:06 +0200 | [diff] [blame] | 115 | 7.4 Does PHP/CURL have dependencies? |
| Daniel Stenberg | 9ac7629 | 2004-08-18 11:18:36 +0000 | [diff] [blame] | 116 | |
| Daniel Stenberg | 352b07f | 2021-09-13 17:21:38 +0200 | [diff] [blame] | 117 | 8. Development |
| 118 | 8.1 Why does curl use C89? |
| 119 | 8.2 Will curl be rewritten? |
| 120 | |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 121 | ============================================================================== |
| 122 | |
| 123 | 1. Philosophy |
| 124 | |
| 125 | 1.1 What is cURL? |
| 126 | |
| Daniel Stenberg | c368800 | 2004-10-04 12:54:58 +0000 | [diff] [blame] | 127 | 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 Stenberg | e28628f | 2021-12-08 10:12:19 +0100 | [diff] [blame] | 129 | URLs. The fact it can also be read as 'see URL' also helped, it works as |
| Dan Fandrich | ec2ad57 | 2005-04-13 19:31:00 +0000 | [diff] [blame] | 130 | an abbreviation for "Client URL Request Library" or why not the recursive |
| Daniel Stenberg | 490879e | 2020-11-05 13:06:00 +0100 | [diff] [blame] | 131 | version: "curl URL Request Library". |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 132 | |
| Daniel Stenberg | c368800 | 2004-10-04 12:54:58 +0000 | [diff] [blame] | 133 | The cURL project produces two products: |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 134 | |
| Daniel Stenberg | c368800 | 2004-10-04 12:54:58 +0000 | [diff] [blame] | 135 | libcurl |
| 136 | |
| Daniel Stenberg | e30b206 | 2021-12-09 12:03:35 +0100 | [diff] [blame] | 137 | 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 Stenberg | ac20f52 | 2010-08-18 19:43:06 +0200 | [diff] [blame] | 140 | |
| Daniel Stenberg | 7ac1681 | 2009-01-14 22:52:18 +0000 | [diff] [blame] | 141 | libcurl supports HTTPS certificates, HTTP POST, HTTP PUT, FTP uploading, |
| Michael Osipov | 37f0e8a | 2014-08-02 13:51:18 +0100 | [diff] [blame] | 142 | Kerberos, SPNEGO, HTTP form based upload, proxies, cookies, user+password |
| Daniel Stenberg | e30b206 | 2021-12-09 12:03:35 +0100 | [diff] [blame] | 143 | authentication, file transfer resume, http proxy tunneling and more. |
| Daniel Stenberg | c368800 | 2004-10-04 12:54:58 +0000 | [diff] [blame] | 144 | |
| 145 | libcurl is highly portable, it builds and works identically on numerous |
| Michael Osipov | 37f0e8a | 2014-08-02 13:51:18 +0100 | [diff] [blame] | 146 | platforms, including Solaris, NetBSD, FreeBSD, OpenBSD, Darwin, HP-UX, |
| Daniel Stenberg | 90dd1fc | 2022-01-16 23:35:00 +0100 | [diff] [blame] | 147 | 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 Stenberg | c368800 | 2004-10-04 12:54:58 +0000 | [diff] [blame] | 150 | |
| 151 | libcurl is free, thread-safe, IPv6 compatible, feature rich, well |
| 152 | supported and fast. |
| Gisle Vanem | 51a87fa | 2004-11-24 15:14:42 +0000 | [diff] [blame] | 153 | |
| Daniel Stenberg | c368800 | 2004-10-04 12:54:58 +0000 | [diff] [blame] | 154 | curl |
| 155 | |
| Daniel Stenberg | 7aa79dc | 2021-09-15 14:33:05 +0200 | [diff] [blame] | 156 | A command line tool for getting or sending data using URL syntax. |
| Daniel Stenberg | c368800 | 2004-10-04 12:54:58 +0000 | [diff] [blame] | 157 | |
| Daniel Stenberg | ac20f52 | 2010-08-18 19:43:06 +0200 | [diff] [blame] | 158 | Since curl uses libcurl, curl supports the same wide range of common |
| 159 | Internet protocols that libcurl does. |
| Daniel Stenberg | c368800 | 2004-10-04 12:54:58 +0000 | [diff] [blame] | 160 | |
| Daniel Stenberg | 17932a8 | 2014-09-19 10:01:45 +0200 | [diff] [blame] | 161 | 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 Szakats | 13ef623 | 2017-08-08 19:22:34 +0000 | [diff] [blame] | 164 | https://media.merriam-webster.com/soundc11/c/curl0001.wav |
| Daniel Stenberg | 887e728 | 2001-01-03 09:13:07 +0000 | [diff] [blame] | 165 | |
| Daniel Stenberg | f83be11 | 2005-05-18 10:12:08 +0000 | [diff] [blame] | 166 | 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 Stenberg | 073ef0b | 2003-05-09 07:07:13 +0000 | [diff] [blame] | 168 | notice that this FAQ is directed at the command-line tool named curl (and |
| Daniel Stenberg | eea2287 | 2004-03-16 07:56:51 +0000 | [diff] [blame] | 169 | libcurl the library), and may therefore not be valid for other curl-related |
| Daniel Stenberg | f83be11 | 2005-05-18 10:12:08 +0000 | [diff] [blame] | 170 | projects. (There is however a small section for the PHP/CURL in this FAQ.) |
| Daniel Stenberg | 073ef0b | 2003-05-09 07:07:13 +0000 | [diff] [blame] | 171 | |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 172 | 1.2 What is libcurl? |
| 173 | |
| Daniel Stenberg | 5ad23d5 | 2021-10-20 09:24:18 +0200 | [diff] [blame] | 174 | libcurl is a reliable and portable library for doing Internet data transfers |
| 175 | using one or more of its supported Internet protocols. |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 176 | |
| Daniel Stenberg | e30b206 | 2021-12-09 12:03:35 +0100 | [diff] [blame] | 177 | You can use libcurl freely in your application, be it open source, |
| Daniel Stenberg | eea2287 | 2004-03-16 07:56:51 +0000 | [diff] [blame] | 178 | commercial or closed-source. |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 179 | |
| Daniel Stenberg | 9a44fa8 | 2005-11-02 09:34:53 +0000 | [diff] [blame] | 180 | 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 Stenberg | c368800 | 2004-10-04 12:54:58 +0000 | [diff] [blame] | 184 | 1.3 What is curl not? |
| Daniel Stenberg | ef34ad2 | 2000-06-02 12:45:23 +0000 | [diff] [blame] | 185 | |
| Daniel Stenberg | e30b206 | 2021-12-09 12:03:35 +0100 | [diff] [blame] | 186 | curl is not a wget clone. That is a common misconception. Never, during |
| Daniel Stenberg | eea2287 | 2004-03-16 07:56:51 +0000 | [diff] [blame] | 187 | curl's development, have we intended curl to replace wget or compete on its |
| Daniel Stenberg | 490879e | 2020-11-05 13:06:00 +0100 | [diff] [blame] | 188 | market. curl is targeted at single-shot file transfers. |
| Daniel Stenberg | eea2287 | 2004-03-16 07:56:51 +0000 | [diff] [blame] | 189 | |
| Daniel Stenberg | 490879e | 2020-11-05 13:06:00 +0100 | [diff] [blame] | 190 | 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 Stenberg | ef34ad2 | 2000-06-02 12:45:23 +0000 | [diff] [blame] | 193 | |
| Daniel Stenberg | 490879e | 2020-11-05 13:06:00 +0100 | [diff] [blame] | 194 | curl is not an FTP site mirroring program. Sure, get and send FTP with curl |
| Daniel Stenberg | 4c48599 | 2001-04-22 15:45:27 +0000 | [diff] [blame] | 195 | but if you want systematic and sequential behavior you should write a |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 196 | script (or write a new program that interfaces libcurl) and do it. |
| 197 | |
| Daniel Stenberg | 490879e | 2020-11-05 13:06:00 +0100 | [diff] [blame] | 198 | curl is not a PHP tool, even though it works perfectly well when used from |
| Daniel Stenberg | c368800 | 2004-10-04 12:54:58 +0000 | [diff] [blame] | 199 | or with PHP (when using the PHP/CURL module). |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 200 | |
| Daniel Stenberg | 490879e | 2020-11-05 13:06:00 +0100 | [diff] [blame] | 201 | curl is not a program for a single operating system. curl exists, compiles, |
| Daniel Stenberg | 890b34d | 2007-02-11 09:55:17 +0000 | [diff] [blame] | 202 | builds and runs under a wide range of operating systems, including all |
| Daniel Stenberg | 90dd1fc | 2022-01-16 23:35:00 +0100 | [diff] [blame] | 203 | modern Unixes (and a bunch of older ones too), Windows, Amiga, OS/2, macOS, |
| 204 | QNX etc. |
| Daniel Stenberg | 31b8eea | 2000-08-23 07:27:00 +0000 | [diff] [blame] | 205 | |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 206 | 1.4 When will you make curl do XXXX ? |
| 207 | |
| Daniel Stenberg | 11d718b | 2001-03-13 11:47:30 +0000 | [diff] [blame] | 208 | 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 Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 210 | curl: |
| 211 | |
| Daniel Stenberg | 490879e | 2020-11-05 13:06:00 +0100 | [diff] [blame] | 212 | curl -- the command line tool -- is to remain a non-graphical command line |
| Daniel Stenberg | 1a911f7 | 2013-08-24 17:13:46 +0200 | [diff] [blame] | 213 | tool. If you want GUIs or fancy scripting capabilities, you should look for |
| 214 | another tool that uses libcurl. |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 215 | |
| Daniel Stenberg | 1a911f7 | 2013-08-24 17:13:46 +0200 | [diff] [blame] | 216 | We do not add things to curl that other small and available tools already do |
| Daniel Stenberg | 92efb3d | 2021-11-01 13:43:11 +0100 | [diff] [blame] | 217 | well at the side. curl's output can be piped into another program or |
| railsnewbie257 | cd6b99e | 2017-01-11 23:48:22 -0600 | [diff] [blame] | 218 | redirected to another file for the next program to interpret. |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 219 | |
| Viktor Szakats | 7e35eb7 | 2018-02-23 23:29:01 +0000 | [diff] [blame] | 220 | We focus on protocol related issues and improvements. If you want to do more |
| Daniel Stenberg | 92efb3d | 2021-11-01 13:43:11 +0100 | [diff] [blame] | 221 | 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 Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 223 | |
| railsnewbie257 | cd6b99e | 2017-01-11 23:48:22 -0600 | [diff] [blame] | 224 | If you want someone else to do all the work while you wait for us to |
| Daniel Stenberg | 92efb3d | 2021-11-01 13:43:11 +0100 | [diff] [blame] | 225 | implement it for you, that is not a friendly attitude. We spend a |
| Daniel Stenberg | 1a911f7 | 2013-08-24 17:13:46 +0200 | [diff] [blame] | 226 | 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 |
| railsnewbie257 | cd6b99e | 2017-01-11 23:48:22 -0600 | [diff] [blame] | 228 | effort in return. Simply go to the GitHub repo which resides at |
| Viktor Szakats | 20dcd19 | 2016-02-03 18:34:16 +0100 | [diff] [blame] | 229 | https://github.com/curl/curl, fork the project, and create pull requests |
| paulehoffman | 53d1e42 | 2016-01-24 14:27:08 -0800 | [diff] [blame] | 230 | with your proposed changes. |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 231 | |
| railsnewbie257 | cd6b99e | 2017-01-11 23:48:22 -0600 | [diff] [blame] | 232 | If you write the code, chances are better that it will get into curl faster. |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 233 | |
| Daniel Stenberg | c368800 | 2004-10-04 12:54:58 +0000 | [diff] [blame] | 234 | 1.5 Who makes curl? |
| Daniel Stenberg | a0eb52b | 2001-03-23 15:28:13 +0000 | [diff] [blame] | 235 | |
| Daniel Stenberg | f83be11 | 2005-05-18 10:12:08 +0000 | [diff] [blame] | 236 | 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 Stenberg | d16c757 | 2002-08-08 11:54:11 +0000 | [diff] [blame] | 238 | 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 |
| railsnewbie257 | cd6b99e | 2017-01-11 23:48:22 -0600 | [diff] [blame] | 240 | condition that developers agree that the fixes are good). |
| Daniel Stenberg | a0eb52b | 2001-03-23 15:28:13 +0000 | [diff] [blame] | 241 | |
| Daniel Stenberg | db2d52a | 2007-12-10 11:33:46 +0000 | [diff] [blame] | 242 | The full list of all contributors is found in the docs/THANKS file. |
| Daniel Stenberg | a0eb52b | 2001-03-23 15:28:13 +0000 | [diff] [blame] | 243 | |
| 244 | curl is developed by a community, with Daniel at the wheel. |
| 245 | |
| Daniel Stenberg | c368800 | 2004-10-04 12:54:58 +0000 | [diff] [blame] | 246 | 1.6 What do you get for making curl? |
| Daniel Stenberg | a0eb52b | 2001-03-23 15:28:13 +0000 | [diff] [blame] | 247 | |
| Daniel Stenberg | d63b390 | 2020-09-07 17:08:07 +0200 | [diff] [blame] | 248 | Project cURL is entirely free and open. We do this voluntarily, mostly in |
| Daniel Stenberg | e30b206 | 2021-12-09 12:03:35 +0100 | [diff] [blame] | 249 | 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 Stenberg | a0eb52b | 2001-03-23 15:28:13 +0000 | [diff] [blame] | 251 | |
| Daniel Stenberg | d63b390 | 2020-09-07 17:08:07 +0200 | [diff] [blame] | 252 | 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 Stenberg | a0eb52b | 2001-03-23 15:28:13 +0000 | [diff] [blame] | 257 | |
| Daniel Stenberg | f83be11 | 2005-05-18 10:12:08 +0000 | [diff] [blame] | 258 | If you want to support our project, consider a donation or a banner-program |
| railsnewbie257 | cd6b99e | 2017-01-11 23:48:22 -0600 | [diff] [blame] | 259 | or even better: by helping us with coding, documenting or testing etc. |
| Daniel Stenberg | c528dc5 | 2001-08-07 11:17:37 +0000 | [diff] [blame] | 260 | |
| Daniel Stenberg | 4d2f800 | 2020-11-04 14:02:01 +0100 | [diff] [blame] | 261 | See also: https://curl.se/sponsors.html |
| Daniel Stenberg | d63b390 | 2020-09-07 17:08:07 +0200 | [diff] [blame] | 262 | |
| Daniel Stenberg | c528dc5 | 2001-08-07 11:17:37 +0000 | [diff] [blame] | 263 | 1.7 What about CURL from curl.com? |
| 264 | |
| railsnewbie257 | cd6b99e | 2017-01-11 23:48:22 -0600 | [diff] [blame] | 265 | During the summer of 2001, curl.com was busy advertising their client-side |
| Daniel Stenberg | c528dc5 | 2001-08-07 11:17:37 +0000 | [diff] [blame] | 266 | programming language for the web, named CURL. |
| 267 | |
| Daniel Stenberg | 81b6ebc | 2001-08-07 18:02:37 +0000 | [diff] [blame] | 268 | We are in no way associated with curl.com or their CURL programming |
| Daniel Stenberg | eea2287 | 2004-03-16 07:56:51 +0000 | [diff] [blame] | 269 | language. |
| Daniel Stenberg | c528dc5 | 2001-08-07 11:17:37 +0000 | [diff] [blame] | 270 | |
| Daniel Stenberg | 81b6ebc | 2001-08-07 18:02:37 +0000 | [diff] [blame] | 271 | 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] | 272 | first computer related project to use the name "curl" and do not claim any |
| Daniel Stenberg | 1a911f7 | 2013-08-24 17:13:46 +0200 | [diff] [blame] | 273 | rights to the name. |
| Daniel Stenberg | c528dc5 | 2001-08-07 11:17:37 +0000 | [diff] [blame] | 274 | |
| Daniel Stenberg | 81b6ebc | 2001-08-07 18:02:37 +0000 | [diff] [blame] | 275 | We recognize that we will be living in parallel with curl.com and wish them |
| 276 | every success. |
| Daniel Stenberg | c528dc5 | 2001-08-07 11:17:37 +0000 | [diff] [blame] | 277 | |
| Antoine Pietri | b341b76 | 2022-01-27 02:12:50 +0100 | [diff] [blame] | 278 | 1.8 I have a problem, who do I mail? |
| Daniel Stenberg | 8eaa7fe | 2002-04-27 18:12:26 +0000 | [diff] [blame] | 279 | |
| Daniel Stenberg | db5c9cd | 2003-02-25 08:52:32 +0000 | [diff] [blame] | 280 | 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 Stenberg | 4d2f800 | 2020-11-04 14:02:01 +0100 | [diff] [blame] | 283 | https://curl.se/mail/ |
| Daniel Stenberg | 8eaa7fe | 2002-04-27 18:12:26 +0000 | [diff] [blame] | 284 | |
| Daniel Stenberg | db5c9cd | 2003-02-25 08:52:32 +0000 | [diff] [blame] | 285 | Keeping curl-related questions and discussions on mailing lists allows |
| railsnewbie257 | cd6b99e | 2017-01-11 23:48:22 -0600 | [diff] [blame] | 286 | 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 Stenberg | db5c9cd | 2003-02-25 08:52:32 +0000 | [diff] [blame] | 288 | 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 Stenberg | 8eaa7fe | 2002-04-27 18:12:26 +0000 | [diff] [blame] | 291 | |
| Daniel Stenberg | 0b8f57b | 2005-08-07 14:36:55 +0000 | [diff] [blame] | 292 | If you have found or simply suspect a security problem in curl or libcurl, |
| Daniel Stenberg | ab2f27c | 2021-09-09 14:46:38 +0200 | [diff] [blame] | 293 | 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 Pietri | b341b76 | 2022-01-27 02:12:50 +0100 | [diff] [blame] | 297 | the problem risks having on existing users. |
| Daniel Stenberg | ab2f27c | 2021-09-09 14:46:38 +0200 | [diff] [blame] | 298 | |
| 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 Stenberg | 0b8f57b | 2005-08-07 14:36:55 +0000 | [diff] [blame] | 301 | |
| Daniel Stenberg | 9a44fa8 | 2005-11-02 09:34:53 +0000 | [diff] [blame] | 302 | 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 | |
| H3RSKO | 3d22140 | 2020-08-16 16:36:10 -0400 | [diff] [blame] | 307 | We list available alternatives on the curl website: |
| Daniel Stenberg | 4d2f800 | 2020-11-04 14:02:01 +0100 | [diff] [blame] | 308 | https://curl.se/support.html |
| Daniel Stenberg | 9a44fa8 | 2005-11-02 09:34:53 +0000 | [diff] [blame] | 309 | |
| 310 | 1.10 How many are using curl? |
| 311 | |
| 312 | It is impossible to tell. |
| 313 | |
| Daniel Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 314 | We do not know how many users that knowingly have installed and use curl. |
| Daniel Stenberg | 9a44fa8 | 2005-11-02 09:34:53 +0000 | [diff] [blame] | 315 | |
| Daniel Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 316 | We do not know how many users that use curl without knowing that they are in |
| Daniel Stenberg | 9a44fa8 | 2005-11-02 09:34:53 +0000 | [diff] [blame] | 317 | fact using it. |
| 318 | |
| Daniel Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 319 | We do not know how many users that downloaded or installed curl and then |
| Daniel Stenberg | 9a44fa8 | 2005-11-02 09:34:53 +0000 | [diff] [blame] | 320 | never use it. |
| 321 | |
| Daniel Gustafsson | afbf7d2 | 2020-11-05 09:36:24 +0100 | [diff] [blame] | 322 | In 2020, we estimate that curl runs in roughly ten billion installations |
| Daniel Stenberg | d63b390 | 2020-09-07 17:08:07 +0200 | [diff] [blame] | 323 | world wide. |
| Daniel Stenberg | 9a44fa8 | 2005-11-02 09:34:53 +0000 | [diff] [blame] | 324 | |
| Daniel Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 325 | 1.11 Why do you not update ca-bundle.crt |
| Daniel Stenberg | 15bf168 | 2008-02-07 15:43:36 +0000 | [diff] [blame] | 326 | |
| Daniel Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 327 | In the cURL project we have decided not to attempt to keep this file updated |
| Daniel Stenberg | d63b390 | 2020-09-07 17:08:07 +0200 | [diff] [blame] | 328 | (or even present) since deciding what to add to a ca cert bundle is an |
| Daniel Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 329 | undertaking we have not been ready to accept, and the one we can get from |
| Daniel Stenberg | 074bd2a | 2008-02-18 11:39:11 +0000 | [diff] [blame] | 330 | Mozilla is perfectly fine so there's no need to duplicate that work. |
| Daniel Stenberg | 15bf168 | 2008-02-07 15:43:36 +0000 | [diff] [blame] | 331 | |
| 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 Stenberg | 074bd2a | 2008-02-18 11:39:11 +0000 | [diff] [blame] | 335 | be a lot better than a private curl version. |
| Daniel Stenberg | 15bf168 | 2008-02-07 15:43:36 +0000 | [diff] [blame] | 336 | |
| Daniel Stenberg | 074bd2a | 2008-02-18 11:39:11 +0000 | [diff] [blame] | 337 | 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 Stenberg | 4d2f800 | 2020-11-04 14:02:01 +0100 | [diff] [blame] | 340 | for this purpose: https://curl.se/docs/caextract.html |
| Daniel Stenberg | 15bf168 | 2008-02-07 15:43:36 +0000 | [diff] [blame] | 341 | |
| Antoine Pietri | b341b76 | 2022-01-27 02:12:50 +0100 | [diff] [blame] | 342 | 1.12 I have a problem who, can I chat with? |
| Daniel Stenberg | 8740d14 | 2009-06-09 09:02:39 +0000 | [diff] [blame] | 343 | |
| 344 | There's a bunch of friendly people hanging out in the #curl channel on the |
| Daniel Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 345 | IRC network libera.chat. If you are polite and nice, chances are good that |
| Daniel Stenberg | b03b82a | 2021-05-24 00:21:00 +0200 | [diff] [blame] | 346 | you can get -- or provide -- help instantly. |
| Daniel Stenberg | 8740d14 | 2009-06-09 09:02:39 +0000 | [diff] [blame] | 347 | |
| Daniel Stenberg | 59842d4 | 2010-08-18 16:54:11 +0200 | [diff] [blame] | 348 | 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 Stenberg | b823596 | 2016-01-04 18:59:29 +0100 | [diff] [blame] | 354 | Apache Software Foundation gives a good explanation of ECCNs at |
| 355 | https://www.apache.org/dev/crypto.html |
| Daniel Stenberg | 59842d4 | 2010-08-18 16:54:11 +0200 | [diff] [blame] | 356 | |
| 357 | We believe curl's number might be ECCN 5D002, another possibility is |
| Daniel Stenberg | b823596 | 2016-01-04 18:59:29 +0100 | [diff] [blame] | 358 | 5D992. It seems necessary to write them (the authority that administers ECCN |
| 359 | numbers), asking to confirm. |
| Daniel Stenberg | 59842d4 | 2010-08-18 16:54:11 +0200 | [diff] [blame] | 360 | |
| Daniel Stenberg | b823596 | 2016-01-04 18:59:29 +0100 | [diff] [blame] | 361 | Comprehensible explanations of the meaning of such numbers and how to obtain |
| 362 | them (resp.) are here |
| Daniel Stenberg | 59842d4 | 2010-08-18 16:54:11 +0200 | [diff] [blame] | 363 | |
| Viktor Szakats | 13ef623 | 2017-08-08 19:22:34 +0000 | [diff] [blame] | 364 | https://www.bis.doc.gov/licensing/exportingbasics.htm |
| 365 | https://www.bis.doc.gov/licensing/do_i_needaneccn.html |
| Daniel Stenberg | 59842d4 | 2010-08-18 16:54:11 +0200 | [diff] [blame] | 366 | |
| 367 | An incomprehensible description of the two numbers above is here |
| Viktor Szakats | f078361 | 2018-09-22 07:58:05 +0000 | [diff] [blame] | 368 | https://www.bis.doc.gov/index.php/documents/new-encryption/1653-ccl5-pt2-3 |
| Daniel Stenberg | 59842d4 | 2010-08-18 16:54:11 +0200 | [diff] [blame] | 369 | |
| Daniel Stenberg | a5f96b4 | 2010-10-06 20:03:13 +0200 | [diff] [blame] | 370 | 1.14 How do I submit my patch? |
| 371 | |
| Daniel Stenberg | d63b390 | 2020-09-07 17:08:07 +0200 | [diff] [blame] | 372 | We strongly encourage you to submit changes and improvements directly as |
| Daniel Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 373 | "pull requests" on GitHub: https://github.com/curl/curl/pulls |
| Daniel Stenberg | a5f96b4 | 2010-10-06 20:03:13 +0200 | [diff] [blame] | 374 | |
| Daniel Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 375 | 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 Stenberg | d63b390 | 2020-09-07 17:08:07 +0200 | [diff] [blame] | 377 | lots of people who can review patches, comment on them and "receive" them |
| 378 | properly. |
| Daniel Stenberg | a5f96b4 | 2010-10-06 20:03:13 +0200 | [diff] [blame] | 379 | |
| Daniel Stenberg | 490879e | 2020-11-05 13:06:00 +0100 | [diff] [blame] | 380 | Lots of more details are found in the CONTRIBUTE.md and INTERNALS.md |
| 381 | documents. |
| Daniel Stenberg | a5f96b4 | 2010-10-06 20:03:13 +0200 | [diff] [blame] | 382 | |
| Daniel Stenberg | f81d356 | 2015-05-26 19:13:09 +0200 | [diff] [blame] | 383 | 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 Stenberg | 8eaa7fe | 2002-04-27 18:12:26 +0000 | [diff] [blame] | 396 | |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 397 | 2. Install Related Problems |
| 398 | |
| Daniel Stenberg | 490879e | 2020-11-05 13:06:00 +0100 | [diff] [blame] | 399 | 2.1 configure fails when using static libraries |
| Daniel Stenberg | 7c37c6a | 2000-05-22 17:35:35 +0000 | [diff] [blame] | 400 | |
| Daniel Stenberg | 490879e | 2020-11-05 13:06:00 +0100 | [diff] [blame] | 401 | 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 Stenberg | 7c37c6a | 2000-05-22 17:35:35 +0000 | [diff] [blame] | 404 | |
| Daniel Stenberg | 490879e | 2020-11-05 13:06:00 +0100 | [diff] [blame] | 405 | The reason why static libraries is much harder to deal with is that for them |
| Daniel Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 406 | we do not get any help but the script itself must know or check what more |
| Daniel Stenberg | 490879e | 2020-11-05 13:06:00 +0100 | [diff] [blame] | 407 | libraries that are needed (with shared libraries, that dependency "chain" is |
| Daniel Stenberg | 92efb3d | 2021-11-01 13:43:11 +0100 | [diff] [blame] | 408 | handled automatically). This is a error-prone process and one that also |
| Daniel Stenberg | 490879e | 2020-11-05 13:06:00 +0100 | [diff] [blame] | 409 | tends to vary over time depending on the release versions of the involved |
| 410 | components and may also differ between operating systems. |
| Daniel Stenberg | 7c37c6a | 2000-05-22 17:35:35 +0000 | [diff] [blame] | 411 | |
| Daniel Stenberg | 92efb3d | 2021-11-01 13:43:11 +0100 | [diff] [blame] | 412 | 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 Stenberg | 7c37c6a | 2000-05-22 17:35:35 +0000 | [diff] [blame] | 416 | |
| Daniel Stenberg | 490879e | 2020-11-05 13:06:00 +0100 | [diff] [blame] | 417 | 2.2 Does curl work with other SSL libraries? |
| Daniel Stenberg | 7c37c6a | 2000-05-22 17:35:35 +0000 | [diff] [blame] | 418 | |
| Daniel Stenberg | 490879e | 2020-11-05 13:06:00 +0100 | [diff] [blame] | 419 | curl has been written to use a generic SSL function layer internally, and |
| Daniel Stenberg | 045c734 | 2013-01-23 13:17:36 +0100 | [diff] [blame] | 420 | 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 Stenberg | 223f26c | 2022-01-09 22:28:48 +0100 | [diff] [blame] | 424 | libressl, BoringSSL, GnuTLS, wolfSSL, NSS, mbedTLS, Secure |
| Michael Forney | 9b87916 | 2019-11-07 20:17:18 -0800 | [diff] [blame] | 425 | Transport (native iOS/OS X), Schannel (native Windows), GSKit (native IBM |
| Jacob Hoffman-Andrews | 246399a | 2020-12-12 23:55:09 -0800 | [diff] [blame] | 426 | 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 Stenberg | e9640b6 | 2000-08-02 07:17:56 +0000 | [diff] [blame] | 428 | |
| Dan Fandrich | 5c9fff9 | 2009-01-30 18:28:29 +0000 | [diff] [blame] | 429 | 2.4 Does curl support SOCKS (RFC 1928) ? |
| Daniel Stenberg | e9640b6 | 2000-08-02 07:17:56 +0000 | [diff] [blame] | 430 | |
| Daniel Stenberg | 844cbc7 | 2007-07-29 22:17:39 +0000 | [diff] [blame] | 431 | Yes, SOCKS 4 and 5 are supported. |
| Daniel Stenberg | e9640b6 | 2000-08-02 07:17:56 +0000 | [diff] [blame] | 432 | |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 433 | 3. Usage problems |
| Daniel Stenberg | e9640b6 | 2000-08-02 07:17:56 +0000 | [diff] [blame] | 434 | |
| Daniel Stenberg | 811edcd | 2004-08-10 08:41:41 +0000 | [diff] [blame] | 435 | 3.1 curl: (1) SSL is disabled, https: not supported |
| Daniel Stenberg | e9640b6 | 2000-08-02 07:17:56 +0000 | [diff] [blame] | 436 | |
| Daniel Stenberg | 3a4182d | 2022-03-29 13:58:11 +0200 | [diff] [blame^] | 437 | If you get this output when trying to get anything from an https:// server, |
| Daniel Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 438 | it means that the instance of curl/libcurl that you are using was built |
| Daniel Stenberg | 0d0f808 | 2011-03-08 11:15:59 +0100 | [diff] [blame] | 439 | without support for this protocol. |
| 440 | |
| Daniel Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 441 | 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 Stenberg | 0d0f808 | 2011-03-08 11:15:59 +0100 | [diff] [blame] | 443 | the configure script fails to find them, curl is simply built without SSL |
| 444 | support. |
| Daniel Stenberg | e9640b6 | 2000-08-02 07:17:56 +0000 | [diff] [blame] | 445 | |
| 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 Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 448 | and logs and check out why the configure script does not find the SSL libs |
| Daniel Stenberg | e9640b6 | 2000-08-02 07:17:56 +0000 | [diff] [blame] | 449 | and/or include files. |
| 450 | |
| Daniel Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 451 | Also, check out the other paragraph in this FAQ labeled "configure does not |
| Daniel Stenberg | e9640b6 | 2000-08-02 07:17:56 +0000 | [diff] [blame] | 452 | find OpenSSL even when it is installed". |
| 453 | |
| Daniel Stenberg | 811edcd | 2004-08-10 08:41:41 +0000 | [diff] [blame] | 454 | 3.2 How do I tell curl to resume a transfer? |
| Daniel Stenberg | e9640b6 | 2000-08-02 07:17:56 +0000 | [diff] [blame] | 455 | |
| Daniel Stenberg | 490879e | 2020-11-05 13:06:00 +0100 | [diff] [blame] | 456 | curl supports resumed transfers both ways on both FTP and HTTP. |
| Daniel Stenberg | 887e728 | 2001-01-03 09:13:07 +0000 | [diff] [blame] | 457 | Try the -C option. |
| Daniel Stenberg | e9640b6 | 2000-08-02 07:17:56 +0000 | [diff] [blame] | 458 | |
| Daniel Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 459 | 3.3 Why does my posting using -F not work? |
| Daniel Stenberg | e9640b6 | 2000-08-02 07:17:56 +0000 | [diff] [blame] | 460 | |
| Daniel Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 461 | You cannot arbitrarily use -F or -d, the choice between -F or -d depends on |
| Daniel Stenberg | 490879e | 2020-11-05 13:06:00 +0100 | [diff] [blame] | 462 | the HTTP operation you need curl to do and what the web server that will |
| 463 | receive your post expects. |
| railsnewbie257 | cd6b99e | 2017-01-11 23:48:22 -0600 | [diff] [blame] | 464 | |
| Daniel Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 465 | If the form you are trying to submit uses the type 'multipart/form-data', |
| Daniel Stenberg | 490879e | 2020-11-05 13:06:00 +0100 | [diff] [blame] | 466 | 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 |
| railsnewbie257 | cd6b99e | 2017-01-11 23:48:22 -0600 | [diff] [blame] | 468 | 'application/x-www-form-urlencoded'. |
| Daniel Stenberg | e9640b6 | 2000-08-02 07:17:56 +0000 | [diff] [blame] | 469 | |
| Daniel Stenberg | 4c48599 | 2001-04-22 15:45:27 +0000 | [diff] [blame] | 470 | This is described in some detail in the MANUAL and TheArtOfHttpScripting |
| Daniel Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 471 | documents, and if you do not understand it the first time, read it again |
| Daniel Stenberg | 4c48599 | 2001-04-22 15:45:27 +0000 | [diff] [blame] | 472 | 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 Stenberg | e9640b6 | 2000-08-02 07:17:56 +0000 | [diff] [blame] | 475 | |
| Daniel Stenberg | 811edcd | 2004-08-10 08:41:41 +0000 | [diff] [blame] | 476 | 3.4 How do I tell curl to run custom FTP commands? |
| Daniel Stenberg | e9640b6 | 2000-08-02 07:17:56 +0000 | [diff] [blame] | 477 | |
| 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 Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 481 | Since curl is used for file transfers, you do not normally use curl to |
| Daniel Stenberg | 68e2c9a | 2012-11-25 19:44:49 +0100 | [diff] [blame] | 482 | 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 Stenberg | e9640b6 | 2000-08-02 07:17:56 +0000 | [diff] [blame] | 485 | |
| Dan Fandrich | b3740f0 | 2011-06-02 18:41:57 -0700 | [diff] [blame] | 486 | 3.5 How can I disable the Accept: */* header? |
| Daniel Stenberg | e9640b6 | 2000-08-02 07:17:56 +0000 | [diff] [blame] | 487 | |
| 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 Fandrich | b3740f0 | 2011-06-02 18:41:57 -0700 | [diff] [blame] | 490 | disable that one. Use -H "Accept:" to disable that specific header. |
| Daniel Stenberg | e9640b6 | 2000-08-02 07:17:56 +0000 | [diff] [blame] | 491 | |
| Daniel Stenberg | 811edcd | 2004-08-10 08:41:41 +0000 | [diff] [blame] | 492 | 3.6 Does curl support ASP, XML, XHTML or HTML version Y? |
| Daniel Stenberg | e9640b6 | 2000-08-02 07:17:56 +0000 | [diff] [blame] | 493 | |
| Daniel Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 494 | To curl, all contents are alike. It does not matter how the page was |
| Daniel Stenberg | 07f9780 | 2013-02-08 09:58:23 +0100 | [diff] [blame] | 495 | generated. It may be ASP, PHP, Perl, shell-script, SSI or plain HTML |
| Daniel Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 496 | files. There's no difference to curl and it does not even know what kind of |
| Daniel Stenberg | 07f9780 | 2013-02-08 09:58:23 +0100 | [diff] [blame] | 497 | language that generated the page. |
| Daniel Stenberg | e9640b6 | 2000-08-02 07:17:56 +0000 | [diff] [blame] | 498 | |
| Daniel Stenberg | 2080738 | 2002-05-21 14:00:55 +0000 | [diff] [blame] | 499 | See also item 3.14 regarding javascript. |
| Daniel Stenberg | e9640b6 | 2000-08-02 07:17:56 +0000 | [diff] [blame] | 500 | |
| Daniel Stenberg | 811edcd | 2004-08-10 08:41:41 +0000 | [diff] [blame] | 501 | 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] | 502 | |
| Daniel Stenberg | 4c48599 | 2001-04-22 15:45:27 +0000 | [diff] [blame] | 503 | Yes. You specify custom FTP commands with -Q/--quote. |
| Daniel Stenberg | e9640b6 | 2000-08-02 07:17:56 +0000 | [diff] [blame] | 504 | |
| 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 Stenberg | 33b9daa | 2007-06-26 21:53:46 +0000 | [diff] [blame] | 509 | or rename a file after upload: |
| 510 | |
| 511 | curl -T infile ftp://upload.com/dir/ -Q "-RNFR infile" -Q "-RNTO newname" |
| 512 | |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 513 | 3.8 How do I tell curl to follow HTTP redirects? |
| Daniel Stenberg | e9640b6 | 2000-08-02 07:17:56 +0000 | [diff] [blame] | 514 | |
| Daniel Stenberg | 490879e | 2020-11-05 13:06:00 +0100 | [diff] [blame] | 515 | curl does not follow so-called redirects by default. The Location: header |
| Daniel Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 516 | that informs the client about this is only interpreted if you are using the |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 517 | -L/--location option. As in: |
| Daniel Stenberg | e9640b6 | 2000-08-02 07:17:56 +0000 | [diff] [blame] | 518 | |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 519 | curl -L http://redirector.com |
| 520 | |
| Daniel Stenberg | 09cb9c7 | 2005-08-26 13:22:39 +0000 | [diff] [blame] | 521 | Not all redirects are HTTP ones, see 4.14 |
| 522 | |
| Daniel Stenberg | 98871d1 | 2002-05-22 22:14:03 +0000 | [diff] [blame] | 523 | 3.9 How do I use curl in my favorite programming language? |
| Daniel Stenberg | 368e352 | 2001-01-29 10:16:21 +0000 | [diff] [blame] | 524 | |
| dbrowndan | 84086b3 | 2019-05-23 15:05:29 -0700 | [diff] [blame] | 525 | 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 Stenberg | 4c48599 | 2001-04-22 15:45:27 +0000 | [diff] [blame] | 528 | |
| Daniel Stenberg | 4c48599 | 2001-04-22 15:45:27 +0000 | [diff] [blame] | 529 | Find out more about which languages that support curl directly, and how to |
| H3RSKO | 3d22140 | 2020-08-16 16:36:10 -0400 | [diff] [blame] | 530 | install and use them, in the libcurl section of the curl website: |
| Daniel Stenberg | 4d2f800 | 2020-11-04 14:02:01 +0100 | [diff] [blame] | 531 | https://curl.se/libcurl/ |
| Daniel Stenberg | 368e352 | 2001-01-29 10:16:21 +0000 | [diff] [blame] | 532 | |
| Daniel Stenberg | 832e827 | 2011-06-13 19:02:38 +0200 | [diff] [blame] | 533 | 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 Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 535 | with its plain C API. If you do not find anywhere else to ask you can ask |
| Daniel Stenberg | 832e827 | 2011-06-13 19:02:38 +0200 | [diff] [blame] | 536 | 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 Stenberg | e30b206 | 2021-12-09 12:03:35 +0100 | [diff] [blame] | 539 | In December 2021, there were interfaces available for the following |
| Daniel Stenberg | 1640bb6 | 2019-02-28 09:09:51 +0100 | [diff] [blame] | 540 | 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 Stenberg | e30b206 | 2021-12-09 12:03:35 +0100 | [diff] [blame] | 546 | may have appeared. |
| Daniel Stenberg | 368e352 | 2001-01-29 10:16:21 +0000 | [diff] [blame] | 547 | |
| Daniel Stenberg | 147a673 | 2001-03-08 09:25:09 +0000 | [diff] [blame] | 548 | 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] | 549 | |
| Daniel Stenberg | 490879e | 2020-11-05 13:06:00 +0100 | [diff] [blame] | 550 | 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] | 551 | 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] | 552 | 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 Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 555 | Using libcurl is of course just as good and you would just use the proper |
| Daniel Stenberg | db5c9cd | 2003-02-25 08:52:32 +0000 | [diff] [blame] | 556 | library options to do the same. |
| Daniel Stenberg | c59baa0 | 2001-02-12 10:05:09 +0000 | [diff] [blame] | 557 | |
| Daniel Stenberg | 88d14e9 | 2001-05-29 14:02:20 +0000 | [diff] [blame] | 558 | 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 | |
| dbrowndan | 84086b3 | 2019-05-23 15:05:29 -0700 | [diff] [blame] | 565 | 3.12 Why do FTP-specific features over HTTP proxy fail? |
| Daniel Stenberg | 7d3daa5 | 2001-10-23 10:12:00 +0000 | [diff] [blame] | 566 | |
| Daniel Stenberg | 3a4182d | 2022-03-29 13:58:11 +0200 | [diff] [blame^] | 567 | 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 Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 569 | normally cannot use FTP-specific features such as FTP upload and FTP quote |
| Daniel Stenberg | 7d3daa5 | 2001-10-23 10:12:00 +0000 | [diff] [blame] | 570 | etc. |
| 571 | |
| 572 | There is one exception to this rule, and that is if you can "tunnel through" |
| Daniel Stenberg | 271f96f | 2001-11-20 08:03:01 +0000 | [diff] [blame] | 573 | the given HTTP proxy. Proxy tunneling is enabled with a special option (-p) |
| Daniel Stenberg | 97a8c98 | 2001-12-21 08:10:34 +0000 | [diff] [blame] | 574 | and is generally not available as proxy admins usually disable tunneling to |
| railsnewbie257 | cd6b99e | 2017-01-11 23:48:22 -0600 | [diff] [blame] | 575 | ports other than 443 (which is used for HTTPS access through proxies). |
| Daniel Stenberg | 7d3daa5 | 2001-10-23 10:12:00 +0000 | [diff] [blame] | 576 | |
| dbrowndan | 84086b3 | 2019-05-23 15:05:29 -0700 | [diff] [blame] | 577 | 3.13 Why do my single/double quotes fail? |
| Daniel Stenberg | 6b1a1a6 | 2002-03-11 08:29:26 +0000 | [diff] [blame] | 578 | |
| 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 Stenberg | eea2287 | 2004-03-16 07:56:51 +0000 | [diff] [blame] | 583 | |
| Daniel Stenberg | 6b1a1a6 | 2002-03-11 08:29:26 +0000 | [diff] [blame] | 584 | 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 Stenberg | 98871d1 | 2002-05-22 22:14:03 +0000 | [diff] [blame] | 589 | or command line interpreter that you are using. For most unix shells, you |
| Daniel Stenberg | 6b1a1a6 | 2002-03-11 08:29:26 +0000 | [diff] [blame] | 590 | can more or less pick either single (') or double (") quotes. For |
| Daniel Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 591 | Windows/DOS prompts I believe you are forced to use double (") quotes. |
| Daniel Stenberg | 6b1a1a6 | 2002-03-11 08:29:26 +0000 | [diff] [blame] | 592 | |
| Daniel Stenberg | 98871d1 | 2002-05-22 22:14:03 +0000 | [diff] [blame] | 593 | Please study the documentation for your particular environment. Examples in |
| railsnewbie257 | cd6b99e | 2017-01-11 23:48:22 -0600 | [diff] [blame] | 594 | the curl docs will use a mix of both of these as shown above. You must |
| Daniel Stenberg | 6b1a1a6 | 2002-03-11 08:29:26 +0000 | [diff] [blame] | 595 | adjust them to work in your environment. |
| 596 | |
| Daniel Stenberg | 61f6284 | 2002-03-11 08:39:00 +0000 | [diff] [blame] | 597 | Remember that curl works and runs on more operating systems than most single |
| Daniel Stenberg | 6b1a1a6 | 2002-03-11 08:29:26 +0000 | [diff] [blame] | 598 | individuals have ever tried. |
| 599 | |
| Dan Fandrich | 5c9fff9 | 2009-01-30 18:28:29 +0000 | [diff] [blame] | 600 | 3.14 Does curl support Javascript or PAC (automated proxy config)? |
| Daniel Stenberg | 48bc73c | 2002-05-21 13:53:32 +0000 | [diff] [blame] | 601 | |
| Daniel Stenberg | 490879e | 2020-11-05 13:06:00 +0100 | [diff] [blame] | 602 | Many web pages do magic stuff using embedded Javascript. curl and libcurl |
| Daniel Stenberg | 48bc73c | 2002-05-21 13:53:32 +0000 | [diff] [blame] | 603 | have no built-in support for that, so it will be treated just like any other |
| 604 | contents. |
| 605 | |
| Jan-Piet Mens | 09c8074 | 2022-01-30 12:57:24 +0100 | [diff] [blame] | 606 | .pac files are a Netscape invention and are sometimes used by organizations |
| Daniel Stenberg | 48bc73c | 2002-05-21 13:53:32 +0000 | [diff] [blame] | 607 | to allow them to differentiate which proxies to use. The .pac contents is |
| Dan Fandrich | 5c9fff9 | 2009-01-30 18:28:29 +0000 | [diff] [blame] | 608 | just a Javascript program that gets invoked by the browser and that returns |
| Daniel Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 609 | the name of the proxy to connect to. Since curl does not support Javascript, |
| 610 | it cannot support .pac proxy configuration either. |
| Daniel Stenberg | 48bc73c | 2002-05-21 13:53:32 +0000 | [diff] [blame] | 611 | |
| Dan Fandrich | ea1f30e | 2009-11-03 19:07:19 +0000 | [diff] [blame] | 612 | Some workarounds usually suggested to overcome this Javascript dependency: |
| Daniel Stenberg | 48bc73c | 2002-05-21 13:53:32 +0000 | [diff] [blame] | 613 | |
| Daniel Stenberg | 1a911f7 | 2013-08-24 17:13:46 +0200 | [diff] [blame] | 614 | Depending on the Javascript complexity, write up a script that translates it |
| 615 | to another language and execute that. |
| Daniel Stenberg | 48bc73c | 2002-05-21 13:53:32 +0000 | [diff] [blame] | 616 | |
| Daniel Stenberg | 1a911f7 | 2013-08-24 17:13:46 +0200 | [diff] [blame] | 617 | Read the Javascript code and rewrite the same logic in another language. |
| Daniel Stenberg | 48bc73c | 2002-05-21 13:53:32 +0000 | [diff] [blame] | 618 | |
| Daniel Stenberg | 1a911f7 | 2013-08-24 17:13:46 +0200 | [diff] [blame] | 619 | Implement a Javascript interpreter, people have successfully used the |
| 620 | Mozilla Javascript engine in the past. |
| Daniel Stenberg | 48bc73c | 2002-05-21 13:53:32 +0000 | [diff] [blame] | 621 | |
| Daniel Stenberg | 1a911f7 | 2013-08-24 17:13:46 +0200 | [diff] [blame] | 622 | Ask your admins to stop this, for a static proxy setup or similar. |
| Daniel Stenberg | 48bc73c | 2002-05-21 13:53:32 +0000 | [diff] [blame] | 623 | |
| Daniel Stenberg | f3e5d4a | 2003-12-22 17:24:21 +0000 | [diff] [blame] | 624 | 3.15 Can I do recursive fetches with curl? |
| 625 | |
| 626 | No. curl itself has no code that performs recursive operations, such as |
| Daniel Stenberg | 811edcd | 2004-08-10 08:41:41 +0000 | [diff] [blame] | 627 | those performed by wget and similar tools. |
| Daniel Stenberg | f3e5d4a | 2003-12-22 17:24:21 +0000 | [diff] [blame] | 628 | |
| railsnewbie257 | cd6b99e | 2017-01-11 23:48:22 -0600 | [diff] [blame] | 629 | There exists wrapper scripts with that functionality (for example the |
| Daniel Stenberg | f3e5d4a | 2003-12-22 17:24:21 +0000 | [diff] [blame] | 630 | curlmirror perl script), and you can write programs based on libcurl to do |
| 631 | it, but the command line tool curl itself cannot. |
| Daniel Stenberg | 6b1a1a6 | 2002-03-11 08:29:26 +0000 | [diff] [blame] | 632 | |
| Daniel Stenberg | edd16d9 | 2004-08-12 11:39:00 +0000 | [diff] [blame] | 633 | 3.16 What certificates do I need when I use SSL? |
| Daniel Stenberg | 4356356 | 2004-08-12 11:02:01 +0000 | [diff] [blame] | 634 | |
| 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 Stenberg | 1a911f7 | 2013-08-24 17:13:46 +0200 | [diff] [blame] | 638 | CLIENT CERTIFICATE |
| Daniel Stenberg | 4356356 | 2004-08-12 11:02:01 +0000 | [diff] [blame] | 639 | |
| Daniel Stenberg | 6d49695 | 2017-05-12 19:58:06 +0200 | [diff] [blame] | 640 | The server you communicate with may require that you can provide this in |
| Daniel Stenberg | e30b206 | 2021-12-09 12:03:35 +0100 | [diff] [blame] | 641 | order to prove that you actually are who you claim to be. If the server |
| Daniel Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 642 | does not require this, you do not need a client certificate. |
| Daniel Stenberg | 64f12a3 | 2010-09-07 19:05:07 +0200 | [diff] [blame] | 643 | |
| Daniel Stenberg | 1a911f7 | 2013-08-24 17:13:46 +0200 | [diff] [blame] | 644 | A client certificate is always used together with a private key, and the |
| 645 | private key has a pass phrase that protects it. |
| Daniel Stenberg | 4356356 | 2004-08-12 11:02:01 +0000 | [diff] [blame] | 646 | |
| Daniel Stenberg | 1a911f7 | 2013-08-24 17:13:46 +0200 | [diff] [blame] | 647 | SERVER CERTIFICATE |
| Daniel Stenberg | 4356356 | 2004-08-12 11:02:01 +0000 | [diff] [blame] | 648 | |
| Daniel Stenberg | 1a911f7 | 2013-08-24 17:13:46 +0200 | [diff] [blame] | 649 | 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 Stenberg | 4d2f800 | 2020-11-04 14:02:01 +0100 | [diff] [blame] | 665 | (https://curl.se/docs/sslcerts.html). Server certificates that are |
| Daniel Stenberg | 1a911f7 | 2013-08-24 17:13:46 +0200 | [diff] [blame] | 666 | "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 Stenberg | 9a44fa8 | 2005-11-02 09:34:53 +0000 | [diff] [blame] | 670 | |
| Daniel Stenberg | 951fdeb | 2004-12-21 09:37:55 +0000 | [diff] [blame] | 671 | 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 Stenberg | e9eb523 | 2005-04-05 14:36:37 +0000 | [diff] [blame] | 683 | 3.18 Can I use curl to send a POST/PUT and not wait for a response? |
| Yang Tse | a07bc79 | 2010-02-14 19:40:18 +0000 | [diff] [blame] | 684 | |
| Daniel Stenberg | e9eb523 | 2005-04-05 14:36:37 +0000 | [diff] [blame] | 685 | No. |
| 686 | |
| Daniel Stenberg | e30b206 | 2021-12-09 12:03:35 +0100 | [diff] [blame] | 687 | You can easily write your own program using libcurl to do such stunts. |
| Daniel Stenberg | 9a44fa8 | 2005-11-02 09:34:53 +0000 | [diff] [blame] | 688 | |
| Daniel Stenberg | 64f12a3 | 2010-09-07 19:05:07 +0200 | [diff] [blame] | 689 | 3.19 How do I get HTTP from a host using a specific IP address? |
| 690 | |
| Daniel Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 691 | For example, you may be trying out a website installation that is not yet in |
| Daniel Stenberg | 64f12a3 | 2010-09-07 19:05:07 +0200 | [diff] [blame] | 692 | 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 Stenberg | 50d88bf | 2011-12-07 23:08:15 +0100 | [diff] [blame] | 700 | 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 Stenberg | 3f7b7de | 2011-03-07 22:27:26 +0100 | [diff] [blame] | 706 | 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 Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 709 | work with. It means that if you do not specify that you want the user's home |
| Daniel Stenberg | 3f7b7de | 2011-03-07 22:27:26 +0100 | [diff] [blame] | 710 | 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 Stenberg | 1640bb6 | 2019-02-28 09:09:51 +0100 | [diff] [blame] | 713 | URL syntax which for SFTP might look similar to: |
| Daniel Stenberg | 3f7b7de | 2011-03-07 22:27:26 +0100 | [diff] [blame] | 714 | |
| 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 Stenberg | 0d0f808 | 2011-03-08 11:15:59 +0100 | [diff] [blame] | 721 | 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 Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 725 | is phrased is because curl does not make a distinction internally of whether |
| Dan Fandrich | 31c6e7a | 2013-04-15 22:26:18 +0200 | [diff] [blame] | 726 | a particular protocol is not supported (i.e. never got any code added that |
| Daniel Stenberg | 0d0f808 | 2011-03-08 11:15:59 +0100 | [diff] [blame] | 727 | 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 Stenberg | 0ed4a09 | 2013-01-21 14:33:12 +0100 | [diff] [blame] | 735 | 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 Stenberg | 3a4182d | 2022-03-29 13:58:11 +0200 | [diff] [blame^] | 740 | use when the URL identifies an HTTP transfer. If you just pass in a URL like |
| Daniel Stenberg | 0ed4a09 | 2013-01-21 14:33:12 +0100 | [diff] [blame] | 741 | "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 Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 744 | If for whatever reason you are not happy with these default choices that curl |
| Daniel Stenberg | 0ed4a09 | 2013-01-21 14:33:12 +0100 | [diff] [blame] | 745 | 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 Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 755 | Note that -X does not actually change curl's behavior as it only modifies the |
| Daniel Stenberg | 7b53484 | 2015-02-02 15:38:29 +0100 | [diff] [blame] | 756 | actual string sent in the request, but that may of course trigger a |
| 757 | different set of events. |
| Daniel Stenberg | 0ed4a09 | 2013-01-21 14:33:12 +0100 | [diff] [blame] | 758 | |
| 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 Stenberg | 811edcd | 2004-08-10 08:41:41 +0000 | [diff] [blame] | 763 | |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 764 | 4. Running Problems |
| 765 | |
| Daniel Stenberg | 811edcd | 2004-08-10 08:41:41 +0000 | [diff] [blame] | 766 | 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] | 767 | |
| Daniel Stenberg | 07d4688 | 2009-02-13 09:12:52 +0000 | [diff] [blame] | 768 | In general unix shells, the & symbol is treated specially and when used, it |
| Daniel Stenberg | c3c7739 | 2000-07-31 22:42:34 +0000 | [diff] [blame] | 769 | 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] | 770 | of a URL, you should quote the entire URL by using single (') or double (") |
| Dan Fandrich | 5c9fff9 | 2009-01-30 18:28:29 +0000 | [diff] [blame] | 771 | quotes around it. Similar problems can also occur on some shells with other |
| Daniel Stenberg | e30b206 | 2021-12-09 12:03:35 +0100 | [diff] [blame] | 772 | characters, including ?*!$~(){}<>\|;`. When in doubt, quote the URL. |
| Daniel Stenberg | 2947010 | 2000-06-02 13:32:01 +0000 | [diff] [blame] | 773 | |
| Daniel Stenberg | 07d4688 | 2009-02-13 09:12:52 +0000 | [diff] [blame] | 774 | An example that would invoke a remote CGI that uses &-symbols could be: |
| Daniel Stenberg | 8f03732 | 2000-06-06 14:09:01 +0000 | [diff] [blame] | 775 | |
| Daniel Stenberg | edcd5df | 2000-06-06 14:13:36 +0000 | [diff] [blame] | 776 | curl 'http://www.altavista.com/cgi-bin/query?text=yes&q=curl' |
| Daniel Stenberg | 8f03732 | 2000-06-06 14:09:01 +0000 | [diff] [blame] | 777 | |
| Daniel Stenberg | 1a911f7 | 2013-08-24 17:13:46 +0200 | [diff] [blame] | 778 | 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 Stenberg | e26ee09 | 2001-01-15 10:26:37 +0000 | [diff] [blame] | 781 | |
| Daniel Stenberg | 1a911f7 | 2013-08-24 17:13:46 +0200 | [diff] [blame] | 782 | 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 Stenberg | 1b77c18 | 2001-01-29 10:24:51 +0000 | [diff] [blame] | 785 | |
| Daniel Stenberg | 811edcd | 2004-08-10 08:41:41 +0000 | [diff] [blame] | 786 | 4.3 How can I use {, }, [ or ] to specify multiple URLs? |
| Daniel Stenberg | 2947010 | 2000-06-02 13:32:01 +0000 | [diff] [blame] | 787 | |
| railsnewbie257 | cd6b99e | 2017-01-11 23:48:22 -0600 | [diff] [blame] | 788 | Because those letters have a special meaning to the shell, to be used in |
| Daniel Stenberg | c3c7739 | 2000-07-31 22:42:34 +0000 | [diff] [blame] | 789 | a URL specified to curl you must quote them. |
| Daniel Stenberg | 2947010 | 2000-06-02 13:32:01 +0000 | [diff] [blame] | 790 | |
| railsnewbie257 | cd6b99e | 2017-01-11 23:48:22 -0600 | [diff] [blame] | 791 | An example that downloads two URLs (sequentially) would be: |
| Daniel Stenberg | 8f03732 | 2000-06-06 14:09:01 +0000 | [diff] [blame] | 792 | |
| Daniel Stenberg | edcd5df | 2000-06-06 14:13:36 +0000 | [diff] [blame] | 793 | curl '{curl,www}.haxx.se' |
| Daniel Stenberg | 8f03732 | 2000-06-06 14:09:01 +0000 | [diff] [blame] | 794 | |
| railsnewbie257 | cd6b99e | 2017-01-11 23:48:22 -0600 | [diff] [blame] | 795 | To be able to use those characters as actual parts of the URL (without using |
| Daniel Stenberg | db5c9cd | 2003-02-25 08:52:32 +0000 | [diff] [blame] | 796 | them for the curl URL "globbing" system), use the -g/--globoff option: |
| Daniel Stenberg | e26ee09 | 2001-01-15 10:26:37 +0000 | [diff] [blame] | 797 | |
| 798 | curl -g 'www.site.com/weirdname[].html' |
| 799 | |
| Daniel Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 800 | 4.4 Why do I get downloaded data even though the web page does not exist? |
| Daniel Stenberg | 2947010 | 2000-06-02 13:32:01 +0000 | [diff] [blame] | 801 | |
| Daniel Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 802 | curl asks remote servers for the page you specify. If the page does not exist |
| Daniel Stenberg | c3c7739 | 2000-07-31 22:42:34 +0000 | [diff] [blame] | 803 | at the server, the HTTP protocol defines how the server should respond and |
| Daniel Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 804 | that means that headers and a "page" will be returned. That is simply how |
| Daniel Stenberg | c3c7739 | 2000-07-31 22:42:34 +0000 | [diff] [blame] | 805 | HTTP works. |
| Daniel Stenberg | 2947010 | 2000-06-02 13:32:01 +0000 | [diff] [blame] | 806 | |
| Daniel Stenberg | c3c7739 | 2000-07-31 22:42:34 +0000 | [diff] [blame] | 807 | By using the --fail option you can tell curl explicitly to not get any data |
| Daniel Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 808 | if the HTTP return code does not say success. |
| Daniel Stenberg | 8f03732 | 2000-06-06 14:09:01 +0000 | [diff] [blame] | 809 | |
| Daniel Stenberg | 3a4182d | 2022-03-29 13:58:11 +0200 | [diff] [blame^] | 810 | 4.5 Why do I get return code XXX from an HTTP server? |
| Daniel Stenberg | 2947010 | 2000-06-02 13:32:01 +0000 | [diff] [blame] | 811 | |
| Daniel Stenberg | 11d718b | 2001-03-13 11:47:30 +0000 | [diff] [blame] | 812 | RFC2616 clearly explains the return codes. This is a short transcript. Go |
| 813 | read the RFC for exact details: |
| Daniel Stenberg | 2947010 | 2000-06-02 13:32:01 +0000 | [diff] [blame] | 814 | |
| Daniel Stenberg | 09ba856 | 2000-10-27 12:25:00 +0000 | [diff] [blame] | 815 | 4.5.1 "400 Bad Request" |
| Daniel Stenberg | 2947010 | 2000-06-02 13:32:01 +0000 | [diff] [blame] | 816 | |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 817 | 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 Stenberg | 09ba856 | 2000-10-27 12:25:00 +0000 | [diff] [blame] | 820 | 4.5.2 "401 Unauthorized" |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 821 | |
| 822 | The request requires user authentication. |
| 823 | |
| Daniel Stenberg | 09ba856 | 2000-10-27 12:25:00 +0000 | [diff] [blame] | 824 | 4.5.3 "403 Forbidden" |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 825 | |
| Viktor Szakats | ff9d7f4 | 2018-10-08 19:37:40 +0000 | [diff] [blame] | 826 | The server understood the request, but is refusing to fulfill it. |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 827 | Authorization will not help and the request SHOULD NOT be repeated. |
| 828 | |
| Daniel Stenberg | 09ba856 | 2000-10-27 12:25:00 +0000 | [diff] [blame] | 829 | 4.5.4 "404 Not Found" |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 830 | |
| 831 | The server has not found anything matching the Request-URI. No indication |
| Antoine Pietri | b341b76 | 2022-01-27 02:12:50 +0100 | [diff] [blame] | 832 | is given as to whether the condition is temporary or permanent. |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 833 | |
| Daniel Stenberg | 09ba856 | 2000-10-27 12:25:00 +0000 | [diff] [blame] | 834 | 4.5.5 "405 Method Not Allowed" |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 835 | |
| 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 Stenberg | d60029d | 2001-12-19 23:25:04 +0000 | [diff] [blame] | 840 | 4.5.6 "301 Moved Permanently" |
| Daniel Stenberg | eea2287 | 2004-03-16 07:56:51 +0000 | [diff] [blame] | 841 | |
| Daniel Stenberg | 98871d1 | 2002-05-22 22:14:03 +0000 | [diff] [blame] | 842 | If you get this return code and an HTML output similar to this: |
| Daniel Stenberg | d60029d | 2001-12-19 23:25:04 +0000 | [diff] [blame] | 843 | |
| 844 | <H1>Moved Permanently</H1> The document has moved <A |
| 845 | HREF="http://same_url_now_with_a_trailing_slash/">here</A>. |
| 846 | |
| dbrowndan | 84086b3 | 2019-05-23 15:05:29 -0700 | [diff] [blame] | 847 | it might be because you requested a directory URL but without the trailing |
| Daniel Stenberg | d60029d | 2001-12-19 23:25:04 +0000 | [diff] [blame] | 848 | slash. Try the same operation again _with_ the trailing URL, or use the |
| 849 | -L/--location option to follow the redirection. |
| 850 | |
| Daniel Stenberg | 811edcd | 2004-08-10 08:41:41 +0000 | [diff] [blame] | 851 | 4.6 Can you tell me what error code 142 means? |
| Daniel Stenberg | 2947010 | 2000-06-02 13:32:01 +0000 | [diff] [blame] | 852 | |
| Daniel Stenberg | 8b5f0ab | 2004-12-21 21:35:00 +0000 | [diff] [blame] | 853 | 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 Stenberg | 13bf964 | 2001-08-23 11:11:13 +0000 | [diff] [blame] | 857 | that curl has exited due to a crash. This is a serious error, and we |
| Daniel Stenberg | 25fe47f | 2001-11-14 20:13:38 +0000 | [diff] [blame] | 858 | appreciate a detailed bug report from you that describes how we could go |
| Daniel Stenberg | e30b206 | 2021-12-09 12:03:35 +0100 | [diff] [blame] | 859 | ahead and repeat this. |
| Daniel Stenberg | 2947010 | 2000-06-02 13:32:01 +0000 | [diff] [blame] | 860 | |
| Daniel Stenberg | 490879e | 2020-11-05 13:06:00 +0100 | [diff] [blame] | 861 | 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] | 862 | |
| Daniel Stenberg | 11d718b | 2001-03-13 11:47:30 +0000 | [diff] [blame] | 863 | This problem has two sides: |
| Daniel Stenberg | 2947010 | 2000-06-02 13:32:01 +0000 | [diff] [blame] | 864 | |
| Daniel Stenberg | c3c7739 | 2000-07-31 22:42:34 +0000 | [diff] [blame] | 865 | The first part is to avoid having clear-text passwords in the command line |
| Daniel Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 866 | so that they do not appear in 'ps' outputs and similar. That is easily |
| Daniel Stenberg | eea2287 | 2004-03-16 07:56:51 +0000 | [diff] [blame] | 867 | 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 Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 870 | does not work on all platforms. |
| Daniel Stenberg | 2947010 | 2000-06-02 13:32:01 +0000 | [diff] [blame] | 871 | |
| Daniel Stenberg | c3c7739 | 2000-07-31 22:42:34 +0000 | [diff] [blame] | 872 | 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 Stenberg | 2947010 | 2000-06-02 13:32:01 +0000 | [diff] [blame] | 876 | |
| Daniel Stenberg | eea2287 | 2004-03-16 07:56:51 +0000 | [diff] [blame] | 877 | Also note that regular HTTP (using Basic authentication) and FTP passwords |
| dbrowndan | 84086b3 | 2019-05-23 15:05:29 -0700 | [diff] [blame] | 878 | are sent as cleartext across the network. All it takes for anyone to fetch |
| Daniel Stenberg | 92efb3d | 2021-11-01 13:43:11 +0100 | [diff] [blame] | 879 | them is to listen on the network. Eavesdropping is easy. Use more secure |
| Daniel Stenberg | eea2287 | 2004-03-16 07:56:51 +0000 | [diff] [blame] | 880 | authentication methods (like Digest, Negotiate or even NTLM) or consider the |
| 881 | SSL-based alternatives HTTPS and FTPS. |
| Daniel Stenberg | 887e728 | 2001-01-03 09:13:07 +0000 | [diff] [blame] | 882 | |
| Daniel Stenberg | e30b206 | 2021-12-09 12:03:35 +0100 | [diff] [blame] | 883 | 4.8 I found a bug |
| Daniel Stenberg | 09ba856 | 2000-10-27 12:25:00 +0000 | [diff] [blame] | 884 | |
| Daniel Stenberg | 4c48599 | 2001-04-22 15:45:27 +0000 | [diff] [blame] | 885 | It is not a bug if the behavior is documented. Read the docs first. |
| Daniel Stenberg | e30b206 | 2021-12-09 12:03:35 +0100 | [diff] [blame] | 886 | Especially check out the KNOWN_BUGS file, it may be a documented bug. |
| Daniel Stenberg | 09ba856 | 2000-10-27 12:25:00 +0000 | [diff] [blame] | 887 | |
| Daniel Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 888 | If it is a problem with a binary you have downloaded or a package for your |
| Daniel Stenberg | 09ba856 | 2000-10-27 12:25:00 +0000 | [diff] [blame] | 889 | particular platform, try contacting the person who built the package/archive |
| 890 | you have. |
| 891 | |
| Daniel Stenberg | 8eaa7fe | 2002-04-27 18:12:26 +0000 | [diff] [blame] | 892 | If there is a bug, read the BUGS document first. Then report it as described |
| 893 | in there. |
| Daniel Stenberg | 09ba856 | 2000-10-27 12:25:00 +0000 | [diff] [blame] | 894 | |
| Daniel Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 895 | 4.9 curl cannot authenticate to the server that requires NTLM? |
| Daniel Stenberg | 2c10037 | 2000-12-19 07:30:51 +0000 | [diff] [blame] | 896 | |
| Bill Nagel | 497e7c9 | 2016-07-07 08:40:45 -0700 | [diff] [blame] | 897 | NTLM support requires OpenSSL, GnuTLS, mbedTLS, NSS, Secure Transport, or |
| 898 | Microsoft Windows libraries at build-time to provide this functionality. |
| Daniel Stenberg | 3a552b1 | 2003-06-26 11:35:48 +0000 | [diff] [blame] | 899 | |
| 900 | NTLM is a Microsoft proprietary protocol. Proprietary formats are evil. You |
| 901 | should not use such ones. |
| Daniel Stenberg | 2947010 | 2000-06-02 13:32:01 +0000 | [diff] [blame] | 902 | |
| Daniel Stenberg | e30b206 | 2021-12-09 12:03:35 +0100 | [diff] [blame] | 903 | 4.10 My HTTP request using HEAD, PUT or DELETE does not work |
| Daniel Stenberg | bc74375 | 2002-05-15 21:40:29 +0000 | [diff] [blame] | 904 | |
| 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 Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 911 | software you are trying to interact with. This is not anything curl can do |
| Daniel Stenberg | bc74375 | 2002-05-15 21:40:29 +0000 | [diff] [blame] | 912 | anything about. |
| 913 | |
| dbrowndan | 84086b3 | 2019-05-23 15:05:29 -0700 | [diff] [blame] | 914 | 4.11 Why do my HTTP range requests return the full document? |
| Daniel Stenberg | 522b85a | 2002-11-12 20:00:02 +0000 | [diff] [blame] | 915 | |
| 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 Stenberg | bc74375 | 2002-05-15 21:40:29 +0000 | [diff] [blame] | 918 | |
| Daniel Stenberg | 1607711 | 2002-11-20 19:17:43 +0000 | [diff] [blame] | 919 | 4.12 Why do I get "certificate verify failed" ? |
| 920 | |
| Daniel Stenberg | 3864ad3 | 2020-11-06 09:16:06 +0100 | [diff] [blame] | 921 | When you invoke curl and get an error 60 error back it means that curl |
| Daniel Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 922 | could not verify that the server's certificate was good. curl verifies the |
| Daniel Stenberg | 3864ad3 | 2020-11-06 09:16:06 +0100 | [diff] [blame] | 923 | certificate using the CA cert bundle and verifying for which names the |
| Dan Fandrich | 2a264d4 | 2020-12-12 09:59:10 -0800 | [diff] [blame] | 924 | certificate has been granted. |
| Daniel Stenberg | 1607711 | 2002-11-20 19:17:43 +0000 | [diff] [blame] | 925 | |
| Dan Fandrich | 2a264d4 | 2020-12-12 09:59:10 -0800 | [diff] [blame] | 926 | To completely disable the certificate verification, use -k. This does |
| Daniel Stenberg | 3864ad3 | 2020-11-06 09:16:06 +0100 | [diff] [blame] | 927 | however enable man-in-the-middle attacks and makes the transfer INSECURE. |
| Antoine Pietri | b341b76 | 2022-01-27 02:12:50 +0100 | [diff] [blame] | 928 | We strongly advise against doing this for more than experiments. |
| Daniel Stenberg | 1607711 | 2002-11-20 19:17:43 +0000 | [diff] [blame] | 929 | |
| Daniel Stenberg | 3864ad3 | 2020-11-06 09:16:06 +0100 | [diff] [blame] | 930 | If you get this failure with a CA cert bundle installed and used, the |
| Bruno Baguette | 0d380a8 | 2021-11-26 08:23:34 +0100 | [diff] [blame] | 931 | server's certificate might not be signed by one of the CA's in your CA |
| Daniel Stenberg | 3864ad3 | 2020-11-06 09:16:06 +0100 | [diff] [blame] | 932 | 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 Stenberg | 1607711 | 2002-11-20 19:17:43 +0000 | [diff] [blame] | 935 | |
| Daniel Stenberg | 3864ad3 | 2020-11-06 09:16:06 +0100 | [diff] [blame] | 936 | 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 Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 939 | "intermediate certificates" but does not. This typically works with browsers |
| Daniel Stenberg | 3864ad3 | 2020-11-06 09:16:06 +0100 | [diff] [blame] | 940 | 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 Stenberg | 1607711 | 2002-11-20 19:17:43 +0000 | [diff] [blame] | 944 | |
| Daniel Stenberg | 3864ad3 | 2020-11-06 09:16:06 +0100 | [diff] [blame] | 945 | Details are also in the SSLCERTS.md document, found online here: |
| 946 | https://curl.se/docs/sslcerts.html |
| Daniel Stenberg | 1607711 | 2002-11-20 19:17:43 +0000 | [diff] [blame] | 947 | |
| Daniel Stenberg | 1dc0ce9 | 2005-06-13 18:33:40 +0000 | [diff] [blame] | 948 | 4.13 Why is curl -R on Windows one hour off? |
| 949 | |
| Jay Satiro | ee3c83f | 2016-11-11 02:48:52 -0500 | [diff] [blame] | 950 | 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 Szakats | 62a71af | 2018-03-12 18:17:05 +0000 | [diff] [blame] | 955 | https://www.codeproject.com/Articles/1144/Beating-the-Daylight-Savings-Time-bug-and-getting |
| Daniel Stenberg | 1dc0ce9 | 2005-06-13 18:33:40 +0000 | [diff] [blame] | 956 | |
| Daniel Stenberg | e30b206 | 2021-12-09 12:03:35 +0100 | [diff] [blame] | 957 | 4.14 Redirects work in browser but not with curl |
| Daniel Stenberg | 09cb9c7 | 2005-08-26 13:22:39 +0000 | [diff] [blame] | 958 | |
| railsnewbie257 | cd6b99e | 2017-01-11 23:48:22 -0600 | [diff] [blame] | 959 | curl supports HTTP redirects well (see item 3.8). Browsers generally support |
| Daniel Stenberg | 1a911f7 | 2013-08-24 17:13:46 +0200 | [diff] [blame] | 960 | at least two other ways to perform redirects that curl does not: |
| Daniel Stenberg | 09cb9c7 | 2005-08-26 13:22:39 +0000 | [diff] [blame] | 961 | |
| Daniel Stenberg | 3a4182d | 2022-03-29 13:58:11 +0200 | [diff] [blame^] | 962 | Meta tags. You can write an HTML tag that will cause the browser to redirect |
| Daniel Stenberg | 1a911f7 | 2013-08-24 17:13:46 +0200 | [diff] [blame] | 963 | to another given URL after a certain time. |
| Daniel Stenberg | 09cb9c7 | 2005-08-26 13:22:39 +0000 | [diff] [blame] | 964 | |
| Daniel Stenberg | 3a4182d | 2022-03-29 13:58:11 +0200 | [diff] [blame^] | 965 | Javascript. You can write a Javascript program embedded in an HTML page that |
| Daniel Stenberg | 1a911f7 | 2013-08-24 17:13:46 +0200 | [diff] [blame] | 966 | redirects the browser to another given URL. |
| Daniel Stenberg | 09cb9c7 | 2005-08-26 13:22:39 +0000 | [diff] [blame] | 967 | |
| 968 | There is no way to make curl follow these redirects. You must either |
| dbrowndan | 84086b3 | 2019-05-23 15:05:29 -0700 | [diff] [blame] | 969 | 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 Stenberg | 09cb9c7 | 2005-08-26 13:22:39 +0000 | [diff] [blame] | 971 | |
| Daniel Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 972 | 4.15 FTPS does not work |
| Daniel Stenberg | 844cbc7 | 2007-07-29 22:17:39 +0000 | [diff] [blame] | 973 | |
| 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 Stenberg | 3a4182d | 2022-03-29 13:58:11 +0200 | [diff] [blame^] | 981 | To use explicit FTPS, you use an FTP:// URL and the --ftp-ssl option (or one |
| Daniel Stenberg | 1640bb6 | 2019-02-28 09:09:51 +0100 | [diff] [blame] | 982 | of its related flavors). This is the most common method, and the one |
| railsnewbie257 | cd6b99e | 2017-01-11 23:48:22 -0600 | [diff] [blame] | 983 | mandated by RFC4217. This kind of connection will then of course use the |
| Daniel Stenberg | 844cbc7 | 2007-07-29 22:17:39 +0000 | [diff] [blame] | 984 | standard FTP port 21 by default. |
| 985 | |
| Daniel Stenberg | e30b206 | 2021-12-09 12:03:35 +0100 | [diff] [blame] | 986 | 4.16 My HTTP POST or PUT requests are slow |
| Daniel Stenberg | 95df5d0 | 2008-09-24 07:50:46 +0000 | [diff] [blame] | 987 | |
| 988 | libcurl makes all POST and PUT requests (except for POST requests with a |
| Daniel Stenberg | 92efb3d | 2021-11-01 13:43:11 +0100 | [diff] [blame] | 989 | tiny request body) use the "Expect: 100-continue" header. This header |
| Daniel Stenberg | 95df5d0 | 2008-09-24 07:50:46 +0000 | [diff] [blame] | 990 | allows the server to deny the operation early so that libcurl can bail out |
| railsnewbie257 | cd6b99e | 2017-01-11 23:48:22 -0600 | [diff] [blame] | 991 | before having to send any data. This is useful in authentication |
| Daniel Stenberg | 95df5d0 | 2008-09-24 07:50:46 +0000 | [diff] [blame] | 992 | cases and others. |
| 993 | |
| Daniel Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 994 | 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 Stenberg | 95df5d0 | 2008-09-24 07:50:46 +0000 | [diff] [blame] | 996 | 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 Stenberg | 811edcd | 2004-08-10 08:41:41 +0000 | [diff] [blame] | 1000 | |
| Daniel Stenberg | 2afb88e | 2009-02-23 21:21:00 +0000 | [diff] [blame] | 1001 | 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 Stenberg | e30b206 | 2021-12-09 12:03:35 +0100 | [diff] [blame] | 1006 | the second. No more than three packets are sent, no matter how long the |
| Daniel Stenberg | 2afb88e | 2009-02-23 21:21:00 +0000 | [diff] [blame] | 1007 | timeout is set. |
| 1008 | |
| 1009 | See option TcpMaxConnectRetransmissions on this page: |
| Viktor Szakats | 45f21e0 | 2015-06-16 00:47:26 +0200 | [diff] [blame] | 1010 | https://support.microsoft.com/en-us/kb/175523/en-us |
| Daniel Stenberg | 2afb88e | 2009-02-23 21:21:00 +0000 | [diff] [blame] | 1011 | |
| 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 Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 1015 | and thus the connect timeout will not trigger. |
| Daniel Stenberg | 2afb88e | 2009-02-23 21:21:00 +0000 | [diff] [blame] | 1016 | |
| Daniel Stenberg | b8012ea | 2009-11-07 21:52:41 +0000 | [diff] [blame] | 1017 | 4.18 file:// URLs containing drive letters (Windows, NetWare) |
| 1018 | |
| Daniel Stenberg | 0f19963 | 2016-10-18 13:59:54 +0200 | [diff] [blame] | 1019 | When using curl to try to download a local file, one might use a URL |
| Daniel Stenberg | b8012ea | 2009-11-07 21:52:41 +0000 | [diff] [blame] | 1020 | in this format: |
| 1021 | |
| 1022 | file://D:/blah.txt |
| 1023 | |
| Daniel Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 1024 | you will find that even if D:\blah.txt does exist, curl returns a 'file |
| Daniel Stenberg | b8012ea | 2009-11-07 21:52:41 +0000 | [diff] [blame] | 1025 | not found' error. |
| 1026 | |
| Viktor Szakats | 45f21e0 | 2015-06-16 00:47:26 +0200 | [diff] [blame] | 1027 | According to RFC 1738 (https://www.ietf.org/rfc/rfc1738.txt), |
| Daniel Stenberg | b8012ea | 2009-11-07 21:52:41 +0000 | [diff] [blame] | 1028 | 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 Stenberg | 0f19963 | 2016-10-18 13:59:54 +0200 | [diff] [blame] | 1030 | host component, and is taken away. Thus, curl tries to open '/blah.txt'. |
| Daniel Stenberg | b8012ea | 2009-11-07 21:52:41 +0000 | [diff] [blame] | 1031 | If your system is installed to drive C:, that will resolve to 'C:\blah.txt', |
| Daniel Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 1032 | and if that does not exist you will get the not found error. |
| Daniel Stenberg | b8012ea | 2009-11-07 21:52:41 +0000 | [diff] [blame] | 1033 | |
| 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 Stenberg | 0f19963 | 2016-10-18 13:59:54 +0200 | [diff] [blame] | 1043 | In either case, curl should now be looking for the correct file. |
| Daniel Stenberg | 2afb88e | 2009-02-23 21:21:00 +0000 | [diff] [blame] | 1044 | |
| Daniel Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 1045 | 4.19 Why does not curl return an error when the network cable is unplugged? |
| Dan Fandrich | 7d166b0 | 2010-07-21 15:15:07 -0700 | [diff] [blame] | 1046 | |
| Dan Fandrich | 31c6e7a | 2013-04-15 22:26:18 +0200 | [diff] [blame] | 1047 | Unplugging a cable is not an error situation. The TCP/IP protocol stack |
| Dan Fandrich | 7d166b0 | 2010-07-21 15:15:07 -0700 | [diff] [blame] | 1048 | was designed to be fault tolerant, so even though there may be a physical |
| Daniel Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 1049 | break somewhere the connection should not be affected, just possibly |
| Daniel Stenberg | e30b206 | 2021-12-09 12:03:35 +0100 | [diff] [blame] | 1050 | delayed. Eventually, the physical break will be fixed or the data will be |
| Dan Fandrich | 31c6e7a | 2013-04-15 22:26:18 +0200 | [diff] [blame] | 1051 | re-routed around the physical problem through another path. |
| Dan Fandrich | 7d166b0 | 2010-07-21 15:15:07 -0700 | [diff] [blame] | 1052 | |
| 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 Stenberg | 14f92f2 | 2016-01-25 11:11:29 +0100 | [diff] [blame] | 1055 | perfectly legal for the client to wait indefinitely for data, the stack may |
| Dan Fandrich | 7d166b0 | 2010-07-21 15:15:07 -0700 | [diff] [blame] | 1056 | never report a problem, and even when it does, it can take up to 20 minutes |
| Daniel Stenberg | e30b206 | 2021-12-09 12:03:35 +0100 | [diff] [blame] | 1057 | for it to detect an issue. The curl option --keepalive-time enables |
| Dan Fandrich | 7d166b0 | 2010-07-21 15:15:07 -0700 | [diff] [blame] | 1058 | 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 Stenberg | e30b206 | 2021-12-09 12:03:35 +0100 | [diff] [blame] | 1062 | TCP keep alive will not detect the network going down before the TCP/IP |
| Dan Fandrich | 7d166b0 | 2010-07-21 15:15:07 -0700 | [diff] [blame] | 1063 | connection is established (e.g. during a DNS lookup) or using protocols that |
| Daniel Stenberg | e30b206 | 2021-12-09 12:03:35 +0100 | [diff] [blame] | 1064 | do not use TCP. To handle those situations, curl offers a number of timeouts |
| Dan Fandrich | 7d166b0 | 2010-07-21 15:15:07 -0700 | [diff] [blame] | 1065 | 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 Fandrich | 31c6e7a | 2013-04-15 22:26:18 +0200 | [diff] [blame] | 1069 | 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 Stenberg | e30b206 | 2021-12-09 12:03:35 +0100 | [diff] [blame] | 1071 | immediately if its lone network connection goes down. That can be achieved |
| Dan Fandrich | 31c6e7a | 2013-04-15 22:26:18 +0200 | [diff] [blame] | 1072 | by having the application monitor the network connection on its own using an |
| Daniel Stenberg | 1640bb6 | 2019-02-28 09:09:51 +0100 | [diff] [blame] | 1073 | OS-specific mechanism, then signaling libcurl to abort (see also item 5.13). |
| Daniel Stenberg | 889de6b | 2014-08-28 11:39:39 +0200 | [diff] [blame] | 1074 | |
| Daniel Stenberg | e30b206 | 2021-12-09 12:03:35 +0100 | [diff] [blame] | 1075 | 4.20 curl does not return error for HTTP non-200 responses |
| Daniel Stenberg | 889de6b | 2014-08-28 11:39:39 +0200 | [diff] [blame] | 1076 | |
| 1077 | Correct. Unless you use -f (--fail). |
| 1078 | |
| Daniel Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 1079 | When doing HTTP transfers, curl will perform exactly what you are asking it |
| Daniel Stenberg | 889de6b | 2014-08-28 11:39:39 +0200 | [diff] [blame] | 1080 | 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 |
| railsnewbie257 | cd6b99e | 2017-01-11 23:48:22 -0600 | [diff] [blame] | 1082 | use it to check your authentication protected web pages (that gets a 401 |
| Daniel Stenberg | 889de6b | 2014-08-28 11:39:39 +0200 | [diff] [blame] | 1083 | 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 Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 1088 | higher level error information that curl does not care about. The error was |
| Daniel Stenberg | 889de6b | 2014-08-28 11:39:39 +0200 | [diff] [blame] | 1089 | 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 Stenberg | accbbd7 | 2014-08-28 11:42:00 +0200 | [diff] [blame] | 1096 | You can also use the -w option and the variable %{response_code} to extract |
| railsnewbie257 | cd6b99e | 2017-01-11 23:48:22 -0600 | [diff] [blame] | 1097 | the exact response code that was returned in the response. |
| Daniel Stenberg | accbbd7 | 2014-08-28 11:42:00 +0200 | [diff] [blame] | 1098 | |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 1099 | 5. libcurl Issues |
| Daniel Stenberg | 2947010 | 2000-06-02 13:32:01 +0000 | [diff] [blame] | 1100 | |
| Daniel Stenberg | 811edcd | 2004-08-10 08:41:41 +0000 | [diff] [blame] | 1101 | 5.1 Is libcurl thread-safe? |
| Daniel Stenberg | 2947010 | 2000-06-02 13:32:01 +0000 | [diff] [blame] | 1102 | |
| Daniel Stenberg | 7d09e51 | 2001-01-11 12:52:07 +0000 | [diff] [blame] | 1103 | Yes. |
| 1104 | |
| Dan Fandrich | ec2ad57 | 2005-04-13 19:31:00 +0000 | [diff] [blame] | 1105 | We have written the libcurl code specifically adjusted for multi-threaded |
| Daniel Stenberg | 7d09e51 | 2001-01-11 12:52:07 +0000 | [diff] [blame] | 1106 | programs. libcurl will use thread-safe functions instead of non-safe ones if |
| Daniel Stenberg | e30b206 | 2021-12-09 12:03:35 +0100 | [diff] [blame] | 1107 | your system has such. Note that you must never share the same handle in |
| Dan Fandrich | 31c6e7a | 2013-04-15 22:26:18 +0200 | [diff] [blame] | 1108 | multiple threads. |
| 1109 | |
| Jay Satiro | befa21f | 2016-05-05 14:34:27 -0400 | [diff] [blame] | 1110 | 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 Stenberg | 4d2f800 | 2020-11-04 14:02:01 +0100 | [diff] [blame] | 1112 | https://curl.se/libcurl/c/threadsafe.html |
| Daniel Stenberg | 7f70dbc | 2007-02-12 22:32:37 +0000 | [diff] [blame] | 1113 | |
| Daniel Stenberg | a40b55d | 2000-11-22 07:27:26 +0000 | [diff] [blame] | 1114 | 5.2 How can I receive all data into a large memory chunk? |
| 1115 | |
| Daniel Stenberg | a84af98 | 2001-05-15 13:09:27 +0000 | [diff] [blame] | 1116 | [ See also the examples/getinmemory.c source ] |
| 1117 | |
| Daniel Stenberg | a40b55d | 2000-11-22 07:27:26 +0000 | [diff] [blame] | 1118 | 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 Stenberg | 4c48599 | 2001-04-22 15:45:27 +0000 | [diff] [blame] | 1120 | 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] | 1121 | |
| 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 Stenberg | 9a44fa8 | 2005-11-02 09:34:53 +0000 | [diff] [blame] | 1124 | CURLOPT_WRITEDATA option. Then that pointer will be passed to the callback |
| 1125 | instead of a FILE * to a file: |
| Daniel Stenberg | a40b55d | 2000-11-22 07:27:26 +0000 | [diff] [blame] | 1126 | |
| 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 Stenberg | 811edcd | 2004-08-10 08:41:41 +0000 | [diff] [blame] | 1137 | size_t realsize = size * nmemb; |
| Daniel Stenberg | a40b55d | 2000-11-22 07:27:26 +0000 | [diff] [blame] | 1138 | struct MemoryStruct *mem = (struct MemoryStruct *)data; |
| Daniel Stenberg | eea2287 | 2004-03-16 07:56:51 +0000 | [diff] [blame] | 1139 | |
| Daniel Stenberg | a40b55d | 2000-11-22 07:27:26 +0000 | [diff] [blame] | 1140 | 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 Stenberg | 2c10037 | 2000-12-19 07:30:51 +0000 | [diff] [blame] | 1149 | 5.3 How do I fetch multiple files with libcurl? |
| Daniel Stenberg | ec5ac82 | 2000-12-14 08:37:09 +0000 | [diff] [blame] | 1150 | |
| Daniel Stenberg | db5c9cd | 2003-02-25 08:52:32 +0000 | [diff] [blame] | 1151 | 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 Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 1154 | only reusable, but you are even encouraged to reuse it if you can, as that |
| Daniel Stenberg | db5c9cd | 2003-02-25 08:52:32 +0000 | [diff] [blame] | 1155 | will enable libcurl to use persistent connections. |
| Daniel Stenberg | a40b55d | 2000-11-22 07:27:26 +0000 | [diff] [blame] | 1156 | |
| Daniel Stenberg | bc5954f | 2001-03-23 08:16:24 +0000 | [diff] [blame] | 1157 | 5.4 Does libcurl do Winsock initialization on win32 systems? |
| Daniel Stenberg | 910fc85 | 2000-12-30 11:48:51 +0000 | [diff] [blame] | 1158 | |
| Daniel Stenberg | db5c9cd | 2003-02-25 08:52:32 +0000 | [diff] [blame] | 1159 | Yes, if told to in the curl_global_init() call. |
| Daniel Stenberg | 910fc85 | 2000-12-30 11:48:51 +0000 | [diff] [blame] | 1160 | |
| Daniel Stenberg | 7e3cd82 | 2003-12-08 13:59:35 +0000 | [diff] [blame] | 1161 | 5.5 Does CURLOPT_WRITEDATA and CURLOPT_READDATA work on win32 ? |
| Daniel Stenberg | 41084e5 | 2001-01-22 08:42:00 +0000 | [diff] [blame] | 1162 | |
| 1163 | Yes, but you cannot open a FILE * and pass the pointer to a DLL and have |
| Daniel Stenberg | 7e3cd82 | 2003-12-08 13:59:35 +0000 | [diff] [blame] | 1164 | 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 Stenberg | 41084e5 | 2001-01-22 08:42:00 +0000 | [diff] [blame] | 1170 | |
| Daniel Stenberg | 4c48599 | 2001-04-22 15:45:27 +0000 | [diff] [blame] | 1171 | 5.6 What about Keep-Alive or persistent connections? |
| Daniel Stenberg | 6dc5c6f | 2001-01-27 20:51:31 +0000 | [diff] [blame] | 1172 | |
| Daniel Stenberg | db5c9cd | 2003-02-25 08:52:32 +0000 | [diff] [blame] | 1173 | curl and libcurl have excellent support for persistent connections when |
| Daniel Stenberg | 490879e | 2020-11-05 13:06:00 +0100 | [diff] [blame] | 1174 | transferring several files from the same server. curl will attempt to reuse |
| Daniel Stenberg | db5c9cd | 2003-02-25 08:52:32 +0000 | [diff] [blame] | 1175 | 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 Stenberg | 6dc5c6f | 2001-01-27 20:51:31 +0000 | [diff] [blame] | 1178 | |
| Daniel Stenberg | 6d49695 | 2017-05-12 19:58:06 +0200 | [diff] [blame] | 1179 | 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 |
| railsnewbie257 | cd6b99e | 2017-01-11 23:48:22 -0600 | [diff] [blame] | 1182 | that are used within the same multi handle. |
| Daniel Stenberg | c9a82f3 | 2011-06-21 08:44:42 +0200 | [diff] [blame] | 1183 | |
| Daniel Stenberg | e30b206 | 2021-12-09 12:03:35 +0100 | [diff] [blame] | 1184 | 5.7 Link errors when building libcurl on Windows |
| Daniel Stenberg | dd82d69 | 2002-10-08 07:16:17 +0000 | [diff] [blame] | 1185 | |
| 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 Vanem | 51a87fa | 2004-11-24 15:14:42 +0000 | [diff] [blame] | 1194 | 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 Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 1196 | dynamic import symbols. If you are using Visual Studio, you need to instead |
| Daniel Stenberg | 6ce76e6 | 2010-09-08 23:23:19 +0200 | [diff] [blame] | 1197 | add CURL_STATICLIB in the "Preprocessor Definitions" section. |
| 1198 | |
| Antoine Pietri | b341b76 | 2022-01-27 02:12:50 +0100 | [diff] [blame] | 1199 | If you get a linker error like "unknown symbol __imp__curl_easy_init ..." you |
| Daniel Stenberg | e30b206 | 2021-12-09 12:03:35 +0100 | [diff] [blame] | 1200 | have linked against the wrong (static) library. If you want to use the |
| Daniel Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 1201 | libcurl.dll and import lib, you do not need any extra CFLAGS, but use one of |
| Daniel Stenberg | 6ce76e6 | 2010-09-08 23:23:19 +0200 | [diff] [blame] | 1202 | the import libraries below. These are the libraries produced by the various |
| 1203 | lib/Makefile.* files: |
| Gisle Vanem | 51a87fa | 2004-11-24 15:14:42 +0000 | [diff] [blame] | 1204 | |
| Daniel Stenberg | 7711086 | 2011-03-14 13:31:05 +0100 | [diff] [blame] | 1205 | 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 Vanem | 51a87fa | 2004-11-24 15:14:42 +0000 | [diff] [blame] | 1211 | |
| Daniel Stenberg | 9754b20 | 2010-08-11 09:15:43 +0200 | [diff] [blame] | 1212 | 5.8 libcurl.so.X: open failed: No such file or directory |
| Daniel Stenberg | 811edcd | 2004-08-10 08:41:41 +0000 | [diff] [blame] | 1213 | |
| 1214 | This is an error message you might get when you try to run a program linked |
| Daniel Stenberg | 3a4182d | 2022-03-29 13:58:11 +0200 | [diff] [blame^] | 1215 | with a shared version of libcurl and your runtime linker (ld.so) could not |
| Daniel Stenberg | 9754b20 | 2010-08-11 09:15:43 +0200 | [diff] [blame] | 1216 | find the shared library named libcurl.so.X. (Where X is the number of the |
| 1217 | current libcurl ABI, typically 3 or 4). |
| Daniel Stenberg | 811edcd | 2004-08-10 08:41:41 +0000 | [diff] [blame] | 1218 | |
| Daniel Stenberg | 9754b20 | 2010-08-11 09:15:43 +0200 | [diff] [blame] | 1219 | You need to make sure that ld.so finds libcurl.so.X. You can do that |
| Daniel Stenberg | e30b206 | 2021-12-09 12:03:35 +0100 | [diff] [blame] | 1220 | multiple ways, and it differs somewhat between different operating systems. |
| 1221 | They are usually: |
| Daniel Stenberg | 811edcd | 2004-08-10 08:41:41 +0000 | [diff] [blame] | 1222 | |
| 1223 | * Add an option to the linker command line that specify the hard-coded path |
| Daniel Stenberg | 3a4182d | 2022-03-29 13:58:11 +0200 | [diff] [blame^] | 1224 | the runtime linker should check for the lib (usually -R) |
| Daniel Stenberg | 811edcd | 2004-08-10 08:41:41 +0000 | [diff] [blame] | 1225 | |
| 1226 | * Set an environment variable (LD_LIBRARY_PATH for example) where ld.so |
| 1227 | should check for libs |
| 1228 | |
| Daniel Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 1229 | * Adjust the system's config to check for libs in the directory where you have |
| Daniel Stenberg | 811edcd | 2004-08-10 08:41:41 +0000 | [diff] [blame] | 1230 | 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 Stenberg | 1d32336 | 2004-08-12 14:09:10 +0000 | [diff] [blame] | 1234 | 5.9 How does libcurl resolve host names? |
| 1235 | |
| Daniel Stenberg | e30b206 | 2021-12-09 12:03:35 +0100 | [diff] [blame] | 1236 | 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 Stenberg | 1d32336 | 2004-08-12 14:09:10 +0000 | [diff] [blame] | 1240 | |
| Daniel Stenberg | 6d49695 | 2017-05-12 19:58:06 +0200 | [diff] [blame] | 1241 | - The non-IPv6 resolver that can use one of four different host name resolve |
| railsnewbie257 | cd6b99e | 2017-01-11 23:48:22 -0600 | [diff] [blame] | 1242 | calls (depending on what your system supports): |
| Daniel Stenberg | 1d32336 | 2004-08-12 14:09:10 +0000 | [diff] [blame] | 1243 | |
| Daniel Stenberg | 7711086 | 2011-03-14 13:31:05 +0100 | [diff] [blame] | 1244 | A - gethostbyname() |
| 1245 | B - gethostbyname_r() with 3 arguments |
| 1246 | C - gethostbyname_r() with 5 arguments |
| 1247 | D - gethostbyname_r() with 6 arguments |
| Daniel Stenberg | 1d32336 | 2004-08-12 14:09:10 +0000 | [diff] [blame] | 1248 | |
| Steve Holme | 151ae59 | 2014-12-27 11:09:01 +0000 | [diff] [blame] | 1249 | - The IPv6-resolver that uses getaddrinfo() |
| Daniel Stenberg | 1d32336 | 2004-08-12 14:09:10 +0000 | [diff] [blame] | 1250 | |
| 1251 | - The c-ares based name resolver that uses the c-ares library for resolves. |
| Daniel Stenberg | fa81193 | 2011-04-14 23:12:27 +0200 | [diff] [blame] | 1252 | Using this offers asynchronous name resolves. |
| Daniel Stenberg | 1d32336 | 2004-08-12 14:09:10 +0000 | [diff] [blame] | 1253 | |
| Daniel Stenberg | 18a9ee6 | 2010-06-30 15:52:58 +0200 | [diff] [blame] | 1254 | - The threaded resolver (default option on Windows). It uses: |
| Daniel Stenberg | 1d32336 | 2004-08-12 14:09:10 +0000 | [diff] [blame] | 1255 | |
| Steve Holme | 151ae59 | 2014-12-27 11:09:01 +0000 | [diff] [blame] | 1256 | A - gethostbyname() on plain IPv4 hosts |
| 1257 | B - getaddrinfo() on IPv6 enabled hosts |
| Daniel Stenberg | dd82d69 | 2002-10-08 07:16:17 +0000 | [diff] [blame] | 1258 | |
| Daniel Stenberg | e9eb523 | 2005-04-05 14:36:37 +0000 | [diff] [blame] | 1259 | 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 Stenberg | 9a44fa8 | 2005-11-02 09:34:53 +0000 | [diff] [blame] | 1265 | to stdout. Set the CURLOPT_WRITEFUNCTION to receive the data, or possibly |
| 1266 | set CURLOPT_WRITEDATA to a different FILE * handle. |
| Daniel Stenberg | e9eb523 | 2005-04-05 14:36:37 +0000 | [diff] [blame] | 1267 | |
| Daniel Stenberg | 6e8e041 | 2005-04-05 14:38:38 +0000 | [diff] [blame] | 1268 | 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 Stenberg | b5d50e9 | 2005-04-11 13:39:55 +0000 | [diff] [blame] | 1273 | 5.12 Can I make libcurl fake or hide my real IP address? |
| 1274 | |
| Daniel Stenberg | 1a911f7 | 2013-08-24 17:13:46 +0200 | [diff] [blame] | 1275 | No. libcurl operates on a higher level. Besides, faking IP address would |
| railsnewbie257 | cd6b99e | 2017-01-11 23:48:22 -0600 | [diff] [blame] | 1276 | imply sending IP packets with a made-up source address, and then you normally |
| Daniel Stenberg | 1a911f7 | 2013-08-24 17:13:46 +0200 | [diff] [blame] | 1277 | get a problem with receiving the packet sent back as they would then not be |
| Daniel Stenberg | e30b206 | 2021-12-09 12:03:35 +0100 | [diff] [blame] | 1278 | routed to you. |
| Daniel Stenberg | b5d50e9 | 2005-04-11 13:39:55 +0000 | [diff] [blame] | 1279 | |
| 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 Stenberg | 1a911f7 | 2013-08-24 17:13:46 +0200 | [diff] [blame] | 1285 | remote server will see you coming from. You may also consider using |
| Viktor Szakats | 45f21e0 | 2015-06-16 00:47:26 +0200 | [diff] [blame] | 1286 | https://www.torproject.org/ . |
| Daniel Stenberg | b5d50e9 | 2005-04-11 13:39:55 +0000 | [diff] [blame] | 1287 | |
| Daniel Stenberg | 24602ed | 2007-12-10 10:28:56 +0000 | [diff] [blame] | 1288 | 5.13 How do I stop an ongoing transfer? |
| 1289 | |
| Daniel Stenberg | 4b837a7 | 2011-01-24 22:18:43 +0100 | [diff] [blame] | 1290 | 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 Fandrich | b3740f0 | 2011-06-02 18:41:57 -0700 | [diff] [blame] | 1293 | Instead, you need to make sure that one of the callbacks you use returns an |
| Daniel Stenberg | e30b206 | 2021-12-09 12:03:35 +0100 | [diff] [blame] | 1294 | appropriate value that will stop the transfer. Suitable callbacks that you |
| Dan Fandrich | b3740f0 | 2011-06-02 18:41:57 -0700 | [diff] [blame] | 1295 | can do this with include the progress callback, the read callback and the |
| 1296 | write callback. |
| Daniel Stenberg | 24602ed | 2007-12-10 10:28:56 +0000 | [diff] [blame] | 1297 | |
| Daniel Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 1298 | If you are using the multi interface, you can also stop a transfer by |
| Dan Fandrich | b3740f0 | 2011-06-02 18:41:57 -0700 | [diff] [blame] | 1299 | removing the particular easy handle from the multi stack at any moment you |
| Daniel Stenberg | 9ca812f | 2013-02-04 22:46:51 +0100 | [diff] [blame] | 1300 | think the transfer is done or when you wish to abort the transfer. |
| Daniel Stenberg | e9eb523 | 2005-04-05 14:36:37 +0000 | [diff] [blame] | 1301 | |
| Daniel Stenberg | 2205985 | 2008-09-24 07:39:42 +0000 | [diff] [blame] | 1302 | 5.14 Using C++ non-static functions for callbacks? |
| 1303 | |
| Daniel Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 1304 | libcurl is a C library, it does not know anything about C++ member functions. |
| Daniel Stenberg | 2205985 | 2008-09-24 07:39:42 +0000 | [diff] [blame] | 1305 | |
| railsnewbie257 | cd6b99e | 2017-01-11 23:48:22 -0600 | [diff] [blame] | 1306 | You can overcome this "limitation" with relative ease using a static |
| Daniel Stenberg | 2205985 | 2008-09-24 07:39:42 +0000 | [diff] [blame] | 1307 | member function that is passed a pointer to the class: |
| 1308 | |
| 1309 | // f is the pointer to your object. |
| Stephen Brokenshire | 2a1d538 | 2016-10-01 16:36:50 +0100 | [diff] [blame] | 1310 | static size_t YourClass::func(void *buffer, size_t sz, size_t n, void *f) |
| Daniel Stenberg | 2205985 | 2008-09-24 07:39:42 +0000 | [diff] [blame] | 1311 | { |
| 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 Brokenshire | 2a1d538 | 2016-10-01 16:36:50 +0100 | [diff] [blame] | 1317 | curl_easy_setopt(hcurl, CURLOPT_WRITEFUNCTION, YourClass::func); |
| Daniel Stenberg | 2205985 | 2008-09-24 07:39:42 +0000 | [diff] [blame] | 1318 | curl_easy_setopt(hcurl, CURLOPT_WRITEDATA, this); |
| 1319 | |
| Yang Tse | a07bc79 | 2010-02-14 19:40:18 +0000 | [diff] [blame] | 1320 | 5.15 How do I get an FTP directory listing? |
| Daniel Stenberg | 8740d14 | 2009-06-09 09:02:39 +0000 | [diff] [blame] | 1321 | |
| 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 Satiro | f9eed59 | 2016-07-09 03:05:55 -0400 | [diff] [blame] | 1327 | 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 Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 1332 | 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 Satiro | f9eed59 | 2016-07-09 03:05:55 -0400 | [diff] [blame] | 1335 | 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 Stenberg | 8740d14 | 2009-06-09 09:02:39 +0000 | [diff] [blame] | 1337 | |
| Jay Satiro | f9eed59 | 2016-07-09 03:05:55 -0400 | [diff] [blame] | 1338 | 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 Szakats | d49881c | 2016-02-03 05:09:25 +0100 | [diff] [blame] | 1348 | list parser is available at https://cr.yp.to/ftpparse.html Versions of |
| Dan Fandrich | 7d166b0 | 2010-07-21 15:15:07 -0700 | [diff] [blame] | 1349 | libcurl since 7.21.0 also provide the ability to specify a wildcard to |
| 1350 | download multiple files from one FTP directory. |
| Daniel Stenberg | 8740d14 | 2009-06-09 09:02:39 +0000 | [diff] [blame] | 1351 | |
| Daniel Stenberg | e30b206 | 2021-12-09 12:03:35 +0100 | [diff] [blame] | 1352 | 5.16 I want a different time-out |
| Daniel Stenberg | e8ab9a0 | 2012-09-28 15:50:18 +0200 | [diff] [blame] | 1353 | |
| Daniel Stenberg | e30b206 | 2021-12-09 12:03:35 +0100 | [diff] [blame] | 1354 | 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 Stenberg | e8ab9a0 | 2012-09-28 15:50:18 +0200 | [diff] [blame] | 1357 | |
| 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 Stenberg | 7f555dc | 2017-10-09 16:13:27 +0200 | [diff] [blame] | 1364 | CURLOPT_XFERINFOFUNCTION (perhaps in combination with other callbacks) and |
| Daniel Stenberg | e8ab9a0 | 2012-09-28 15:50:18 +0200 | [diff] [blame] | 1365 | use that to figure out exactly when the right condition is met when the |
| 1366 | transfer should get stopped. |
| 1367 | |
| Daniel Stenberg | dbf93a8 | 2013-01-03 10:15:02 +0100 | [diff] [blame] | 1368 | 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 Stenberg | 3a4182d | 2022-03-29 13:58:11 +0200 | [diff] [blame^] | 1371 | Internet protocol server. libcurl is only a client-side library. For server |
| Daniel Stenberg | dbf93a8 | 2013-01-03 10:15:02 +0100 | [diff] [blame] | 1372 | libraries, you need to continue your search elsewhere but there exist many |
| Daniel Stenberg | e30b206 | 2021-12-09 12:03:35 +0100 | [diff] [blame] | 1373 | 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 Stenberg | dbf93a8 | 2013-01-03 10:15:02 +0100 | [diff] [blame] | 1376 | |
| Daniel Stenberg | 1495f42 | 2014-05-08 09:30:35 +0200 | [diff] [blame] | 1377 | 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 Stenberg | e30b206 | 2021-12-09 12:03:35 +0100 | [diff] [blame] | 1383 | sure you use the non-blocking multi API which will do transfers |
| 1384 | asynchronously - still in the same single thread. |
| Daniel Stenberg | 1495f42 | 2014-05-08 09:30:35 +0200 | [diff] [blame] | 1385 | |
| 1386 | libcurl will potentially internally use threads for name resolving, if it |
| Daniel Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 1387 | was built to work like that, but in those cases it will create the child |
| Daniel Stenberg | 1495f42 | 2014-05-08 09:30:35 +0200 | [diff] [blame] | 1388 | threads by itself and they will only be used and then killed internally by |
| 1389 | libcurl and never exposed to the outside. |
| Daniel Stenberg | 8740d14 | 2009-06-09 09:02:39 +0000 | [diff] [blame] | 1390 | |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 1391 | 6. License Issues |
| Daniel Stenberg | c3c7739 | 2000-07-31 22:42:34 +0000 | [diff] [blame] | 1392 | |
| Daniel Stenberg | 92efb3d | 2021-11-01 13:43:11 +0100 | [diff] [blame] | 1393 | 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 Stenberg | c3c7739 | 2000-07-31 22:42:34 +0000 | [diff] [blame] | 1397 | |
| Daniel Stenberg | 9a44fa8 | 2005-11-02 09:34:53 +0000 | [diff] [blame] | 1398 | We are not lawyers and this is not legal advice. You should probably consult |
| Dan Fandrich | c28443c | 2010-12-08 10:16:25 -0800 | [diff] [blame] | 1399 | 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 Stenberg | 9a44fa8 | 2005-11-02 09:34:53 +0000 | [diff] [blame] | 1403 | |
| Daniel Stenberg | 811edcd | 2004-08-10 08:41:41 +0000 | [diff] [blame] | 1404 | 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] | 1405 | |
| Daniel Stenberg | e30b206 | 2021-12-09 12:03:35 +0100 | [diff] [blame] | 1406 | Yes |
| Daniel Stenberg | 7d1ef96 | 2000-08-14 06:31:59 +0000 | [diff] [blame] | 1407 | |
| Daniel Stenberg | e30b206 | 2021-12-09 12:03:35 +0100 | [diff] [blame] | 1408 | Since libcurl may be distributed under the MIT/X derivative license, it can |
| 1409 | be used together with GPL in any software. |
| Daniel Stenberg | c3c7739 | 2000-07-31 22:42:34 +0000 | [diff] [blame] | 1410 | |
| Daniel Stenberg | 811edcd | 2004-08-10 08:41:41 +0000 | [diff] [blame] | 1411 | 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] | 1412 | |
| Daniel Stenberg | e30b206 | 2021-12-09 12:03:35 +0100 | [diff] [blame] | 1413 | Yes |
| Daniel Stenberg | 0d181b5 | 2001-01-04 12:43:53 +0000 | [diff] [blame] | 1414 | |
| Daniel Stenberg | c59baa0 | 2001-02-12 10:05:09 +0000 | [diff] [blame] | 1415 | 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] | 1416 | |
| Daniel Stenberg | 811edcd | 2004-08-10 08:41:41 +0000 | [diff] [blame] | 1417 | 6.3 I have a BSD licensed program, can I use the libcurl library? |
| Daniel Stenberg | 31b8eea | 2000-08-23 07:27:00 +0000 | [diff] [blame] | 1418 | |
| Daniel Stenberg | e30b206 | 2021-12-09 12:03:35 +0100 | [diff] [blame] | 1419 | Yes |
| Daniel Stenberg | 0d181b5 | 2001-01-04 12:43:53 +0000 | [diff] [blame] | 1420 | |
| Daniel Stenberg | c59baa0 | 2001-02-12 10:05:09 +0000 | [diff] [blame] | 1421 | 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] | 1422 | |
| Daniel Stenberg | 811edcd | 2004-08-10 08:41:41 +0000 | [diff] [blame] | 1423 | 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] | 1424 | |
| Daniel Stenberg | e30b206 | 2021-12-09 12:03:35 +0100 | [diff] [blame] | 1425 | Yes |
| Daniel Stenberg | c3c7739 | 2000-07-31 22:42:34 +0000 | [diff] [blame] | 1426 | |
| Daniel Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 1427 | The LGPL license does not clash with other licenses. |
| Daniel Stenberg | c3318b4 | 2000-08-17 14:06:42 +0000 | [diff] [blame] | 1428 | |
| Daniel Stenberg | 811edcd | 2004-08-10 08:41:41 +0000 | [diff] [blame] | 1429 | 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] | 1430 | |
| Daniel Stenberg | e30b206 | 2021-12-09 12:03:35 +0100 | [diff] [blame] | 1431 | Yes |
| Daniel Stenberg | 0d181b5 | 2001-01-04 12:43:53 +0000 | [diff] [blame] | 1432 | |
| Daniel Stenberg | e30b206 | 2021-12-09 12:03:35 +0100 | [diff] [blame] | 1433 | 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 Stenberg | c3c7739 | 2000-07-31 22:42:34 +0000 | [diff] [blame] | 1436 | |
| Daniel Stenberg | 811edcd | 2004-08-10 08:41:41 +0000 | [diff] [blame] | 1437 | 6.6 Can you please change the curl/libcurl license to XXXX? |
| Daniel Stenberg | c3c7739 | 2000-07-31 22:42:34 +0000 | [diff] [blame] | 1438 | |
| Daniel Stenberg | c59baa0 | 2001-02-12 10:05:09 +0000 | [diff] [blame] | 1439 | No. |
| 1440 | |
| Daniel Stenberg | 11d718b | 2001-03-13 11:47:30 +0000 | [diff] [blame] | 1441 | 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 Stenberg | 3a552b1 | 2003-06-26 11:35:48 +0000 | [diff] [blame] | 1445 | 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 Stenberg | 9ac7629 | 2004-08-18 11:18:36 +0000 | [diff] [blame] | 1447 | |
| Dan Fandrich | 5c9fff9 | 2009-01-30 18:28:29 +0000 | [diff] [blame] | 1448 | 6.7 What are my obligations when using libcurl in my commercial apps? |
| Daniel Stenberg | 9a44fa8 | 2005-11-02 09:34:53 +0000 | [diff] [blame] | 1449 | |
| 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 Stenberg | 819dfdd | 2011-01-29 23:52:40 +0100 | [diff] [blame] | 1460 | You do not have to broadcast to the world that you are using libcurl within |
| Daniel Stenberg | 9a44fa8 | 2005-11-02 09:34:53 +0000 | [diff] [blame] | 1461 | your app. |
| 1462 | |
| Daniel Stenberg | 819dfdd | 2011-01-29 23:52:40 +0100 | [diff] [blame] | 1463 | 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 Stenberg | 4d2f800 | 2020-11-04 14:02:01 +0100 | [diff] [blame] | 1467 | As can be seen here: https://curl.se/docs/companies.html and elsewhere, |
| Daniel Stenberg | 819dfdd | 2011-01-29 23:52:40 +0100 | [diff] [blame] | 1468 | more and more companies are discovering the power of libcurl and take |
| 1469 | advantage of it even in commercial environments. |
| Daniel Stenberg | 9a44fa8 | 2005-11-02 09:34:53 +0000 | [diff] [blame] | 1470 | |
| 1471 | |
| Daniel Stenberg | 9ac7629 | 2004-08-18 11:18:36 +0000 | [diff] [blame] | 1472 | 7. 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 Stenberg | b6c876b | 2005-07-30 23:37:05 +0000 | [diff] [blame] | 1477 | 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 Stenberg | 844cbc7 | 2007-07-29 22:17:39 +0000 | [diff] [blame] | 1482 | 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 Stenberg | 9ac7629 | 2004-08-18 11:18:36 +0000 | [diff] [blame] | 1484 | |
| Daniel Stenberg | e38a788 | 2011-03-17 11:30:29 +0100 | [diff] [blame] | 1485 | 7.2 Who wrote PHP/CURL? |
| Daniel Stenberg | 9ac7629 | 2004-08-18 11:18:36 +0000 | [diff] [blame] | 1486 | |
| MaxGiting | 05cd55f | 2015-11-18 23:00:24 -0500 | [diff] [blame] | 1487 | PHP/CURL was initially written by Sterling Hughes. |
| Daniel Stenberg | 9ac7629 | 2004-08-18 11:18:36 +0000 | [diff] [blame] | 1488 | |
| 1489 | 7.3 Can I perform multiple requests using the same handle? |
| 1490 | |
| Daniel Stenberg | ee400f9 | 2004-08-19 06:31:29 +0000 | [diff] [blame] | 1491 | 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 Stenberg | 9ac7629 | 2004-08-18 11:18:36 +0000 | [diff] [blame] | 1494 | |
| Daniel Stenberg | ee400f9 | 2004-08-19 06:31:29 +0000 | [diff] [blame] | 1495 | After a transfer, you just set new options in the handle and make another |
| MaxGiting | 05cd55f | 2015-11-18 23:00:24 -0500 | [diff] [blame] | 1496 | 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 Stenberg | 352b07f | 2021-09-13 17:21:38 +0200 | [diff] [blame] | 1503 | |
| 1504 | 8. Development |
| 1505 | |
| 1506 | 8.1 Why does curl use C89? |
| 1507 | |
| Daniel Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 1508 | As with everything in curl, there's a history and we keep using what we have |
| Daniel Stenberg | 352b07f | 2021-09-13 17:21:38 +0200 | [diff] [blame] | 1509 | 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 Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 1515 | platforms such as Windows. Today, we do not really know how many users that |
| Daniel Stenberg | 352b07f | 2021-09-13 17:21:38 +0200 | [diff] [blame] | 1516 | 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 Stenberg | a28464a | 2021-10-31 16:34:44 +0100 | [diff] [blame] | 1519 | reason for us to change our minds. The core developers of the project do not |
| Daniel Stenberg | 352b07f | 2021-09-13 17:21:38 +0200 | [diff] [blame] | 1520 | 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 Stenberg | 3a4182d | 2022-03-29 13:58:11 +0200 | [diff] [blame^] | 1538 | Backends can be written in any language, but should probably provide APIs |
| Daniel Stenberg | 352b07f | 2021-09-13 17:21:38 +0200 | [diff] [blame] | 1539 | usable from C to ease integration and transition. |