diff options
author | George Hazan <george.hazan@gmail.com> | 2013-11-10 21:43:18 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-11-10 21:43:18 +0000 |
commit | 530102b3b16fdc6f008cdf312e5977a878f295db (patch) | |
tree | 3159eb3d5712151a33d796b7a0039ae9a4d00e09 /plugins/FTPFileYM/curl | |
parent | e40ecc70a7db28bdf78dad5d804e07d08a77159c (diff) |
libcurl update
git-svn-id: http://svn.miranda-ng.org/main/trunk@6864 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/FTPFileYM/curl')
378 files changed, 12632 insertions, 32692 deletions
diff --git a/plugins/FTPFileYM/curl/docs/BINDINGS b/plugins/FTPFileYM/curl/docs/BINDINGS index 5cf07fecde..466c36bd0f 100644 --- a/plugins/FTPFileYM/curl/docs/BINDINGS +++ b/plugins/FTPFileYM/curl/docs/BINDINGS @@ -6,14 +6,14 @@ libcurl bindings -Creative people have written bindings or interfaces for various environments -and programming languages. Using one of these allows you to take advantage of -curl powers from within your favourite language or system. + Creative people have written bindings or interfaces for various environments + and programming languages. Using one of these allows you to take advantage of + curl powers from within your favourite language or system. -This is a list of all known interfaces as of this writing. + This is a list of all known interfaces as of this writing. -The bindings listed below are not part of the curl/libcurl distribution -archives, but must be downloaded and installed separately. + The bindings listed below are not part of the curl/libcurl distribution + archives, but must be downloaded and installed separately. Ada95 @@ -41,7 +41,10 @@ Ch Cocoa - Written by Dan Wood + BBHTTP: written by Bruno de Carvalho + https://github.com/brunodecarvalho/BBHTTP + + curlhandle: Written by Dan Wood http://curlhandle.sourceforge.net/ D @@ -55,6 +58,7 @@ Dylan http://dylanlibs.sourceforge.net/ Eiffel + Written by Eiffel Software http://curl.haxx.se/libcurl/eiffel/ @@ -81,6 +85,11 @@ glib/GTK+ Written by Richard Atterer http://atterer.net/glibcurl/ +Guile: + + Written by Michael L. Gran + http://www.lonelycactus.com/guile-curl.html + Haskell Written by Galois, Inc @@ -91,6 +100,11 @@ Java Maintained by [blank] http://curl.haxx.se/libcurl/java/ +Julia + + Written by Paul Howe + https://github.com/forio/Curl.jl + Lisp Written by Liam Healy diff --git a/plugins/FTPFileYM/curl/docs/CONTRIBUTE b/plugins/FTPFileYM/curl/docs/CONTRIBUTE index 33a1f21e80..75e7ebbb93 100644 --- a/plugins/FTPFileYM/curl/docs/CONTRIBUTE +++ b/plugins/FTPFileYM/curl/docs/CONTRIBUTE @@ -79,9 +79,9 @@ 1.3 What To Read Source code, the man pages, the INTERNALS document, TODO, KNOWN_BUGS, the - most recent CHANGES. Just lurking on the libcurl mailing list is gonna give - you a lot of insights on what's going on right now. Asking there is a good - idea too. + most recent CHANGES. Just lurking on the curl-library mailing list is gonna + give you a lot of insights on what's going on right now. Asking there is a + good idea too. 2. cURL Coding Standards @@ -98,12 +98,12 @@ 2.2 Indenting - Please try using the same indenting levels and bracing method as all the - other code already does. It makes the source code a lot easier to follow if - all of it is written using the same style. We don't ask you to like it, we - just ask you to follow the tradition! ;-) This mainly means: 2-level indents, - using spaces only (no tabs) and having the opening brace ({) on the same line - as the if() or while(). + Use the same indenting levels and bracing method as all the other code + already does. It makes the source code easier to follow if all of it is + written using the same style. We don't ask you to like it, we just ask you to + follow the tradition! ;-) This mainly means: 2-level indents, using spaces + only (no tabs) and having the opening brace ({) on the same line as the if() + or while(). Also note that we use if() and while() with no space before the parenthesis. @@ -151,6 +151,9 @@ description exactly what they correct so that all patches can be selectively applied by the maintainer or other interested parties. + Also, separate patches enable bisecting much better when we track problems in + the future. + 2.9 Patch Against Recent Sources Please try to get the latest available sources to make your patches @@ -178,6 +181,10 @@ test case that verifies that it works as documented. If every submitter also posts a few test cases, it won't end up as a heavy burden on a single person! + If you don't have test cases or perhaps you have done something that is very + hard to write tests for, do explain exactly how you have otherwise tested and + verified your changes. + 3. Pushing Out Your Changes 3.1 Write Access to git Repository @@ -212,7 +219,7 @@ commit. Now send those patches off to the curl-library list. You can of course opt to - do that with the 'get send-email' command. + do that with the 'git send-email' command. 3.3 How To Make a Patch without git diff --git a/plugins/FTPFileYM/curl/docs/FAQ b/plugins/FTPFileYM/curl/docs/FAQ index 48075cea6d..b6f8958afc 100644 --- a/plugins/FTPFileYM/curl/docs/FAQ +++ b/plugins/FTPFileYM/curl/docs/FAQ @@ -202,27 +202,25 @@ FAQ better. We do however believe in a few rules when it comes to the future of curl: - * Curl -- the command line tool -- is to remain a non-graphical command line - tool. If you want GUIs or fancy scripting capabilities, you should look - for another tool that uses libcurl. + Curl -- the command line tool -- is to remain a non-graphical command line + tool. If you want GUIs or fancy scripting capabilities, you should look for + another tool that uses libcurl. - * We do not add things to curl that other small and available tools already - do very fine at the side. Curl's output is fine to pipe into another - program or redirect to another file for the next program to interpret. + We do not add things to curl that other small and available tools already do + very fine at the side. Curl's output is fine to pipe into another program or + redirect to another file for the next program to interpret. - * We focus on protocol related issues and improvements. If you wanna do more - magic with the supported protocols than curl currently does, chances are - big we will agree. If you wanna add more protocols, we may very well - agree. + We focus on protocol related issues and improvements. If you wanna do more + magic with the supported protocols than curl currently does, chances are big + we will agree. If you wanna add more protocols, we may very well agree. - * If you want someone else to make all the work while you wait for us to - implement it for you, that is not a very friendly attitude. We spend a - considerable time already on maintaining and developing curl. In order to - get more out of us, you should consider trading in some of your time and - efforts in return. + If you want someone else to make all the work while you wait for us to + implement it for you, that is not a very friendly attitude. We spend a + considerable time already on maintaining and developing curl. In order to + get more out of us, you should consider trading in some of your time and + efforts in return. - * If you write the code, chances are bigger that it will get into curl - faster. + If you write the code, chances are bigger that it will get into curl faster. 1.5 Who makes curl? @@ -245,10 +243,10 @@ FAQ supervised in any way by the project. We still get help from companies. Haxx provides web site, bandwidth, mailing - lists etc and sourceforge.net hosts project services we take advantage from, - like the bug tracker. Also again, some companies have sponsored certain - parts of the development in the past and I hope some will continue to do so - in the future. + lists etc, sourceforge.net hosts project services we take advantage from, + like the bug tracker and github hosts the primary git repository. Also + again, some companies have sponsored certain parts of the development in the + past and I hope some will continue to do so in the future. If you want to support our project, consider a donation or a banner-program or even better: by helping us coding, documenting, testing etc. @@ -263,7 +261,7 @@ FAQ Our project name curl has been in effective use since 1998. We were not the first computer related project to use the name "curl" and do not claim any - first-hand rights to the name. + rights to the name. We recognize that we will be living in parallel with curl.com and wish them every success. @@ -309,17 +307,16 @@ FAQ never use it. In May 2012 Daniel did a counting game and came up with a number that may - be completely wrong or somewhat accurate. 300 million! + be completely wrong or somewhat accurate. Over 500 million! See http://daniel.haxx.se/blog/2012/05/16/300m-users/ 1.11 Why don't you update ca-bundle.crt - The ca-bundle.crt file that used to be bundled with curl was very outdated - (it being last modified year 2000 should tell) and must be replaced with a - much more modern and up-to-date version by anyone who wants to verify peers - anyway. It is no longer provided, the last curl release that shipped it was - curl 7.18.0. + The ca cert bundle that used to shipped with curl was very outdated and must + be replaced with an up-to-date version by anyone who wants to verify + peers. It is no longer provided by curl. The last curl release ever that + shipped a ca cert bundle was curl 7.18.0. In the cURL project we've decided not to attempt to keep this file updated (or even present anymore) since deciding what to add to a ca cert bundle is @@ -433,10 +430,10 @@ FAQ That is an OpenSSL binary built for Windows. - Curl uses OpenSSL to do the SSL stuff. The LIBEAY32.DLL is what curl needs - on a windows machine to do https://. Check out the curl web site to find - accurate and up-to-date pointers to recent OpenSSL DLLs and other binary - packages. + Curl can be built with OpenSSL to do the SSL stuff. The LIBEAY32.DLL is then + what curl needs on a windows machine to do https:// etc. Check out the curl + web site to find accurate and up-to-date pointers to recent OpenSSL DLLs and + other binary packages. 2.4 Does curl support SOCKS (RFC 1928) ? @@ -472,9 +469,9 @@ FAQ 3.3 Why doesn't my posting using -F work? You can't simply use -F or -d at your choice. The web server that will - receive your post assumes one of the formats. If the form you're trying to - "fake" sets the type to 'multipart/form-data', then and only then you must - use the -F type. In all the most common cases, you should use -d which then + receive your post expects one of the formats. If the form you're trying to + submit uses the type 'multipart/form-data', then and only then you must use + the -F type. In all the most common cases, you should use -d which then causes a posting with the type 'application/x-www-form-urlencoded'. This is described in some detail in the MANUAL and TheArtOfHttpScripting @@ -502,9 +499,9 @@ FAQ 3.6 Does curl support ASP, XML, XHTML or HTML version Y? To curl, all contents are alike. It doesn't matter how the page was - generated. It may be ASP, PHP, Perl, shell-script, SSI or plain - HTML-files. There's no difference to curl and it doesn't even know what kind - of language that generated the page. + generated. It may be ASP, PHP, Perl, shell-script, SSI or plain HTML + files. There's no difference to curl and it doesn't even know what kind of + language that generated the page. See also item 3.14 regarding javascript. @@ -621,15 +618,15 @@ FAQ Some workarounds usually suggested to overcome this Javascript dependency: - - Depending on the Javascript complexity, write up a script that - translates it to another language and execute that. + Depending on the Javascript complexity, write up a script that translates it + to another language and execute that. - - Read the Javascript code and rewrite the same logic in another language. + Read the Javascript code and rewrite the same logic in another language. - - Implement a Javascript interpreter, people have successfully used the - Mozilla Javascript engine in the past. + Implement a Javascript interpreter, people have successfully used the + Mozilla Javascript engine in the past. - - Ask your admins to stop this, for a static proxy setup or similar. + Ask your admins to stop this, for a static proxy setup or similar. 3.15 Can I do recursive fetches with curl? @@ -645,34 +642,38 @@ FAQ There are three different kinds of "certificates" to keep track of when we talk about using SSL-based protocols (HTTPS or FTPS) using curl or libcurl. - - Client certificate. The server you communicate may require that you can - provide this in order to prove that you actually are who you claim to be. - If the server doesn't require this, you don't need a client certificate. - - A client certificate is always used together with a private key, and the - private key has a pass phrase that protects it. - - - Server certificate. The server you communicate with has a server - certificate. You can and should verify this certificate to make sure that - you are truly talking to the real server and not a server impersonating - it. - - - Certificate Authority certificate ("CA cert"). You often have several CA - certs in a CA cert bundle that can be used to verify a server certificate - that was signed by one of the authorities in the bundle. curl does not - come with a CA cert bundle but most curl installs provide one. You can - also override the default. - - The server certificate verification process is made by using a Certificate - Authority certificate ("CA cert") that was used to sign the server - certificate. Server certificate verification is enabled by default in curl - and libcurl and is often the reason for problems as explained in FAQ entry - 4.12 and the SSLCERTS document - (http://curl.haxx.se/docs/sslcerts.html). Server certificates that are - "self-signed" or otherwise signed by a CA that you do not have a CA cert - for, cannot be verified. If the verification during a connect fails, you - are refused access. You then need to explicitly disable the verification - to connect to the server. + CLIENT CERTIFICATE + + The server you communicate may require that you can provide this in order to + prove that you actually are who you claim to be. If the server doesn't + require this, you don't need a client certificate. + + A client certificate is always used together with a private key, and the + private key has a pass phrase that protects it. + + SERVER CERTIFICATE + + The server you communicate with has a server certificate. You can and should + verify this certificate to make sure that you are truly talking to the real + server and not a server impersonating it. + + CERTIFICATE AUTHORITY CERTIFICATE ("CA cert") + + You often have several CA certs in a CA cert bundle that can be used to + verify a server certificate that was signed by one of the authorities in the + bundle. curl does not come with a CA cert bundle but most curl installs + provide one. You can also override the default. + + The server certificate verification process is made by using a Certificate + Authority certificate ("CA cert") that was used to sign the server + certificate. Server certificate verification is enabled by default in curl + and libcurl and is often the reason for problems as explained in FAQ entry + 4.12 and the SSLCERTS document + (http://curl.haxx.se/docs/sslcerts.html). Server certificates that are + "self-signed" or otherwise signed by a CA that you do not have a CA cert + for, cannot be verified. If the verification during a connect fails, you are + refused access. You then need to explicitly disable the verification to + connect to the server. 3.17 How do I list the root dir of an FTP server? @@ -729,7 +730,7 @@ FAQ When passing on a URL to curl to use, it may respond that the particular protocol is not supported or disabled. The particular way this error message is phrased is because curl doesn't make a distinction internally of whether - a particular protocol is not supported (ie never got any code added that + a particular protocol is not supported (i.e. never got any code added that knows how to speak that protocol) or if it was explicitly disabled. curl can be built to only support a given set of protocols, and the rest would then be disabled or not supported. @@ -795,12 +796,13 @@ FAQ curl 'http://www.altavista.com/cgi-bin/query?text=yes&q=curl' - In Windows, the standard DOS shell treats the %-symbol specially and you - need to use TWO %-symbols for each single one you want to use in the URL. + In Windows, the standard DOS shell treats the percent sign specially and you + need to use TWO percent signs for each single one you want to use in the + URL. - Also note that if you want the literal %-symbol to be part of the data you - pass in a POST using -d/--data you must encode it as '%25' (which then also - needs the %-symbol doubled on Windows machines). + If you want a literal percent sign to be part of the data you pass in a POST + using -d/--data you must encode it as '%25' (which then also needs the + percent sign doubled on Windows machines). 4.3 How can I use {, }, [ or ] to specify multiple URLs? @@ -969,13 +971,13 @@ FAQ 4.14 Redirects work in browser but not with curl! curl supports HTTP redirects fine (see item 3.8). Browsers generally support - at least two other ways to perform directs that curl does not: + at least two other ways to perform redirects that curl does not: - - Meta tags. You can write a HTML tag that will cause the browser to - redirect to another given URL after a certain time. + Meta tags. You can write a HTML tag that will cause the browser to redirect + to another given URL after a certain time. - - Javascript. You can write a Javascript program embedded in a HTML page - that redirects the browser to another given URL. + Javascript. You can write a Javascript program embedded in a HTML page that + redirects the browser to another given URL. There is no way to make curl follow these redirects. You must either manually figure out what the page is set to do, or you write a script that @@ -1056,11 +1058,11 @@ FAQ 4.19 Why doesn't cURL return an error when the network cable is unplugged? - Unplugging the cable is not an error situation. The TCP/IP protocol stack + Unplugging a cable is not an error situation. The TCP/IP protocol stack was designed to be fault tolerant, so even though there may be a physical break somewhere the connection shouldn't be affected, just possibly delayed. Eventually, the physical break will be fixed or the data will be - re-routed around the physical problem. + re-routed around the physical problem through another path. In such cases, the TCP/IP stack is responsible for detecting when the network connection is irrevocably lost. Since with some protocols it is @@ -1078,6 +1080,12 @@ FAQ falls too low, and --connect-timeout and --max-time can be used to put an overall timeout on the connection phase or the entire transfer. + A libcurl-using application running in a known physical environment (e.g. + an embedded device with only a single network connection) may want to act + immediately if its lone network connection goes down. That can be achieved + by having the application monitor the network connection on its own using an + OS-specific mechanism, then signalling libcurl to abort (see also item 5.13). + 5. libcurl Issues @@ -1087,7 +1095,9 @@ FAQ We have written the libcurl code specifically adjusted for multi-threaded programs. libcurl will use thread-safe functions instead of non-safe ones if - your system has such. + your system has such. Note that you must never share the same handle in + multiple threads. + If you use a OpenSSL-powered libcurl in a multi-threaded environment, you need to provide one or two locking functions: @@ -1263,17 +1273,18 @@ FAQ 5.12 Can I make libcurl fake or hide my real IP address? - No. libcurl operates on a higher level than so. Besides, faking IP address - would imply sending IP packages with a made-up source address, and then you - normally get a problem with intercepting the packages sent back as they - would then not be routed to you! + No. libcurl operates on a higher level. Besides, faking IP address would + imply sending IP packet with a made-up source address, and then you normally + get a problem with receiving the packet sent back as they would then not be + routed to you! If you use a proxy to access remote sites, the sites will not see your local IP address but instead the address of the proxy. Also note that on many networks NATs or other IP-munging techniques are used that makes you see and use a different IP address locally than what the - remote server will see you coming from. + remote server will see you coming from. You may also consider using + http://www.torproject.org . 5.13 How do I stop an ongoing transfer? diff --git a/plugins/FTPFileYM/curl/docs/FEATURES b/plugins/FTPFileYM/curl/docs/FEATURES index 74fb735935..14d7e78ddb 100644 --- a/plugins/FTPFileYM/curl/docs/FEATURES +++ b/plugins/FTPFileYM/curl/docs/FEATURES @@ -13,27 +13,29 @@ curl tool - multiple file upload on a single command line - custom maximum transfer rate - redirectable stderr + - metalink support (*13) -libcurl supports +libcurl - full URL syntax with no length limit - custom maximum download time - custom least download speed acceptable - custom output result after completion - guesses protocol from host name unless specified - uses .netrc - - progress bar/time specs while downloading + - progress bar with time statistics while downloading - "standard" proxy environment variables support - compiles on win32 (reported builds on 40+ operating systems) - selectable network interface for outgoing traffic - IPv6 support on unix and Windows - persistent connections - socks5 support - - supports user name + password in proxy environment variables + - supports user name and password in proxy environment variables - operations through proxy "tunnel" (using CONNECT) - - supports large files (>2GB and >4GB) both upload/download + - support for large files (>2GB and >4GB) during upload and download - replaceable memory functions (malloc, free, realloc, etc) - asynchronous name resolving (*6) - both a push and a pull style interface + - international domain names (*11) HTTP - HTTP/1.1 compliant (optionally uses 1.0) @@ -60,7 +62,8 @@ HTTP - via http-proxy - retrieve file modification date - Content-Encoding support for deflate and gzip - - "Transfer-Encoding: chunked" support for "uploads" + - "Transfer-Encoding: chunked" support in uploads + - data compression (*12) HTTPS (*1) - (all the HTTP features) @@ -68,12 +71,13 @@ HTTPS (*1) - verify server certificate - via http-proxy - select desired encryption - - force usage of a specific SSL version (SSLv2(*7), SSLv3 or TLSv1) + - force usage of a specific SSL version (SSLv2 (*7), SSLv3 (*10) or TLSv1) FTP - download - authentication - - kerberos4 (*5), kerberos5 (*3) + - kerberos4 (*5) + - kerberos5 (*3) - active/passive using PORT, EPRT, PASV or EPSV - single file size information (compare to HTTP HEAD) - 'type=' URL support @@ -93,7 +97,7 @@ FTP FTPS (*1) - implicit ftps:// support that use SSL on both connections - - explicit "AUTH TSL" and "AUTH SSL" usage to "upgrade" plain ftp:// + - explicit "AUTH TLS" and "AUTH SSL" usage to "upgrade" plain ftp:// connection to use SSL for both or one of the connections SCP (*8) @@ -104,7 +108,8 @@ SFTP (*8) - with custom commands sent before/after the transfer TFTP - - download / upload + - download + - upload TELNET - connection negotiation @@ -119,12 +124,12 @@ DICT FILE - URL support - - "uploads" + - upload - resume SMTP - authentication: Plain, Login, CRAM-MD5, Digest-MD5 and NTLM (*9) - - send mail + - send e-mails - mail from support - mail size support - mail auth support for trusted server-to-server relaying @@ -142,7 +147,8 @@ POP3 NTLM (*9) - list e-mails - retrieve e-mails - - enhanced command support for: CAPA, DELE, TOP, STAT, UIDL and NOOP + - enhanced command support for: CAPA, DELE, TOP, STAT, UIDL and NOOP via + custom requests - via http-proxy POP3S (*1) @@ -152,10 +158,14 @@ POP3S (*1) IMAP - authentication: Clear Text and SASL - - select mailbox - - basic fetch e-mail support - SASL based authentication: Plain, Login, CRAM-MD5, Digest-MD5 and NTLM (*9) + - list the folders of a mailbox + - select a mailbox with support for verifing the UIDVALIDITY + - fetch e-mails with support for specifing the UID and SECTION + - upload e-mails via the append command + - enhanced command support for: EXAMINE, CREATE, DELETE, RENAME, STATUS, + STORE, COPY and UID via custom requests - via http-proxy IMAPS (*1) @@ -167,12 +177,20 @@ FOOTNOTES ========= *1 = requires OpenSSL, GnuTLS, NSS, yassl, axTLS, PolarSSL, schannel (native - Windows), Secure Transport (native iOS/OS X) or qssl (native IBM i) + Windows), Secure Transport (native iOS/OS X) or qssl (native IBM i) *2 = requires OpenLDAP - *3 = requires a GSSAPI-compliant library, such as Heimdal or similar. + *3 = requires a GSSAPI-compliant library, such as Heimdal or similar *4 = requires FBopenssl - *5 = requires a krb4 library, such as the MIT one or similar. + *5 = requires a krb4 library, such as the MIT one or similar *6 = requires c-ares - *7 = requires OpenSSL or NSS, as GnuTLS only supports SSLv3 and TLSv1 + *7 = requires OpenSSL, NSS, qssl, schannel or Secure Transport; GnuTLS, for + example, only supports SSLv3 and TLSv1 *8 = requires libssh2 - *9 = requires OpenSSL, GnuTLS, NSS, yassl or SSPI (native Windows) + *9 = requires OpenSSL, GnuTLS, NSS, yassl, Secure Transport or SSPI (native + Windows) + *10 = requires any of the SSL libraries in (*1) above other than axTLS, which + does not support SSLv3 + *11 = requires libidn or Windows + *12 = requires libz + *13 = requires libmetalink, and either an Apple or Microsoft operating + system, or OpenSSL, or GnuTLS, or NSS diff --git a/plugins/FTPFileYM/curl/docs/HISTORY b/plugins/FTPFileYM/curl/docs/HISTORY index e04fb53df0..3c140999ec 100644 --- a/plugins/FTPFileYM/curl/docs/HISTORY +++ b/plugins/FTPFileYM/curl/docs/HISTORY @@ -7,19 +7,19 @@ How cURL Became Like This -In the second half of 1997, Daniel Stenberg came up with the idea to make +Towards the end of 1996, Daniel Stenberg came up with the idea to make currency-exchange calculations available to Internet Relay Chat (IRC) users. All the necessary data are published on the Web; he just needed to automate their retrieval. Daniel simply adopted an existing command-line open-source tool, httpget, that -Brazilian Rafael Sagula had written. After a few minor adjustments, it did -just what he needed. +Brazilian Rafael Sagula had written and recently release version 0.1 of. After +a few minor adjustments, it did just what he needed. HttpGet 1.0 was released +on April 8th 1997 with brand new HTTP proxy support. -Soon, he found currencies on a GOPHER site, so support for that had to go in, -and not before long FTP download support was added as well. The name of the -project was changed to urlget to better fit what it actually did now, since -the http-only days were already passed. +We soon found and fixed support for getting currencies over GOPHER. Once FTP +download support was added, the name of the project was changed and urlget 2.0 +was released in August 1997. The http-only days were already passed. The project slowly grew bigger. When upload capabilities were added and the name once again was misleading, a second name change was made and on March 20, diff --git a/plugins/FTPFileYM/curl/docs/INSTALL b/plugins/FTPFileYM/curl/docs/INSTALL index def3ce81e4..4140359dad 100644 --- a/plugins/FTPFileYM/curl/docs/INSTALL +++ b/plugins/FTPFileYM/curl/docs/INSTALL @@ -220,8 +220,8 @@ Win32 adjust as necessary. It is also possible to override these paths with environment variables, for example: - set ZLIB_PATH=c:\zlib-1.2.7 - set OPENSSL_PATH=c:\openssl-0.9.8x + set ZLIB_PATH=c:\zlib-1.2.8 + set OPENSSL_PATH=c:\openssl-0.9.8y set LIBSSH2_PATH=c:\libssh2-1.4.3 ATTENTION: if you want to build with libssh2 support you have to use latest @@ -323,7 +323,7 @@ Win32 documentation on how to compile zlib. Define the ZLIB_PATH environment variable to the location of zlib.h and zlib.lib, for example: - set ZLIB_PATH=c:\zlib-1.2.7 + set ZLIB_PATH=c:\zlib-1.2.8 Then run 'nmake vc-zlib' in curl's root directory. @@ -337,7 +337,7 @@ Win32 Before running nmake define the OPENSSL_PATH environment variable with the root/base directory of OpenSSL, for example: - set OPENSSL_PATH=c:\openssl-0.9.8x + set OPENSSL_PATH=c:\openssl-0.9.8y Then run 'nmake vc-ssl' or 'nmake vc-ssl-dll' in curl's root directory. 'nmake vc-ssl' will create a libcurl static and dynamic @@ -359,7 +359,7 @@ Win32 source distribution archive to allow proper building of the two included projects, the libcurl library and the curl tool. - 1) Open the vc6curl.dsw workspace with MSVC6's IDE. + 1) Open the vs/vc6/vc6curl.dsw workspace with MSVC6's IDE. 2) Select 'Build' from top menu. 3) Select 'Batch Build' from dropdown menu. 4) Make sure that the eight project configurations are 'checked'. @@ -367,12 +367,12 @@ Win32 6) Once the eight project configurations are built you are done. Dynamic and static libcurl libraries are built in debug and release flavours, - and can be located each one in its own subdirectory, DLL-Debug, DLL-Release, - LIB-Debug and LIB-Release, all of them below the 'lib' subdirectory. + and can be located each one in its own subdirectory, dll-debug, dll-release, + lib-debug and lib-release, all of them below the 'vs/vc6/lib' subdirectory. In the same way four curl executables are created, each using its respective library. The resulting curl executables are located in its own subdirectory, - DLL-Debug, DLL-Release, LIB-Debug and LIB-Release, below the 'src' subdir. + dll-debug, dll-release, lib-debug and lib-release, below 'vs/vc6/src' subdir. These reference VC++ 6.0 configurations are generated using the dynamic CRT. @@ -876,7 +876,7 @@ VxWorks Android ======= Method using the static makefile: - - see the build notes in the Android.mk file. + - see the build notes in the packages/Android/Android.mk file. Method using a configure cross-compile (tested with Android NDK r7c, r8): - prepare the toolchain of the Android NDK for standalone use; this can @@ -1045,7 +1045,7 @@ PORTS - Alpha OpenVMS V7.1-1H2 - Alpha Tru64 v5.0 5.1 - AVR32 Linux - - ARM Android 1.5, 2.1 + - ARM Android 1.5, 2.1, 2.3, 3.2, 4.x - ARM INTEGRITY - ARM iOS - Cell Linux @@ -1116,6 +1116,7 @@ GNU GSS http://www.gnu.org/software/gss/ GnuTLS http://www.gnu.org/software/gnutls/ Heimdal http://www.pdc.kth.se/heimdal/ libidn http://www.gnu.org/software/libidn/ +libmetalink https://launchpad.net/libmetalink/ libssh2 http://www.libssh2.org/ MIT Kerberos http://web.mit.edu/kerberos/www/dist/ NSS http://www.mozilla.org/projects/security/pki/nss/ diff --git a/plugins/FTPFileYM/curl/docs/INTERNALS b/plugins/FTPFileYM/curl/docs/INTERNALS index 03839c33d0..66e11a46b7 100644 --- a/plugins/FTPFileYM/curl/docs/INTERNALS +++ b/plugins/FTPFileYM/curl/docs/INTERNALS @@ -42,7 +42,7 @@ Portability cyassl 2.0.0 openldap 2.0 MIT krb5 lib 1.2.4 - qsossl V5R2M0 + qsossl V5R3M0 NSS 3.12.x axTLS 1.2.7 Heimdal ? @@ -52,7 +52,7 @@ Portability curl running fine on: Windows 98 - AS/400 V5R2M0 + AS/400 V5R3M0 Symbian 9.1 Windows CE ? TPF ? @@ -111,6 +111,9 @@ Windows vs Unix Library ======= + (See LIBCURL-STRUCTS for a separate document describing all major internal + structs and their purposes.) + There are plenty of entry points to the library, namely each publicly defined function that libcurl offers to applications. All of those functions are rather small and easy-to-follow. All the ones prefixed with 'curl_easy' are @@ -135,16 +138,18 @@ Library options is documented in the man page. This function mainly sets things in the 'SessionHandle' struct. - curl_easy_perform() does a whole lot of things: + curl_easy_perform() is just a wrapper function that makes use of the multi + API. It basically curl_multi_init(), curl_multi_add_handle(), + curl_multi_wait(), and curl_multi_perform() until the transfer is done and + then returns. - It starts off in the lib/easy.c file by calling Curl_perform() and the main - work then continues in lib/url.c. The flow continues with a call to - Curl_connect() to connect to the remote site. + Some of the most important key functions in url.c are called from multi.c + when certain key steps are to be made in the transfer operation. o Curl_connect() - ... analyzes the URL, it separates the different components and connects to - the remote host. This may involve using a proxy and/or using SSL. The + Analyzes the URL, it separates the different components and connects to the + remote host. This may involve using a proxy and/or using SSL. The Curl_resolv() function in lib/hostip.c is used for looking up host names (it does then use the proper underlying method, which may vary between platforms and builds). @@ -160,10 +165,7 @@ Library o Curl_do() Curl_do() makes sure the proper protocol-specific function is called. The - functions are named after the protocols they handle. Curl_ftp(), - Curl_http(), Curl_dict(), etc. They all reside in their respective files - (ftp.c, http.c and dict.c). HTTPS is handled by Curl_http() and FTPS by - Curl_ftp(). + functions are named after the protocols they handle. The protocol-specific functions of course deal with protocol-specific negotiations and setup. They have access to the Curl_sendf() (from @@ -182,10 +184,9 @@ Library be called with some basic info about the upcoming transfer: what socket(s) to read/write and the expected file transfer sizes (if known). - o Transfer() + o Curl_readwrite() - Curl_perform() then calls Transfer() in lib/transfer.c that performs the - entire file transfer. + Called during the transfer of the actual protocol payload. During transfer, the progress functions in lib/progress.c are called at a frequent interval (or at the user's choice, a specified callback might get @@ -207,33 +208,11 @@ Library used. This function is only used when we are certain that no more transfers is going to be made on the connection. It can be also closed by force, or it can be called to make sure that libcurl doesn't keep too many - connections alive at the same time (there's a default amount of 5 but that - can be changed with the CURLOPT_MAXCONNECTS option). + connections alive at the same time. This function cleans up all resources that are associated with a single connection. - Curl_perform() is the function that does the main "connect - do - transfer - - done" loop. It loops if there's a Location: to follow. - - When completed, the curl_easy_cleanup() should be called to free up used - resources. It runs Curl_disconnect() on all open connections. - - A quick roundup on internal function sequences (many of these call - protocol-specific function-pointers): - - Curl_connect - connects to a remote site and does initial connect fluff - This also checks for an existing connection to the requested site and uses - that one if it is possible. - - Curl_do - starts a transfer - Curl_handler::do_it() - transfers data - Curl_done - ends a transfer - - Curl_disconnect - disconnects from a remote site. This is called when the - disconnect is really requested, which doesn't necessarily have to be - exactly after curl_done in case we want to keep the connection open for - a while. HTTP(S) @@ -316,48 +295,38 @@ Persistent Connections hold connection-oriented data. It is meant to hold the root data as well as all the options etc that the library-user may choose. o The 'SessionHandle' struct holds the "connection cache" (an array of - pointers to 'connectdata' structs). There's one connectdata struct - allocated for each connection that libcurl knows about. Note that when you - use the multi interface, the multi handle will hold the connection cache - and not the particular easy handle. This of course to allow all easy handles - in a multi stack to be able to share and re-use connections. + pointers to 'connectdata' structs). o This enables the 'curl handle' to be reused on subsequent transfers. - o When we are about to perform a transfer with curl_easy_perform(), we first - check for an already existing connection in the cache that we can use, - otherwise we create a new one and add to the cache. If the cache is full - already when we add a new connection, we close one of the present ones. We - select which one to close dependent on the close policy that may have been - previously set. - o When the transfer operation is complete, we try to leave the connection - open. Particular options may tell us not to, and protocols may signal - closure on connections and then we don't keep it open of course. + o When libcurl is told to perform a transfer, it first checks for an already + existing connection in the cache that we can use. Otherwise it creates a + new one and adds that the cache. If the cache is full already when a new + conncetion is added added, it will first close the oldest unused one. + o When the transfer operation is complete, the connection is left + open. Particular options may tell libcurl not to, and protocols may signal + closure on connections and then they won't be kept open of course. o When curl_easy_cleanup() is called, we close all still opened connections, unless of course the multi interface "owns" the connections. - You do realize that the curl handle must be re-used in order for the - persistent connections to work. + The curl handle must be re-used in order for the persistent connections to + work. multi interface/non-blocking ============================ - We make an effort to provide a non-blocking interface to the library, the - multi interface. To make that interface work as good as possible, no - low-level functions within libcurl must be written to work in a blocking - manner. + The multi interface is a non-blocking interface to the library. To make that + interface work as good as possible, no low-level functions within libcurl + must be written to work in a blocking manner. (There are still a few spots + violating this rule.) One of the primary reasons we introduced c-ares support was to allow the name resolve phase to be perfectly non-blocking as well. - The ultimate goal is to provide the easy interface simply by wrapping the - multi interface functions and thus treat everything internally as the multi - interface is the single interface we have. - - The FTP and the SFTP/SCP protocols are thus perfect examples of how we adapt - and adjust the code to allow non-blocking operations even on multi-stage - protocols. They are built around state machines that return when they could - block waiting for data. The DICT, LDAP and TELNET protocols are crappy - examples and they are subject for rewrite in the future to better fit the - libcurl protocol family. + The FTP and the SFTP/SCP protocols are examples of how we adapt and adjust + the code to allow non-blocking operations even on multi-stage command- + response protocols. They are built around state machines that return when + they would otherwise block waiting for data. The DICT, LDAP and TELNET + protocols are crappy examples and they are subject for rewrite in the future + to better fit the libcurl protocol family. SSL libraries ============= @@ -408,12 +377,12 @@ API/ABI Client ====== - main() resides in src/main.c together with most of the client code. + main() resides in src/tool_main.c. src/tool_hugehelp.c is automatically generated by the mkhelp.pl perl script - to display the complete "manual" and the src/urlglob.c file holds the - functions used for the URL-"globbing" support. Globbing in the sense that - the {} and [] expansion stuff is there. + to display the complete "manual" and the src/tool_urlglob.c file holds the + functions used for the URL-"globbing" support. Globbing in the sense that the + {} and [] expansion stuff is there. The client mostly messes around to setup its 'config' struct properly, then it calls the curl_easy_*() functions of the library and when it gets back @@ -425,8 +394,8 @@ Client curl_easy_getinfo() function to extract useful information from the curl session. - Recent versions may loop and do all this several times if many URLs were - specified on the command line or config file. + It may loop and do all this several times if many URLs were specified on the + command line or config file. Memory Debugging ================ diff --git a/plugins/FTPFileYM/curl/docs/KNOWN_BUGS b/plugins/FTPFileYM/curl/docs/KNOWN_BUGS index d36382740e..d53d970d96 100644 --- a/plugins/FTPFileYM/curl/docs/KNOWN_BUGS +++ b/plugins/FTPFileYM/curl/docs/KNOWN_BUGS @@ -3,20 +3,42 @@ join in and help us correct one or more of these! Also be sure to check the changelog of the current development status, as one or more of these problems may have been fixed since this was written! +84. CURLINFO_SSL_VERIFYRESULT is only implemented for the OpenSSL and NSS + backends, so relying on this information in a generic app is flaky. + +83. curl is unable to load non-default openssl engines, because openssl isn't + initialized properly. This seems to require OpenSSL_config() or + CONF_modules_load_file() to be used by libcurl but the first seems to not + work and we've gotten not reports from tests with the latter. Possibly we + need to discuss with OpenSSL developers how this is supposed to be done. We + need users with actual external openssl engines for testing to work on this. + http://curl.haxx.se/bug/view.cgi?id=1208 + +82. When building with the Windows Borland compiler, it fails because the + "tlib" tool doesn't support hyphens (minus signs) in file names and we have + such in the build. + http://curl.haxx.se/bug/view.cgi?id=1222 + +81. When using -J (with -O), automaticly resumed downloading together with "-C + -" fails. Without -J the same command line works! This happens because the + resume logic is worked out before the target file name (and thus its + pre-transfer size) has been figured out! + http://curl.haxx.se/bug/view.cgi?id=1169 + 80. Curl doesn't recognize certificates in DER format in keychain, but it works with PEM. - http://curl.haxx.se/bug/view.cgi?id=3439999 + http://curl.haxx.se/bug/view.cgi?id=1065 79. SMTP. When sending data to multiple recipients, curl will abort and return failure if one of the recipients indicate failure (on the "RCPT TO" command). Ordinary mail programs would proceed and still send to the ones that can receive data. This is subject for change in the future. - http://curl.haxx.se/bug/view.cgi?id=3438362 + http://curl.haxx.se/bug/view.cgi?id=1116 78. curl and libcurl don't always signal the client properly when "sending" zero bytes files - it makes for example the command line client not creating any file at all. Like when using FTP. - http://curl.haxx.se/bug/view.cgi?id=3438362 + http://curl.haxx.se/bug/view.cgi?id=1063 77. CURLOPT_FORBID_REUSE on a handle prevents NTLM from working since it "abuses" the underlying connection re-use system and if connections are @@ -31,7 +53,7 @@ may have been fixed since this was written! properly if built with UNICODE defined together with the schannel/winssl backend. The original problem was mentioned in: http://curl.haxx.se/mail/lib-2009-10/0024.html - http://curl.haxx.se/bug/view.cgi?id=2944325 + http://curl.haxx.se/bug/view.cgi?id=896 The schannel version verified to work as mentioned in http://curl.haxx.se/mail/lib-2012-07/0073.html @@ -41,7 +63,7 @@ may have been fixed since this was written! acknowledge the connection timeout during that phase but only the "real" timeout - which may surprise users as it is probably considered to be the connect phase to most people. Brought up (and is being misunderstood) in: - http://curl.haxx.se/bug/view.cgi?id=2844077 + http://curl.haxx.se/bug/view.cgi?id=856 72. "Pausing pipeline problems." http://curl.haxx.se/mail/lib-2009-07/0214.html @@ -59,7 +81,7 @@ may have been fixed since this was written! http://tools.ietf.org/html/draft-reschke-rfc2231-in-http-02 66. When using telnet, the time limitation options don't work. - http://curl.haxx.se/bug/view.cgi?id=2818950 + http://curl.haxx.se/bug/view.cgi?id=846 65. When doing FTP over a socks proxy or CONNECT through HTTP proxy and the multi interface is used, libcurl will fail if the (passive) TCP connection @@ -85,19 +107,12 @@ may have been fixed since this was written! CURLOPT_FAILONERROR with FTP to detect if a file exists or not, but it is not working: http://curl.haxx.se/mail/lib-2008-07/0295.html -57. On VMS-Alpha: When using an http-file-upload the file is not sent to the - Server with the correct content-length. Sending a file with 511 or less - bytes, content-length 512 is used. Sending a file with 513 - 1023 bytes, - content-length 1024 is used. Files with a length of a multiple of 512 Bytes - show the correct content-length. Only these files work for upload. - http://curl.haxx.se/bug/view.cgi?id=2057858 - 56. When libcurl sends CURLOPT_POSTQUOTE commands when connected to a SFTP server using the multi interface, the commands are not being sent correctly and instead the connection is "cancelled" (the operation is considered done) prematurely. There is a half-baked (busy-looping) patch provided in the bug report but it cannot be accepted as-is. See - http://curl.haxx.se/bug/view.cgi?id=2006544 + http://curl.haxx.se/bug/view.cgi?id=748 55. libcurl fails to build with MIT Kerberos for Windows (KfW) due to KfW's library header files exporting symbols/macros that should be kept private @@ -121,12 +136,12 @@ may have been fixed since this was written! protocol code. This should be very rare. 43. There seems to be a problem when connecting to the Microsoft telnet server. - http://curl.haxx.se/bug/view.cgi?id=1720605 + http://curl.haxx.se/bug/view.cgi?id=649 41. When doing an operation over FTP that requires the ACCT command (but not when logging in), the operation will fail since libcurl doesn't detect this and thus fails to issue the correct command: - http://curl.haxx.se/bug/view.cgi?id=1693337 + http://curl.haxx.se/bug/view.cgi?id=635 39. Steffen Rumler's Race Condition in Curl_proxyCONNECT: http://curl.haxx.se/mail/lib-2007-01/0045.html @@ -139,7 +154,7 @@ may have been fixed since this was written! 34. The SOCKS4 connection codes don't properly acknowledge (connect) timeouts. Also see #12. According to bug #1556528, even the SOCKS5 connect code does - not do it right: http://curl.haxx.se/bug/view.cgi?id=1556528, + not do it right: http://curl.haxx.se/bug/view.cgi?id=604 31. "curl-config --libs" will include details set in LDFLAGS when configure is run that might be needed only for building libcurl. Further, curl-config @@ -154,13 +169,12 @@ may have been fixed since this was written! IDs in URLs to get around the problem of percent signs being special. According to the reporter, Firefox deals with the URL _with_ a percent letter (which seems like a blatant URL spec violation). - libcurl supports zone IDs where the percent sign is URL-escaped (i.e. %25). - - See http://curl.haxx.se/bug/view.cgi?id=1371118 + libcurl supports zone IDs where the percent sign is URL-escaped (i.e. %25): + http://curl.haxx.se/bug/view.cgi?id=555 26. NTLM authentication using SSPI (on Windows) when (lib)curl is running in "system context" will make it use wrong(?) user name - at least when compared - to what winhttp does. See http://curl.haxx.se/bug/view.cgi?id=1281867 + to what winhttp does. See http://curl.haxx.se/bug/view.cgi?id=535 23. SOCKS-related problems: B) libcurl doesn't support FTPS over a SOCKS proxy. @@ -169,12 +183,6 @@ may have been fixed since this was written! We probably have even more bugs and lack of features when a SOCKS proxy is used. -22. Sending files to a FTP server using curl on VMS, might lead to curl - complaining on "unaligned file size" on completion. The problem is related - to VMS file structures and the perceived file sizes stat() returns. A - possible fix would involve sending a "STRU VMS" command. - http://curl.haxx.se/bug/view.cgi?id=1156287 - 21. FTP ASCII transfers do not follow RFC959. They don't convert the data accordingly (not for sending nor for receiving). RFC 959 section 3.1.1.1 clearly describes how this should be done: @@ -212,7 +220,7 @@ may have been fixed since this was written! 10. To get HTTP Negotiate authentication to work fine, you need to provide a (fake) user name (this concerns both curl and the lib) because the code wrongly only considers authentication if there's a user name provided. - http://curl.haxx.se/bug/view.cgi?id=1004841. How? + http://curl.haxx.se/bug/view.cgi?id=440 How? http://curl.haxx.se/mail/lib-2004-08/0182.html 8. Doing resumed upload over HTTP does not work with '-C -', because curl diff --git a/plugins/FTPFileYM/curl/docs/Makefile.am b/plugins/FTPFileYM/curl/docs/Makefile.am index 0701ba823f..8466a6c296 100644 --- a/plugins/FTPFileYM/curl/docs/Makefile.am +++ b/plugins/FTPFileYM/curl/docs/Makefile.am @@ -5,7 +5,7 @@ # | (__| |_| | _ <| |___ # \___|\___/|_| \_\_____| # -# Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. +# Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms @@ -22,7 +22,8 @@ AUTOMAKE_OPTIONS = foreign no-dependencies -man_MANS = curl.1 curl-config.1 mk-ca-bundle.1 +man_MANS = curl.1 curl-config.1 +noinst_man_MANS = mk-ca-bundle.1 GENHTMLPAGES = curl.html curl-config.html mk-ca-bundle.html PDFPAGES = curl.pdf curl-config.pdf mk-ca-bundle.pdf @@ -36,7 +37,7 @@ EXTRA_DIST = MANUAL BUGS CONTRIBUTE FAQ FEATURES INTERNALS SSLCERTS \ README.win32 RESOURCES TODO TheArtOfHttpScripting THANKS VERSIONS \ KNOWN_BUGS BINDINGS $(man_MANS) $(HTMLPAGES) HISTORY INSTALL \ $(PDFPAGES) LICENSE-MIXING README.netware DISTRO-DILEMMA INSTALL.devcpp \ - MAIL-ETIQUETTE HTTP-COOKIES + MAIL-ETIQUETTE HTTP-COOKIES LIBCURL-STRUCTS MAN2HTML= roffit < $< >$@ diff --git a/plugins/FTPFileYM/curl/docs/Makefile.in b/plugins/FTPFileYM/curl/docs/Makefile.in index dbce191355..971c63f1db 100644 --- a/plugins/FTPFileYM/curl/docs/Makefile.in +++ b/plugins/FTPFileYM/curl/docs/Makefile.in @@ -1,9 +1,8 @@ -# Makefile.in generated by automake 1.11.6 from Makefile.am. +# Makefile.in generated by automake 1.14 from Makefile.am. # @configure_input@ -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software -# Foundation, Inc. +# Copyright (C) 1994-2013 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -22,7 +21,7 @@ # | (__| |_| | _ <| |___ # \___|\___/|_| \_\_____| # -# Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. +# Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms @@ -37,23 +36,51 @@ # ########################################################################### VPATH = @srcdir@ -am__make_dryrun = \ - { \ - am__dry=no; \ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ - echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ - | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ - *) \ - for am__flg in $$MAKEFLAGS; do \ - case $$am__flg in \ - *=*|--*) ;; \ - *n*) am__dry=yes; break;; \ - esac; \ - done;; \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ - test $$am__dry = yes; \ - } + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -73,8 +100,8 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = docs -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in INSTALL \ - THANKS TODO +DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ + $(top_srcdir)/mkinstalldirs INSTALL THANKS TODO ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/curl-compilers.m4 \ $(top_srcdir)/m4/curl-confopts.m4 \ @@ -84,7 +111,9 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/curl-compilers.m4 \ $(top_srcdir)/m4/curl-reentrant.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/xc-am-iface.m4 \ $(top_srcdir)/m4/xc-cc-check.m4 \ + $(top_srcdir)/m4/xc-lt-iface.m4 \ $(top_srcdir)/m4/xc-translit.m4 \ $(top_srcdir)/m4/xc-val-flgs.m4 \ $(top_srcdir)/m4/zz40-xc-ovr.m4 \ @@ -98,17 +127,30 @@ CONFIG_HEADER = $(top_builddir)/lib/curl_config.h \ $(top_builddir)/include/curl/curlbuild.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = depcomp = am__depfiles_maybe = SOURCES = DIST_SOURCES = -RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ - html-recursive info-recursive install-data-recursive \ - install-dvi-recursive install-exec-recursive \ - install-html-recursive install-info-recursive \ - install-pdf-recursive install-ps-recursive install-recursive \ - installcheck-recursive installdirs-recursive pdf-recursive \ - ps-recursive uninstall-recursive +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -146,9 +188,29 @@ am__installdirs = "$(DESTDIR)$(man1dir)" MANS = $(man_MANS) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive -AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ - $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) @@ -180,6 +242,7 @@ am__relativize = \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ @@ -212,6 +275,7 @@ CURL_DISABLE_RTSP = @CURL_DISABLE_RTSP@ CURL_DISABLE_SMTP = @CURL_DISABLE_SMTP@ CURL_DISABLE_TELNET = @CURL_DISABLE_TELNET@ CURL_DISABLE_TFTP = @CURL_DISABLE_TFTP@ +CURL_LT_SHLIB_VERSIONED_FLAVOUR = @CURL_LT_SHLIB_VERSIONED_FLAVOUR@ CURL_NETWORK_AND_TIME_LIBS = @CURL_NETWORK_AND_TIME_LIBS@ CURL_NETWORK_LIBS = @CURL_NETWORK_LIBS@ CYGPATH_W = @CYGPATH_W@ @@ -225,6 +289,7 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_SHARED = @ENABLE_SHARED@ +ENABLE_STATIC = @ENABLE_STATIC@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ @@ -240,7 +305,6 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ IPV6_ENABLED = @IPV6_ENABLED@ -KRB4_ENABLED = @KRB4_ENABLED@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBCURL_LIBS = @LIBCURL_LIBS@ @@ -296,6 +360,7 @@ USE_GNUTLS = @USE_GNUTLS@ USE_GNUTLS_NETTLE = @USE_GNUTLS_NETTLE@ USE_LIBRTMP = @USE_LIBRTMP@ USE_LIBSSH2 = @USE_LIBSSH2@ +USE_NGHTTP2 = @USE_NGHTTP2@ USE_NSS = @USE_NSS@ USE_OPENLDAP = @USE_OPENLDAP@ USE_POLARSSL = @USE_POLARSSL@ @@ -303,7 +368,6 @@ USE_SCHANNEL = @USE_SCHANNEL@ USE_SSLEAY = @USE_SSLEAY@ USE_WINDOWS_SSPI = @USE_WINDOWS_SSPI@ VERSION = @VERSION@ -VERSIONED_FLAVOUR = @VERSIONED_FLAVOUR@ VERSIONNUM = @VERSIONNUM@ ZLIB_LIBS = @ZLIB_LIBS@ abs_builddir = @abs_builddir@ @@ -361,7 +425,8 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = foreign no-dependencies -man_MANS = curl.1 curl-config.1 mk-ca-bundle.1 +man_MANS = curl.1 curl-config.1 +noinst_man_MANS = mk-ca-bundle.1 GENHTMLPAGES = curl.html curl-config.html mk-ca-bundle.html PDFPAGES = curl.pdf curl-config.pdf mk-ca-bundle.pdf HTMLPAGES = $(GENHTMLPAGES) index.html @@ -371,7 +436,7 @@ EXTRA_DIST = MANUAL BUGS CONTRIBUTE FAQ FEATURES INTERNALS SSLCERTS \ README.win32 RESOURCES TODO TheArtOfHttpScripting THANKS VERSIONS \ KNOWN_BUGS BINDINGS $(man_MANS) $(HTMLPAGES) HISTORY INSTALL \ $(PDFPAGES) LICENSE-MIXING README.netware DISTRO-DILEMMA INSTALL.devcpp \ - MAIL-ETIQUETTE HTTP-COOKIES + MAIL-ETIQUETTE HTTP-COOKIES LIBCURL-STRUCTS MAN2HTML = roffit < $< >$@ SUFFIXES = .1 .html .pdf @@ -460,22 +525,25 @@ uninstall-man1: dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) # This directory's subdirectories are mostly independent; you can cd -# into them and run `make' without going through this Makefile. -# To change the values of `make' variables: instead of editing Makefiles, -# (1) if the variable is set in `config.status', edit `config.status' -# (which will cause the Makefiles to be regenerated when you run `make'); -# (2) otherwise, pass the desired values on the `make' command line. -$(RECURSIVE_TARGETS): - @fail= failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ @@ -490,57 +558,12 @@ $(RECURSIVE_TARGETS): $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" -$(RECURSIVE_CLEAN_TARGETS): - @fail= failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - rev=''; for subdir in $$list; do \ - if test "$$subdir" = "."; then :; else \ - rev="$$subdir $$rev"; \ - fi; \ - done; \ - rev="$$rev ."; \ - target=`echo $@ | sed s/-recursive//`; \ - for subdir in $$rev; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done && test -z "$$fail" -tags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ - done -ctags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ - done +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ @@ -556,12 +579,7 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ + $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ @@ -573,15 +591,11 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $$unique; \ fi; \ fi -ctags: CTAGS -CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique @@ -590,24 +604,26 @@ GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) - @list='$(MANS)'; if test -n "$$list"; then \ - list=`for p in $$list; do \ - if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ - if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \ - if test -n "$$list" && \ - grep 'ab help2man is required to generate this page' $$list >/dev/null; then \ - echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \ - grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \ - echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \ - echo " typically \`make maintainer-clean' will remove them" >&2; \ - exit 1; \ - else :; fi; \ - else :; fi @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ @@ -765,23 +781,21 @@ uninstall-am: uninstall-man uninstall-man: uninstall-man1 -.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ - install-am install-strip tags-recursive - -.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ - all all-am check check-am clean clean-generic clean-libtool \ - ctags ctags-recursive distclean distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-man1 install-pdf \ - install-pdf-am install-ps install-ps-am install-strip \ - installcheck installcheck-am installdirs installdirs-am \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags tags-recursive uninstall uninstall-am uninstall-man \ - uninstall-man1 +.MAKE: $(am__recursive_targets) install-am install-strip + +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ + check-am clean clean-generic clean-libtool cscopelist-am ctags \ + ctags-am distclean distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-man1 install-pdf install-pdf-am install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ + uninstall-am uninstall-man uninstall-man1 html: $(HTMLPAGES) diff --git a/plugins/FTPFileYM/curl/docs/SSLCERTS b/plugins/FTPFileYM/curl/docs/SSLCERTS index 0d1414cea6..e6b05c3e3f 100644 --- a/plugins/FTPFileYM/curl/docs/SSLCERTS +++ b/plugins/FTPFileYM/curl/docs/SSLCERTS @@ -1,6 +1,12 @@ Peer SSL Certificate Verification ================================= +(NOTE: If libcurl was built with Schannel or Secure Transport support, then +this does not apply to you. Scroll down for details on how the OS-native +engines handle SSL certificates. If you're not sure, then run "curl -V" and +read the results. If the version string says "WinSSL" in it, then it was built +with Schannel support.) + libcurl performs peer SSL certificate verification by default. This is done by using CA cert bundle that the SSL library can use to make sure the peer's server certificate is valid. @@ -93,24 +99,40 @@ server. Peer SSL Certificate Verification with NSS ========================================== -If libcurl is build with NSS support then depending on the OS distribution it -is probably required to take some additional steps to use the system-wide CA -cert db. RedHat ships with an additional module libnsspem.so which enables NSS -to read the OpenSSL PEM CA bundle. With OpenSuSE this lib is missing, and NSS -can only work with its own internal formats. Also NSS got a new database -format: -https://wiki.mozilla.org/NSS_Shared_DB -Starting with version 7.19.7 libcurl will check for the NSS version it runs, -and add automatically the 'sql:' prefix to the certdb directory (either the +If libcurl was built with NSS support, then depending on the OS distribution, +it is probably required to take some additional steps to use the system-wide CA +cert db. RedHat ships with an additional module, libnsspem.so, which enables +NSS to read the OpenSSL PEM CA bundle. This library is missing in OpenSuSE, and +without it, NSS can only work with its own internal formats. NSS also has a new +database format: https://wiki.mozilla.org/NSS_Shared_DB + +Starting with version 7.19.7, libcurl will check for the NSS version it runs, +and automatically add the 'sql:' prefix to the certdb directory (either the hardcoded default /etc/pki/nssdb or the directory configured with SSL_DIR -environment variable) if a version 3.12.0 or later is detected. -To check which certdb format your distribution provides examine the default -certdb location /etc/pki/nssdb; the new certdb format can be identified by +environment variable) if version 3.12.0 or later is detected. To check which +ertdb format your distribution provides, examine the default +certdb location: /etc/pki/nssdb; the new certdb format can be identified by the filenames cert9.db, key4.db, pkcs11.txt; filenames of older versions are cert8.db, key3.db, modsec.db. -Usually these cert databases are empty; but NSS also has built-in CAs which are -provided through a shared library libnssckbi.so; if you want to use these -built-in CAs then create a symlink to libnssckbi.so in /etc/pki/nssdb: -ln -s /usr/lib[64]/libnssckbi.so /etc/pki/nssdb/libnssckbi.so +Usually these cert databases are empty, but NSS also has built-in CAs which are +provided through a shared library, libnssckbi.so; if you want to use these +built-in CAs, then create a symlink to libnssckbi.so in /etc/pki/nssdb: +ln -s /usr/lib[64]/libnssckbi.so /etc/pki/nssdb/libnssckbi.so + Peer SSL Certificate Verification with Schannel and Secure Transport + ==================================================================== + +If libcurl was built with Schannel (Microsoft's TLS/SSL engine) or Secure +Transport (Apple's TLS/SSL engine) support, then libcurl will still perform +peer certificate verification, but instead of using a CA cert bundle, it will +use the certificates that are built into the OS. These are the same +certificates that appear in the Internet Options control panel (under Windows) +or Keychain Access application (under OS X). Any custom security rules for +certificates will be honored. + +Schannel will run CRL checks on certificates unless peer verification is +disabled. Secure Transport on iOS will run OCSP checks on certificates unless +peer verification is disabled. Secure Transport on OS X will run either OCSP +or CRL checks on certificates if those features are enabled, and this behavior +can be adjusted in the preferences of Keychain Access. diff --git a/plugins/FTPFileYM/curl/docs/THANKS b/plugins/FTPFileYM/curl/docs/THANKS index 46965163b0..693139bf73 100644 --- a/plugins/FTPFileYM/curl/docs/THANKS +++ b/plugins/FTPFileYM/curl/docs/THANKS @@ -13,14 +13,15 @@ Adam Tkac Adrian Schuur Adriano Meirelles Ajit Dhumale +Aki Koskinen Akos Pasztory Alan Pinstein -Albert Chin Albert Chin-A-Young Albert Choy Ale Vesely Alejandro Alvarez Aleksandar Milivojevic +Aleksey Tulinov Alessandro Ghedini Alessandro Vesely Alex Bligh @@ -31,6 +32,7 @@ Alex Suykov Alex Vinnik Alex aka WindEagle Alexander Beedie +Alexander Klauer Alexander Kourakos Alexander Krasnostavsky Alexander Lazic @@ -46,11 +48,13 @@ Amol Pattekar Amr Shahin Anatoli Tubman Anders Gustafsson +Anders Havn Andi Jahja Andre Guibert de Bruet Andreas Damm Andreas Faerber Andreas Farber +Andreas Malzahn Andreas Ntaflos Andreas Olsson Andreas Rieke @@ -64,9 +68,11 @@ Andrew Biggs Andrew Bushnell Andrew Francis Andrew Fuller +Andrew Kurushin Andrew Moise Andrew Wansink Andrew de los Reyes +Andrii Moiseiev Andrés GarcÃa Andy Cedilnik Andy Serpa @@ -89,6 +95,7 @@ Ates Goral Augustus Saunders Avery Fay Axel Tillequin +Balaji Parasuram Balint Szilakszi Bart Whiteley Bas Mevissen @@ -100,17 +107,20 @@ Ben Van Hof Ben Winslow Benbuck Nason Benjamin Gerard +Benjamin Gilbert Benjamin Johnson Bernard Leak Bernhard Reutner-Fischer Bertrand Demiddelaer Bill Egert Bill Hoffman +Bill Middlecamp Bjoern Sikora Bjorn Augustsson Bjorn Reese Björn Stenberg Blaise Potard +Bob Relyea Bob Richmond Bob Schader Bogdan Nicula @@ -128,8 +138,10 @@ Brian R Duffy Brian Ulm Brock Noland Bruce Mitchener +Bruno de Carvalho Bryan Henderson Bryan Kemp +Byrial Jensen Cameron Kaiser Camille Moncelier Caolan McNamara @@ -150,13 +162,13 @@ Chris Maltby Chris Mumford Chris Smowton Christian Grothoff -Christian Hagele Christian Hägele Christian Krause Christian Kurz Christian Robottom Reis Christian Schmitz Christian Vogt +Christian Weisgerber Christophe Demory Christophe Legry Christopher Conroy @@ -166,6 +178,7 @@ Christopher Stone Ciprian Badescu Claes Jakobsson Clarence Gardner +Clemens Gruber Clifford Wolf Cody Jones Colin Hogben @@ -177,10 +190,10 @@ Craig A West Craig Davison Craig Markwardt Cris Bailiff -Cristian Rodriguez Cristian RodrÃguez Curt Bogmine Cyrill Osterwalder +Cédric Deltheil Dag Ekengren Dagobert Michelsen Damien Adant @@ -228,6 +241,7 @@ David Odin David Phillips David Rosenstrauch David Shaw +David Strauss David Tarendash David Thiel David Wright @@ -260,6 +274,7 @@ Douglas R. Horner Douglas Steinwand Dov Murik Duane Cathey +Duncan Duncan Mac-Vicar Prett Dustin Boswell Dylan Ellicott @@ -268,9 +283,11 @@ Early Ehlinger Ebenezer Ikonne Edin Kadribasic Eduard Bloch +Edward Rudd Edward Sheldrake Eelco Dolstra Eetu Ojanen +Eldar Zaitov Ellis Pritchard Emanuele Bovisio Emil Romanus @@ -284,15 +301,18 @@ Eric Lavigne Eric Melville Eric Mertens Eric Rautman +Eric S. Raymond Eric Thelin Eric Vergnaud Eric Wong Eric Young Erick Nuwendam +Erik Johansson Erwan Legrand Erwin Authried Eugene Kotlyarov Evan Jordan +Evgeny Turnaev Eygene Ryabinkin Fabian Hiernaux Fabian Keil @@ -313,6 +333,7 @@ Fred Machado Fred New Fred Noz Frederic Lepied +Fredrik Thulin Gabriel Kuri Gabriel Sjoberg Garrett Holmstrom @@ -356,6 +377,7 @@ Gwenole Beauchesne Götz Babin-Ebell Hamish Mackenzie Hang Kin Lau +Hang Su Hanno Kranzhoff Hans Steegers Hans-Jurgen May @@ -390,6 +412,7 @@ Immanuel Gregoire Ingmar Runge Ingo Ralf Blum Ingo Wilken +Ishan SinghLevett Jack Zhang Jacky Lam Jacob Meuser @@ -411,6 +434,7 @@ Jan Koen Annot Jan Kunder Jan Schaumann Jan Van Boghout +Jared Jennings Jared Lundell Jari Sundell Jason Glasgow @@ -425,6 +449,7 @@ Jean-Claude Chauve Jean-Francois Bertrand Jean-Louis Lemaire Jean-Marc Ranger +Jean-Noel Rouvignac Jean-Philippe Barrette-LaPierre Jeff Connelly Jeff Johnson @@ -434,6 +459,7 @@ Jeff Pohlmeyer Jeff Weber Jeffrey Pohlmeyer Jeremy Friesner +Jeremy Huddleston Jerome Muffat-Meridol Jerome Vouillon Jerry Wu @@ -445,6 +471,8 @@ Jim Drash Jim Freeman Jim Hollinger Jim Meyering +Jiri Hruska +Jiri Jaburek Jocelyn Jaubert Joe Halpin Joe Malicki @@ -459,6 +487,7 @@ John Bradshaw John Crow John Dennis John E. Malmberg +John Gardiner Myers John Janssen John Joseph Bachir John Kelly @@ -500,8 +529,10 @@ Julien Royer Jun-ichiro itojun Hagino Jurij Smakov Justin Fletcher +Justin Karneges Jörg Mueller-Tolk Jörn Hartroth +Kai Engert Kai Sommerfeld Kai-Uwe Rommel Kalle Vahlman @@ -527,10 +558,12 @@ Kevin Lussier Kevin Reed Kevin Roth Kim Rinnewitz +Kim Vandry Kimmo Kinnunen Kjell Ericson Kjetil Jacobsen Klevtsov Vadim +Konstantin Isakov Kris Kennaway Krishnendu Majumdar Krister Johansen @@ -543,6 +576,7 @@ Larry Fahnoe Lars Buitinck Lars Gustafsson Lars J. Aas +Lars Johannesen Lars Nilsson Lars Torben Wilson Lau Hang Kin @@ -559,11 +593,13 @@ Ling Thio Linus Nielsen Feltzing Lisa Xu Liza Alenchery +LluÃs Batlle i Rossell Loic Dachary Loren Kirkby Luca Altea Luca Alteas Lucas Adamski +Ludovico Cavedon Lukasz Czekierda Luke Amery Luke Call @@ -575,6 +611,7 @@ Mandy Wu Manfred Schwarb Manuel Massing Marc Boucher +Marc Doughty Marc Hoersken Marc Kleine-Budde Marcel Raad @@ -606,6 +643,7 @@ Martin C. Martin Martin Drasar Martin Hager Martin Hedenfalk +Martin Jansen Martin Lemke Martin Skinner Martin Storsjo @@ -616,6 +654,7 @@ Massimo Callegari Mateusz Loskot Mathias Axelsson Mats Lidell +Matt Arsenault Matt Kraai Matt Veenstra Matt Witherspoon @@ -652,12 +691,14 @@ Michal Gorny Michal Kowalczyk Michal Marek Michele Bini +Miguel Angel Mihai Ionescu Mikael Johansson Mikael Sennerholm Mike Bytnar Mike Crowe Mike Dobbs +Mike Giancola Mike Hommey Mike Power Mike Protts @@ -667,6 +708,8 @@ Mitz Wark Mohamed Lrhazi Mohun Biswas Moonesamy +Myk Taylor +Nach M. S. Nathan Coulter Nathan O'Sullivan Nathanael Nerode @@ -700,6 +743,7 @@ Ofer Olaf Flebbe Olaf Stueben Olaf Stüben +Oliver Gondža Olivier Berger Oren Tirosh Ori Avtalion @@ -711,6 +755,7 @@ Pascal Terjan Pasha Kuznetsov Pat Ray Patrice Guerin +Patricia Muscalu Patrick Bihan-Faou Patrick Monnerat Patrick Scott @@ -733,6 +778,7 @@ Pedro Neves Pete Su Peter Bray Peter Forret +Peter Gal Peter Heuchert Peter Hjalmarsson Peter Korsgaard @@ -770,6 +816,7 @@ Quinn Slack Rafa Muyo Rafael Sagula Rainer Canavan +Rainer Jung Rainer Koenig Rajesh Naganathan Ralf S. Engelschall @@ -784,6 +831,7 @@ Reinout van Schouwen Renato Botelho Renaud Chaillat Renaud Duhaut +Renaud Guillard Rene Bernhardt Rene Rebe Reuven Wachtfogel @@ -797,6 +845,7 @@ Richard Bramante Richard Clayton Richard Cooper Richard Gorton +Richard Michael Richard Prescott Richard Silverman Rick Jones @@ -813,6 +862,7 @@ Robert Iakobashvili Robert Olson Robert Schumann Robert Weaver +Robert Wruck Robin Cornelius Robin Johnson Robin Kay @@ -837,6 +887,7 @@ Ryan Schmidt S. Moonesamy Salvador Dávila Salvatore Sorrentino +Sam Deane Sam Listopad Sampo Kellomaki Samuel DÃaz GarcÃa @@ -847,6 +898,7 @@ Sandor Feldi Santhana Todatry Saqib Ali Sara Golemon +Saran Neti Saul good Scott Bailey Scott Barrett @@ -876,8 +928,10 @@ Spacen Jasset Spiridonoff A.V Stadler Stephan Stan van de Burgt +Stanislav Ivochkin Stefan Esser Stefan Krause +Stefan Neis Stefan Teleman Stefan Tomanek Stefan Ulrich @@ -896,6 +950,7 @@ Steve Oliphant Steve Roskowski Steven Bazyl Steven G. Johnson +Steven Gu Steven M. Schweda Steven Parkes Stoned Elipot @@ -924,6 +979,7 @@ Tim Harder Tim Heckman Tim Newsome Tim Sneddon +Timo Sirainen Tinus van den Berg Tobias Rundström Toby Peterson @@ -933,6 +989,7 @@ Todd Ouska Todd Vierling Tom Benoist Tom Donovan +Tom Grace Tom Lee Tom Mattison Tom Moers @@ -958,6 +1015,7 @@ Troels Walsted Hansen Troy Engel Tupone Alfredo Ulf Härnhammar +Ulrich Doehner Ulrich Zadow Venkat Akella Victor Snezhko @@ -983,15 +1041,21 @@ Wesley Laxton Wesley Miaw Wez Furlong Wilfredo Sanchez +Willem Sparreboom Wojciech Zwiefka +Wouter Van Rooy Wu Yongzheng Xavier Bouchoux +Yamada Yasuharu Yang Tse Yarram Sunil Yehoshua Hershberg Yukihiro Kawada Yuriy Sosov +Yves Arrouye Yves Lejeune +Zdenek Pavlas +Zekun Ni Zmey Petroff Zvi Har'El nk diff --git a/plugins/FTPFileYM/curl/docs/TODO b/plugins/FTPFileYM/curl/docs/TODO index 470612d300..8b133dc160 100644 --- a/plugins/FTPFileYM/curl/docs/TODO +++ b/plugins/FTPFileYM/curl/docs/TODO @@ -16,8 +16,8 @@ 1.3 struct lifreq 1.4 signal-based resolver timeouts 1.5 get rid of PATH_MAX - 1.6 progress callback without doubles - 1.7 Happy Eyeball dual stack connect + 1.6 Happy Eyeball dual stack connect + 1.7 Modified buffer size approach 2. libcurl - multi interface 2.1 More non-blocking @@ -38,6 +38,7 @@ 5.1 Better persistency for HTTP 1.0 5.2 support FF3 sqlite cookie files 5.3 Rearrange request header order + 5.4 HTTP2/SPDY 6. TELNET 6.1 ditch stdin @@ -45,36 +46,40 @@ 6.3 feature negotiation debug data 6.4 send data in chunks - 7. SSL - 7.1 Disable specific versions - 7.2 Provide mutex locking API - 7.3 Evaluate SSL patches - 7.4 Cache OpenSSL contexts - 7.5 Export session ids - 7.6 Provide callback for cert verification - 7.7 Support other SSL libraries - 7.9 improve configure --with-ssl - 7.10 Support DANE - - 8. GnuTLS - 8.1 SSL engine stuff - 8.3 check connection - - 9. SMTP - 9.1 Specify the preferred authentication mechanism - 9.2 Initial response - 9.3 Pipelining + 7. SMTP + 7.1 Pipelining + 7.2 Graceful base64 decoding failure + 7.3 Enhanced capability support - 10. POP3 - 10.1 auth= in URLs + 8. POP3 + 8.1 Pipelining + 8.2 Graceful base64 decoding failure + 8.3 Enhanced capability support - 11. LDAP - 11.1 SASL based authentication mechanisms + 9. IMAP + 9.1 Graceful base64 decoding failure + 9.2 Enhanced capability support - 12. Other protocols - - 13. New protocols - 13.1 RSYNC + 10. LDAP + 10.1 SASL based authentication mechanisms + + 11. New protocols + 11.1 RSYNC + + 12. SSL + 12.1 Disable specific versions + 12.2 Provide mutex locking API + 12.3 Evaluate SSL patches + 12.4 Cache OpenSSL contexts + 12.5 Export session ids + 12.6 Provide callback for cert verification + 12.7 Support other SSL libraries + 12.8 improve configure --with-ssl + 12.9 Support DANE + + 13. GnuTLS + 13.1 SSL engine stuff + 13.2 check connection 14. SASL 14.1 Other authentication mechanisms @@ -152,16 +157,7 @@ we need libssh2 to properly tell us when we pass in a too small buffer and its current API (as of libssh2 1.2.7) doesn't. -1.6 progress callback without doubles - - The progress callback was introduced way back in the days and the choice to - use doubles in the arguments was possibly good at the time. Today the doubles - only confuse users and make the amounts less precise. We should introduce - another progress callback option that take precedence over the old one and - have both co-exist for a forseeable time until we can remove the double-using - one. - -1.7 Happy Eyeball dual stack connect +1.6 Happy Eyeball dual stack connect In order to make alternative technologies not suffer when transitioning, like when introducing IPv6 as an alternative to IPv4 and there are more than one @@ -173,6 +169,27 @@ http://tools.ietf.org/html/rfc6555 +1.7 Modified buffer size approach + + Current libcurl allocates a fixed 16K size buffer for download and an + additional 16K for upload. They are always unconditionally part of the easy + handle. If CRLF translations are requested, an additional 32K "scratch + buffer" is allocated. A total of 64K transfer buffers in the worst case. + + First, while the handles are not actually in use these buffers could be freed + so that lingering handles just kept in queues or whatever waste less memory. + + Secondly, SFTP is a protocol that needs to handle many ~30K blocks at once + since each need to be individually acked and therefore libssh2 must be + allowed to send (or receive) many separate ones in parallel to achieve high + transfer speeds. A current libcurl build with a 16K buffer makes that + impossible, but one with a 512K buffer will reach MUCH faster transfers. But + allocating 512K unconditionally for all buffers just in case they would like + to do fast SFTP transfers at some point is not a good solution either. + + Dynamically allocate buffer size depending on protocol in use in combination + with freeing it after each individual transfer? Other suggestions? + 2. libcurl - multi interface @@ -265,6 +282,24 @@ headers use a default value so only headers that need to be moved have to be specified. +5.4 HTTP2/SPDY + + The first drafts for HTTP2 have been published + (http://tools.ietf.org/html/draft-ietf-httpbis-http2-03) and is so far based + on SPDY (http://www.chromium.org/spdy) designs and experiences. Chances are + it will end up in that style. Chrome and Firefox already support SPDY and + lots of web services do. + + It would make sense to implement SPDY support now and later transition into + or add HTTP2 support as well. + + We should base or HTTP2/SPDY work on a 3rd party library for the protocol + fiddling. The Spindy library (http://spindly.haxx.se/) was an attempt to make + such a library with an API suitable for use by libcurl but that effort has + more or less stalled. spdylay (https://github.com/tatsuhiro-t/spdylay) may + be a better option, either used directly or wrapped with a more spindly-like + API. + 6. TELNET @@ -290,25 +325,92 @@ to provide the data to send. use, but inefficient for any other. Sent data should be sent in larger chunks. -7. SSL +7. SMTP + +7.1 Pipelining + + Add support for pipelining emails. + +7.2 Graceful base64 decoding failure + + Rather than shutting down the session and returning an error when the + decoding of a base64 encoded authentication response fails, we should + gracefully shutdown the authentication process by sending a * response to the + server as per RFC4954. + +7.3 Enhanced capability support -7.1 Disable specific versions + Add the ability, for an application that uses libcurl, to obtain the list of + capabilities returned from the EHLO command. + +8. POP3 + +8.1 Pipelining + + Add support for pipelining commands. + +8.2 Graceful base64 decoding failure + + Rather than shutting down the session and returning an error when the + decoding of a base64 encoded authentication response fails, we should + gracefully shutdown the authentication process by sending a * response to the + server as per RFC5034. + +8.3 Enhanced capability support + + Add the ability, for an application that uses libcurl, to obtain the list of + capabilities returned from the CAPA command. + +9. IMAP + +9.1 Graceful base64 decoding failure + + Rather than shutting down the session and returning an error when the + decoding of a base64 encoded authentication response fails, we should + gracefully shutdown the authentication process by sending a * response to the + server as per RFC3501. + +9.2 Enhanced capability support + + Add the ability, for an application that uses libcurl, to obtain the list of + capabilities returned from the CAPABILITY command. + +10. LDAP + +10.1 SASL based authentication mechanisms + + Currently the LDAP module only supports ldap_simple_bind_s() in order to bind + to an LDAP server. However, this function sends username and password details + using the simple authentication mechanism (as clear text). However, it should + be possible to use ldap_bind_s() instead specifing the security context + information ourselves. + +11. New protocols + +11.1 RSYNC + + There's no RFC for the protocol or an URI/URL format. An implementation + should most probably use an existing rsync library, such as librsync. + +12. SSL + +12.1 Disable specific versions Provide an option that allows for disabling specific SSL versions, such as SSLv2 http://curl.haxx.se/bug/feature.cgi?id=1767276 -7.2 Provide mutex locking API +12.2 Provide mutex locking API Provide a libcurl API for setting mutex callbacks in the underlying SSL library, so that the same application code can use mutex-locking independently of OpenSSL or GnutTLS being used. -7.3 Evaluate SSL patches +12.3 Evaluate SSL patches Evaluate/apply Gertjan van Wingerde's SSL patches: http://curl.haxx.se/mail/lib-2004-03/0087.html -7.4 Cache OpenSSL contexts +12.4 Cache OpenSSL contexts "Look at SSL cafile - quick traces look to me like these are done on every request as well, when they should only be necessary once per ssl context (or @@ -318,7 +420,7 @@ to provide the data to send. style connections are re-used. It will make us use slightly more memory but it will libcurl do less creations and deletions of SSL contexts. -7.5 Export session ids +12.5 Export session ids Add an interface to libcurl that enables "session IDs" to get exported/imported. Cris Bailiff said: "OpenSSL has functions which can @@ -326,93 +428,50 @@ to provide the data to send. the state from such a buffer at a later date - this is used by mod_ssl for apache to implement and SSL session ID cache". -7.6 Provide callback for cert verification +12.6 Provide callback for cert verification OpenSSL supports a callback for customised verification of the peer certificate, but this doesn't seem to be exposed in the libcurl APIs. Could it be? There's so much that could be done if it were! -7.7 Support other SSL libraries +12.7 Support other SSL libraries Make curl's SSL layer capable of using other free SSL libraries. Such as MatrixSSL (http://www.matrixssl.org/). -7.9 improve configure --with-ssl +12.8 improve configure --with-ssl make the configure --with-ssl option first check for OpenSSL, then GnuTLS, then NSS... -7.10 Support DANE +12.9 Support DANE DNS-Based Authentication of Named Entities (DANE) is a way to provide SSL keys and certs over DNS using DNSSEC as an alternative to the CA model. http://www.rfc-editor.org/rfc/rfc6698.txt + An initial patch was posted by Suresh Krishnaswamy on March 7th 2013 + (http://curl.haxx.se/mail/lib-2013-03/0075.html) but it was a too simple + approach. See Daniel's comments: + http://curl.haxx.se/mail/lib-2013-03/0103.html . libunbound may be the + correct library to base this development on. -8. GnuTLS +13. GnuTLS -8.1 SSL engine stuff +13.1 SSL engine stuff Is this even possible? -8.3 check connection +13.2 check connection Add a way to check if the connection seems to be alive, to correspond to the SSL_peak() way we use with OpenSSL. - -9. SMTP - -9.1 Specify the preferred authentication mechanism - - Add the ability to specify the preferred authentication mechanism or a list - of mechanisms that should be used. Not only that, but the order that is - returned by the server during the EHLO response should be honored by curl. - -9.2 Initial response - - Add the ability for the user to specify whether the initial response is - included in the AUTH command. Some email servers, such as Microsoft - Exchange, can work with either whilst others need to have the initial - response sent separately: - - http://curl.haxx.se/mail/lib-2012-03/0114.html - -9.3 Pipelining - - Add support for pipelining emails. - -10. POP3 - -10.1 auth= in URLs - - Being able to specify the preferred authentication mechanism in the URL as - per RFC2384. - -11. LDAP - -11.1 SASL based authentication mechanisms - - Currently the LDAP module only supports ldap_simple_bind_s() in order to bind - to an LDAP server. However, this function sends username and password details - using the simple authentication mechanism (as clear text). However, it should - be possible to use ldap_bind_s() instead specifing the security context - information ourselves. - -12. Other protocols - -13. New protocols - -13.1 RSYNC - - There's no RFC for the protocol or an URI/URL format. An implementation - should most probably use an existing rsync library, such as librsync. - 14. SASL 14.1 Other authentication mechanisms - Add support for gssapi to SMTP, POP3 and IMAP. + Add support for GSSAPI to SMTP, POP3 and IMAP. 15. Client diff --git a/plugins/FTPFileYM/curl/docs/curl-config.pdf b/plugins/FTPFileYM/curl/docs/curl-config.pdf Binary files differindex 34aa789e7d..0d0d994246 100644 --- a/plugins/FTPFileYM/curl/docs/curl-config.pdf +++ b/plugins/FTPFileYM/curl/docs/curl-config.pdf diff --git a/plugins/FTPFileYM/curl/docs/curl.1 b/plugins/FTPFileYM/curl/docs/curl.1 index 1aeeb46504..30ef4ccf6f 100644 --- a/plugins/FTPFileYM/curl/docs/curl.1 +++ b/plugins/FTPFileYM/curl/docs/curl.1 @@ -5,7 +5,7 @@ .\" * | (__| |_| | _ <| |___ .\" * \___|\___/|_| \_\_____| .\" * -.\" * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. +.\" * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. .\" * .\" * This software is licensed as described in the file COPYING, which .\" * you should have received as part of this distribution. The terms @@ -103,6 +103,18 @@ any response data to the terminal. If you prefer a progress "bar" instead of the regular meter, \fI-#\fP is your friend. .SH OPTIONS +Options start with one or two dashes. Many of the options require an addition +value next to it. + +The short "single-dash" form of the options, -d for example, may be used with +or without a space between it and its value, although a space is a recommended +separator. The long "double-dash" form, --data for example, requires a space +between it and its value. + +Short version options that don't need any additional values can be used +immediately next to each other, like for example you can specify all the +options -O, -L and -v at once as -OLv. + In general, all boolean options are enabled with --\fBoption\fP and yet again disabled with --\fBno-\fPoption. That is, you use the exact same option name but prefix it with "no-". However, in this list we mostly only list and show @@ -113,8 +125,14 @@ same command line option.) Make curl display progress as a simple progress bar instead of the standard, more informational, meter. .IP "-0, --http1.0" -(HTTP) Forces curl to issue its requests using HTTP 1.0 instead of using its -internally preferred: HTTP 1.1. +(HTTP) Tells curl to use HTTP version 1.0 instead of using its internally +preferred: HTTP 1.1. +.IP "--http1.1" +(HTTP) Tells curl to use HTTP version 1.1. This is the internal default +version. (Added in 7.33.0) +.IP "--http2.0" +(HTTP) Tells curl to issue its requests using HTTP 2.0. This requires that the +underlying libcurl was built to support it. (Added in 7.33.0) .IP "-1, --tlsv1" (SSL) Forces curl to use TLS version 1 when negotiating with a remote TLS server. @@ -230,7 +248,9 @@ server sends an unsupported encoding, curl will report an error. .IP "--connect-timeout <seconds>" Maximum time in seconds that you allow the connection to the server to take. This only limits the connection phase, once curl has connected this option is -of no more use. See also the \fI-m, --max-time\fP option. +of no more use. Since 7.32.0, this option accepts decimal values, but the +actual timeout will decrease in accuracy as the specified timeout increases in +decimal precision. See also the \fI-m, --max-time\fP option. If this option is used several times, the last one will be used. .IP "--create-dirs" @@ -270,7 +290,8 @@ If you start the data with the letter @, the rest should be a file name to read the data from, or - if you want curl to read the data from stdin. The contents of the file must already be URL-encoded. Multiple files can also be specified. Posting data from a file named 'foobar' would thus be done with -\fI--data @foobar\fP. +\fI--data\fP @foobar. When --data is told to read from a file like that, +carriage returns and newlines will be stripped out. .IP "-D, --dump-header <file>" Write the protocol headers to the specified file. @@ -292,7 +313,7 @@ whatsoever. If you start the data with the letter @, the rest should be a filename. Data is posted in a similar manner as \fI--data-ascii\fP does, except that newlines -are preserved and conversions are never done. +and carriage returns are preserved and conversions are never done. If this option is used several times, the ones following the first will append data as described in \fI-d, --data\fP. @@ -367,6 +388,39 @@ is an alias for \fB--disable-epsv\fP. Disabling EPSV only changes the passive behavior. If you want to switch to active mode you need to use \fI-P, --ftp-port\fP. +.IP "--dns-interface <interface>" +Tell curl to send outgoing DNS requests through <interface>. This option +is a counterpart to \fI--interface\fP (which does not affect DNS). The +supplied string must be an interface name (not an address). + +This option requires that libcurl was built with a resolver backend that +supports this operation. The c-ares backend is the only such one. (Added in +7.33.0) +.IP "--dns-ipv4-addr <ip-address>" +Tell curl to bind to <ip-address> when making IPv4 DNS requests, so that +the DNS requests originate from this address. The argument should be a +single IPv4 address. + +This option requires that libcurl was built with a resolver backend that +supports this operation. The c-ares backend is the only such one. (Added in +7.33.0) +.IP "--dns-ipv6-addr <ip-address>" +Tell curl to bind to <ip-address> when making IPv6 DNS requests, so that +the DNS requests originate from this address. The argument should be a +single IPv6 address. + +This option requires that libcurl was built with a resolver backend that +supports this operation. The c-ares backend is the only such one. (Added in +7.33.0) +.IP "--dns-servers <ip-address,ip-address>" +Set the list of DNS servers to be used instead of the system default. +The list of IP addresses should be separated with commas. Port numbers +may also optionally be given as \fI:<port-number>\fP after each IP +address. + +This option requires that libcurl was built with a resolver backend that +supports this operation. The c-ares backend is the only such one. (Added in +7.33.0) .IP "-e, --referer <URL>" (HTTP) Sends the "Referer Page" information to the HTTP server. This can also be set with the \fI-H, --header\fP flag of course. When used with @@ -378,7 +432,8 @@ If this option is used several times, the last one will be used. .IP "-E, --cert <certificate[:password]>" (SSL) Tells curl to use the specified client certificate file when getting a file with HTTPS, FTPS or another SSL-based protocol. The certificate must be -in PEM format. If the optional password isn't specified, it will be queried +in PKCS#12 format if using Secure Transport, or PEM format if using any other +engine. If the optional password isn't specified, it will be queried for on the terminal. Note that this option assumes a \&"certificate" file that is the private key and the private certificate concatenated! See \fI--cert\fP and \fI--key\fP to specify them independently. @@ -388,7 +443,16 @@ curl the nickname of the certificate to use within the NSS database defined by the environment variable SSL_DIR (or by default /etc/pki/nssdb). If the NSS PEM PKCS#11 module (libnsspem.so) is available then PEM files may be loaded. If you want to use a file from the current directory, please precede -it with "./" prefix, in order to avoid confusion with a nickname. +it with "./" prefix, in order to avoid confusion with a nickname. If the +nickname contains ":", it needs to be preceded by "\\" so that it is not +recognized as password delimiter. If the nickname contains "\\", it needs to +be escaped as "\\\\" so that it is not recognized as an escape character. + +(iOS and Mac OS X only) If curl is built against Secure Transport, then the +certificate string can either be the name of a certificate/private key in the +system or user keychain, or the path to a PKCS#12-encoded certificate and +private key. If you want to use a file from the current directory, please +precede it with "./" prefix, in order to avoid confusion with a nickname. If this option is used several times, the last one will be used. .IP "--engine <name>" @@ -805,7 +869,10 @@ Basic authentication). .IP "-m, --max-time <seconds>" Maximum time in seconds that you allow the whole operation to take. This is useful for preventing your batch jobs from hanging for hours due to slow -networks or links going down. See also the \fI--connect-timeout\fP option. +networks or links going down. Since 7.32.0, this option accepts decimal +values, but the actual timeout will decrease in accuracy as the specified +timeout increases in decimal precision. See also the \fI--connect-timeout\fP +option. If this option is used several times, the last one will be used. .IP "--mail-auth <address>" @@ -987,6 +1054,14 @@ you want the file saved in a different directory, make sure you change current working directory before you invoke curl with the \fB-O, --remote-name\fP flag! You may use this option as many times as the number of URLs you have. +.IP "--oauth2-bearer" +(IMAP/POP3/SMTP) Specify the Bearer Token for OAUTH 2.0 server authentication. +The Bearer Token is used in conjuction with the user name which can be +specified as part of the \fI--url\fP or \fI-u, --user\fP options. + +The Bearer Token and user name are formatted according to RFC 6750. + +If this option is used several times, the last one will be used. .IP "-p, --proxytunnel" When an HTTP proxy is used (\fI-x, --proxy\fP), this option will cause non-HTTP protocols to attempt to tunnel through the proxy instead of merely using it to @@ -1038,6 +1113,13 @@ ubiquitous in web browsers, so curl does the conversion by default to maintain consistency. However, a server may require a POST to remain a POST after such a redirection. This option is meaningful only when using \fI-L, --location\fP (Added in 7.19.1) +.IP "--post303" +(HTTP) Tells curl to respect RFC 2616/10.3.2 and not convert POST requests +into GET requests when following a 303 redirection. The non-RFC behaviour is +ubiquitous in web browsers, so curl does the conversion by default to maintain +consistency. However, a server may require a POST to remain a POST after such +a redirection. This option is meaningful only when using \fI-L, --location\fP +(Added in 7.26.0) .IP "--proto <protocols>" Tells curl to use the listed protocols for its initial retrieval. Protocols are evaluated left to right, are comma separated, and are each a protocol @@ -1272,8 +1354,12 @@ Set this option to zero to not timeout retries. (Added in 7.12.3) If this option is used several times, the last one will be used. .IP "-s, --silent" -Silent or quiet mode. Don't show progress meter or error messages. Makes -Curl mute. +Silent or quiet mode. Don't show progress meter or error messages. Makes Curl +mute. It will still output the data you ask for, potentially even to the +terminal/stdout unless you redirect it. +.IP "--sasl-ir" +Enable initial response in SASL authentication. +(Added in 7.31.0) .IP "-S, --show-error" When used with \fI-s\fP it makes curl show an error message if it fails. .IP "--ssl" @@ -1449,16 +1535,23 @@ If this option is used several times, the last one will be used. .IP "--trace-time" Prepends a time stamp to each trace or verbose line that curl displays. (Added in 7.14.0) -.IP "-u, --user <user:password>" -Specify the user name and password to use for server authentication. Overrides -\fI-n, --netrc\fP and \fI--netrc-optional\fP. +.IP "-u, --user <user:password;options>" +Specify the user name, password and optional login options to use for server +authentication. Overrides \fI-n, --netrc\fP and \fI--netrc-optional\fP. -If you just give the user name (without entering a colon) curl will prompt for -a password. +If you simply specify the user name, with or without the login options, curl +will prompt for a password. -If you use an SSPI-enabled curl binary and do NTLM authentication, you can -force curl to pick up the user name and password from your environment by -simply specifying a single colon with this option: "-u :". +If you use an SSPI-enabled curl binary and perform NTLM authentication, you +can force curl to select the user name and password from your environment by +simply specifying a single colon with this option: "-u :" or by specfying the +login options on their own, for example "-u ;auth=NTLM". + +You can use the optional login options part to specify protocol specific +options that may be used during authentication. At present only IMAP, POP3 and +SMTP support login options as part of the user login information. For more +information about the login options please see RFC 2384, RFC 5092 and IETF +draft draft-earhart-url-smtp-00.txt (Added in 7.31.0). If this option is used several times, the last one will be used. .IP "-U, --proxy-user <user:password>" @@ -1619,8 +1712,16 @@ to follow location: headers. If this option is used several times, the last one will be used. .IP "-x, --proxy <[protocol://][user:password@]proxyhost[:port]>" -Use the specified HTTP proxy. If the port number is not specified, it is -assumed at port 1080. +Use the specified proxy. + +The proxy string can be specified with a protocol:// prefix to specify +alternative proxy protocols. Use socks4://, socks4a://, socks5:// or +socks5h:// to request the specific SOCKS version to be used. No protocol +specified, http:// and all others will be treated as HTTP proxies. (The +protocol support was added in curl 7.21.7) + +If the port number is not specified in the proxy string, it is assumed to be +1080. This option overrides existing environment variables that set the proxy to use. If there's an environment variable setting a proxy, you can set proxy to @@ -1639,11 +1740,6 @@ The proxy host can be specified the exact same way as the proxy environment variables, including the protocol prefix (http://) and the embedded user + password. -From 7.21.7, the proxy string may be specified with a protocol:// prefix to -specify alternative proxy protocols. Use socks4://, socks4a://, socks5:// or -socks5h:// to request the specific SOCKS version to be used. No protocol -specified, http:// and all others will be treated as HTTP proxies. - If this option is used several times, the last one will be used. .IP "-X, --request <command>" (HTTP) Specifies a custom request method to use when communicating with the @@ -1669,7 +1765,7 @@ If this option is used several times, the last one will be used. .IP "--xattr" When saving output to a file, this option tells curl to store certain file -metadata in extened file attributes. Currently, the URL is stored in the +metadata in extended file attributes. Currently, the URL is stored in the xdg.origin.url attribute and, for HTTP, the content type is stored in the mime_type attribute. If the file system does not support extended attributes, a warning is issued. @@ -1689,7 +1785,7 @@ speed-time seconds it gets aborted. speed-time is set with \fI-y\fP and is 30 if not set. If this option is used several times, the last one will be used. -.IP "-z/--time-cond <date expression>|<file>" +.IP "-z, --time-cond <date expression>|<file>" (HTTP/FTP) Request a file that has been modified later than the given time and date, or one that has been modified before that time. The <date expression> can be all sorts of date strings or if it doesn't match any internal ones, it diff --git a/plugins/FTPFileYM/curl/docs/curl.html b/plugins/FTPFileYM/curl/docs/curl.html index 5e99ebbeda..c04a69633d 100644 --- a/plugins/FTPFileYM/curl/docs/curl.html +++ b/plugins/FTPFileYM/curl/docs/curl.html @@ -69,11 +69,18 @@ p.roffit { <p class="level0">If you want a progress meter for HTTP POST or PUT requests, you need to redirect the response output to a file, using shell redirect (>), -o [file] or similar. <p class="level0">It is not the same case for FTP upload as that operation does not spit out any response data to the terminal. <p class="level0">If you prefer a progress "bar" instead of the regular meter, <a class="emphasis" href="#-">-#</a> is your friend. <a name="OPTIONS"></a><h2 class="nroffsh">OPTIONS</h2> +<p class="level0">Options start with one or two dashes. Many of the options require an addition value next to it. +<p class="level0">The short "single-dash" form of the options, -d for example, may be used with or without a space between it and its value, although a space is a recommended separator. The long "double-dash" form, --data for example, requires a space between it and its value. +<p class="level0">Short version options that don't need any additional values can be used immediately next to each other, like for example you can specify all the options -O, -L and -v at once as -OLv. <p class="level0">In general, all boolean options are enabled with --<span Class="bold">option</span> and yet again disabled with --<span Class="bold">no-</span>option. That is, you use the exact same option name but prefix it with "no-". However, in this list we mostly only list and show the --option version of them. (This concept with --no options was added in 7.19.0. Previously most options were toggled on/off on repeated use of the same command line option.) <p class="level0"><a name="-"></a><span class="nroffip">-#, --progress-bar</span> <p class="level1">Make curl display progress as a simple progress bar instead of the standard, more informational, meter. <p class="level0"><a name="-0"></a><span class="nroffip">-0, --http1.0</span> -<p class="level1">(HTTP) Forces curl to issue its requests using HTTP 1.0 instead of using its internally preferred: HTTP 1.1. +<p class="level1">(HTTP) Tells curl to use HTTP version 1.0 instead of using its internally preferred: HTTP 1.1. +<p class="level0"><a name="--http11"></a><span class="nroffip">--http1.1</span> +<p class="level1">(HTTP) Tells curl to use HTTP version 1.1. This is the internal default version. (Added in 7.33.0) +<p class="level0"><a name="--http20"></a><span class="nroffip">--http2.0</span> +<p class="level1">(HTTP) Tells curl to issue its requests using HTTP 2.0. This requires that the underlying libcurl was built to support it. (Added in 7.33.0) <p class="level0"><a name="-1"></a><span class="nroffip">-1, --tlsv1</span> <p class="level1">(SSL) Forces curl to use TLS version 1 when negotiating with a remote TLS server. <p class="level0"><a name="-2"></a><span class="nroffip">-2, --sslv2</span> @@ -117,7 +124,7 @@ p.roffit { <p class="level0"><a name="--compressed"></a><span class="nroffip">--compressed</span> <p class="level1">(HTTP) Request a compressed response using one of the algorithms curl supports, and save the uncompressed document. If this option is used and the server sends an unsupported encoding, curl will report an error. <p class="level0"><a name="--connect-timeout"></a><span class="nroffip">--connect-timeout <seconds></span> -<p class="level1">Maximum time in seconds that you allow the connection to the server to take. This only limits the connection phase, once curl has connected this option is of no more use. See also the <a class="emphasis" href="#-m">-m, --max-time</a> option. +<p class="level1">Maximum time in seconds that you allow the connection to the server to take. This only limits the connection phase, once curl has connected this option is of no more use. Since 7.32.0, this option accepts decimal values, but the actual timeout will decrease in accuracy as the specified timeout increases in decimal precision. See also the <a class="emphasis" href="#-m">-m, --max-time</a> option. <p class="level1">If this option is used several times, the last one will be used. <p class="level0"><a name="--create-dirs"></a><span class="nroffip">--create-dirs</span> <p class="level1">When used in conjunction with the <a class="emphasis" href="#-o">-o</a> option, curl will create the necessary local directory hierarchy as needed. This option creates the dirs mentioned with the <a class="emphasis" href="#-o">-o</a> option, nothing else. If the <a class="emphasis" href="#-o">-o</a> file name uses no dir or if the dirs it mentions already exist, no dir will be created. @@ -132,7 +139,7 @@ p.roffit { <p class="level1">(HTTP) Sends the specified data in a POST request to the HTTP server, in the same way that a browser does when a user has filled in an HTML form and presses the submit button. This will cause curl to pass the data to the server using the content-type application/x-www-form-urlencoded. Compare to <a class="emphasis" href="#-F">-F, --form</a>. <p class="level1"><a class="emphasis" href="#-d">-d, --data</a> is the same as <a class="emphasis" href="#--data-ascii">--data-ascii</a>. To post data purely binary, you should instead use the <a class="emphasis" href="#--data-binary">--data-binary</a> option. To URL-encode the value of a form field you may use <a class="emphasis" href="#--data-urlencode">--data-urlencode</a>. <p class="level1">If any of these options is used more than once on the same command line, the data pieces specified will be merged together with a separating &-symbol. Thus, using '-d name=daniel -d skill=lousy' would generate a post chunk that looks like 'name=daniel&skill=lousy'. -<p class="level1">If you start the data with the letter @, the rest should be a file name to read the data from, or - if you want curl to read the data from stdin. The contents of the file must already be URL-encoded. Multiple files can also be specified. Posting data from a file named 'foobar' would thus be done with <span Class="emphasis">--data @foobar</span>. +<p class="level1">If you start the data with the letter @, the rest should be a file name to read the data from, or - if you want curl to read the data from stdin. The contents of the file must already be URL-encoded. Multiple files can also be specified. Posting data from a file named 'foobar' would thus be done with <span Class="emphasis">--data</span> @foobar. When --data is told to read from a file like that, carriage returns and newlines will be stripped out. <p class="level0"><a name="-D"></a><span class="nroffip">-D, --dump-header <file></span> <p class="level1">Write the protocol headers to the specified file. <p class="level1">This option is handy to use when you want to store the headers that an HTTP site sends to you. Cookies from the headers could then be read in a second curl invocation by using the <a class="emphasis" href="#-b">-b, --cookie</a> option! The <a class="emphasis" href="#-c">-c, --cookie-jar</a> option is however a better way to store cookies. @@ -143,7 +150,7 @@ p.roffit { <p class="level1">See <a class="emphasis" href="#-d">-d, --data</a>. <p class="level0"><a name="--data-binary"></a><span class="nroffip">--data-binary <data></span> <p class="level1">(HTTP) This posts data exactly as specified with no extra processing whatsoever. -<p class="level1">If you start the data with the letter @, the rest should be a filename. Data is posted in a similar manner as <a class="emphasis" href="#--data-ascii">--data-ascii</a> does, except that newlines are preserved and conversions are never done. +<p class="level1">If you start the data with the letter @, the rest should be a filename. Data is posted in a similar manner as <a class="emphasis" href="#--data-ascii">--data-ascii</a> does, except that newlines and carriage returns are preserved and conversions are never done. <p class="level1">If this option is used several times, the ones following the first will append data as described in <a class="emphasis" href="#-d">-d, --data</a>. <p class="level0"><a name="--data-urlencode"></a><span class="nroffip">--data-urlencode <data></span> <p class="level1">(HTTP) This posts data, similar to the other --data options with the exception that this performs URL-encoding. (Added in 7.18.0) @@ -181,12 +188,25 @@ p.roffit { <p class="level1">(FTP) Tell curl to disable the use of the EPSV command when doing passive FTP transfers. Curl will normally always first attempt to use EPSV before PASV, but with this option, it will not try using EPSV. <p class="level1"><span Class="bold">--epsv</span> can be used to explicitly enable EPSV again and <span Class="bold">--no-epsv</span> is an alias for <a class="bold" href="#--disable-epsv">--disable-epsv</a>. <p class="level1">Disabling EPSV only changes the passive behavior. If you want to switch to active mode you need to use <a class="emphasis" href="#-P">-P, --ftp-port</a>. +<p class="level0"><a name="--dns-interface"></a><span class="nroffip">--dns-interface <interface></span> +<p class="level1">Tell curl to send outgoing DNS requests through <interface>. This option is a counterpart to <a class="emphasis" href="#--interface">--interface</a> (which does not affect DNS). The supplied string must be an interface name (not an address). +<p class="level1">This option requires that libcurl was built with a resolver backend that supports this operation. The c-ares backend is the only such one. (Added in 7.33.0) +<p class="level0"><a name="--dns-ipv4-addr"></a><span class="nroffip">--dns-ipv4-addr <ip-address></span> +<p class="level1">Tell curl to bind to <ip-address> when making IPv4 DNS requests, so that the DNS requests originate from this address. The argument should be a single IPv4 address. +<p class="level1">This option requires that libcurl was built with a resolver backend that supports this operation. The c-ares backend is the only such one. (Added in 7.33.0) +<p class="level0"><a name="--dns-ipv6-addr"></a><span class="nroffip">--dns-ipv6-addr <ip-address></span> +<p class="level1">Tell curl to bind to <ip-address> when making IPv6 DNS requests, so that the DNS requests originate from this address. The argument should be a single IPv6 address. +<p class="level1">This option requires that libcurl was built with a resolver backend that supports this operation. The c-ares backend is the only such one. (Added in 7.33.0) +<p class="level0"><a name="--dns-servers"></a><span class="nroffip">--dns-servers <ip-address,ip-address></span> +<p class="level1">Set the list of DNS servers to be used instead of the system default. The list of IP addresses should be separated with commas. Port numbers may also optionally be given as <span Class="emphasis">:<port-number></span> after each IP address. +<p class="level1">This option requires that libcurl was built with a resolver backend that supports this operation. The c-ares backend is the only such one. (Added in 7.33.0) <p class="level0"><a name="-e"></a><span class="nroffip">-e, --referer <URL></span> <p class="level1">(HTTP) Sends the "Referer Page" information to the HTTP server. This can also be set with the <a class="emphasis" href="#-H">-H, --header</a> flag of course. When used with <a class="emphasis" href="#-L">-L, --location</a> you can append ";auto" to the --referer URL to make curl automatically set the previous URL when it follows a Location: header. The ";auto" string can be used alone, even if you don't set an initial --referer. <p class="level1">If this option is used several times, the last one will be used. <p class="level0"><a name="-E"></a><span class="nroffip">-E, --cert <certificate[:password]></span> -<p class="level1">(SSL) Tells curl to use the specified client certificate file when getting a file with HTTPS, FTPS or another SSL-based protocol. The certificate must be in PEM format. If the optional password isn't specified, it will be queried for on the terminal. Note that this option assumes a "certificate" file that is the private key and the private certificate concatenated! See <span Class="emphasis">--cert</span> and <a class="emphasis" href="#--key">--key</a> to specify them independently. -<p class="level1">If curl is built against the NSS SSL library then this option can tell curl the nickname of the certificate to use within the NSS database defined by the environment variable SSL_DIR (or by default /etc/pki/nssdb). If the NSS PEM PKCS#11 module (libnsspem.so) is available then PEM files may be loaded. If you want to use a file from the current directory, please precede it with "./" prefix, in order to avoid confusion with a nickname. +<p class="level1">(SSL) Tells curl to use the specified client certificate file when getting a file with HTTPS, FTPS or another SSL-based protocol. The certificate must be in PKCS#12 format if using Secure Transport, or PEM format if using any other engine. If the optional password isn't specified, it will be queried for on the terminal. Note that this option assumes a "certificate" file that is the private key and the private certificate concatenated! See <span Class="emphasis">--cert</span> and <a class="emphasis" href="#--key">--key</a> to specify them independently. +<p class="level1">If curl is built against the NSS SSL library then this option can tell curl the nickname of the certificate to use within the NSS database defined by the environment variable SSL_DIR (or by default /etc/pki/nssdb). If the NSS PEM PKCS#11 module (libnsspem.so) is available then PEM files may be loaded. If you want to use a file from the current directory, please precede it with "./" prefix, in order to avoid confusion with a nickname. If the nickname contains ":", it needs to be preceded by "\" so that it is not recognized as password delimiter. If the nickname contains "\", it needs to be escaped as "\\" so that it is not recognized as an escape character. +<p class="level1">(iOS and Mac OS X only) If curl is built against Secure Transport, then the certificate string can either be the name of a certificate/private key in the system or user keychain, or the path to a PKCS#12-encoded certificate and private key. If you want to use a file from the current directory, please precede it with "./" prefix, in order to avoid confusion with a nickname. <p class="level1">If this option is used several times, the last one will be used. <p class="level0"><a name="--engine"></a><span class="nroffip">--engine <name></span> <p class="level1">Select the OpenSSL crypto engine to use for cipher operations. Use <a class="emphasis" href="#--engine">--engine list</a> to print a list of build-time supported engines. Note that not all (or none) of the engines may be available at run-time. @@ -300,9 +320,19 @@ p.roffit { <p class="level1">When curl is invoked, it always (unless <a class="emphasis" href="#-q">-q</a> is used) checks for a default config file and uses it if found. The default config file is checked for in the following places in this order: <p class="level1">1) curl tries to find the "home dir": It first checks for the CURL_HOME and then the HOME environment variables. Failing that, it uses getpwuid() on UNIX-like systems (which returns the home dir given the current user in your system). On Windows, it then checks for the APPDATA variable, or as a last resort the '%USERPROFILE%\Application Data'. <p class="level1">2) On windows, if there is no _curlrc file in the home dir, it checks for one in the same dir the curl executable is placed. On UNIX-like systems, it will simply try to load .curlrc from the determined home dir. -<p class="level1"> -<p class="level1"># --- Example file --- # this is a comment url = "curl.haxx.se" output = "curlhere.html" user-agent = "superagent/1.0" -<p class="level1"># and fetch another URL too url = "curl.haxx.se/docs/manpage.html" -O referer = "<a href="http://nowhereatall.com/">http://nowhereatall.com/</a>" # --- End of example file --- +<p class="level1"><pre> +<p class="level1"># --- Example file --- + # this is a comment + url = "curl.haxx.se" + output = "curlhere.html" + user-agent = "superagent/1.0" + <p class="level1"># and fetch another URL too + url = "curl.haxx.se/docs/manpage.html" + -O + referer = "<a href="http://nowhereatall.com/">http://nowhereatall.com/</a>" + # --- End of example file --- + </pre> + <p class="level1"> <p class="level1">This option can be used multiple times to load multiple config files. <p class="level0"><a name="--keepalive-time"></a><span class="nroffip">--keepalive-time <seconds></span> @@ -339,7 +369,7 @@ p.roffit { <p class="level0"><a name="--location-trusted"></a><span class="nroffip">--location-trusted</span> <p class="level1">(HTTP/HTTPS) Like <a class="emphasis" href="#-L">-L, --location</a>, but will allow sending the name + password to all hosts that the site may redirect to. This may or may not introduce a security breach if the site redirects you to a site to which you'll send your authentication info (which is plaintext in the case of HTTP Basic authentication). <p class="level0"><a name="-m"></a><span class="nroffip">-m, --max-time <seconds></span> -<p class="level1">Maximum time in seconds that you allow the whole operation to take. This is useful for preventing your batch jobs from hanging for hours due to slow networks or links going down. See also the <a class="emphasis" href="#--connect-timeout">--connect-timeout</a> option. +<p class="level1">Maximum time in seconds that you allow the whole operation to take. This is useful for preventing your batch jobs from hanging for hours due to slow networks or links going down. Since 7.32.0, this option accepts decimal values, but the actual timeout will decrease in accuracy as the specified timeout increases in decimal precision. See also the <a class="emphasis" href="#--connect-timeout">--connect-timeout</a> option. <p class="level1">If this option is used several times, the last one will be used. <p class="level0"><a name="--mail-auth"></a><span class="nroffip">--mail-auth <address></span> <p class="level1">(SMTP) Specify a single address. This will be used to specify the authentication address (identity) of a submitted message that is being relayed to another server. @@ -409,6 +439,10 @@ p.roffit { <p class="level1">The remote file name to use for saving is extracted from the given URL, nothing else. <p class="level1">Consequentially, the file will be saved in the current working directory. If you want the file saved in a different directory, make sure you change current working directory before you invoke curl with the <a class="bold" href="#-O">-O, --remote-name</a> flag! <p class="level1">You may use this option as many times as the number of URLs you have. +<p class="level0"><a name="--oauth2-bearer"></a><span class="nroffip">--oauth2-bearer</span> +<p class="level1">(IMAP/POP3/SMTP) Specify the Bearer Token for OAUTH 2.0 server authentication. The Bearer Token is used in conjuction with the user name which can be specified as part of the <a class="emphasis" href="#--url">--url</a> or <a class="emphasis" href="#-u">-u, --user</a> options. +<p class="level1">The Bearer Token and user name are formatted according to <a href="http://www.ietf.org/rfc/rfc6750.txt">RFC 6750</a>. +<p class="level1">If this option is used several times, the last one will be used. <p class="level0"><a name="-p"></a><span class="nroffip">-p, --proxytunnel</span> <p class="level1">When an HTTP proxy is used (<a class="emphasis" href="#-x">-x, --proxy</a>), this option will cause non-HTTP protocols to attempt to tunnel through the proxy instead of merely using it to do HTTP-like operations. The tunnel approach is made with the HTTP proxy CONNECT request and requires that the proxy allows direct connect to the remote port number curl wants to tunnel through to. <p class="level0"><a name="-P"></a><span class="nroffip">-P, --ftp-port <address></span> @@ -432,6 +466,8 @@ p.roffit { <p class="level1">(HTTP) Tells curl to respect <a href="http://www.ietf.org/rfc/rfc2616.txt">RFC 2616</a>/10.3.2 and not convert POST requests into GET requests when following a 301 redirection. The non-RFC behaviour is ubiquitous in web browsers, so curl does the conversion by default to maintain consistency. However, a server may require a POST to remain a POST after such a redirection. This option is meaningful only when using <a class="emphasis" href="#-L">-L, --location</a> (Added in 7.17.1) <p class="level0"><a name="--post302"></a><span class="nroffip">--post302</span> <p class="level1">(HTTP) Tells curl to respect <a href="http://www.ietf.org/rfc/rfc2616.txt">RFC 2616</a>/10.3.2 and not convert POST requests into GET requests when following a 302 redirection. The non-RFC behaviour is ubiquitous in web browsers, so curl does the conversion by default to maintain consistency. However, a server may require a POST to remain a POST after such a redirection. This option is meaningful only when using <a class="emphasis" href="#-L">-L, --location</a> (Added in 7.19.1) +<p class="level0"><a name="--post303"></a><span class="nroffip">--post303</span> +<p class="level1">(HTTP) Tells curl to respect <a href="http://www.ietf.org/rfc/rfc2616.txt">RFC 2616</a>/10.3.2 and not convert POST requests into GET requests when following a 303 redirection. The non-RFC behaviour is ubiquitous in web browsers, so curl does the conversion by default to maintain consistency. However, a server may require a POST to remain a POST after such a redirection. This option is meaningful only when using <a class="emphasis" href="#-L">-L, --location</a> (Added in 7.26.0) <p class="level0"><a name="--proto"></a><span class="nroffip">--proto <protocols></span> <p class="level1">Tells curl to use the listed protocols for its initial retrieval. Protocols are evaluated left to right, are comma separated, and are each a protocol name or 'all', optionally prefixed by zero or more modifiers. Available modifiers are: <p class="level2"> @@ -535,7 +571,9 @@ p.roffit { <p class="level1">The retry timer is reset before the first transfer attempt. Retries will be done as usual (see <a class="emphasis" href="#--retry">--retry</a>) as long as the timer hasn't reached this given limit. Notice that if the timer hasn't reached the limit, the request will be made and while performing, it may take longer than this given time period. To limit a single request´s maximum time, use <a class="emphasis" href="#-m">-m, --max-time</a>. Set this option to zero to not timeout retries. (Added in 7.12.3) <p class="level1">If this option is used several times, the last one will be used. <p class="level0"><a name="-s"></a><span class="nroffip">-s, --silent</span> -<p class="level1">Silent or quiet mode. Don't show progress meter or error messages. Makes Curl mute. +<p class="level1">Silent or quiet mode. Don't show progress meter or error messages. Makes Curl mute. It will still output the data you ask for, potentially even to the terminal/stdout unless you redirect it. +<p class="level0"><a name="--sasl-ir"></a><span class="nroffip">--sasl-ir</span> +<p class="level1">Enable initial response in SASL authentication. (Added in 7.31.0) <p class="level0"><a name="-S"></a><span class="nroffip">-S, --show-error</span> <p class="level1">When used with <a class="emphasis" href="#-s">-s</a> it makes curl show an error message if it fails. <p class="level0"><a name="--ssl"></a><span class="nroffip">--ssl</span> @@ -613,10 +651,11 @@ p.roffit { <p class="level1">If this option is used several times, the last one will be used. <p class="level0"><a name="--trace-time"></a><span class="nroffip">--trace-time</span> <p class="level1">Prepends a time stamp to each trace or verbose line that curl displays. (Added in 7.14.0) -<p class="level0"><a name="-u"></a><span class="nroffip">-u, --user <user:password></span> -<p class="level1">Specify the user name and password to use for server authentication. Overrides <a class="emphasis" href="#-n">-n, --netrc</a> and <a class="emphasis" href="#--netrc-optional">--netrc-optional</a>. -<p class="level1">If you just give the user name (without entering a colon) curl will prompt for a password. -<p class="level1">If you use an SSPI-enabled curl binary and do NTLM authentication, you can force curl to pick up the user name and password from your environment by simply specifying a single colon with this option: "-u :". +<p class="level0"><a name="-u"></a><span class="nroffip">-u, --user <user:password;options></span> +<p class="level1">Specify the user name, password and optional login options to use for server authentication. Overrides <a class="emphasis" href="#-n">-n, --netrc</a> and <a class="emphasis" href="#--netrc-optional">--netrc-optional</a>. +<p class="level1">If you simply specify the user name, with or without the login options, curl will prompt for a password. +<p class="level1">If you use an SSPI-enabled curl binary and perform NTLM authentication, you can force curl to select the user name and password from your environment by simply specifying a single colon with this option: "-u :" or by specfying the login options on their own, for example "-u ;auth=NTLM". +<p class="level1">You can use the optional login options part to specify protocol specific options that may be used during authentication. At present only IMAP, POP3 and SMTP support login options as part of the user login information. For more information about the login options please see <a href="http://www.ietf.org/rfc/rfc2384.txt">RFC 2384</a>, RFC 5092 and IETF draft draft-earhart-url-smtp-00.txt (Added in 7.31.0). <p class="level1">If this option is used several times, the last one will be used. <p class="level0"><a name="-U"></a><span class="nroffip">-U, --proxy-user <user:password></span> <p class="level1">Specify the user name and password to use for proxy authentication. @@ -667,12 +706,13 @@ p.roffit { <p class="level1"> <p class="level1">If this option is used several times, the last one will be used. <p class="level0"><a name="-x"></a><span class="nroffip">-x, --proxy <[protocol://][user:password@]proxyhost[:port]></span> -<p class="level1">Use the specified HTTP proxy. If the port number is not specified, it is assumed at port 1080. +<p class="level1">Use the specified proxy. +<p class="level1">The proxy string can be specified with a protocol:// prefix to specify alternative proxy protocols. Use socks4://, socks4a://, socks5:// or socks5h:// to request the specific SOCKS version to be used. No protocol specified, http:// and all others will be treated as HTTP proxies. (The protocol support was added in curl 7.21.7) +<p class="level1">If the port number is not specified in the proxy string, it is assumed to be 1080. <p class="level1">This option overrides existing environment variables that set the proxy to use. If there's an environment variable setting a proxy, you can set proxy to "" to override it. <p class="level1">All operations that are performed over an HTTP proxy will transparently be converted to HTTP. It means that certain protocol specific operations might not be available. This is not the case if you can tunnel through the proxy, as one with the <a class="emphasis" href="#-p">-p, --proxytunnel</a> option. <p class="level1">User and password that might be provided in the proxy string are URL decoded by curl. This allows you to pass in special characters such as @ by using %40 or pass in a colon with %3a. <p class="level1">The proxy host can be specified the exact same way as the proxy environment variables, including the protocol prefix (http://) and the embedded user + password. -<p class="level1">From 7.21.7, the proxy string may be specified with a protocol:// prefix to specify alternative proxy protocols. Use socks4://, socks4a://, socks5:// or socks5h:// to request the specific SOCKS version to be used. No protocol specified, http:// and all others will be treated as HTTP proxies. <p class="level1">If this option is used several times, the last one will be used. <p class="level0"><a name="-X"></a><span class="nroffip">-X, --request <command></span> <p class="level1">(HTTP) Specifies a custom request method to use when communicating with the HTTP server. The specified request will be used instead of the method otherwise used (which defaults to GET). Read the HTTP 1.1 specification for details and explanations. Common additional HTTP requests include PUT and DELETE, but related technologies like WebDAV offers PROPFIND, COPY, MOVE and more. @@ -682,7 +722,7 @@ p.roffit { <p class="level1">If this option is used several times, the last one will be used. <p class="level1"> <p class="level0"><a name="--xattr"></a><span class="nroffip">--xattr</span> -<p class="level1">When saving output to a file, this option tells curl to store certain file metadata in extened file attributes. Currently, the URL is stored in the xdg.origin.url attribute and, for HTTP, the content type is stored in the mime_type attribute. If the file system does not support extended attributes, a warning is issued. +<p class="level1">When saving output to a file, this option tells curl to store certain file metadata in extended file attributes. Currently, the URL is stored in the xdg.origin.url attribute and, for HTTP, the content type is stored in the mime_type attribute. If the file system does not support extended attributes, a warning is issued. <p class="level1"> <p class="level0"><a name="-y"></a><span class="nroffip">-y, --speed-time <time></span> <p class="level1">If a download is slower than speed-limit bytes per second during a speed-time period, the download gets aborted. If speed-time is used, the default speed-limit will be 1 unless set with <a class="emphasis" href="#-Y">-Y</a>. @@ -691,7 +731,7 @@ p.roffit { <p class="level0"><a name="-Y"></a><span class="nroffip">-Y, --speed-limit <speed></span> <p class="level1">If a download is slower than this given speed (in bytes per second) for speed-time seconds it gets aborted. speed-time is set with <a class="emphasis" href="#-y">-y</a> and is 30 if not set. <p class="level1">If this option is used several times, the last one will be used. -<p class="level0"><a name="-z--time-cond"></a><span class="nroffip">-z/--time-cond <date expression>|<file></span> +<p class="level0"><a name="-z"></a><span class="nroffip">-z, --time-cond <date expression>|<file></span> <p class="level1">(HTTP/FTP) Request a file that has been modified later than the given time and date, or one that has been modified before that time. The <date expression> can be all sorts of date strings or if it doesn't match any internal ones, it is taken as a filename and tries to get the modification date (mtime) from <file> instead. See the <span Class="emphasis">curl_getdate(3)</span> man pages for date expression details. <p class="level1">Start the date expression with a dash (-) to make it request for a document that is older than the given date/time, default is a document that is newer than the specified date/time. <p class="level1">If this option is used several times, the last one will be used. diff --git a/plugins/FTPFileYM/curl/docs/curl.pdf b/plugins/FTPFileYM/curl/docs/curl.pdf Binary files differindex 176e06f486..d990270390 100644 --- a/plugins/FTPFileYM/curl/docs/curl.pdf +++ b/plugins/FTPFileYM/curl/docs/curl.pdf diff --git a/plugins/FTPFileYM/curl/docs/examples/10-at-a-time.c b/plugins/FTPFileYM/curl/docs/examples/10-at-a-time.c deleted file mode 100644 index a85fff46f0..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/10-at-a-time.c +++ /dev/null @@ -1,197 +0,0 @@ -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at http://curl.haxx.se/docs/copyright.html. - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the COPYING file. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ***************************************************************************/ -/* Example application source code using the multi interface to download many - * files, but with a capped maximum amount of simultaneous transfers. - * - * Written by Michael Wallner - */ - -#include <errno.h> -#include <stdlib.h> -#include <string.h> -#ifndef WIN32 -# include <unistd.h> -#endif -#include <curl/multi.h> - -static const char *urls[] = { - "http://www.microsoft.com", - "http://www.opensource.org", - "http://www.google.com", - "http://www.yahoo.com", - "http://www.ibm.com", - "http://www.mysql.com", - "http://www.oracle.com", - "http://www.ripe.net", - "http://www.iana.org", - "http://www.amazon.com", - "http://www.netcraft.com", - "http://www.heise.de", - "http://www.chip.de", - "http://www.ca.com", - "http://www.cnet.com", - "http://www.news.com", - "http://www.cnn.com", - "http://www.wikipedia.org", - "http://www.dell.com", - "http://www.hp.com", - "http://www.cert.org", - "http://www.mit.edu", - "http://www.nist.gov", - "http://www.ebay.com", - "http://www.playstation.com", - "http://www.uefa.com", - "http://www.ieee.org", - "http://www.apple.com", - "http://www.sony.com", - "http://www.symantec.com", - "http://www.zdnet.com", - "http://www.fujitsu.com", - "http://www.supermicro.com", - "http://www.hotmail.com", - "http://www.ecma.com", - "http://www.bbc.co.uk", - "http://news.google.com", - "http://www.foxnews.com", - "http://www.msn.com", - "http://www.wired.com", - "http://www.sky.com", - "http://www.usatoday.com", - "http://www.cbs.com", - "http://www.nbc.com", - "http://slashdot.org", - "http://www.bloglines.com", - "http://www.techweb.com", - "http://www.newslink.org", - "http://www.un.org", -}; - -#define MAX 10 /* number of simultaneous transfers */ -#define CNT sizeof(urls)/sizeof(char*) /* total number of transfers to do */ - -static size_t cb(char *d, size_t n, size_t l, void *p) -{ - /* take care of the data here, ignored in this example */ - (void)d; - (void)p; - return n*l; -} - -static void init(CURLM *cm, int i) -{ - CURL *eh = curl_easy_init(); - - curl_easy_setopt(eh, CURLOPT_WRITEFUNCTION, cb); - curl_easy_setopt(eh, CURLOPT_HEADER, 0L); - curl_easy_setopt(eh, CURLOPT_URL, urls[i]); - curl_easy_setopt(eh, CURLOPT_PRIVATE, urls[i]); - curl_easy_setopt(eh, CURLOPT_VERBOSE, 0L); - - curl_multi_add_handle(cm, eh); -} - -int main(void) -{ - CURLM *cm; - CURLMsg *msg; - long L; - unsigned int C=0; - int M, Q, U = -1; - fd_set R, W, E; - struct timeval T; - - curl_global_init(CURL_GLOBAL_ALL); - - cm = curl_multi_init(); - - /* we can optionally limit the total amount of connections this multi handle - uses */ - curl_multi_setopt(cm, CURLMOPT_MAXCONNECTS, (long)MAX); - - for (C = 0; C < MAX; ++C) { - init(cm, C); - } - - while (U) { - curl_multi_perform(cm, &U); - - if (U) { - FD_ZERO(&R); - FD_ZERO(&W); - FD_ZERO(&E); - - if (curl_multi_fdset(cm, &R, &W, &E, &M)) { - fprintf(stderr, "E: curl_multi_fdset\n"); - return EXIT_FAILURE; - } - - if (curl_multi_timeout(cm, &L)) { - fprintf(stderr, "E: curl_multi_timeout\n"); - return EXIT_FAILURE; - } - if (L == -1) - L = 100; - - if (M == -1) { -#ifdef WIN32 - Sleep(L); -#else - sleep(L / 1000); -#endif - } else { - T.tv_sec = L/1000; - T.tv_usec = (L%1000)*1000; - - if (0 > select(M+1, &R, &W, &E, &T)) { - fprintf(stderr, "E: select(%i,,,,%li): %i: %s\n", - M+1, L, errno, strerror(errno)); - return EXIT_FAILURE; - } - } - } - - while ((msg = curl_multi_info_read(cm, &Q))) { - if (msg->msg == CURLMSG_DONE) { - char *url; - CURL *e = msg->easy_handle; - curl_easy_getinfo(msg->easy_handle, CURLINFO_PRIVATE, &url); - fprintf(stderr, "R: %d - %s <%s>\n", - msg->data.result, curl_easy_strerror(msg->data.result), url); - curl_multi_remove_handle(cm, e); - curl_easy_cleanup(e); - } - else { - fprintf(stderr, "E: CURLMsg (%d)\n", msg->msg); - } - if (C < CNT) { - init(cm, C++); - U++; /* just to prevent it from remaining at 0 if there are more - URLs to get */ - } - } - } - - curl_multi_cleanup(cm); - curl_global_cleanup(); - - return EXIT_SUCCESS; -} diff --git a/plugins/FTPFileYM/curl/docs/examples/Makefile.am b/plugins/FTPFileYM/curl/docs/examples/Makefile.am deleted file mode 100644 index cbfdac5025..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/Makefile.am +++ /dev/null @@ -1,64 +0,0 @@ -#*************************************************************************** -# _ _ ____ _ -# Project ___| | | | _ \| | -# / __| | | | |_) | | -# | (__| |_| | _ <| |___ -# \___|\___/|_| \_\_____| -# -# Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. -# -# This software is licensed as described in the file COPYING, which -# you should have received as part of this distribution. The terms -# are also available at http://curl.haxx.se/docs/copyright.html. -# -# You may opt to use, copy, modify, merge, publish, distribute and/or sell -# copies of the Software, and permit persons to whom the Software is -# furnished to do so, under the terms of the COPYING file. -# -# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -# KIND, either express or implied. -# -########################################################################### - -AUTOMAKE_OPTIONS = foreign nostdinc - -EXTRA_DIST = README Makefile.example Makefile.inc Makefile.m32 \ - Makefile.netware makefile.dj $(COMPLICATED_EXAMPLES) - -# Specify our include paths here, and do it relative to $(top_srcdir) and -# $(top_builddir), to ensure that these paths which belong to the library -# being currently built and tested are searched before the library which -# might possibly already be installed in the system. -# -# $(top_builddir)/include/curl for generated curlbuild.h included from curl.h -# $(top_builddir)/include for generated curlbuild.h inc. from lib/curl_setup.h -# $(top_srcdir)/include is for libcurl's external include files - -AM_CPPFLAGS = -I$(top_builddir)/include/curl \ - -I$(top_builddir)/include \ - -I$(top_srcdir)/include - -LIBDIR = $(top_builddir)/lib - -# Avoid libcurl obsolete stuff -AM_CPPFLAGS += -DCURL_NO_OLDIES - -# Mostly for Windows build targets, when using static libcurl -if USE_CPPFLAG_CURL_STATICLIB -AM_CPPFLAGS += -DCURL_STATICLIB -endif - -# Prevent LIBS from being used for all link targets -LIBS = $(BLANK_AT_MAKETIME) - -# Dependencies -if USE_EXPLICIT_LIB_DEPS -LDADD = $(LIBDIR)/libcurl.la @LIBCURL_LIBS@ -else -LDADD = $(LIBDIR)/libcurl.la -endif - -# Makefile.inc provides the check_PROGRAMS and COMPLICATED_EXAMPLES defines -include Makefile.inc - -all: $(check_PROGRAMS) diff --git a/plugins/FTPFileYM/curl/docs/examples/Makefile.example b/plugins/FTPFileYM/curl/docs/examples/Makefile.example deleted file mode 100644 index dfd117873a..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/Makefile.example +++ /dev/null @@ -1,53 +0,0 @@ -#*************************************************************************** -# _ _ ____ _ -# Project ___| | | | _ \| | -# / __| | | | |_) | | -# | (__| |_| | _ <| |___ -# \___|\___/|_| \_\_____| -# -# Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. -# -# This software is licensed as described in the file COPYING, which -# you should have received as part of this distribution. The terms -# are also available at http://curl.haxx.se/docs/copyright.html. -# -# You may opt to use, copy, modify, merge, publish, distribute and/or sell -# copies of the Software, and permit persons to whom the Software is -# furnished to do so, under the terms of the COPYING file. -# -# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -# KIND, either express or implied. -# -########################################################################### - -# What to call the final executable -TARGET = example - -# Which object files that the executable consists of -OBJS= ftpget.o - -# What compiler to use -CC = gcc - -# Compiler flags, -g for debug, -c to make an object file -CFLAGS = -c -g - -# This should point to a directory that holds libcurl, if it isn't -# in the system's standard lib dir -# We also set a -L to include the directory where we have the openssl -# libraries -LDFLAGS = -L/home/dast/lib -L/usr/local/ssl/lib - -# We need -lcurl for the curl stuff -# We need -lsocket and -lnsl when on Solaris -# We need -lssl and -lcrypto when using libcurl with SSL support -# We need -lpthread for the pthread example -LIBS = -lcurl -lsocket -lnsl -lssl -lcrypto - -# Link the target with all objects and libraries -$(TARGET) : $(OBJS) - $(CC) -o $(TARGET) $(OBJS) $(LDFLAGS) $(LIBS) - -# Compile the source files into object files -ftpget.o : ftpget.c - $(CC) $(CFLAGS) $< diff --git a/plugins/FTPFileYM/curl/docs/examples/Makefile.in b/plugins/FTPFileYM/curl/docs/examples/Makefile.in deleted file mode 100644 index 77e07289f6..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/Makefile.in +++ /dev/null @@ -1,1153 +0,0 @@ -# Makefile.in generated by automake 1.11.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software -# Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -#*************************************************************************** -# _ _ ____ _ -# Project ___| | | | _ \| | -# / __| | | | |_) | | -# | (__| |_| | _ <| |___ -# \___|\___/|_| \_\_____| -# -# Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. -# -# This software is licensed as described in the file COPYING, which -# you should have received as part of this distribution. The terms -# are also available at http://curl.haxx.se/docs/copyright.html. -# -# You may opt to use, copy, modify, merge, publish, distribute and/or sell -# copies of the Software, and permit persons to whom the Software is -# furnished to do so, under the terms of the COPYING file. -# -# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -# KIND, either express or implied. -# -########################################################################### -VPATH = @srcdir@ -am__make_dryrun = \ - { \ - am__dry=no; \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ - | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ - *) \ - for am__flg in $$MAKEFLAGS; do \ - case $$am__flg in \ - *=*|--*) ;; \ - *n*) am__dry=yes; break;; \ - esac; \ - done;; \ - esac; \ - test $$am__dry = yes; \ - } -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ - -# Mostly for Windows build targets, when using static libcurl -@USE_CPPFLAG_CURL_STATICLIB_TRUE@am__append_1 = -DCURL_STATICLIB -DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ - $(srcdir)/Makefile.inc -check_PROGRAMS = 10-at-a-time$(EXEEXT) anyauthput$(EXEEXT) \ - cookie_interface$(EXEEXT) debug$(EXEEXT) fileupload$(EXEEXT) \ - fopen$(EXEEXT) ftpget$(EXEEXT) ftpgetresp$(EXEEXT) \ - ftpupload$(EXEEXT) getinfo$(EXEEXT) getinmemory$(EXEEXT) \ - http-post$(EXEEXT) httpput$(EXEEXT) https$(EXEEXT) \ - multi-app$(EXEEXT) multi-debugcallback$(EXEEXT) \ - multi-double$(EXEEXT) multi-post$(EXEEXT) \ - multi-single$(EXEEXT) persistant$(EXEEXT) \ - post-callback$(EXEEXT) postit2$(EXEEXT) sepheaders$(EXEEXT) \ - simple$(EXEEXT) simplepost$(EXEEXT) simplessl$(EXEEXT) \ - sendrecv$(EXEEXT) httpcustomheader$(EXEEXT) certinfo$(EXEEXT) \ - chkspeed$(EXEEXT) ftpgetinfo$(EXEEXT) ftp-wildcard$(EXEEXT) \ - smtp-multi$(EXEEXT) simplesmtp$(EXEEXT) smtp-tls$(EXEEXT) \ - rtsp$(EXEEXT) externalsocket$(EXEEXT) resolve$(EXEEXT) \ - progressfunc$(EXEEXT) pop3s$(EXEEXT) pop3slist$(EXEEXT) \ - imap$(EXEEXT) url2file$(EXEEXT) sftpget$(EXEEXT) \ - ftpsget$(EXEEXT) -subdir = docs/examples -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/curl-compilers.m4 \ - $(top_srcdir)/m4/curl-confopts.m4 \ - $(top_srcdir)/m4/curl-functions.m4 \ - $(top_srcdir)/m4/curl-openssl.m4 \ - $(top_srcdir)/m4/curl-override.m4 \ - $(top_srcdir)/m4/curl-reentrant.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/xc-cc-check.m4 \ - $(top_srcdir)/m4/xc-translit.m4 \ - $(top_srcdir)/m4/xc-val-flgs.m4 \ - $(top_srcdir)/m4/zz40-xc-ovr.m4 \ - $(top_srcdir)/m4/zz50-xc-ovr.m4 \ - $(top_srcdir)/m4/zz60-xc-ovr.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/lib/curl_config.h \ - $(top_builddir)/include/curl/curlbuild.h -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -10_at_a_time_SOURCES = 10-at-a-time.c -10_at_a_time_OBJECTS = 10-at-a-time.$(OBJEXT) -10_at_a_time_LDADD = $(LDADD) -@USE_EXPLICIT_LIB_DEPS_FALSE@10_at_a_time_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la -@USE_EXPLICIT_LIB_DEPS_TRUE@10_at_a_time_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la -anyauthput_SOURCES = anyauthput.c -anyauthput_OBJECTS = anyauthput.$(OBJEXT) -anyauthput_LDADD = $(LDADD) -@USE_EXPLICIT_LIB_DEPS_FALSE@anyauthput_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la -@USE_EXPLICIT_LIB_DEPS_TRUE@anyauthput_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la -certinfo_SOURCES = certinfo.c -certinfo_OBJECTS = certinfo.$(OBJEXT) -certinfo_LDADD = $(LDADD) -@USE_EXPLICIT_LIB_DEPS_FALSE@certinfo_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la -@USE_EXPLICIT_LIB_DEPS_TRUE@certinfo_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la -chkspeed_SOURCES = chkspeed.c -chkspeed_OBJECTS = chkspeed.$(OBJEXT) -chkspeed_LDADD = $(LDADD) -@USE_EXPLICIT_LIB_DEPS_FALSE@chkspeed_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la -@USE_EXPLICIT_LIB_DEPS_TRUE@chkspeed_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la -cookie_interface_SOURCES = cookie_interface.c -cookie_interface_OBJECTS = cookie_interface.$(OBJEXT) -cookie_interface_LDADD = $(LDADD) -@USE_EXPLICIT_LIB_DEPS_FALSE@cookie_interface_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la -@USE_EXPLICIT_LIB_DEPS_TRUE@cookie_interface_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la -debug_SOURCES = debug.c -debug_OBJECTS = debug.$(OBJEXT) -debug_LDADD = $(LDADD) -@USE_EXPLICIT_LIB_DEPS_FALSE@debug_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la -@USE_EXPLICIT_LIB_DEPS_TRUE@debug_DEPENDENCIES = $(LIBDIR)/libcurl.la -externalsocket_SOURCES = externalsocket.c -externalsocket_OBJECTS = externalsocket.$(OBJEXT) -externalsocket_LDADD = $(LDADD) -@USE_EXPLICIT_LIB_DEPS_FALSE@externalsocket_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la -@USE_EXPLICIT_LIB_DEPS_TRUE@externalsocket_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la -fileupload_SOURCES = fileupload.c -fileupload_OBJECTS = fileupload.$(OBJEXT) -fileupload_LDADD = $(LDADD) -@USE_EXPLICIT_LIB_DEPS_FALSE@fileupload_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la -@USE_EXPLICIT_LIB_DEPS_TRUE@fileupload_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la -fopen_SOURCES = fopen.c -fopen_OBJECTS = fopen.$(OBJEXT) -fopen_LDADD = $(LDADD) -@USE_EXPLICIT_LIB_DEPS_FALSE@fopen_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la -@USE_EXPLICIT_LIB_DEPS_TRUE@fopen_DEPENDENCIES = $(LIBDIR)/libcurl.la -ftp_wildcard_SOURCES = ftp-wildcard.c -ftp_wildcard_OBJECTS = ftp-wildcard.$(OBJEXT) -ftp_wildcard_LDADD = $(LDADD) -@USE_EXPLICIT_LIB_DEPS_FALSE@ftp_wildcard_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la -@USE_EXPLICIT_LIB_DEPS_TRUE@ftp_wildcard_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la -ftpget_SOURCES = ftpget.c -ftpget_OBJECTS = ftpget.$(OBJEXT) -ftpget_LDADD = $(LDADD) -@USE_EXPLICIT_LIB_DEPS_FALSE@ftpget_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la -@USE_EXPLICIT_LIB_DEPS_TRUE@ftpget_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la -ftpgetinfo_SOURCES = ftpgetinfo.c -ftpgetinfo_OBJECTS = ftpgetinfo.$(OBJEXT) -ftpgetinfo_LDADD = $(LDADD) -@USE_EXPLICIT_LIB_DEPS_FALSE@ftpgetinfo_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la -@USE_EXPLICIT_LIB_DEPS_TRUE@ftpgetinfo_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la -ftpgetresp_SOURCES = ftpgetresp.c -ftpgetresp_OBJECTS = ftpgetresp.$(OBJEXT) -ftpgetresp_LDADD = $(LDADD) -@USE_EXPLICIT_LIB_DEPS_FALSE@ftpgetresp_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la -@USE_EXPLICIT_LIB_DEPS_TRUE@ftpgetresp_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la -ftpsget_SOURCES = ftpsget.c -ftpsget_OBJECTS = ftpsget.$(OBJEXT) -ftpsget_LDADD = $(LDADD) -@USE_EXPLICIT_LIB_DEPS_FALSE@ftpsget_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la -@USE_EXPLICIT_LIB_DEPS_TRUE@ftpsget_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la -ftpupload_SOURCES = ftpupload.c -ftpupload_OBJECTS = ftpupload.$(OBJEXT) -ftpupload_LDADD = $(LDADD) -@USE_EXPLICIT_LIB_DEPS_FALSE@ftpupload_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la -@USE_EXPLICIT_LIB_DEPS_TRUE@ftpupload_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la -getinfo_SOURCES = getinfo.c -getinfo_OBJECTS = getinfo.$(OBJEXT) -getinfo_LDADD = $(LDADD) -@USE_EXPLICIT_LIB_DEPS_FALSE@getinfo_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la -@USE_EXPLICIT_LIB_DEPS_TRUE@getinfo_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la -getinmemory_SOURCES = getinmemory.c -getinmemory_OBJECTS = getinmemory.$(OBJEXT) -getinmemory_LDADD = $(LDADD) -@USE_EXPLICIT_LIB_DEPS_FALSE@getinmemory_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la -@USE_EXPLICIT_LIB_DEPS_TRUE@getinmemory_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la -http_post_SOURCES = http-post.c -http_post_OBJECTS = http-post.$(OBJEXT) -http_post_LDADD = $(LDADD) -@USE_EXPLICIT_LIB_DEPS_FALSE@http_post_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la -@USE_EXPLICIT_LIB_DEPS_TRUE@http_post_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la -httpcustomheader_SOURCES = httpcustomheader.c -httpcustomheader_OBJECTS = httpcustomheader.$(OBJEXT) -httpcustomheader_LDADD = $(LDADD) -@USE_EXPLICIT_LIB_DEPS_FALSE@httpcustomheader_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la -@USE_EXPLICIT_LIB_DEPS_TRUE@httpcustomheader_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la -httpput_SOURCES = httpput.c -httpput_OBJECTS = httpput.$(OBJEXT) -httpput_LDADD = $(LDADD) -@USE_EXPLICIT_LIB_DEPS_FALSE@httpput_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la -@USE_EXPLICIT_LIB_DEPS_TRUE@httpput_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la -https_SOURCES = https.c -https_OBJECTS = https.$(OBJEXT) -https_LDADD = $(LDADD) -@USE_EXPLICIT_LIB_DEPS_FALSE@https_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la -@USE_EXPLICIT_LIB_DEPS_TRUE@https_DEPENDENCIES = $(LIBDIR)/libcurl.la -imap_SOURCES = imap.c -imap_OBJECTS = imap.$(OBJEXT) -imap_LDADD = $(LDADD) -@USE_EXPLICIT_LIB_DEPS_FALSE@imap_DEPENDENCIES = $(LIBDIR)/libcurl.la -@USE_EXPLICIT_LIB_DEPS_TRUE@imap_DEPENDENCIES = $(LIBDIR)/libcurl.la -multi_app_SOURCES = multi-app.c -multi_app_OBJECTS = multi-app.$(OBJEXT) -multi_app_LDADD = $(LDADD) -@USE_EXPLICIT_LIB_DEPS_FALSE@multi_app_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la -@USE_EXPLICIT_LIB_DEPS_TRUE@multi_app_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la -multi_debugcallback_SOURCES = multi-debugcallback.c -multi_debugcallback_OBJECTS = multi-debugcallback.$(OBJEXT) -multi_debugcallback_LDADD = $(LDADD) -@USE_EXPLICIT_LIB_DEPS_FALSE@multi_debugcallback_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la -@USE_EXPLICIT_LIB_DEPS_TRUE@multi_debugcallback_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la -multi_double_SOURCES = multi-double.c -multi_double_OBJECTS = multi-double.$(OBJEXT) -multi_double_LDADD = $(LDADD) -@USE_EXPLICIT_LIB_DEPS_FALSE@multi_double_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la -@USE_EXPLICIT_LIB_DEPS_TRUE@multi_double_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la -multi_post_SOURCES = multi-post.c -multi_post_OBJECTS = multi-post.$(OBJEXT) -multi_post_LDADD = $(LDADD) -@USE_EXPLICIT_LIB_DEPS_FALSE@multi_post_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la -@USE_EXPLICIT_LIB_DEPS_TRUE@multi_post_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la -multi_single_SOURCES = multi-single.c -multi_single_OBJECTS = multi-single.$(OBJEXT) -multi_single_LDADD = $(LDADD) -@USE_EXPLICIT_LIB_DEPS_FALSE@multi_single_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la -@USE_EXPLICIT_LIB_DEPS_TRUE@multi_single_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la -persistant_SOURCES = persistant.c -persistant_OBJECTS = persistant.$(OBJEXT) -persistant_LDADD = $(LDADD) -@USE_EXPLICIT_LIB_DEPS_FALSE@persistant_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la -@USE_EXPLICIT_LIB_DEPS_TRUE@persistant_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la -pop3s_SOURCES = pop3s.c -pop3s_OBJECTS = pop3s.$(OBJEXT) -pop3s_LDADD = $(LDADD) -@USE_EXPLICIT_LIB_DEPS_FALSE@pop3s_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la -@USE_EXPLICIT_LIB_DEPS_TRUE@pop3s_DEPENDENCIES = $(LIBDIR)/libcurl.la -pop3slist_SOURCES = pop3slist.c -pop3slist_OBJECTS = pop3slist.$(OBJEXT) -pop3slist_LDADD = $(LDADD) -@USE_EXPLICIT_LIB_DEPS_FALSE@pop3slist_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la -@USE_EXPLICIT_LIB_DEPS_TRUE@pop3slist_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la -post_callback_SOURCES = post-callback.c -post_callback_OBJECTS = post-callback.$(OBJEXT) -post_callback_LDADD = $(LDADD) -@USE_EXPLICIT_LIB_DEPS_FALSE@post_callback_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la -@USE_EXPLICIT_LIB_DEPS_TRUE@post_callback_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la -postit2_SOURCES = postit2.c -postit2_OBJECTS = postit2.$(OBJEXT) -postit2_LDADD = $(LDADD) -@USE_EXPLICIT_LIB_DEPS_FALSE@postit2_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la -@USE_EXPLICIT_LIB_DEPS_TRUE@postit2_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la -progressfunc_SOURCES = progressfunc.c -progressfunc_OBJECTS = progressfunc.$(OBJEXT) -progressfunc_LDADD = $(LDADD) -@USE_EXPLICIT_LIB_DEPS_FALSE@progressfunc_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la -@USE_EXPLICIT_LIB_DEPS_TRUE@progressfunc_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la -resolve_SOURCES = resolve.c -resolve_OBJECTS = resolve.$(OBJEXT) -resolve_LDADD = $(LDADD) -@USE_EXPLICIT_LIB_DEPS_FALSE@resolve_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la -@USE_EXPLICIT_LIB_DEPS_TRUE@resolve_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la -rtsp_SOURCES = rtsp.c -rtsp_OBJECTS = rtsp.$(OBJEXT) -rtsp_LDADD = $(LDADD) -@USE_EXPLICIT_LIB_DEPS_FALSE@rtsp_DEPENDENCIES = $(LIBDIR)/libcurl.la -@USE_EXPLICIT_LIB_DEPS_TRUE@rtsp_DEPENDENCIES = $(LIBDIR)/libcurl.la -sendrecv_SOURCES = sendrecv.c -sendrecv_OBJECTS = sendrecv.$(OBJEXT) -sendrecv_LDADD = $(LDADD) -@USE_EXPLICIT_LIB_DEPS_FALSE@sendrecv_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la -@USE_EXPLICIT_LIB_DEPS_TRUE@sendrecv_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la -sepheaders_SOURCES = sepheaders.c -sepheaders_OBJECTS = sepheaders.$(OBJEXT) -sepheaders_LDADD = $(LDADD) -@USE_EXPLICIT_LIB_DEPS_FALSE@sepheaders_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la -@USE_EXPLICIT_LIB_DEPS_TRUE@sepheaders_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la -sftpget_SOURCES = sftpget.c -sftpget_OBJECTS = sftpget.$(OBJEXT) -sftpget_LDADD = $(LDADD) -@USE_EXPLICIT_LIB_DEPS_FALSE@sftpget_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la -@USE_EXPLICIT_LIB_DEPS_TRUE@sftpget_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la -simple_SOURCES = simple.c -simple_OBJECTS = simple.$(OBJEXT) -simple_LDADD = $(LDADD) -@USE_EXPLICIT_LIB_DEPS_FALSE@simple_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la -@USE_EXPLICIT_LIB_DEPS_TRUE@simple_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la -simplepost_SOURCES = simplepost.c -simplepost_OBJECTS = simplepost.$(OBJEXT) -simplepost_LDADD = $(LDADD) -@USE_EXPLICIT_LIB_DEPS_FALSE@simplepost_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la -@USE_EXPLICIT_LIB_DEPS_TRUE@simplepost_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la -simplesmtp_SOURCES = simplesmtp.c -simplesmtp_OBJECTS = simplesmtp.$(OBJEXT) -simplesmtp_LDADD = $(LDADD) -@USE_EXPLICIT_LIB_DEPS_FALSE@simplesmtp_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la -@USE_EXPLICIT_LIB_DEPS_TRUE@simplesmtp_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la -simplessl_SOURCES = simplessl.c -simplessl_OBJECTS = simplessl.$(OBJEXT) -simplessl_LDADD = $(LDADD) -@USE_EXPLICIT_LIB_DEPS_FALSE@simplessl_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la -@USE_EXPLICIT_LIB_DEPS_TRUE@simplessl_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la -smtp_multi_SOURCES = smtp-multi.c -smtp_multi_OBJECTS = smtp-multi.$(OBJEXT) -smtp_multi_LDADD = $(LDADD) -@USE_EXPLICIT_LIB_DEPS_FALSE@smtp_multi_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la -@USE_EXPLICIT_LIB_DEPS_TRUE@smtp_multi_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la -smtp_tls_SOURCES = smtp-tls.c -smtp_tls_OBJECTS = smtp-tls.$(OBJEXT) -smtp_tls_LDADD = $(LDADD) -@USE_EXPLICIT_LIB_DEPS_FALSE@smtp_tls_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la -@USE_EXPLICIT_LIB_DEPS_TRUE@smtp_tls_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la -url2file_SOURCES = url2file.c -url2file_OBJECTS = url2file.$(OBJEXT) -url2file_LDADD = $(LDADD) -@USE_EXPLICIT_LIB_DEPS_FALSE@url2file_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_FALSE@ $(LIBDIR)/libcurl.la -@USE_EXPLICIT_LIB_DEPS_TRUE@url2file_DEPENDENCIES = \ -@USE_EXPLICIT_LIB_DEPS_TRUE@ $(LIBDIR)/libcurl.la -DEFAULT_INCLUDES = -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -am__mv = mv -f -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ - $(LDFLAGS) -o $@ -SOURCES = 10-at-a-time.c anyauthput.c certinfo.c chkspeed.c \ - cookie_interface.c debug.c externalsocket.c fileupload.c \ - fopen.c ftp-wildcard.c ftpget.c ftpgetinfo.c ftpgetresp.c \ - ftpsget.c ftpupload.c getinfo.c getinmemory.c http-post.c \ - httpcustomheader.c httpput.c https.c imap.c multi-app.c \ - multi-debugcallback.c multi-double.c multi-post.c \ - multi-single.c persistant.c pop3s.c pop3slist.c \ - post-callback.c postit2.c progressfunc.c resolve.c rtsp.c \ - sendrecv.c sepheaders.c sftpget.c simple.c simplepost.c \ - simplesmtp.c simplessl.c smtp-multi.c smtp-tls.c url2file.c -DIST_SOURCES = 10-at-a-time.c anyauthput.c certinfo.c chkspeed.c \ - cookie_interface.c debug.c externalsocket.c fileupload.c \ - fopen.c ftp-wildcard.c ftpget.c ftpgetinfo.c ftpgetresp.c \ - ftpsget.c ftpupload.c getinfo.c getinmemory.c http-post.c \ - httpcustomheader.c httpput.c https.c imap.c multi-app.c \ - multi-debugcallback.c multi-double.c multi-post.c \ - multi-single.c persistant.c pop3s.c pop3slist.c \ - post-callback.c postit2.c progressfunc.c resolve.c rtsp.c \ - sendrecv.c sepheaders.c sftpget.c simple.c simplepost.c \ - simplesmtp.c simplessl.c smtp-multi.c smtp-tls.c url2file.c -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AR = @AR@ -AS = @AS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BLANK_AT_MAKETIME = @BLANK_AT_MAKETIME@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CFLAG_CURL_SYMBOL_HIDING = @CFLAG_CURL_SYMBOL_HIDING@ -CONFIGURE_OPTIONS = @CONFIGURE_OPTIONS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CPPFLAG_CURL_STATICLIB = @CPPFLAG_CURL_STATICLIB@ -CURLVERSION = @CURLVERSION@ -CURL_CA_BUNDLE = @CURL_CA_BUNDLE@ -CURL_CFLAG_EXTRAS = @CURL_CFLAG_EXTRAS@ -CURL_DISABLE_DICT = @CURL_DISABLE_DICT@ -CURL_DISABLE_FILE = @CURL_DISABLE_FILE@ -CURL_DISABLE_FTP = @CURL_DISABLE_FTP@ -CURL_DISABLE_GOPHER = @CURL_DISABLE_GOPHER@ -CURL_DISABLE_HTTP = @CURL_DISABLE_HTTP@ -CURL_DISABLE_IMAP = @CURL_DISABLE_IMAP@ -CURL_DISABLE_LDAP = @CURL_DISABLE_LDAP@ -CURL_DISABLE_LDAPS = @CURL_DISABLE_LDAPS@ -CURL_DISABLE_POP3 = @CURL_DISABLE_POP3@ -CURL_DISABLE_PROXY = @CURL_DISABLE_PROXY@ -CURL_DISABLE_RTSP = @CURL_DISABLE_RTSP@ -CURL_DISABLE_SMTP = @CURL_DISABLE_SMTP@ -CURL_DISABLE_TELNET = @CURL_DISABLE_TELNET@ -CURL_DISABLE_TFTP = @CURL_DISABLE_TFTP@ -CURL_NETWORK_AND_TIME_LIBS = @CURL_NETWORK_AND_TIME_LIBS@ -CURL_NETWORK_LIBS = @CURL_NETWORK_LIBS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_SHARED = @ENABLE_SHARED@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GREP = @GREP@ -HAVE_GNUTLS_SRP = @HAVE_GNUTLS_SRP@ -HAVE_LDAP_SSL = @HAVE_LDAP_SSL@ -HAVE_LIBZ = @HAVE_LIBZ@ -HAVE_NSS_INITCONTEXT = @HAVE_NSS_INITCONTEXT@ -HAVE_SSLEAY_SRP = @HAVE_SSLEAY_SRP@ -IDN_ENABLED = @IDN_ENABLED@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -IPV6_ENABLED = @IPV6_ENABLED@ -KRB4_ENABLED = @KRB4_ENABLED@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBCURL_LIBS = @LIBCURL_LIBS@ -LIBMETALINK_CPPFLAGS = @LIBMETALINK_CPPFLAGS@ -LIBMETALINK_LDFLAGS = @LIBMETALINK_LDFLAGS@ -LIBMETALINK_LIBS = @LIBMETALINK_LIBS@ -LIBOBJS = @LIBOBJS@ - -# Prevent LIBS from being used for all link targets -LIBS = $(BLANK_AT_MAKETIME) -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MANOPT = @MANOPT@ -MKDIR_P = @MKDIR_P@ -NM = @NM@ -NMEDIT = @NMEDIT@ -NROFF = @NROFF@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PKGADD_NAME = @PKGADD_NAME@ -PKGADD_PKG = @PKGADD_PKG@ -PKGADD_VENDOR = @PKGADD_VENDOR@ -PKGCONFIG = @PKGCONFIG@ -RANDOM_FILE = @RANDOM_FILE@ -RANLIB = @RANLIB@ -REQUIRE_LIB_DEPS = @REQUIRE_LIB_DEPS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SSL_ENABLED = @SSL_ENABLED@ -STRIP = @STRIP@ -SUPPORT_FEATURES = @SUPPORT_FEATURES@ -SUPPORT_PROTOCOLS = @SUPPORT_PROTOCOLS@ -USE_ARES = @USE_ARES@ -USE_AXTLS = @USE_AXTLS@ -USE_CYASSL = @USE_CYASSL@ -USE_DARWINSSL = @USE_DARWINSSL@ -USE_GNUTLS = @USE_GNUTLS@ -USE_GNUTLS_NETTLE = @USE_GNUTLS_NETTLE@ -USE_LIBRTMP = @USE_LIBRTMP@ -USE_LIBSSH2 = @USE_LIBSSH2@ -USE_NSS = @USE_NSS@ -USE_OPENLDAP = @USE_OPENLDAP@ -USE_POLARSSL = @USE_POLARSSL@ -USE_SCHANNEL = @USE_SCHANNEL@ -USE_SSLEAY = @USE_SSLEAY@ -USE_WINDOWS_SSPI = @USE_WINDOWS_SSPI@ -VERSION = @VERSION@ -VERSIONED_FLAVOUR = @VERSIONED_FLAVOUR@ -VERSIONNUM = @VERSIONNUM@ -ZLIB_LIBS = @ZLIB_LIBS@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -libext = @libext@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -subdirs = @subdirs@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -AUTOMAKE_OPTIONS = foreign nostdinc -EXTRA_DIST = README Makefile.example Makefile.inc Makefile.m32 \ - Makefile.netware makefile.dj $(COMPLICATED_EXAMPLES) - - -# Specify our include paths here, and do it relative to $(top_srcdir) and -# $(top_builddir), to ensure that these paths which belong to the library -# being currently built and tested are searched before the library which -# might possibly already be installed in the system. -# -# $(top_builddir)/include/curl for generated curlbuild.h included from curl.h -# $(top_builddir)/include for generated curlbuild.h inc. from lib/curl_setup.h -# $(top_srcdir)/include is for libcurl's external include files - -# Avoid libcurl obsolete stuff -AM_CPPFLAGS = -I$(top_builddir)/include/curl -I$(top_builddir)/include \ - -I$(top_srcdir)/include -DCURL_NO_OLDIES $(am__append_1) -LIBDIR = $(top_builddir)/lib -@USE_EXPLICIT_LIB_DEPS_FALSE@LDADD = $(LIBDIR)/libcurl.la - -# Dependencies -@USE_EXPLICIT_LIB_DEPS_TRUE@LDADD = $(LIBDIR)/libcurl.la @LIBCURL_LIBS@ - -# These examples require external dependencies that may not be commonly -# available on POSIX systems, so don't bother attempting to compile them here. -COMPLICATED_EXAMPLES = curlgtk.c curlx.c htmltitle.cpp cacertinmem.c \ - ftpuploadresume.c ghiper.c hiperfifo.c htmltidy.c multithread.c \ - opensslthreadlock.c sampleconv.c synctime.c threaded-ssl.c evhiperfifo.c \ - smooth-gtk-thread.c version-check.pl href_extractor.c asiohiper.cpp - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/Makefile.inc $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign docs/examples/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --foreign docs/examples/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; -$(srcdir)/Makefile.inc: - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): - -clean-checkPROGRAMS: - @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ - echo " rm -f" $$list; \ - rm -f $$list || exit $$?; \ - test -n "$(EXEEXT)" || exit 0; \ - list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f" $$list; \ - rm -f $$list -10-at-a-time$(EXEEXT): $(10_at_a_time_OBJECTS) $(10_at_a_time_DEPENDENCIES) $(EXTRA_10_at_a_time_DEPENDENCIES) - @rm -f 10-at-a-time$(EXEEXT) - $(LINK) $(10_at_a_time_OBJECTS) $(10_at_a_time_LDADD) $(LIBS) -anyauthput$(EXEEXT): $(anyauthput_OBJECTS) $(anyauthput_DEPENDENCIES) $(EXTRA_anyauthput_DEPENDENCIES) - @rm -f anyauthput$(EXEEXT) - $(LINK) $(anyauthput_OBJECTS) $(anyauthput_LDADD) $(LIBS) -certinfo$(EXEEXT): $(certinfo_OBJECTS) $(certinfo_DEPENDENCIES) $(EXTRA_certinfo_DEPENDENCIES) - @rm -f certinfo$(EXEEXT) - $(LINK) $(certinfo_OBJECTS) $(certinfo_LDADD) $(LIBS) -chkspeed$(EXEEXT): $(chkspeed_OBJECTS) $(chkspeed_DEPENDENCIES) $(EXTRA_chkspeed_DEPENDENCIES) - @rm -f chkspeed$(EXEEXT) - $(LINK) $(chkspeed_OBJECTS) $(chkspeed_LDADD) $(LIBS) -cookie_interface$(EXEEXT): $(cookie_interface_OBJECTS) $(cookie_interface_DEPENDENCIES) $(EXTRA_cookie_interface_DEPENDENCIES) - @rm -f cookie_interface$(EXEEXT) - $(LINK) $(cookie_interface_OBJECTS) $(cookie_interface_LDADD) $(LIBS) -debug$(EXEEXT): $(debug_OBJECTS) $(debug_DEPENDENCIES) $(EXTRA_debug_DEPENDENCIES) - @rm -f debug$(EXEEXT) - $(LINK) $(debug_OBJECTS) $(debug_LDADD) $(LIBS) -externalsocket$(EXEEXT): $(externalsocket_OBJECTS) $(externalsocket_DEPENDENCIES) $(EXTRA_externalsocket_DEPENDENCIES) - @rm -f externalsocket$(EXEEXT) - $(LINK) $(externalsocket_OBJECTS) $(externalsocket_LDADD) $(LIBS) -fileupload$(EXEEXT): $(fileupload_OBJECTS) $(fileupload_DEPENDENCIES) $(EXTRA_fileupload_DEPENDENCIES) - @rm -f fileupload$(EXEEXT) - $(LINK) $(fileupload_OBJECTS) $(fileupload_LDADD) $(LIBS) -fopen$(EXEEXT): $(fopen_OBJECTS) $(fopen_DEPENDENCIES) $(EXTRA_fopen_DEPENDENCIES) - @rm -f fopen$(EXEEXT) - $(LINK) $(fopen_OBJECTS) $(fopen_LDADD) $(LIBS) -ftp-wildcard$(EXEEXT): $(ftp_wildcard_OBJECTS) $(ftp_wildcard_DEPENDENCIES) $(EXTRA_ftp_wildcard_DEPENDENCIES) - @rm -f ftp-wildcard$(EXEEXT) - $(LINK) $(ftp_wildcard_OBJECTS) $(ftp_wildcard_LDADD) $(LIBS) -ftpget$(EXEEXT): $(ftpget_OBJECTS) $(ftpget_DEPENDENCIES) $(EXTRA_ftpget_DEPENDENCIES) - @rm -f ftpget$(EXEEXT) - $(LINK) $(ftpget_OBJECTS) $(ftpget_LDADD) $(LIBS) -ftpgetinfo$(EXEEXT): $(ftpgetinfo_OBJECTS) $(ftpgetinfo_DEPENDENCIES) $(EXTRA_ftpgetinfo_DEPENDENCIES) - @rm -f ftpgetinfo$(EXEEXT) - $(LINK) $(ftpgetinfo_OBJECTS) $(ftpgetinfo_LDADD) $(LIBS) -ftpgetresp$(EXEEXT): $(ftpgetresp_OBJECTS) $(ftpgetresp_DEPENDENCIES) $(EXTRA_ftpgetresp_DEPENDENCIES) - @rm -f ftpgetresp$(EXEEXT) - $(LINK) $(ftpgetresp_OBJECTS) $(ftpgetresp_LDADD) $(LIBS) -ftpsget$(EXEEXT): $(ftpsget_OBJECTS) $(ftpsget_DEPENDENCIES) $(EXTRA_ftpsget_DEPENDENCIES) - @rm -f ftpsget$(EXEEXT) - $(LINK) $(ftpsget_OBJECTS) $(ftpsget_LDADD) $(LIBS) -ftpupload$(EXEEXT): $(ftpupload_OBJECTS) $(ftpupload_DEPENDENCIES) $(EXTRA_ftpupload_DEPENDENCIES) - @rm -f ftpupload$(EXEEXT) - $(LINK) $(ftpupload_OBJECTS) $(ftpupload_LDADD) $(LIBS) -getinfo$(EXEEXT): $(getinfo_OBJECTS) $(getinfo_DEPENDENCIES) $(EXTRA_getinfo_DEPENDENCIES) - @rm -f getinfo$(EXEEXT) - $(LINK) $(getinfo_OBJECTS) $(getinfo_LDADD) $(LIBS) -getinmemory$(EXEEXT): $(getinmemory_OBJECTS) $(getinmemory_DEPENDENCIES) $(EXTRA_getinmemory_DEPENDENCIES) - @rm -f getinmemory$(EXEEXT) - $(LINK) $(getinmemory_OBJECTS) $(getinmemory_LDADD) $(LIBS) -http-post$(EXEEXT): $(http_post_OBJECTS) $(http_post_DEPENDENCIES) $(EXTRA_http_post_DEPENDENCIES) - @rm -f http-post$(EXEEXT) - $(LINK) $(http_post_OBJECTS) $(http_post_LDADD) $(LIBS) -httpcustomheader$(EXEEXT): $(httpcustomheader_OBJECTS) $(httpcustomheader_DEPENDENCIES) $(EXTRA_httpcustomheader_DEPENDENCIES) - @rm -f httpcustomheader$(EXEEXT) - $(LINK) $(httpcustomheader_OBJECTS) $(httpcustomheader_LDADD) $(LIBS) -httpput$(EXEEXT): $(httpput_OBJECTS) $(httpput_DEPENDENCIES) $(EXTRA_httpput_DEPENDENCIES) - @rm -f httpput$(EXEEXT) - $(LINK) $(httpput_OBJECTS) $(httpput_LDADD) $(LIBS) -https$(EXEEXT): $(https_OBJECTS) $(https_DEPENDENCIES) $(EXTRA_https_DEPENDENCIES) - @rm -f https$(EXEEXT) - $(LINK) $(https_OBJECTS) $(https_LDADD) $(LIBS) -imap$(EXEEXT): $(imap_OBJECTS) $(imap_DEPENDENCIES) $(EXTRA_imap_DEPENDENCIES) - @rm -f imap$(EXEEXT) - $(LINK) $(imap_OBJECTS) $(imap_LDADD) $(LIBS) -multi-app$(EXEEXT): $(multi_app_OBJECTS) $(multi_app_DEPENDENCIES) $(EXTRA_multi_app_DEPENDENCIES) - @rm -f multi-app$(EXEEXT) - $(LINK) $(multi_app_OBJECTS) $(multi_app_LDADD) $(LIBS) -multi-debugcallback$(EXEEXT): $(multi_debugcallback_OBJECTS) $(multi_debugcallback_DEPENDENCIES) $(EXTRA_multi_debugcallback_DEPENDENCIES) - @rm -f multi-debugcallback$(EXEEXT) - $(LINK) $(multi_debugcallback_OBJECTS) $(multi_debugcallback_LDADD) $(LIBS) -multi-double$(EXEEXT): $(multi_double_OBJECTS) $(multi_double_DEPENDENCIES) $(EXTRA_multi_double_DEPENDENCIES) - @rm -f multi-double$(EXEEXT) - $(LINK) $(multi_double_OBJECTS) $(multi_double_LDADD) $(LIBS) -multi-post$(EXEEXT): $(multi_post_OBJECTS) $(multi_post_DEPENDENCIES) $(EXTRA_multi_post_DEPENDENCIES) - @rm -f multi-post$(EXEEXT) - $(LINK) $(multi_post_OBJECTS) $(multi_post_LDADD) $(LIBS) -multi-single$(EXEEXT): $(multi_single_OBJECTS) $(multi_single_DEPENDENCIES) $(EXTRA_multi_single_DEPENDENCIES) - @rm -f multi-single$(EXEEXT) - $(LINK) $(multi_single_OBJECTS) $(multi_single_LDADD) $(LIBS) -persistant$(EXEEXT): $(persistant_OBJECTS) $(persistant_DEPENDENCIES) $(EXTRA_persistant_DEPENDENCIES) - @rm -f persistant$(EXEEXT) - $(LINK) $(persistant_OBJECTS) $(persistant_LDADD) $(LIBS) -pop3s$(EXEEXT): $(pop3s_OBJECTS) $(pop3s_DEPENDENCIES) $(EXTRA_pop3s_DEPENDENCIES) - @rm -f pop3s$(EXEEXT) - $(LINK) $(pop3s_OBJECTS) $(pop3s_LDADD) $(LIBS) -pop3slist$(EXEEXT): $(pop3slist_OBJECTS) $(pop3slist_DEPENDENCIES) $(EXTRA_pop3slist_DEPENDENCIES) - @rm -f pop3slist$(EXEEXT) - $(LINK) $(pop3slist_OBJECTS) $(pop3slist_LDADD) $(LIBS) -post-callback$(EXEEXT): $(post_callback_OBJECTS) $(post_callback_DEPENDENCIES) $(EXTRA_post_callback_DEPENDENCIES) - @rm -f post-callback$(EXEEXT) - $(LINK) $(post_callback_OBJECTS) $(post_callback_LDADD) $(LIBS) -postit2$(EXEEXT): $(postit2_OBJECTS) $(postit2_DEPENDENCIES) $(EXTRA_postit2_DEPENDENCIES) - @rm -f postit2$(EXEEXT) - $(LINK) $(postit2_OBJECTS) $(postit2_LDADD) $(LIBS) -progressfunc$(EXEEXT): $(progressfunc_OBJECTS) $(progressfunc_DEPENDENCIES) $(EXTRA_progressfunc_DEPENDENCIES) - @rm -f progressfunc$(EXEEXT) - $(LINK) $(progressfunc_OBJECTS) $(progressfunc_LDADD) $(LIBS) -resolve$(EXEEXT): $(resolve_OBJECTS) $(resolve_DEPENDENCIES) $(EXTRA_resolve_DEPENDENCIES) - @rm -f resolve$(EXEEXT) - $(LINK) $(resolve_OBJECTS) $(resolve_LDADD) $(LIBS) -rtsp$(EXEEXT): $(rtsp_OBJECTS) $(rtsp_DEPENDENCIES) $(EXTRA_rtsp_DEPENDENCIES) - @rm -f rtsp$(EXEEXT) - $(LINK) $(rtsp_OBJECTS) $(rtsp_LDADD) $(LIBS) -sendrecv$(EXEEXT): $(sendrecv_OBJECTS) $(sendrecv_DEPENDENCIES) $(EXTRA_sendrecv_DEPENDENCIES) - @rm -f sendrecv$(EXEEXT) - $(LINK) $(sendrecv_OBJECTS) $(sendrecv_LDADD) $(LIBS) -sepheaders$(EXEEXT): $(sepheaders_OBJECTS) $(sepheaders_DEPENDENCIES) $(EXTRA_sepheaders_DEPENDENCIES) - @rm -f sepheaders$(EXEEXT) - $(LINK) $(sepheaders_OBJECTS) $(sepheaders_LDADD) $(LIBS) -sftpget$(EXEEXT): $(sftpget_OBJECTS) $(sftpget_DEPENDENCIES) $(EXTRA_sftpget_DEPENDENCIES) - @rm -f sftpget$(EXEEXT) - $(LINK) $(sftpget_OBJECTS) $(sftpget_LDADD) $(LIBS) -simple$(EXEEXT): $(simple_OBJECTS) $(simple_DEPENDENCIES) $(EXTRA_simple_DEPENDENCIES) - @rm -f simple$(EXEEXT) - $(LINK) $(simple_OBJECTS) $(simple_LDADD) $(LIBS) -simplepost$(EXEEXT): $(simplepost_OBJECTS) $(simplepost_DEPENDENCIES) $(EXTRA_simplepost_DEPENDENCIES) - @rm -f simplepost$(EXEEXT) - $(LINK) $(simplepost_OBJECTS) $(simplepost_LDADD) $(LIBS) -simplesmtp$(EXEEXT): $(simplesmtp_OBJECTS) $(simplesmtp_DEPENDENCIES) $(EXTRA_simplesmtp_DEPENDENCIES) - @rm -f simplesmtp$(EXEEXT) - $(LINK) $(simplesmtp_OBJECTS) $(simplesmtp_LDADD) $(LIBS) -simplessl$(EXEEXT): $(simplessl_OBJECTS) $(simplessl_DEPENDENCIES) $(EXTRA_simplessl_DEPENDENCIES) - @rm -f simplessl$(EXEEXT) - $(LINK) $(simplessl_OBJECTS) $(simplessl_LDADD) $(LIBS) -smtp-multi$(EXEEXT): $(smtp_multi_OBJECTS) $(smtp_multi_DEPENDENCIES) $(EXTRA_smtp_multi_DEPENDENCIES) - @rm -f smtp-multi$(EXEEXT) - $(LINK) $(smtp_multi_OBJECTS) $(smtp_multi_LDADD) $(LIBS) -smtp-tls$(EXEEXT): $(smtp_tls_OBJECTS) $(smtp_tls_DEPENDENCIES) $(EXTRA_smtp_tls_DEPENDENCIES) - @rm -f smtp-tls$(EXEEXT) - $(LINK) $(smtp_tls_OBJECTS) $(smtp_tls_LDADD) $(LIBS) -url2file$(EXEEXT): $(url2file_OBJECTS) $(url2file_DEPENDENCIES) $(EXTRA_url2file_DEPENDENCIES) - @rm -f url2file$(EXEEXT) - $(LINK) $(url2file_OBJECTS) $(url2file_LDADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/10-at-a-time.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/anyauthput.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/certinfo.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chkspeed.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cookie_interface.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/debug.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/externalsocket.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fileupload.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fopen.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ftp-wildcard.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ftpget.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ftpgetinfo.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ftpgetresp.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ftpsget.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ftpupload.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getinfo.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getinmemory.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/http-post.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/httpcustomheader.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/httpput.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/https.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/imap.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/multi-app.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/multi-debugcallback.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/multi-double.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/multi-post.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/multi-single.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/persistant.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pop3s.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pop3slist.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/post-callback.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/postit2.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/progressfunc.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/resolve.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rtsp.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sendrecv.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sepheaders.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sftpget.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/simple.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/simplepost.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/simplesmtp.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/simplessl.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smtp-multi.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smtp-tls.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/url2file.Po@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - set x; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - if test $$# -gt 0; then \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - "$$@" $$unique; \ - else \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$unique; \ - fi; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - test -z "$(CTAGS_ARGS)$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && $(am__cd) $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) "$$here" - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done -check-am: all-am - $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) -check: check-am -all-am: Makefile -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ - mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: - -.MAKE: check-am install-am install-strip - -.PHONY: CTAGS GTAGS all all-am check check-am clean \ - clean-checkPROGRAMS clean-generic clean-libtool ctags \ - distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags uninstall uninstall-am - - -# Makefile.inc provides the check_PROGRAMS and COMPLICATED_EXAMPLES defines - -all: $(check_PROGRAMS) - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/plugins/FTPFileYM/curl/docs/examples/Makefile.inc b/plugins/FTPFileYM/curl/docs/examples/Makefile.inc deleted file mode 100644 index 9aabfcabdc..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/Makefile.inc +++ /dev/null @@ -1,15 +0,0 @@ -# These are all libcurl example programs to be test compiled -check_PROGRAMS = 10-at-a-time anyauthput cookie_interface debug fileupload \ - fopen ftpget ftpgetresp ftpupload getinfo getinmemory http-post httpput \ - https multi-app multi-debugcallback multi-double multi-post multi-single \ - persistant post-callback postit2 sepheaders simple simplepost simplessl \ - sendrecv httpcustomheader certinfo chkspeed ftpgetinfo ftp-wildcard \ - smtp-multi simplesmtp smtp-tls rtsp externalsocket resolve \ - progressfunc pop3s pop3slist imap url2file sftpget ftpsget - -# These examples require external dependencies that may not be commonly -# available on POSIX systems, so don't bother attempting to compile them here. -COMPLICATED_EXAMPLES = curlgtk.c curlx.c htmltitle.cpp cacertinmem.c \ - ftpuploadresume.c ghiper.c hiperfifo.c htmltidy.c multithread.c \ - opensslthreadlock.c sampleconv.c synctime.c threaded-ssl.c evhiperfifo.c \ - smooth-gtk-thread.c version-check.pl href_extractor.c asiohiper.cpp diff --git a/plugins/FTPFileYM/curl/docs/examples/Makefile.m32 b/plugins/FTPFileYM/curl/docs/examples/Makefile.m32 deleted file mode 100644 index 4e93093d60..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/Makefile.m32 +++ /dev/null @@ -1,282 +0,0 @@ -#*************************************************************************** -# _ _ ____ _ -# Project ___| | | | _ \| | -# / __| | | | |_) | | -# | (__| |_| | _ <| |___ -# \___|\___/|_| \_\_____| -# -# Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. -# -# This software is licensed as described in the file COPYING, which -# you should have received as part of this distribution. The terms -# are also available at http://curl.haxx.se/docs/copyright.html. -# -# You may opt to use, copy, modify, merge, publish, distribute and/or sell -# copies of the Software, and permit persons to whom the Software is -# furnished to do so, under the terms of the COPYING file. -# -# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -# KIND, either express or implied. -# -########################################################################### -# -## Makefile for building curl examples with MingW (GCC-3.2 or later) -## and optionally OpenSSL (0.9.8), libssh2 (1.3), zlib (1.2.5), librtmp (2.3) -## -## Usage: mingw32-make -f Makefile.m32 CFG=-feature1[-feature2][-feature3][...] -## Example: mingw32-make -f Makefile.m32 CFG=-zlib-ssl-spi-winidn -## -## Hint: you can also set environment vars to control the build, f.e.: -## set ZLIB_PATH=c:/zlib-1.2.7 -## set ZLIB=1 -# -########################################################################### - -# Edit the path below to point to the base of your Zlib sources. -ifndef ZLIB_PATH -ZLIB_PATH = ../../../zlib-1.2.7 -endif -# Edit the path below to point to the base of your OpenSSL package. -ifndef OPENSSL_PATH -OPENSSL_PATH = ../../../openssl-0.9.8x -endif -# Edit the path below to point to the base of your LibSSH2 package. -ifndef LIBSSH2_PATH -LIBSSH2_PATH = ../../../libssh2-1.4.3 -endif -# Edit the path below to point to the base of your librtmp package. -ifndef LIBRTMP_PATH -LIBRTMP_PATH = ../../../librtmp-2.3 -endif -# Edit the path below to point to the base of your libidn package. -ifndef LIBIDN_PATH -LIBIDN_PATH = ../../../libidn-1.18 -endif -# Edit the path below to point to the base of your MS IDN package. -# Microsoft Internationalized Domain Names (IDN) Mitigation APIs 1.1 -# http://www.microsoft.com/downloads/en/details.aspx?FamilyID=ad6158d7-ddba-416a-9109-07607425a815 -ifndef WINIDN_PATH -WINIDN_PATH = ../../../Microsoft IDN Mitigation APIs -endif -# Edit the path below to point to the base of your Novell LDAP NDK. -ifndef LDAP_SDK -LDAP_SDK = c:/novell/ndk/cldapsdk/win32 -endif - -PROOT = ../.. - -# Edit the path below to point to the base of your c-ares package. -ifndef LIBCARES_PATH -LIBCARES_PATH = $(PROOT)/ares -endif - -# Edit the var below to set to your architecture or set environment var. -ifndef ARCH -ARCH = w32 -endif - -CC = $(CROSSPREFIX)gcc -CFLAGS = -g -O2 -Wall -CFLAGS += -fno-strict-aliasing -ifeq ($(ARCH),w64) -CFLAGS += -D_AMD64_ -endif -# comment LDFLAGS below to keep debug info -LDFLAGS = -s -RC = $(CROSSPREFIX)windres -RCFLAGS = --include-dir=$(PROOT)/include -O COFF -i - -# Platform-dependent helper tool macros -ifeq ($(findstring /sh,$(SHELL)),/sh) -DEL = rm -f $1 -RMDIR = rm -fr $1 -MKDIR = mkdir -p $1 -COPY = -cp -afv $1 $2 -#COPYR = -cp -afr $1/* $2 -COPYR = -rsync -aC $1/* $2 -TOUCH = touch $1 -CAT = cat -ECHONL = echo "" -DL = ' -else -ifeq "$(OS)" "Windows_NT" -DEL = -del 2>NUL /q /f $(subst /,\,$1) -RMDIR = -rd 2>NUL /q /s $(subst /,\,$1) -else -DEL = -del 2>NUL $(subst /,\,$1) -RMDIR = -deltree 2>NUL /y $(subst /,\,$1) -endif -MKDIR = -md 2>NUL $(subst /,\,$1) -COPY = -copy 2>NUL /y $(subst /,\,$1) $(subst /,\,$2) -COPYR = -xcopy 2>NUL /q /y /e $(subst /,\,$1) $(subst /,\,$2) -TOUCH = copy 2>&1>NUL /b $(subst /,\,$1) +,, -CAT = type -ECHONL = $(ComSpec) /c echo. -endif - -######################################################## -## Nothing more to do below this line! - -ifeq ($(findstring -dyn,$(CFG)),-dyn) -DYN = 1 -endif -ifeq ($(findstring -ares,$(CFG)),-ares) -ARES = 1 -endif -ifeq ($(findstring -rtmp,$(CFG)),-rtmp) -RTMP = 1 -SSL = 1 -ZLIB = 1 -endif -ifeq ($(findstring -ssh2,$(CFG)),-ssh2) -SSH2 = 1 -SSL = 1 -ZLIB = 1 -endif -ifeq ($(findstring -ssl,$(CFG)),-ssl) -SSL = 1 -endif -ifeq ($(findstring -zlib,$(CFG)),-zlib) -ZLIB = 1 -endif -ifeq ($(findstring -idn,$(CFG)),-idn) -IDN = 1 -endif -ifeq ($(findstring -winidn,$(CFG)),-winidn) -WINIDN = 1 -endif -ifeq ($(findstring -sspi,$(CFG)),-sspi) -SSPI = 1 -endif -ifeq ($(findstring -spnego,$(CFG)),-spnego) -SPNEGO = 1 -endif -ifeq ($(findstring -ldaps,$(CFG)),-ldaps) -LDAPS = 1 -endif -ifeq ($(findstring -ipv6,$(CFG)),-ipv6) -IPV6 = 1 -endif -ifeq ($(findstring -metalink,$(CFG)),-metalink) -METALINK = 1 -endif -ifeq ($(findstring -winssl,$(CFG)),-winssl) -SCHANNEL = 1 -SSPI = 1 -endif - -INCLUDES = -I. -I$(PROOT) -I$(PROOT)/include -I$(PROOT)/lib - -ifdef DYN - curl_DEPENDENCIES = $(PROOT)/lib/libcurldll.a $(PROOT)/lib/libcurl.dll - curl_LDADD = -L$(PROOT)/lib -lcurldll -else - curl_DEPENDENCIES = $(PROOT)/lib/libcurl.a - curl_LDADD = -L$(PROOT)/lib -lcurl - CFLAGS += -DCURL_STATICLIB - LDFLAGS += -static -endif -ifdef ARES - ifndef DYN - curl_DEPENDENCIES += $(LIBCARES_PATH)/libcares.a - endif - CFLAGS += -DUSE_ARES - curl_LDADD += -L"$(LIBCARES_PATH)" -lcares -endif -ifdef RTMP - CFLAGS += -DUSE_LIBRTMP - curl_LDADD += -L"$(LIBRTMP_PATH)/librtmp" -lrtmp -lwinmm -endif -ifdef SSH2 - CFLAGS += -DUSE_LIBSSH2 -DHAVE_LIBSSH2_H - curl_LDADD += -L"$(LIBSSH2_PATH)/win32" -lssh2 -endif -ifdef SSL - ifndef OPENSSL_LIBPATH - OPENSSL_LIBS = -lssl -lcrypto - ifeq "$(wildcard $(OPENSSL_PATH)/out)" "$(OPENSSL_PATH)/out" - OPENSSL_LIBPATH = $(OPENSSL_PATH)/out - ifdef DYN - OPENSSL_LIBS = -lssl32 -leay32 - endif - endif - ifeq "$(wildcard $(OPENSSL_PATH)/lib)" "$(OPENSSL_PATH)/lib" - OPENSSL_LIBPATH = $(OPENSSL_PATH)/lib - endif - endif - ifndef DYN - OPENSSL_LIBS += -lgdi32 -lcrypt32 - endif - CFLAGS += -DUSE_SSLEAY - curl_LDADD += -L"$(OPENSSL_LIBPATH)" $(OPENSSL_LIBS) -endif -ifdef ZLIB - INCLUDES += -I"$(ZLIB_PATH)" - CFLAGS += -DHAVE_LIBZ -DHAVE_ZLIB_H - curl_LDADD += -L"$(ZLIB_PATH)" -lz -endif -ifdef IDN - CFLAGS += -DUSE_LIBIDN - curl_LDADD += -L"$(LIBIDN_PATH)/lib" -lidn -else -ifdef WINIDN - CFLAGS += -DUSE_WIN32_IDN - curl_LDADD += -L"$(WINIDN_PATH)" -lnormaliz -endif -endif -ifdef SSPI - CFLAGS += -DUSE_WINDOWS_SSPI - ifdef SCHANNEL - CFLAGS += -DUSE_SCHANNEL - endif -endif -ifdef SPNEGO - CFLAGS += -DHAVE_SPNEGO -endif -ifdef IPV6 - CFLAGS += -DENABLE_IPV6 -D_WIN32_WINNT=0x0501 -endif -ifdef LDAPS - CFLAGS += -DHAVE_LDAP_SSL -endif -ifdef USE_LDAP_NOVELL - CFLAGS += -DCURL_HAS_NOVELL_LDAPSDK - curl_LDADD += -L"$(LDAP_SDK)/lib/mscvc" -lldapsdk -lldapssl -lldapx -endif -ifdef USE_LDAP_OPENLDAP - CFLAGS += -DCURL_HAS_OPENLDAP_LDAPSDK - curl_LDADD += -L"$(LDAP_SDK)/lib" -lldap -llber -endif -ifndef USE_LDAP_NOVELL -ifndef USE_LDAP_OPENLDAP - curl_LDADD += -lwldap32 -endif -endif -curl_LDADD += -lws2_32 - -# Makefile.inc provides the check_PROGRAMS and COMPLICATED_EXAMPLES defines -include Makefile.inc - -check_PROGRAMS := $(patsubst %,%.exe,$(strip $(check_PROGRAMS))) -check_PROGRAMS += ftpuploadresume.exe synctime.exe - -.PRECIOUS: %.o - - -all: $(check_PROGRAMS) - -%.exe: %.o $(curl_DEPENDENCIES) - $(CC) $(LDFLAGS) -o $@ $< $(curl_LDADD) - -%.o: %.c - $(CC) $(INCLUDES) $(CFLAGS) -c $< - -%.res: %.rc - $(RC) $(RCFLAGS) $< -o $@ - -clean: - @$(call DEL, $(check_PROGRAMS:.exe=.o)) - -distclean vclean: clean - @$(call DEL, $(check_PROGRAMS)) - diff --git a/plugins/FTPFileYM/curl/docs/examples/Makefile.netware b/plugins/FTPFileYM/curl/docs/examples/Makefile.netware deleted file mode 100644 index e1a48b7d55..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/Makefile.netware +++ /dev/null @@ -1,441 +0,0 @@ -################################################################# -# -## Makefile for building curl.nlm (NetWare version - gnu make) -## Use: make -f Makefile.netware -## -## Comments to: Guenter Knauf http://www.gknw.net/phpbb -# -################################################################# - -# Edit the path below to point to the base of your Novell NDK. -ifndef NDKBASE -NDKBASE = c:/novell -endif - -# Edit the path below to point to the base of your Zlib sources. -ifndef ZLIB_PATH -ZLIB_PATH = ../../../zlib-1.2.7 -endif - -# Edit the path below to point to the base of your OpenSSL package. -ifndef OPENSSL_PATH -OPENSSL_PATH = ../../../openssl-0.9.8x -endif - -# Edit the path below to point to the base of your LibSSH2 package. -ifndef LIBSSH2_PATH -LIBSSH2_PATH = ../../../libssh2-1.4.3 -endif - -# Edit the path below to point to the base of your axTLS package. -ifndef AXTLS_PATH -AXTLS_PATH = ../../../axTLS-1.2.7 -endif - -# Edit the path below to point to the base of your libidn package. -ifndef LIBIDN_PATH -LIBIDN_PATH = ../../../libidn-1.18 -endif - -# Edit the path below to point to the base of your librtmp package. -ifndef LIBRTMP_PATH -LIBRTMP_PATH = ../../../librtmp-2.3 -endif - -# Edit the path below to point to the base of your fbopenssl package. -ifndef FBOPENSSL_PATH -FBOPENSSL_PATH = ../../fbopenssl-0.4 -endif - -# Edit the path below to point to the base of your c-ares package. -ifndef LIBCARES_PATH -LIBCARES_PATH = ../../ares -endif - -ifndef INSTDIR -INSTDIR = ..$(DS)..$(DS)curl-$(LIBCURL_VERSION_STR)-bin-nw -endif - -# Edit the vars below to change NLM target settings. -TARGET = examples -VERSION = $(LIBCURL_VERSION) -COPYR = Copyright (C) $(LIBCURL_COPYRIGHT_STR) -DESCR = cURL ($(LIBARCH)) -MTSAFE = YES -STACK = 8192 -SCREEN = Example Program -# Comment the line below if you dont want to load protected automatically. -# LDRING = 3 - -# Uncomment the next line to enable linking with POSIX semantics. -# POSIXFL = 1 - -# Edit the var below to point to your lib architecture. -ifndef LIBARCH -LIBARCH = LIBC -endif - -# must be equal to NDEBUG or DEBUG, CURLDEBUG -ifndef DB -DB = NDEBUG -endif -# Optimization: -O<n> or debugging: -g -ifeq ($(DB),NDEBUG) - OPT = -O2 - OBJDIR = release -else - OPT = -g - OBJDIR = debug -endif - -# The following lines defines your compiler. -ifdef CWFolder - METROWERKS = $(CWFolder) -endif -ifdef METROWERKS - # MWCW_PATH = $(subst \,/,$(METROWERKS))/Novell Support - MWCW_PATH = $(subst \,/,$(METROWERKS))/Novell Support/Metrowerks Support - CC = mwccnlm -else - CC = gcc -endif -PERL = perl -# Here you can find a native Win32 binary of the original awk: -# http://www.gknw.net/development/prgtools/awk-20100523.zip -AWK = awk -CP = cp -afv -MKDIR = mkdir -# RM = rm -f -# If you want to mark the target as MTSAFE you will need a tool for -# generating the xdc data for the linker; here's a minimal tool: -# http://www.gknw.net/development/prgtools/mkxdc.zip -MPKXDC = mkxdc - -# LIBARCH_U = $(shell $(AWK) 'BEGIN {print toupper(ARGV[1])}' $(LIBARCH)) -LIBARCH_L = $(shell $(AWK) 'BEGIN {print tolower(ARGV[1])}' $(LIBARCH)) - -# Include the version info retrieved from curlver.h --include $(OBJDIR)/version.inc - -# Global flags for all compilers -CFLAGS += $(OPT) -D$(DB) -DNETWARE -DHAVE_CONFIG_H -nostdinc - -ifeq ($(CC),mwccnlm) -LD = mwldnlm -LDFLAGS = -nostdlib $< $(PRELUDE) $(LDLIBS) -o $@ -commandfile -LIBEXT = lib -CFLAGS += -gccinc -inline off -opt nointrinsics -proc 586 -CFLAGS += -relax_pointers -#CFLAGS += -w on -ifeq ($(LIBARCH),LIBC) -ifeq ($(POSIXFL),1) - PRELUDE = $(NDK_LIBC)/imports/posixpre.o -else - PRELUDE = $(NDK_LIBC)/imports/libcpre.o -endif - CFLAGS += -align 4 -else - # PRELUDE = $(NDK_CLIB)/imports/clibpre.o - # to avoid the __init_* / __deinit_* whoes dont use prelude from NDK - PRELUDE = "$(MWCW_PATH)/libraries/runtime/prelude.obj" - # CFLAGS += -include "$(MWCW_PATH)/headers/nlm_clib_prefix.h" - CFLAGS += -align 1 -endif -else -LD = nlmconv -LDFLAGS = -T -LIBEXT = a -CFLAGS += -m32 -CFLAGS += -fno-builtin -fno-strict-aliasing -ifeq ($(findstring gcc,$(CC)),gcc) -CFLAGS += -fpcc-struct-return -endif -CFLAGS += -Wall # -pedantic -ifeq ($(LIBARCH),LIBC) -ifeq ($(POSIXFL),1) - PRELUDE = $(NDK_LIBC)/imports/posixpre.gcc.o -else - PRELUDE = $(NDK_LIBC)/imports/libcpre.gcc.o -endif -else - # PRELUDE = $(NDK_CLIB)/imports/clibpre.gcc.o - # to avoid the __init_* / __deinit_* whoes dont use prelude from NDK - # http://www.gknw.net/development/mk_nlm/gcc_pre.zip - PRELUDE = $(NDK_ROOT)/pre/prelude.o - CFLAGS += -include $(NDKBASE)/nlmconv/genlm.h -endif -endif - -NDK_ROOT = $(NDKBASE)/ndk -ifndef NDK_CLIB -NDK_CLIB = $(NDK_ROOT)/nwsdk -endif -ifndef NDK_LIBC -NDK_LIBC = $(NDK_ROOT)/libc -endif -ifndef NDK_LDAP -NDK_LDAP = $(NDK_ROOT)/cldapsdk/netware -endif -CURL_INC = ../../include -CURL_LIB = ../../lib - -INCLUDES = -I$(CURL_INC) - -ifeq ($(findstring -static,$(CFG)),-static) -LINK_STATIC = 1 -endif -ifeq ($(findstring -ares,$(CFG)),-ares) -WITH_ARES = 1 -endif -ifeq ($(findstring -rtmp,$(CFG)),-rtmp) -WITH_RTMP = 1 -WITH_SSL = 1 -WITH_ZLIB = 1 -endif -ifeq ($(findstring -ssh2,$(CFG)),-ssh2) -WITH_SSH2 = 1 -WITH_SSL = 1 -WITH_ZLIB = 1 -endif -ifeq ($(findstring -axtls,$(CFG)),-axtls) -WITH_AXTLS = 1 -WITH_SSL = -else -ifeq ($(findstring -ssl,$(CFG)),-ssl) -WITH_SSL = 1 -endif -endif -ifeq ($(findstring -zlib,$(CFG)),-zlib) -WITH_ZLIB = 1 -endif -ifeq ($(findstring -idn,$(CFG)),-idn) -WITH_IDN = 1 -endif -ifeq ($(findstring -spnego,$(CFG)),-spnego) -WITH_SPNEGO = 1 -endif -ifeq ($(findstring -ipv6,$(CFG)),-ipv6) -ENABLE_IPV6 = 1 -endif - -ifdef LINK_STATIC - LDLIBS = $(CURL_LIB)/libcurl.$(LIBEXT) -ifdef WITH_ARES - LDLIBS += $(LIBCARES_PATH)/libcares.$(LIBEXT) -endif -else - MODULES = libcurl.nlm - IMPORTS = @$(CURL_LIB)/libcurl.imp -endif -ifdef WITH_SSH2 - # INCLUDES += -I$(LIBSSH2_PATH)/include -ifdef LINK_STATIC - LDLIBS += $(LIBSSH2_PATH)/nw/libssh2.$(LIBEXT) -else - MODULES += libssh2.nlm - IMPORTS += @$(LIBSSH2_PATH)/nw/libssh2.imp -endif -endif -ifdef WITH_RTMP - # INCLUDES += -I$(LIBRTMP_PATH) -ifdef LINK_STATIC - LDLIBS += $(LIBRTMP_PATH)/librtmp/librtmp.$(LIBEXT) -endif -endif -ifdef WITH_SSL - INCLUDES += -I$(OPENSSL_PATH)/outinc_nw_$(LIBARCH_L) - LDLIBS += $(OPENSSL_PATH)/out_nw_$(LIBARCH_L)/ssl.$(LIBEXT) - LDLIBS += $(OPENSSL_PATH)/out_nw_$(LIBARCH_L)/crypto.$(LIBEXT) - IMPORTS += GetProcessSwitchCount RunningProcess -ifdef WITH_SPNEGO - # INCLUDES += -I$(FBOPENSSL_PATH)/include - LDLIBS += $(FBOPENSSL_PATH)/nw/fbopenssl.$(LIBEXT) -endif -else -ifdef WITH_AXTLS - INCLUDES += -I$(AXTLS_PATH)/inc -ifdef LINK_STATIC - LDLIBS += $(AXTLS_PATH)/lib/libaxtls.$(LIBEXT) -else - MODULES += libaxtls.nlm - IMPORTS += $(AXTLS_PATH)/lib/libaxtls.imp -endif -endif -endif -ifdef WITH_ZLIB - # INCLUDES += -I$(ZLIB_PATH) -ifdef LINK_STATIC - LDLIBS += $(ZLIB_PATH)/nw/$(LIBARCH)/libz.$(LIBEXT) -else - MODULES += libz.nlm - IMPORTS += @$(ZLIB_PATH)/nw/$(LIBARCH)/libz.imp -endif -endif -ifdef WITH_IDN - # INCLUDES += -I$(LIBIDN_PATH)/include - LDLIBS += $(LIBIDN_PATH)/lib/libidn.$(LIBEXT) -endif - -ifeq ($(LIBARCH),LIBC) - INCLUDES += -I$(NDK_LIBC)/include - # INCLUDES += -I$(NDK_LIBC)/include/nks - # INCLUDES += -I$(NDK_LIBC)/include/winsock - CFLAGS += -D_POSIX_SOURCE -else - INCLUDES += -I$(NDK_CLIB)/include/nlm - # INCLUDES += -I$(NDK_CLIB)/include -endif -ifndef DISABLE_LDAP - # INCLUDES += -I$(NDK_LDAP)/$(LIBARCH_L)/inc -endif -CFLAGS += $(INCLUDES) - -ifeq ($(MTSAFE),YES) - XDCOPT = -n -endif -ifeq ($(MTSAFE),NO) - XDCOPT = -u -endif -ifdef XDCOPT - XDCDATA = $(OBJDIR)/$(TARGET).xdc -endif - -ifeq ($(findstring /sh,$(SHELL)),/sh) -DL = ' -DS = / -PCT = % -#-include $(NDKBASE)/nlmconv/ncpfs.inc -else -DS = \\ -PCT = %% -endif - -# Makefile.inc provides the CSOURCES and HHEADERS defines -include Makefile.inc - -check_PROGRAMS := $(patsubst %,%.nlm,$(strip $(check_PROGRAMS))) - -.PRECIOUS: $(OBJDIR)/%.o $(OBJDIR)/%.def $(OBJDIR)/%.xdc - - -all: prebuild $(check_PROGRAMS) - -prebuild: $(OBJDIR) $(OBJDIR)/version.inc - -$(OBJDIR)/%.o: %.c - @echo Compiling $< - $(CC) $(CFLAGS) -c $< -o $@ - -$(OBJDIR)/version.inc: $(CURL_INC)/curl/curlver.h $(OBJDIR) - @echo Creating $@ - @$(AWK) -f ../../packages/NetWare/get_ver.awk $< > $@ - -install: $(INSTDIR) all - @$(CP) $(check_PROGRAMS) $(INSTDIR) - -clean: - -$(RM) -r $(OBJDIR) - -distclean vclean: clean - -$(RM) $(check_PROGRAMS) - -$(OBJDIR) $(INSTDIR): - @$(MKDIR) $@ - -%.nlm: $(OBJDIR)/%.o $(OBJDIR)/%.def $(XDCDATA) - @echo Linking $@ - @-$(RM) $@ - @$(LD) $(LDFLAGS) $(OBJDIR)/$(@:.nlm=.def) - -$(OBJDIR)/%.xdc: Makefile.netware - @echo Creating $@ - @$(MPKXDC) $(XDCOPT) $@ - -$(OBJDIR)/%.def: Makefile.netware - @echo $(DL)# DEF file for linking with $(LD)$(DL) > $@ - @echo $(DL)# Do not edit this file - it is created by Make!$(DL) >> $@ - @echo $(DL)# All your changes will be lost!!$(DL) >> $@ - @echo $(DL)#$(DL) >> $@ - @echo $(DL)copyright "$(COPYR)"$(DL) >> $@ - @echo $(DL)description "$(DESCR) $(notdir $(@:.def=)) Example"$(DL) >> $@ - @echo $(DL)version $(VERSION)$(DL) >> $@ -ifdef NLMTYPE - @echo $(DL)type $(NLMTYPE)$(DL) >> $@ -endif -ifdef STACK - @echo $(DL)stack $(STACK)$(DL) >> $@ -endif -ifdef SCREEN - @echo $(DL)screenname "$(DESCR) $(notdir $(@:.def=)) $(SCREEN)"$(DL) >> $@ -else - @echo $(DL)screenname "DEFAULT"$(DL) >> $@ -endif -ifneq ($(DB),NDEBUG) - @echo $(DL)debug$(DL) >> $@ -endif - @echo $(DL)threadname "_$(notdir $(@:.def=))"$(DL) >> $@ -ifdef XDCDATA - @echo $(DL)xdcdata $(XDCDATA)$(DL) >> $@ -endif -ifeq ($(LDRING),0) - @echo $(DL)flag_on 16$(DL) >> $@ -endif -ifeq ($(LDRING),3) - @echo $(DL)flag_on 512$(DL) >> $@ -endif -ifeq ($(LIBARCH),CLIB) - @echo $(DL)start _Prelude$(DL) >> $@ - @echo $(DL)exit _Stop$(DL) >> $@ - @echo $(DL)import @$(NDK_CLIB)/imports/clib.imp$(DL) >> $@ - @echo $(DL)import @$(NDK_CLIB)/imports/threads.imp$(DL) >> $@ - @echo $(DL)import @$(NDK_CLIB)/imports/nlmlib.imp$(DL) >> $@ - @echo $(DL)import @$(NDK_CLIB)/imports/socklib.imp$(DL) >> $@ - @echo $(DL)module clib$(DL) >> $@ -ifndef DISABLE_LDAP - @echo $(DL)import @$(NDK_LDAP)/clib/imports/ldapsdk.imp$(DL) >> $@ - @echo $(DL)import @$(NDK_LDAP)/clib/imports/ldapssl.imp$(DL) >> $@ -# @echo $(DL)import @$(NDK_LDAP)/clib/imports/ldapx.imp$(DL) >> $@ - @echo $(DL)module ldapsdk ldapssl$(DL) >> $@ -endif -else -ifeq ($(POSIXFL),1) - @echo $(DL)flag_on 4194304$(DL) >> $@ -endif - @echo $(DL)flag_on 64$(DL) >> $@ - @echo $(DL)pseudopreemption$(DL) >> $@ -ifeq ($(findstring posixpre,$(PRELUDE)),posixpre) - @echo $(DL)start POSIX_Start$(DL) >> $@ - @echo $(DL)exit POSIX_Stop$(DL) >> $@ - @echo $(DL)check POSIX_CheckUnload$(DL) >> $@ -else - @echo $(DL)start _LibCPrelude$(DL) >> $@ - @echo $(DL)exit _LibCPostlude$(DL) >> $@ - @echo $(DL)check _LibCCheckUnload$(DL) >> $@ -endif - @echo $(DL)import @$(NDK_LIBC)/imports/libc.imp$(DL) >> $@ - @echo $(DL)import @$(NDK_LIBC)/imports/netware.imp$(DL) >> $@ - @echo $(DL)module libc$(DL) >> $@ -ifndef DISABLE_LDAP - @echo $(DL)import @$(NDK_LDAP)/libc/imports/lldapsdk.imp$(DL) >> $@ - @echo $(DL)import @$(NDK_LDAP)/libc/imports/lldapssl.imp$(DL) >> $@ -# @echo $(DL)import @$(NDK_LDAP)/libc/imports/lldapx.imp$(DL) >> $@ - @echo $(DL)module lldapsdk lldapssl$(DL) >> $@ -endif -endif -ifdef MODULES - @echo $(DL)module $(MODULES)$(DL) >> $@ -endif -ifdef EXPORTS - @echo $(DL)export $(EXPORTS)$(DL) >> $@ -endif -ifdef IMPORTS - @echo $(DL)import $(IMPORTS)$(DL) >> $@ -endif -ifeq ($(findstring nlmconv,$(LD)),nlmconv) - @echo $(DL)input $(PRELUDE)$(DL) >> $@ - @echo $(DL)input $(@:.def=.o)$(DL) >> $@ -ifdef LDLIBS - @echo $(DL)input $(LDLIBS)$(DL) >> $@ -endif - @echo $(DL)output $(notdir $(@:.def=.nlm))$(DL) >> $@ -endif diff --git a/plugins/FTPFileYM/curl/docs/examples/README b/plugins/FTPFileYM/curl/docs/examples/README deleted file mode 100644 index 270048a6c5..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/README +++ /dev/null @@ -1,80 +0,0 @@ - _ _ ____ _ - ___| | | | _ \| | - / __| | | | |_) | | - | (__| |_| | _ <| |___ - \___|\___/|_| \_\_____| - -This directory is for libcurl programming examples. They are meant to show -some simple steps on how you can build your own application to take full -advantage of libcurl. - -If you end up with other small but still useful example sources, please mail -them for submission in future packages and on the web site. - -BUILDING - -The Makefile.example is an example makefile that could be used to build these -examples. Just edit the file according to your system and requirements first. - -Most examples should build fine using a command line like this: - - $ `curl-config --cc --cflags --libs` -o example example.c - -Some compilers don't like having the arguments in this order but instead -want you do reorganize them like: - - $ `curl-config --cc` -o example example.c `curl-config --cflags --libs` - -*PLEASE* do not use the curl.haxx.se site as a test target for your libcurl -applications/experiments. Even if some of the examples use that site as a URL -at some places, it doesn't mean that the URLs work or that we expect you to -actually torture our web site with your tests! Thanks. - -EXAMPLES - -anyauthput.c - HTTP PUT using "any" authentication method -cacertinmem.c - Use a built-in PEM certificate to retrieve a https page -cookie_interface.c - shows usage of simple cookie interface -curlgtk.c - download using a GTK progress bar -curlx.c - getting file info from the remote cert data -debug.c - showing how to use the debug callback -fileupload.c - uploading to a file:// URL -fopen.c - fopen() layer that supports opening URLs and files -ftpget.c - simple getting a file from FTP -ftpgetresp.c - get the response strings from the FTP server -ftpupload.c - upload a file to an FTP server -ftpuploadresume.c - resume an upload to an FTP server -getinfo.c - get the Content-Type from the recent transfer -getinmemory.c - download a file to memory only -ghiper.c - curl_multi_socket() using code with glib-2 -hiperfifo.c - downloads all URLs written to the fifo, using - curl_multi_socket() and libevent -htmltidy.c - download a document and use libtidy to parse the HTML -htmltitle.cc - download a HTML file and extract the <title> tag from a HTML - page using libxml -http-post.c - HTTP POST -httpput.c - HTTP PUT a local file -https.c - simple HTTPS transfer -imap.c - simple IMAP transfer -multi-app.c - a multi-interface app -multi-debugcallback.c - a multi-interface app using the debug callback -multi-double.c - a multi-interface app doing two simultaneous transfers -multi-post.c - a multi-interface app doing a multipart formpost -multi-single.c - a multi-interface app getting a single file -multithread.c - an example using multi-treading transferring multiple files -opensslthreadlock.c - show how to do locking when using OpenSSL multi-threaded -persistant.c - request two URLs with a persistent connection -pop3s.c - POP3S transfer -pop3slist.c - POP3S LIST -post-callback.c - send a HTTP POST using a callback -postit2.c - send a HTTP multipart formpost -sampleconv.c - showing how a program on a non-ASCII platform would invoke - callbacks to do its own codeset conversions instead of using - the built-in iconv functions in libcurl -sepheaders.c - download headers to a separate file -simple.c - the most simple download a URL source -simplepost.c - HTTP POST -simplessl.c - HTTPS example with certificates many options set -synctime.c - Sync local time by extracting date from remote HTTP servers -url2file.c - download a document and store it in a file -10-at-a-time.c - Download many files simultaneously, 10 at a time. diff --git a/plugins/FTPFileYM/curl/docs/examples/anyauthput.c b/plugins/FTPFileYM/curl/docs/examples/anyauthput.c deleted file mode 100644 index b89dca2e15..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/anyauthput.c +++ /dev/null @@ -1,185 +0,0 @@ -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at http://curl.haxx.se/docs/copyright.html. - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the COPYING file. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ***************************************************************************/ -#include <stdio.h> -#include <fcntl.h> -#ifdef WIN32 -# include <io.h> -#else -# ifdef __VMS - typedef int intptr_t; -# endif -# if !defined(_AIX) && !defined(__sgi) && !defined(__osf__) -# include <stdint.h> -# endif -# include <unistd.h> -#endif -#include <sys/types.h> -#include <sys/stat.h> - -#ifdef _MSC_VER -# ifdef _WIN64 - typedef __int64 intptr_t; -# else - typedef int intptr_t; -# endif -#endif - -#include <curl/curl.h> - -#if LIBCURL_VERSION_NUM < 0x070c03 -#error "upgrade your libcurl to no less than 7.12.3" -#endif - -#ifndef TRUE -#define TRUE 1 -#endif - -#if defined(_AIX) || defined(__sgi) || defined(__osf__) -#ifndef intptr_t -#define intptr_t long -#endif -#endif - -/* - * This example shows a HTTP PUT operation with authentiction using "any" - * type. It PUTs a file given as a command line argument to the URL also given - * on the command line. - * - * Since libcurl 7.12.3, using "any" auth and POST/PUT requires a set ioctl - * function. - * - * This example also uses its own read callback. - */ - -/* ioctl callback function */ -static curlioerr my_ioctl(CURL *handle, curliocmd cmd, void *userp) -{ - intptr_t fd = (intptr_t)userp; - - (void)handle; /* not used in here */ - - switch(cmd) { - case CURLIOCMD_RESTARTREAD: - /* mr libcurl kindly asks as to rewind the read data stream to start */ - if(-1 == lseek(fd, 0, SEEK_SET)) - /* couldn't rewind */ - return CURLIOE_FAILRESTART; - - break; - - default: /* ignore unknown commands */ - return CURLIOE_UNKNOWNCMD; - } - return CURLIOE_OK; /* success! */ -} - -/* read callback function, fread() look alike */ -static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *stream) -{ - size_t retcode; - curl_off_t nread; - - intptr_t fd = (intptr_t)stream; - - retcode = read(fd, ptr, size * nmemb); - - nread = (curl_off_t)retcode; - - fprintf(stderr, "*** We read %" CURL_FORMAT_CURL_OFF_T - " bytes from file\n", nread); - - return retcode; -} - -int main(int argc, char **argv) -{ - CURL *curl; - CURLcode res; - intptr_t hd ; - struct stat file_info; - - char *file; - char *url; - - if(argc < 3) - return 1; - - file= argv[1]; - url = argv[2]; - - /* get the file size of the local file */ - hd = open(file, O_RDONLY) ; - fstat(hd, &file_info); - - /* In windows, this will init the winsock stuff */ - curl_global_init(CURL_GLOBAL_ALL); - - /* get a curl handle */ - curl = curl_easy_init(); - if(curl) { - /* we want to use our own read function */ - curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_callback); - - /* which file to upload */ - curl_easy_setopt(curl, CURLOPT_READDATA, (void*)hd); - - /* set the ioctl function */ - curl_easy_setopt(curl, CURLOPT_IOCTLFUNCTION, my_ioctl); - - /* pass the file descriptor to the ioctl callback as well */ - curl_easy_setopt(curl, CURLOPT_IOCTLDATA, (void*)hd); - - /* enable "uploading" (which means PUT when doing HTTP) */ - curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L) ; - - /* specify target URL, and note that this URL should also include a file - name, not only a directory (as you can do with GTP uploads) */ - curl_easy_setopt(curl,CURLOPT_URL, url); - - /* and give the size of the upload, this supports large file sizes - on systems that have general support for it */ - curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE, - (curl_off_t)file_info.st_size); - - /* tell libcurl we can use "any" auth, which lets the lib pick one, but it - also costs one extra round-trip and possibly sending of all the PUT - data twice!!! */ - curl_easy_setopt(curl, CURLOPT_HTTPAUTH, (long)CURLAUTH_ANY); - - /* set user name and password for the authentication */ - curl_easy_setopt(curl, CURLOPT_USERPWD, "user:password"); - - /* Now run off and do what you've been told! */ - res = curl_easy_perform(curl); - /* Check for errors */ - if(res != CURLE_OK) - fprintf(stderr, "curl_easy_perform() failed: %s\n", - curl_easy_strerror(res)); - - /* always cleanup */ - curl_easy_cleanup(curl); - } - close(hd); /* close the local file */ - - curl_global_cleanup(); - return 0; -} diff --git a/plugins/FTPFileYM/curl/docs/examples/asiohiper.cpp b/plugins/FTPFileYM/curl/docs/examples/asiohiper.cpp deleted file mode 100644 index 44836fdc17..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/asiohiper.cpp +++ /dev/null @@ -1,454 +0,0 @@ -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) 2012, Daniel Stenberg, <daniel@haxx.se>, et al. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at http://curl.haxx.se/docs/copyright.html. - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the COPYING file. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ***************************************************************************/ - -/* - * file: asiohiper.cpp - * Example program to demonstrate the use of multi socket interface - * with boost::asio - * - * This program is in c++ and uses boost::asio instead of libevent/libev. - * Requires boost::asio, boost::bind and boost::system - * - * This is an adaptation of libcurl's "hiperfifo.c" and "evhiperfifo.c" - * sample programs. This example implements a subset of the functionality from - * hiperfifo.c, for full functionality refer hiperfifo.c or evhiperfifo.c - * - * Written by Lijo Antony based on hiperfifo.c by Jeff Pohlmeyer - * - * When running, the program creates an easy handle for a URL and - * uses the curl_multi API to fetch it. - * - * Note: - * For the sake of simplicity, URL is hard coded to "www.google.com" - * - * This is purely a demo app, all retrieved data is simply discarded by the write - * callback. - */ - - -#include <curl/curl.h> -#include <boost/asio.hpp> -#include <boost/bind.hpp> - -#define MSG_OUT stdout /* Send info to stdout, change to stderr if you want */ - -/* boost::asio related objects - * using global variables for simplicity - */ -boost::asio::io_service io_service; -boost::asio::deadline_timer timer(io_service); -std::map<curl_socket_t, boost::asio::ip::tcp::socket *> socket_map; - -/* Global information, common to all connections */ -typedef struct _GlobalInfo -{ - CURLM *multi; - int still_running; -} GlobalInfo; - -/* Information associated with a specific easy handle */ -typedef struct _ConnInfo -{ - CURL *easy; - char *url; - GlobalInfo *global; - char error[CURL_ERROR_SIZE]; -} ConnInfo; - -static void timer_cb(const boost::system::error_code & error, GlobalInfo *g); - -/* Update the event timer after curl_multi library calls */ -static int multi_timer_cb(CURLM *multi, long timeout_ms, GlobalInfo *g) -{ - fprintf(MSG_OUT, "\nmulti_timer_cb: timeout_ms %ld", timeout_ms); - - /* cancel running timer */ - timer.cancel(); - - if ( timeout_ms > 0 ) - { - /* update timer */ - timer.expires_from_now(boost::posix_time::millisec(timeout_ms)); - timer.async_wait(boost::bind(&timer_cb, _1, g)); - } - else - { - /* call timeout function immediately */ - boost::system::error_code error; /*success*/ - timer_cb(error, g); - } - - return 0; -} - -/* Die if we get a bad CURLMcode somewhere */ -static void mcode_or_die(const char *where, CURLMcode code) -{ - if ( CURLM_OK != code ) - { - const char *s; - switch ( code ) - { - case CURLM_CALL_MULTI_PERFORM: s="CURLM_CALL_MULTI_PERFORM"; break; - case CURLM_BAD_HANDLE: s="CURLM_BAD_HANDLE"; break; - case CURLM_BAD_EASY_HANDLE: s="CURLM_BAD_EASY_HANDLE"; break; - case CURLM_OUT_OF_MEMORY: s="CURLM_OUT_OF_MEMORY"; break; - case CURLM_INTERNAL_ERROR: s="CURLM_INTERNAL_ERROR"; break; - case CURLM_UNKNOWN_OPTION: s="CURLM_UNKNOWN_OPTION"; break; - case CURLM_LAST: s="CURLM_LAST"; break; - default: s="CURLM_unknown"; - break; - case CURLM_BAD_SOCKET: s="CURLM_BAD_SOCKET"; - fprintf(MSG_OUT, "\nERROR: %s returns %s", where, s); - /* ignore this error */ - return; - } - fprintf(MSG_OUT, "\nERROR: %s returns %s", where, s); - exit(code); - } -} - -/* Check for completed transfers, and remove their easy handles */ -static void check_multi_info(GlobalInfo *g) -{ - char *eff_url; - CURLMsg *msg; - int msgs_left; - ConnInfo *conn; - CURL *easy; - CURLcode res; - - fprintf(MSG_OUT, "\nREMAINING: %d", g->still_running); - - while ((msg = curl_multi_info_read(g->multi, &msgs_left))) - { - if (msg->msg == CURLMSG_DONE) - { - easy = msg->easy_handle; - res = msg->data.result; - curl_easy_getinfo(easy, CURLINFO_PRIVATE, &conn); - curl_easy_getinfo(easy, CURLINFO_EFFECTIVE_URL, &eff_url); - fprintf(MSG_OUT, "\nDONE: %s => (%d) %s", eff_url, res, conn->error); - curl_multi_remove_handle(g->multi, easy); - free(conn->url); - curl_easy_cleanup(easy); - free(conn); - } - } -} - -/* Called by asio when there is an action on a socket */ -static void event_cb(GlobalInfo * g, boost::asio::ip::tcp::socket * tcp_socket, int action) -{ - fprintf(MSG_OUT, "\nevent_cb: action=%d", action); - - CURLMcode rc; - rc = curl_multi_socket_action(g->multi, tcp_socket->native_handle(), action, &g->still_running); - - mcode_or_die("event_cb: curl_multi_socket_action", rc); - check_multi_info(g); - - if ( g->still_running <= 0 ) - { - fprintf(MSG_OUT, "\nlast transfer done, kill timeout"); - timer.cancel(); - } -} - -/* Called by asio when our timeout expires */ -static void timer_cb(const boost::system::error_code & error, GlobalInfo *g) -{ - if ( !error) - { - fprintf(MSG_OUT, "\ntimer_cb: "); - - CURLMcode rc; - rc = curl_multi_socket_action(g->multi, CURL_SOCKET_TIMEOUT, 0, &g->still_running); - - mcode_or_die("timer_cb: curl_multi_socket_action", rc); - check_multi_info(g); - } -} - -/* Clean up any data */ -static void remsock(int *f, GlobalInfo *g) -{ - fprintf(MSG_OUT, "\nremsock: "); - - if ( f ) - { - free(f); - } -} - -static void setsock(int *fdp, curl_socket_t s, CURL*e, int act, GlobalInfo*g) -{ - fprintf(MSG_OUT, "\nsetsock: socket=%d, act=%d, fdp=%p", s, act, fdp); - - std::map<curl_socket_t, boost::asio::ip::tcp::socket *>::iterator it = socket_map.find(s); - - if ( it == socket_map.end() ) - { - fprintf(MSG_OUT, "\nsocket %d is a c-ares socket, ignoring", s); - return; - } - - boost::asio::ip::tcp::socket * tcp_socket = it->second; - - *fdp = act; - - if ( act == CURL_POLL_IN ) - { - fprintf(MSG_OUT, "\nwatching for socket to become readable"); - - tcp_socket->async_read_some(boost::asio::null_buffers(), - boost::bind(&event_cb, g, - tcp_socket, - act)); - } - else if ( act == CURL_POLL_OUT ) - { - fprintf(MSG_OUT, "\nwatching for socket to become writable"); - - tcp_socket->async_write_some(boost::asio::null_buffers(), - boost::bind(&event_cb, g, - tcp_socket, - act)); - } - else if ( act == CURL_POLL_INOUT ) - { - fprintf(MSG_OUT, "\nwatching for socket to become readable & writable"); - - tcp_socket->async_read_some(boost::asio::null_buffers(), - boost::bind(&event_cb, g, - tcp_socket, - act)); - - tcp_socket->async_write_some(boost::asio::null_buffers(), - boost::bind(&event_cb, g, - tcp_socket, - act)); - } -} - - -static void addsock(curl_socket_t s, CURL *easy, int action, GlobalInfo *g) -{ - int *fdp = (int *)calloc(sizeof(int), 1); /* fdp is used to store current action */ - - setsock(fdp, s, easy, action, g); - curl_multi_assign(g->multi, s, fdp); -} - -/* CURLMOPT_SOCKETFUNCTION */ -static int sock_cb(CURL *e, curl_socket_t s, int what, void *cbp, void *sockp) -{ - fprintf(MSG_OUT, "\nsock_cb: socket=%d, what=%d, sockp=%p", s, what, sockp); - - GlobalInfo *g = (GlobalInfo*) cbp; - int *actionp = (int*) sockp; - const char *whatstr[]={ "none", "IN", "OUT", "INOUT", "REMOVE"}; - - fprintf(MSG_OUT, - "\nsocket callback: s=%d e=%p what=%s ", s, e, whatstr[what]); - - if ( what == CURL_POLL_REMOVE ) - { - fprintf(MSG_OUT, "\n"); - remsock(actionp, g); - } - else - { - if ( !actionp ) - { - fprintf(MSG_OUT, "\nAdding data: %s", whatstr[what]); - addsock(s, e, what, g); - } - else - { - fprintf(MSG_OUT, - "\nChanging action from %s to %s", - whatstr[*actionp], whatstr[what]); - setsock(actionp, s, e, what, g); - } - } - return 0; -} - - -/* CURLOPT_WRITEFUNCTION */ -static size_t write_cb(void *ptr, size_t size, size_t nmemb, void *data) -{ - - size_t written = size * nmemb; - char* pBuffer = (char*)malloc(written + 1); - - strncpy(pBuffer, (const char *)ptr, written); - pBuffer [written] = '\0'; - - fprintf(MSG_OUT, "%s", pBuffer); - - free(pBuffer); - - return written; -} - - -/* CURLOPT_PROGRESSFUNCTION */ -static int prog_cb (void *p, double dltotal, double dlnow, double ult, - double uln) -{ - ConnInfo *conn = (ConnInfo *)p; - (void)ult; - (void)uln; - - fprintf(MSG_OUT, "\nProgress: %s (%g/%g)", conn->url, dlnow, dltotal); - fprintf(MSG_OUT, "\nProgress: %s (%g)", conn->url, ult); - - return 0; -} - -/* CURLOPT_OPENSOCKETFUNCTION */ -static curl_socket_t opensocket(void *clientp, - curlsocktype purpose, - struct curl_sockaddr *address) -{ - fprintf(MSG_OUT, "\nopensocket :"); - - curl_socket_t sockfd = CURL_SOCKET_BAD; - - /* restrict to ipv4 */ - if (purpose == CURLSOCKTYPE_IPCXN && address->family == AF_INET) - { - /* create a tcp socket object */ - boost::asio::ip::tcp::socket *tcp_socket = new boost::asio::ip::tcp::socket(io_service); - - /* open it and get the native handle*/ - boost::system::error_code ec; - tcp_socket->open(boost::asio::ip::tcp::v4(), ec); - - if (ec) - { - //An error occurred - std::cout << std::endl << "Couldn't open socket [" << ec << "][" << ec.message() << "]"; - fprintf(MSG_OUT, "\nERROR: Returning CURL_SOCKET_BAD to signal error"); - } - else - { - sockfd = tcp_socket->native_handle(); - fprintf(MSG_OUT, "\nOpened socket %d", sockfd); - - /* save it for monitoring */ - socket_map.insert(std::pair<curl_socket_t, boost::asio::ip::tcp::socket *>(sockfd, tcp_socket)); - } - } - - return sockfd; -} - -/* CURLOPT_CLOSESOCKETFUNCTION */ -static int closesocket(void *clientp, curl_socket_t item) -{ - fprintf(MSG_OUT, "\nclosesocket : %d", item); - - std::map<curl_socket_t, boost::asio::ip::tcp::socket *>::iterator it = socket_map.find(item); - - if ( it != socket_map.end() ) - { - delete it->second; - socket_map.erase(it); - } - - return 0; -} - -/* Create a new easy handle, and add it to the global curl_multi */ -static void new_conn(char *url, GlobalInfo *g ) -{ - ConnInfo *conn; - CURLMcode rc; - - conn = (ConnInfo *)calloc(1, sizeof(ConnInfo)); - memset(conn, 0, sizeof(ConnInfo)); - conn->error[0]='\0'; - - conn->easy = curl_easy_init(); - - if ( !conn->easy ) - { - fprintf(MSG_OUT, "\ncurl_easy_init() failed, exiting!"); - exit(2); - } - conn->global = g; - conn->url = strdup(url); - curl_easy_setopt(conn->easy, CURLOPT_URL, conn->url); - curl_easy_setopt(conn->easy, CURLOPT_WRITEFUNCTION, write_cb); - curl_easy_setopt(conn->easy, CURLOPT_WRITEDATA, &conn); - curl_easy_setopt(conn->easy, CURLOPT_VERBOSE, 1L); - curl_easy_setopt(conn->easy, CURLOPT_ERRORBUFFER, conn->error); - curl_easy_setopt(conn->easy, CURLOPT_PRIVATE, conn); - curl_easy_setopt(conn->easy, CURLOPT_NOPROGRESS, 1L); - curl_easy_setopt(conn->easy, CURLOPT_PROGRESSFUNCTION, prog_cb); - curl_easy_setopt(conn->easy, CURLOPT_PROGRESSDATA, conn); - curl_easy_setopt(conn->easy, CURLOPT_LOW_SPEED_TIME, 3L); - curl_easy_setopt(conn->easy, CURLOPT_LOW_SPEED_LIMIT, 10L); - - /* call this function to get a socket */ - curl_easy_setopt(conn->easy, CURLOPT_OPENSOCKETFUNCTION, opensocket); - - /* call this function to close a socket */ - curl_easy_setopt(conn->easy, CURLOPT_CLOSESOCKETFUNCTION, closesocket); - - fprintf(MSG_OUT, - "\nAdding easy %p to multi %p (%s)", conn->easy, g->multi, url); - rc = curl_multi_add_handle(g->multi, conn->easy); - mcode_or_die("new_conn: curl_multi_add_handle", rc); - - /* note that the add_handle() will set a time-out to trigger very soon so - that the necessary socket_action() call will be called by this app */ -} - -int main(int argc, char **argv) -{ - GlobalInfo g; - CURLMcode rc; - (void)argc; - (void)argv; - - memset(&g, 0, sizeof(GlobalInfo)); - g.multi = curl_multi_init(); - - curl_multi_setopt(g.multi, CURLMOPT_SOCKETFUNCTION, sock_cb); - curl_multi_setopt(g.multi, CURLMOPT_SOCKETDATA, &g); - curl_multi_setopt(g.multi, CURLMOPT_TIMERFUNCTION, multi_timer_cb); - curl_multi_setopt(g.multi, CURLMOPT_TIMERDATA, &g); - - new_conn((char *)"www.google.com", &g); /* add a URL */ - - /* enter io_service run loop */ - io_service.run(); - - curl_multi_cleanup(g.multi); - - fprintf(MSG_OUT, "\ndone.\n"); - return 0; -} diff --git a/plugins/FTPFileYM/curl/docs/examples/cacertinmem.c b/plugins/FTPFileYM/curl/docs/examples/cacertinmem.c deleted file mode 100644 index 051afbca9b..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/cacertinmem.c +++ /dev/null @@ -1,151 +0,0 @@ -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at http://curl.haxx.se/docs/copyright.html. - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the COPYING file. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ***************************************************************************/ -/* Example using a "in core" PEM certificate to retrieve a https page. - * Written by Theo Borm - */ - -/* on a netBSD system with OPENSSL& LIBCURL installed from - * pkgsrc (using default paths) this program can be compiled using: - * gcc -I/usr/pkg/include -L/usr/pkg/lib -lcurl -Wl,-R/usr/pkg/lib -lssl - * -lcrypto -lz -o curlcacerttest curlcacerttest.c - * on other operating systems you may want to change paths to headers - * and libraries -*/ -#include <openssl/ssl.h> -#include <curl/curl.h> -#include <stdio.h> - -size_t writefunction( void *ptr, size_t size, size_t nmemb, void *stream) -{ - fwrite(ptr,size,nmemb,stream); - return(nmemb*size); -} - -static CURLcode sslctx_function(CURL * curl, void * sslctx, void * parm) -{ - X509_STORE * store; - X509 * cert=NULL; - BIO * bio; - char * mypem = /* www.cacert.org */ - "-----BEGIN CERTIFICATE-----\n"\ - "MIIHPTCCBSWgAwIBAgIBADANBgkqhkiG9w0BAQQFADB5MRAwDgYDVQQKEwdSb290\n"\ - "IENBMR4wHAYDVQQLExVodHRwOi8vd3d3LmNhY2VydC5vcmcxIjAgBgNVBAMTGUNB\n"\ - "IENlcnQgU2lnbmluZyBBdXRob3JpdHkxITAfBgkqhkiG9w0BCQEWEnN1cHBvcnRA\n"\ - "Y2FjZXJ0Lm9yZzAeFw0wMzAzMzAxMjI5NDlaFw0zMzAzMjkxMjI5NDlaMHkxEDAO\n"\ - "BgNVBAoTB1Jvb3QgQ0ExHjAcBgNVBAsTFWh0dHA6Ly93d3cuY2FjZXJ0Lm9yZzEi\n"\ - "MCAGA1UEAxMZQ0EgQ2VydCBTaWduaW5nIEF1dGhvcml0eTEhMB8GCSqGSIb3DQEJ\n"\ - "ARYSc3VwcG9ydEBjYWNlcnQub3JnMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIIC\n"\ - "CgKCAgEAziLA4kZ97DYoB1CW8qAzQIxL8TtmPzHlawI229Z89vGIj053NgVBlfkJ\n"\ - "8BLPRoZzYLdufujAWGSuzbCtRRcMY/pnCujW0r8+55jE8Ez64AO7NV1sId6eINm6\n"\ - "zWYyN3L69wj1x81YyY7nDl7qPv4coRQKFWyGhFtkZip6qUtTefWIonvuLwphK42y\n"\ - "fk1WpRPs6tqSnqxEQR5YYGUFZvjARL3LlPdCfgv3ZWiYUQXw8wWRBB0bF4LsyFe7\n"\ - "w2t6iPGwcswlWyCR7BYCEo8y6RcYSNDHBS4CMEK4JZwFaz+qOqfrU0j36NK2B5jc\n"\ - "G8Y0f3/JHIJ6BVgrCFvzOKKrF11myZjXnhCLotLddJr3cQxyYN/Nb5gznZY0dj4k\n"\ - "epKwDpUeb+agRThHqtdB7Uq3EvbXG4OKDy7YCbZZ16oE/9KTfWgu3YtLq1i6L43q\n"\ - "laegw1SJpfvbi1EinbLDvhG+LJGGi5Z4rSDTii8aP8bQUWWHIbEZAWV/RRyH9XzQ\n"\ - "QUxPKZgh/TMfdQwEUfoZd9vUFBzugcMd9Zi3aQaRIt0AUMyBMawSB3s42mhb5ivU\n"\ - "fslfrejrckzzAeVLIL+aplfKkQABi6F1ITe1Yw1nPkZPcCBnzsXWWdsC4PDSy826\n"\ - "YreQQejdIOQpvGQpQsgi3Hia/0PsmBsJUUtaWsJx8cTLc6nloQsCAwEAAaOCAc4w\n"\ - "ggHKMB0GA1UdDgQWBBQWtTIb1Mfz4OaO873SsDrusjkY0TCBowYDVR0jBIGbMIGY\n"\ - "gBQWtTIb1Mfz4OaO873SsDrusjkY0aF9pHsweTEQMA4GA1UEChMHUm9vdCBDQTEe\n"\ - "MBwGA1UECxMVaHR0cDovL3d3dy5jYWNlcnQub3JnMSIwIAYDVQQDExlDQSBDZXJ0\n"\ - "IFNpZ25pbmcgQXV0aG9yaXR5MSEwHwYJKoZIhvcNAQkBFhJzdXBwb3J0QGNhY2Vy\n"\ - "dC5vcmeCAQAwDwYDVR0TAQH/BAUwAwEB/zAyBgNVHR8EKzApMCegJaAjhiFodHRw\n"\ - "czovL3d3dy5jYWNlcnQub3JnL3Jldm9rZS5jcmwwMAYJYIZIAYb4QgEEBCMWIWh0\n"\ - "dHBzOi8vd3d3LmNhY2VydC5vcmcvcmV2b2tlLmNybDA0BglghkgBhvhCAQgEJxYl\n"\ - "aHR0cDovL3d3dy5jYWNlcnQub3JnL2luZGV4LnBocD9pZD0xMDBWBglghkgBhvhC\n"\ - "AQ0ESRZHVG8gZ2V0IHlvdXIgb3duIGNlcnRpZmljYXRlIGZvciBGUkVFIGhlYWQg\n"\ - "b3ZlciB0byBodHRwOi8vd3d3LmNhY2VydC5vcmcwDQYJKoZIhvcNAQEEBQADggIB\n"\ - "ACjH7pyCArpcgBLKNQodgW+JapnM8mgPf6fhjViVPr3yBsOQWqy1YPaZQwGjiHCc\n"\ - "nWKdpIevZ1gNMDY75q1I08t0AoZxPuIrA2jxNGJARjtT6ij0rPtmlVOKTV39O9lg\n"\ - "18p5aTuxZZKmxoGCXJzN600BiqXfEVWqFcofN8CCmHBh22p8lqOOLlQ+TyGpkO/c\n"\ - "gr/c6EWtTZBzCDyUZbAEmXZ/4rzCahWqlwQ3JNgelE5tDlG+1sSPypZt90Pf6DBl\n"\ - "Jzt7u0NDY8RD97LsaMzhGY4i+5jhe1o+ATc7iwiwovOVThrLm82asduycPAtStvY\n"\ - "sONvRUgzEv/+PDIqVPfE94rwiCPCR/5kenHA0R6mY7AHfqQv0wGP3J8rtsYIqQ+T\n"\ - "SCX8Ev2fQtzzxD72V7DX3WnRBnc0CkvSyqD/HMaMyRa+xMwyN2hzXwj7UfdJUzYF\n"\ - "CpUCTPJ5GhD22Dp1nPMd8aINcGeGG7MW9S/lpOt5hvk9C8JzC6WZrG/8Z7jlLwum\n"\ - "GCSNe9FINSkYQKyTYOGWhlC0elnYjyELn8+CkcY7v2vcB5G5l1YjqrZslMZIBjzk\n"\ - "zk6q5PYvCdxTby78dOs6Y5nCpqyJvKeyRKANihDjbPIky/qbn3BHLt4Ui9SyIAmW\n"\ - "omTxJBzcoTWcFbLUvFUufQb1nA5V9FrWk9p2rSVzTMVD\n"\ - "-----END CERTIFICATE-----\n"; - /* get a BIO */ - bio=BIO_new_mem_buf(mypem, -1); - /* use it to read the PEM formatted certificate from memory into an X509 - * structure that SSL can use - */ - PEM_read_bio_X509(bio, &cert, 0, NULL); - if (cert == NULL) - printf("PEM_read_bio_X509 failed...\n"); - - /* get a pointer to the X509 certificate store (which may be empty!) */ - store=SSL_CTX_get_cert_store((SSL_CTX *)sslctx); - - /* add our certificate to this store */ - if (X509_STORE_add_cert(store, cert)==0) - printf("error adding certificate\n"); - - /* all set to go */ - return CURLE_OK ; -} - -int main(void) -{ - CURL * ch; - CURLcode rv; - - rv=curl_global_init(CURL_GLOBAL_ALL); - ch=curl_easy_init(); - rv=curl_easy_setopt(ch,CURLOPT_VERBOSE, 0L); - rv=curl_easy_setopt(ch,CURLOPT_HEADER, 0L); - rv=curl_easy_setopt(ch,CURLOPT_NOPROGRESS, 1L); - rv=curl_easy_setopt(ch,CURLOPT_NOSIGNAL, 1L); - rv=curl_easy_setopt(ch,CURLOPT_WRITEFUNCTION, *writefunction); - rv=curl_easy_setopt(ch,CURLOPT_WRITEDATA, stdout); - rv=curl_easy_setopt(ch,CURLOPT_HEADERFUNCTION, *writefunction); - rv=curl_easy_setopt(ch,CURLOPT_WRITEHEADER, stderr); - rv=curl_easy_setopt(ch,CURLOPT_SSLCERTTYPE,"PEM"); - rv=curl_easy_setopt(ch,CURLOPT_SSL_VERIFYPEER,1L); - rv=curl_easy_setopt(ch, CURLOPT_URL, "https://www.example.com/"); - - /* first try: retrieve page without cacerts' certificate -> will fail - */ - rv=curl_easy_perform(ch); - if (rv==CURLE_OK) - printf("*** transfer succeeded ***\n"); - else - printf("*** transfer failed ***\n"); - - /* second try: retrieve page using cacerts' certificate -> will succeed - * load the certificate by installing a function doing the nescessary - * "modifications" to the SSL CONTEXT just before link init - */ - rv=curl_easy_setopt(ch,CURLOPT_SSL_CTX_FUNCTION, *sslctx_function); - rv=curl_easy_perform(ch); - if (rv==CURLE_OK) - printf("*** transfer succeeded ***\n"); - else - printf("*** transfer failed ***\n"); - - curl_easy_cleanup(ch); - curl_global_cleanup(); - return rv; -} diff --git a/plugins/FTPFileYM/curl/docs/examples/certinfo.c b/plugins/FTPFileYM/curl/docs/examples/certinfo.c deleted file mode 100644 index ac0109b071..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/certinfo.c +++ /dev/null @@ -1,86 +0,0 @@ -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at http://curl.haxx.se/docs/copyright.html. - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the COPYING file. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ***************************************************************************/ -#include <stdio.h> - -#include <curl/curl.h> - -static size_t wrfu(void *ptr, size_t size, size_t nmemb, void *stream) -{ - (void)stream; - (void)ptr; - return size * nmemb; -} - -int main(void) -{ - CURL *curl; - CURLcode res; - - curl_global_init(CURL_GLOBAL_DEFAULT); - - curl = curl_easy_init(); - if(curl) { - curl_easy_setopt(curl, CURLOPT_URL, "https://www.example.com/"); - - curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, wrfu); - - curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L); - curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L); - - curl_easy_setopt(curl, CURLOPT_VERBOSE, 0L); - curl_easy_setopt(curl, CURLOPT_CERTINFO, 1L); - - res = curl_easy_perform(curl); - - if(!res) { - union { - struct curl_slist *to_info; - struct curl_certinfo *to_certinfo; - } ptr; - - ptr.to_info = NULL; - - res = curl_easy_getinfo(curl, CURLINFO_CERTINFO, &ptr.to_info); - - if(!res && ptr.to_info) { - int i; - - printf("%d certs!\n", ptr.to_certinfo->num_of_certs); - - for(i = 0; i < ptr.to_certinfo->num_of_certs; i++) { - struct curl_slist *slist; - - for(slist = ptr.to_certinfo->certinfo[i]; slist; slist = slist->next) - printf("%s\n", slist->data); - - } - } - - } - - curl_easy_cleanup(curl); - } - - curl_global_cleanup(); - - return 0; -} diff --git a/plugins/FTPFileYM/curl/docs/examples/chkspeed.c b/plugins/FTPFileYM/curl/docs/examples/chkspeed.c deleted file mode 100644 index b5c397ab74..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/chkspeed.c +++ /dev/null @@ -1,176 +0,0 @@ -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at http://curl.haxx.se/docs/copyright.html. - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the COPYING file. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ***************************************************************************/ -/* Example source code to show how the callback function can be used to - * download data into a chunk of memory instead of storing it in a file. - * After successful download we use curl_easy_getinfo() calls to get the - * amount of downloaded bytes, the time used for the whole download, and - * the average download speed. - * On Linux you can create the download test files with: - * dd if=/dev/urandom of=file_1M.bin bs=1M count=1 - * - */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <time.h> - -#include <curl/curl.h> - -#define URL_BASE "http://speedtest.your.domain/" -#define URL_1M URL_BASE "file_1M.bin" -#define URL_2M URL_BASE "file_2M.bin" -#define URL_5M URL_BASE "file_5M.bin" -#define URL_10M URL_BASE "file_10M.bin" -#define URL_20M URL_BASE "file_20M.bin" -#define URL_50M URL_BASE "file_50M.bin" -#define URL_100M URL_BASE "file_100M.bin" - -#define CHKSPEED_VERSION "1.0" - -static size_t WriteCallback(void *ptr, size_t size, size_t nmemb, void *data) -{ - /* we are not interested in the downloaded bytes itself, - so we only return the size we would have saved ... */ - (void)ptr; /* unused */ - (void)data; /* unused */ - return (size_t)(size * nmemb); -} - -int main(int argc, char *argv[]) -{ - CURL *curl_handle; - CURLcode res; - int prtsep = 0, prttime = 0; - const char *url = URL_1M; - char *appname = argv[0]; - - if (argc > 1) { - /* parse input parameters */ - for (argc--, argv++; *argv; argc--, argv++) { - if (strncasecmp(*argv, "-", 1) == 0) { - if (strncasecmp(*argv, "-H", 2) == 0) { - fprintf(stderr, - "\rUsage: %s [-m=1|2|5|10|20|50|100] [-t] [-x] [url]\n", - appname); - exit(1); - } else if (strncasecmp(*argv, "-V", 2) == 0) { - fprintf(stderr, "\r%s %s - %s\n", - appname, CHKSPEED_VERSION, curl_version()); - exit(1); - } else if (strncasecmp(*argv, "-X", 2) == 0) { - prtsep = 1; - } else if (strncasecmp(*argv, "-T", 2) == 0) { - prttime = 1; - } else if (strncasecmp(*argv, "-M=", 3) == 0) { - long m = strtol((*argv)+3, NULL, 10); - switch(m) { - case 1: url = URL_1M; - break; - case 2: url = URL_2M; - break; - case 5: url = URL_5M; - break; - case 10: url = URL_10M; - break; - case 20: url = URL_20M; - break; - case 50: url = URL_50M; - break; - case 100: url = URL_100M; - break; - default: fprintf(stderr, "\r%s: invalid parameter %s\n", - appname, *argv + 3); - exit(1); - } - } else { - fprintf(stderr, "\r%s: invalid or unknown option %s\n", - appname, *argv); - exit(1); - } - } else { - url = *argv; - } - } - } - - /* print separator line */ - if (prtsep) { - printf("-------------------------------------------------\n"); - } - /* print localtime */ - if (prttime) { - time_t t = time(NULL); - printf("Localtime: %s", ctime(&t)); - } - - /* init libcurl */ - curl_global_init(CURL_GLOBAL_ALL); - - /* init the curl session */ - curl_handle = curl_easy_init(); - - /* specify URL to get */ - curl_easy_setopt(curl_handle, CURLOPT_URL, url); - - /* send all data to this function */ - curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, WriteCallback); - - /* some servers don't like requests that are made without a user-agent - field, so we provide one */ - curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, - "libcurl-speedchecker/" CHKSPEED_VERSION); - - /* get it! */ - res = curl_easy_perform(curl_handle); - - if(CURLE_OK == res) { - double val; - - /* check for bytes downloaded */ - res = curl_easy_getinfo(curl_handle, CURLINFO_SIZE_DOWNLOAD, &val); - if((CURLE_OK == res) && (val>0)) - printf("Data downloaded: %0.0f bytes.\n", val); - - /* check for total download time */ - res = curl_easy_getinfo(curl_handle, CURLINFO_TOTAL_TIME, &val); - if((CURLE_OK == res) && (val>0)) - printf("Total download time: %0.3f sec.\n", val); - - /* check for average download speed */ - res = curl_easy_getinfo(curl_handle, CURLINFO_SPEED_DOWNLOAD, &val); - if((CURLE_OK == res) && (val>0)) - printf("Average download speed: %0.3f kbyte/sec.\n", val / 1024); - - } else { - fprintf(stderr, "Error while fetching '%s' : %s\n", - url, curl_easy_strerror(res)); - } - - /* cleanup curl stuff */ - curl_easy_cleanup(curl_handle); - - /* we're done with libcurl, so clean it up */ - curl_global_cleanup(); - - return 0; -} diff --git a/plugins/FTPFileYM/curl/docs/examples/cookie_interface.c b/plugins/FTPFileYM/curl/docs/examples/cookie_interface.c deleted file mode 100644 index 2e7c66db2c..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/cookie_interface.c +++ /dev/null @@ -1,124 +0,0 @@ -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at http://curl.haxx.se/docs/copyright.html. - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the COPYING file. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ***************************************************************************/ -/* This example shows usage of simple cookie interface. */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <errno.h> -#include <time.h> - -#include <curl/curl.h> - -static void -print_cookies(CURL *curl) -{ - CURLcode res; - struct curl_slist *cookies; - struct curl_slist *nc; - int i; - - printf("Cookies, curl knows:\n"); - res = curl_easy_getinfo(curl, CURLINFO_COOKIELIST, &cookies); - if (res != CURLE_OK) { - fprintf(stderr, "Curl curl_easy_getinfo failed: %s\n", curl_easy_strerror(res)); - exit(1); - } - nc = cookies, i = 1; - while (nc) { - printf("[%d]: %s\n", i, nc->data); - nc = nc->next; - i++; - } - if (i == 1) { - printf("(none)\n"); - } - curl_slist_free_all(cookies); -} - -int -main(void) -{ - CURL *curl; - CURLcode res; - - curl_global_init(CURL_GLOBAL_ALL); - curl = curl_easy_init(); - if (curl) { - char nline[256]; - - curl_easy_setopt(curl, CURLOPT_URL, "http://www.example.com/"); - curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); - curl_easy_setopt(curl, CURLOPT_COOKIEFILE, ""); /* just to start the cookie engine */ - res = curl_easy_perform(curl); - if (res != CURLE_OK) { - fprintf(stderr, "Curl perform failed: %s\n", curl_easy_strerror(res)); - return 1; - } - - print_cookies(curl); - - printf("Erasing curl's knowledge of cookies!\n"); - curl_easy_setopt(curl, CURLOPT_COOKIELIST, "ALL"); - - print_cookies(curl); - - printf("-----------------------------------------------\n" - "Setting a cookie \"PREF\" via cookie interface:\n"); -#ifdef WIN32 -#define snprintf _snprintf -#endif - /* Netscape format cookie */ - snprintf(nline, sizeof(nline), "%s\t%s\t%s\t%s\t%lu\t%s\t%s", - ".google.com", "TRUE", "/", "FALSE", (unsigned long)time(NULL) + 31337UL, "PREF", "hello google, i like you very much!"); - res = curl_easy_setopt(curl, CURLOPT_COOKIELIST, nline); - if (res != CURLE_OK) { - fprintf(stderr, "Curl curl_easy_setopt failed: %s\n", curl_easy_strerror(res)); - return 1; - } - - /* HTTP-header style cookie */ - snprintf(nline, sizeof(nline), - "Set-Cookie: OLD_PREF=3d141414bf4209321; " - "expires=Sun, 17-Jan-2038 19:14:07 GMT; path=/; domain=.google.com"); - res = curl_easy_setopt(curl, CURLOPT_COOKIELIST, nline); - if (res != CURLE_OK) { - fprintf(stderr, "Curl curl_easy_setopt failed: %s\n", curl_easy_strerror(res)); - return 1; - } - - print_cookies(curl); - - res = curl_easy_perform(curl); - if (res != CURLE_OK) { - fprintf(stderr, "Curl perform failed: %s\n", curl_easy_strerror(res)); - return 1; - } - } - else { - fprintf(stderr, "Curl init failed!\n"); - return 1; - } - - curl_global_cleanup(); - return 0; -} diff --git a/plugins/FTPFileYM/curl/docs/examples/curlgtk.c b/plugins/FTPFileYM/curl/docs/examples/curlgtk.c deleted file mode 100644 index 8cb9914c60..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/curlgtk.c +++ /dev/null @@ -1,106 +0,0 @@ -/***************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - */ -/* Copyright (c) 2000 David Odin (aka DindinX) for MandrakeSoft */ -/* an attempt to use the curl library in concert with a gtk-threaded application */ - -#include <stdio.h> -#include <gtk/gtk.h> - -#include <curl/curl.h> - -GtkWidget *Bar; - -size_t my_write_func(void *ptr, size_t size, size_t nmemb, FILE *stream) -{ - return fwrite(ptr, size, nmemb, stream); -} - -size_t my_read_func(void *ptr, size_t size, size_t nmemb, FILE *stream) -{ - return fread(ptr, size, nmemb, stream); -} - -int my_progress_func(GtkWidget *bar, - double t, /* dltotal */ - double d, /* dlnow */ - double ultotal, - double ulnow) -{ -/* printf("%d / %d (%g %%)\n", d, t, d*100.0/t);*/ - gdk_threads_enter(); - gtk_progress_set_value(GTK_PROGRESS(bar), d*100.0/t); - gdk_threads_leave(); - return 0; -} - -void *my_thread(void *ptr) -{ - CURL *curl; - CURLcode res; - FILE *outfile; - gchar *url = ptr; - - curl = curl_easy_init(); - if(curl) - { - outfile = fopen("test.curl", "w"); - - curl_easy_setopt(curl, CURLOPT_URL, url); - curl_easy_setopt(curl, CURLOPT_WRITEDATA, outfile); - curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, my_write_func); - curl_easy_setopt(curl, CURLOPT_READFUNCTION, my_read_func); - curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0L); - curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, my_progress_func); - curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, Bar); - - res = curl_easy_perform(curl); - - fclose(outfile); - /* always cleanup */ - curl_easy_cleanup(curl); - } - - return NULL; -} - -int main(int argc, char **argv) -{ - GtkWidget *Window, *Frame, *Frame2; - GtkAdjustment *adj; - - /* Must initialize libcurl before any threads are started */ - curl_global_init(CURL_GLOBAL_ALL); - - /* Init thread */ - g_thread_init(NULL); - - gtk_init(&argc, &argv); - Window = gtk_window_new(GTK_WINDOW_TOPLEVEL); - Frame = gtk_frame_new(NULL); - gtk_frame_set_shadow_type(GTK_FRAME(Frame), GTK_SHADOW_OUT); - gtk_container_add(GTK_CONTAINER(Window), Frame); - Frame2 = gtk_frame_new(NULL); - gtk_frame_set_shadow_type(GTK_FRAME(Frame2), GTK_SHADOW_IN); - gtk_container_add(GTK_CONTAINER(Frame), Frame2); - gtk_container_set_border_width(GTK_CONTAINER(Frame2), 5); - adj = (GtkAdjustment*)gtk_adjustment_new(0, 0, 100, 0, 0, 0); - Bar = gtk_progress_bar_new_with_adjustment(adj); - gtk_container_add(GTK_CONTAINER(Frame2), Bar); - gtk_widget_show_all(Window); - - if (!g_thread_create(&my_thread, argv[1], FALSE, NULL) != 0) - g_warning("can't create the thread"); - - - gdk_threads_enter(); - gtk_main(); - gdk_threads_leave(); - return 0; -} - diff --git a/plugins/FTPFileYM/curl/docs/examples/curlx.c b/plugins/FTPFileYM/curl/docs/examples/curlx.c deleted file mode 100644 index 89d5f407b9..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/curlx.c +++ /dev/null @@ -1,513 +0,0 @@ -/* - curlx.c Authors: Peter Sylvester, Jean-Paul Merlin - - This is a little program to demonstrate the usage of - - - an ssl initialisation callback setting a user key and trustbases - coming from a pkcs12 file - - using an ssl application callback to find a URI in the - certificate presented during ssl session establishment. - -*/ - - -/* - * Copyright (c) 2003 The OpenEvidence Project. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, the following disclaimer, - * and the original OpenSSL and SSLeay Licences below. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions, the following disclaimer - * and the original OpenSSL and SSLeay Licences below in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgments: - * "This product includes software developed by the Openevidence Project - * for use in the OpenEvidence Toolkit. (http://www.openevidence.org/)" - * This product includes software developed by the OpenSSL Project - * for use in the OpenSSL Toolkit (http://www.openssl.org/)" - * This product includes cryptographic software written by Eric Young - * (eay@cryptsoft.com). This product includes software written by Tim - * Hudson (tjh@cryptsoft.com)." - * - * 4. The names "OpenEvidence Toolkit" and "OpenEvidence Project" must not be - * used to endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * openevidence-core@openevidence.org. - * - * 5. Products derived from this software may not be called "OpenEvidence" - * nor may "OpenEvidence" appear in their names without prior written - * permission of the OpenEvidence Project. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgments: - * "This product includes software developed by the OpenEvidence Project - * for use in the OpenEvidence Toolkit (http://www.openevidence.org/) - * This product includes software developed by the OpenSSL Project - * for use in the OpenSSL Toolkit (http://www.openssl.org/)" - * This product includes cryptographic software written by Eric Young - * (eay@cryptsoft.com). This product includes software written by Tim - * Hudson (tjh@cryptsoft.com)." - * - * THIS SOFTWARE IS PROVIDED BY THE OpenEvidence PROJECT ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenEvidence PROJECT OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This product includes software developed by the OpenSSL Project - * for use in the OpenSSL Toolkit (http://www.openssl.org/) - * This product includes cryptographic software written by Eric Young - * (eay@cryptsoft.com). This product includes software written by Tim - * Hudson (tjh@cryptsoft.com). - * - */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <curl/curl.h> -#include <openssl/x509v3.h> -#include <openssl/x509_vfy.h> -#include <openssl/crypto.h> -#include <openssl/lhash.h> -#include <openssl/objects.h> -#include <openssl/err.h> -#include <openssl/evp.h> -#include <openssl/x509.h> -#include <openssl/pkcs12.h> -#include <openssl/bio.h> -#include <openssl/ssl.h> - -static const char *curlx_usage[]={ - "usage: curlx args\n", - " -p12 arg - tia file ", - " -envpass arg - environement variable which content the tia private key password", - " -out arg - output file (response)- default stdout", - " -in arg - input file (request)- default stdin", - " -connect arg - URL of the server for the connection ex: www.openevidence.org", - " -mimetype arg - MIME type for data in ex : application/timestamp-query or application/dvcs -default application/timestamp-query", - " -acceptmime arg - MIME type acceptable for the response ex : application/timestamp-response or application/dvcs -default none", - " -accesstype arg - an Object identifier in an AIA/SIA method, e.g. AD_DVCS or ad_timestamping", - NULL -}; - -/* - -./curlx -p12 psy.p12 -envpass XX -in request -verbose -accesstype AD_DVCS --mimetype application/dvcs -acceptmime application/dvcs -out response - -*/ - -/* - * We use this ZERO_NULL to avoid picky compiler warnings, - * when assigning a NULL pointer to a function pointer var. - */ - -#define ZERO_NULL 0 - -/* This is a context that we pass to all callbacks */ - -typedef struct sslctxparm_st { - unsigned char * p12file ; - const char * pst ; - PKCS12 * p12 ; - EVP_PKEY * pkey ; - X509 * usercert ; - STACK_OF(X509) * ca ; - CURL * curl; - BIO * errorbio; - int accesstype ; - int verbose; - -} sslctxparm; - -/* some helper function. */ - -static char *i2s_ASN1_IA5STRING( ASN1_IA5STRING *ia5) -{ - char *tmp; - if(!ia5 || !ia5->length) - return NULL; - tmp = OPENSSL_malloc(ia5->length + 1); - memcpy(tmp, ia5->data, ia5->length); - tmp[ia5->length] = 0; - return tmp; -} - -/* A conveniance routine to get an access URI. */ - -static unsigned char *my_get_ext(X509 * cert, const int type, int extensiontype) { - - int i; - STACK_OF(ACCESS_DESCRIPTION) * accessinfo ; - accessinfo = X509_get_ext_d2i(cert, extensiontype, NULL, NULL) ; - - if (!sk_ACCESS_DESCRIPTION_num(accessinfo)) - return NULL; - for (i = 0; i < sk_ACCESS_DESCRIPTION_num(accessinfo); i++) { - ACCESS_DESCRIPTION * ad = sk_ACCESS_DESCRIPTION_value(accessinfo, i); - if (OBJ_obj2nid(ad->method) == type) { - if (ad->location->type == GEN_URI) { - return i2s_ASN1_IA5STRING(ad->location->d.ia5); - } - return NULL; - } - } - return NULL; -} - -/* This is an application verification call back, it does not - perform any addition verification but tries to find a URL - in the presented certificat. If found, this will become - the URL to be used in the POST. -*/ - -static int ssl_app_verify_callback(X509_STORE_CTX *ctx, void *arg) -{ - sslctxparm * p = (sslctxparm *) arg; - int ok; - - if (p->verbose > 2) - BIO_printf(p->errorbio,"entering ssl_app_verify_callback\n"); - - if ((ok= X509_verify_cert(ctx)) && ctx->cert) { - unsigned char * accessinfo ; - if (p->verbose > 1) - X509_print_ex(p->errorbio,ctx->cert,0,0); - - if (accessinfo = my_get_ext(ctx->cert,p->accesstype ,NID_sinfo_access)) { - if (p->verbose) - BIO_printf(p->errorbio,"Setting URL from SIA to: %s\n", accessinfo); - - curl_easy_setopt(p->curl, CURLOPT_URL,accessinfo); - } - else if (accessinfo = my_get_ext(ctx->cert,p->accesstype, - NID_info_access)) { - if (p->verbose) - BIO_printf(p->errorbio,"Setting URL from AIA to: %s\n", accessinfo); - - curl_easy_setopt(p->curl, CURLOPT_URL,accessinfo); - } - } - if (p->verbose > 2) - BIO_printf(p->errorbio,"leaving ssl_app_verify_callback with %d\n", ok); - return(ok); -} - - -/* This is an example of an curl SSL initialisation call back. The callback sets: - - a private key and certificate - - a trusted ca certificate - - a preferred cipherlist - - an application verification callback (the function above) -*/ - -static CURLcode sslctxfun(CURL * curl, void * sslctx, void * parm) { - - sslctxparm * p = (sslctxparm *) parm; - SSL_CTX * ctx = (SSL_CTX *) sslctx ; - - if (!SSL_CTX_use_certificate(ctx,p->usercert)) { - BIO_printf(p->errorbio, "SSL_CTX_use_certificate problem\n"); goto err; - } - if (!SSL_CTX_use_PrivateKey(ctx,p->pkey)) { - BIO_printf(p->errorbio, "SSL_CTX_use_PrivateKey\n"); goto err; - } - - if (!SSL_CTX_check_private_key(ctx)) { - BIO_printf(p->errorbio, "SSL_CTX_check_private_key\n"); goto err; - } - - SSL_CTX_set_quiet_shutdown(ctx,1); - SSL_CTX_set_cipher_list(ctx,"RC4-MD5"); - SSL_CTX_set_mode(ctx, SSL_MODE_AUTO_RETRY); - - X509_STORE_add_cert(SSL_CTX_get_cert_store(ctx), sk_X509_value(p->ca, sk_X509_num(p->ca)-1)); - - SSL_CTX_set_verify_depth(ctx,2); - - SSL_CTX_set_verify(ctx,SSL_VERIFY_PEER,ZERO_NULL); - - SSL_CTX_set_cert_verify_callback(ctx, ssl_app_verify_callback, parm); - - - return CURLE_OK ; - err: - ERR_print_errors(p->errorbio); - return CURLE_SSL_CERTPROBLEM; - -} - -int main(int argc, char **argv) { - - BIO* in=NULL; - BIO* out=NULL; - - char * outfile = NULL; - char * infile = NULL ; - - int tabLength=100; - char *binaryptr; - char* mimetype; - char* mimetypeaccept=NULL; - char* contenttype; - const char** pp; - unsigned char* hostporturl = NULL; - BIO * p12bio ; - char **args = argv + 1; - unsigned char * serverurl; - sslctxparm p; - char *response; - - CURLcode res; - struct curl_slist * headers=NULL; - int badarg=0; - - binaryptr = malloc(tabLength); - - p.verbose = 0; - p.errorbio = BIO_new_fp (stderr, BIO_NOCLOSE); - - curl_global_init(CURL_GLOBAL_DEFAULT); - - /* we need some more for the P12 decoding */ - - OpenSSL_add_all_ciphers(); - OpenSSL_add_all_digests(); - ERR_load_crypto_strings(); - - - - while (*args && *args[0] == '-') { - if (!strcmp (*args, "-in")) { - if (args[1]) { - infile=*(++args); - } else badarg=1; - } else if (!strcmp (*args, "-out")) { - if (args[1]) { - outfile=*(++args); - } else badarg=1; - } else if (!strcmp (*args, "-p12")) { - if (args[1]) { - p.p12file = *(++args); - } else badarg=1; - } else if (strcmp(*args,"-envpass") == 0) { - if (args[1]) { - p.pst = getenv(*(++args)); - } else badarg=1; - } else if (strcmp(*args,"-connect") == 0) { - if (args[1]) { - hostporturl = *(++args); - } else badarg=1; - } else if (strcmp(*args,"-mimetype") == 0) { - if (args[1]) { - mimetype = *(++args); - } else badarg=1; - } else if (strcmp(*args,"-acceptmime") == 0) { - if (args[1]) { - mimetypeaccept = *(++args); - } else badarg=1; - } else if (strcmp(*args,"-accesstype") == 0) { - if (args[1]) { - if ((p.accesstype = OBJ_obj2nid(OBJ_txt2obj(*++args,0))) == 0) badarg=1; - } else badarg=1; - } else if (strcmp(*args,"-verbose") == 0) { - p.verbose++; - } else badarg=1; - args++; - } - - if (mimetype==NULL || mimetypeaccept == NULL) badarg = 1; - - if (badarg) { - for (pp=curlx_usage; (*pp != NULL); pp++) - BIO_printf(p.errorbio,"%s\n",*pp); - BIO_printf(p.errorbio,"\n"); - goto err; - } - - - - /* set input */ - - if ((in=BIO_new(BIO_s_file())) == NULL) { - BIO_printf(p.errorbio, "Error setting input bio\n"); - goto err; - } else if (infile == NULL) - BIO_set_fp(in,stdin,BIO_NOCLOSE|BIO_FP_TEXT); - else if (BIO_read_filename(in,infile) <= 0) { - BIO_printf(p.errorbio, "Error opening input file %s\n", infile); - BIO_free(in); - goto err; - } - - /* set output */ - - if ((out=BIO_new(BIO_s_file())) == NULL) { - BIO_printf(p.errorbio, "Error setting output bio.\n"); - goto err; - } else if (outfile == NULL) - BIO_set_fp(out,stdout,BIO_NOCLOSE|BIO_FP_TEXT); - else if (BIO_write_filename(out,outfile) <= 0) { - BIO_printf(p.errorbio, "Error opening output file %s\n", outfile); - BIO_free(out); - goto err; - } - - - p.errorbio = BIO_new_fp (stderr, BIO_NOCLOSE); - - if (!(p.curl = curl_easy_init())) { - BIO_printf(p.errorbio, "Cannot init curl lib\n"); - goto err; - } - - - - if (!(p12bio = BIO_new_file(p.p12file , "rb"))) { - BIO_printf(p.errorbio, "Error opening P12 file %s\n", p.p12file); goto err; - } - if (!(p.p12 = d2i_PKCS12_bio (p12bio, NULL))) { - BIO_printf(p.errorbio, "Cannot decode P12 structure %s\n", p.p12file); goto err; - } - - p.ca= NULL; - if (!(PKCS12_parse (p.p12, p.pst, &(p.pkey), &(p.usercert), &(p.ca) ) )) { - BIO_printf(p.errorbio,"Invalid P12 structure in %s\n", p.p12file); goto err; - } - - if (sk_X509_num(p.ca) <= 0) { - BIO_printf(p.errorbio,"No trustworthy CA given.%s\n", p.p12file); goto err; - } - - if (p.verbose > 1) - X509_print_ex(p.errorbio,p.usercert,0,0); - - /* determine URL to go */ - - if (hostporturl) { - serverurl = malloc(9+strlen(hostporturl)); - sprintf(serverurl,"https://%s",hostporturl); - } - else if (p.accesstype != 0) { /* see whether we can find an AIA or SIA for a given access type */ - if (!(serverurl = my_get_ext(p.usercert,p.accesstype,NID_info_access))) { - int j=0; - BIO_printf(p.errorbio,"no service URL in user cert " - "cherching in others certificats\n"); - for (j=0;j<sk_X509_num(p.ca);j++) { - if ((serverurl = my_get_ext(sk_X509_value(p.ca,j),p.accesstype, - NID_info_access))) - break; - if ((serverurl = my_get_ext(sk_X509_value(p.ca,j),p.accesstype, - NID_sinfo_access))) - break; - } - } - } - - if (!serverurl) { - BIO_printf(p.errorbio, "no service URL in certificats," - " check '-accesstype (AD_DVCS | ad_timestamping)'" - " or use '-connect'\n"); - goto err; - } - - if (p.verbose) - BIO_printf(p.errorbio, "Service URL: <%s>\n", serverurl); - - curl_easy_setopt(p.curl, CURLOPT_URL, serverurl); - - /* Now specify the POST binary data */ - - curl_easy_setopt(p.curl, CURLOPT_POSTFIELDS, binaryptr); - curl_easy_setopt(p.curl, CURLOPT_POSTFIELDSIZE,(long)tabLength); - - /* pass our list of custom made headers */ - - contenttype = malloc(15+strlen(mimetype)); - sprintf(contenttype,"Content-type: %s",mimetype); - headers = curl_slist_append(headers,contenttype); - curl_easy_setopt(p.curl, CURLOPT_HTTPHEADER, headers); - - if (p.verbose) - BIO_printf(p.errorbio, "Service URL: <%s>\n", serverurl); - - { - FILE *outfp; - BIO_get_fp(out,&outfp); - curl_easy_setopt(p.curl, CURLOPT_WRITEDATA, outfp); - } - - res = curl_easy_setopt(p.curl, CURLOPT_SSL_CTX_FUNCTION, sslctxfun) ; - - if (res != CURLE_OK) - BIO_printf(p.errorbio,"%d %s=%d %d\n", __LINE__, "CURLOPT_SSL_CTX_FUNCTION",CURLOPT_SSL_CTX_FUNCTION,res); - - curl_easy_setopt(p.curl, CURLOPT_SSL_CTX_DATA, &p); - - { - int lu; int i=0; - while ((lu = BIO_read (in,&binaryptr[i],tabLength-i)) >0 ) { - i+=lu; - if (i== tabLength) { - tabLength+=100; - binaryptr=realloc(binaryptr,tabLength); /* should be more careful */ - } - } - tabLength = i; - } - /* Now specify the POST binary data */ - - curl_easy_setopt(p.curl, CURLOPT_POSTFIELDS, binaryptr); - curl_easy_setopt(p.curl, CURLOPT_POSTFIELDSIZE,(long)tabLength); - - - /* Perform the request, res will get the return code */ - - BIO_printf(p.errorbio,"%d %s %d\n", __LINE__, "curl_easy_perform", - res = curl_easy_perform(p.curl)); - { - int result =curl_easy_getinfo(p.curl,CURLINFO_CONTENT_TYPE,&response); - if( mimetypeaccept && p.verbose) - if(!strcmp(mimetypeaccept,response)) - BIO_printf(p.errorbio,"the response has a correct mimetype : %s\n", - response); - else - BIO_printf(p.errorbio,"the reponse doesn\'t has an acceptable " - "mime type, it is %s instead of %s\n", - response,mimetypeaccept); - } - - /*** code d'erreur si accept mime ***, egalement code return HTTP != 200 ***/ - -/* free the header list*/ - - curl_slist_free_all(headers); - - /* always cleanup */ - curl_easy_cleanup(p.curl); - - BIO_free(in); - BIO_free(out); - return (EXIT_SUCCESS); - - err: BIO_printf(p.errorbio,"error"); - exit(1); -} diff --git a/plugins/FTPFileYM/curl/docs/examples/debug.c b/plugins/FTPFileYM/curl/docs/examples/debug.c deleted file mode 100644 index 36dd80d702..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/debug.c +++ /dev/null @@ -1,147 +0,0 @@ -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at http://curl.haxx.se/docs/copyright.html. - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the COPYING file. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ***************************************************************************/ -#include <stdio.h> -#include <curl/curl.h> - -struct data { - char trace_ascii; /* 1 or 0 */ -}; - -static -void dump(const char *text, - FILE *stream, unsigned char *ptr, size_t size, - char nohex) -{ - size_t i; - size_t c; - - unsigned int width=0x10; - - if(nohex) - /* without the hex output, we can fit more on screen */ - width = 0x40; - - fprintf(stream, "%s, %10.10ld bytes (0x%8.8lx)\n", - text, (long)size, (long)size); - - for(i=0; i<size; i+= width) { - - fprintf(stream, "%4.4lx: ", (long)i); - - if(!nohex) { - /* hex not disabled, show it */ - for(c = 0; c < width; c++) - if(i+c < size) - fprintf(stream, "%02x ", ptr[i+c]); - else - fputs(" ", stream); - } - - for(c = 0; (c < width) && (i+c < size); c++) { - /* check for 0D0A; if found, skip past and start a new line of output */ - if (nohex && (i+c+1 < size) && ptr[i+c]==0x0D && ptr[i+c+1]==0x0A) { - i+=(c+2-width); - break; - } - fprintf(stream, "%c", - (ptr[i+c]>=0x20) && (ptr[i+c]<0x80)?ptr[i+c]:'.'); - /* check again for 0D0A, to avoid an extra \n if it's at width */ - if (nohex && (i+c+2 < size) && ptr[i+c+1]==0x0D && ptr[i+c+2]==0x0A) { - i+=(c+3-width); - break; - } - } - fputc('\n', stream); /* newline */ - } - fflush(stream); -} - -static -int my_trace(CURL *handle, curl_infotype type, - char *data, size_t size, - void *userp) -{ - struct data *config = (struct data *)userp; - const char *text; - (void)handle; /* prevent compiler warning */ - - switch (type) { - case CURLINFO_TEXT: - fprintf(stderr, "== Info: %s", data); - default: /* in case a new one is introduced to shock us */ - return 0; - - case CURLINFO_HEADER_OUT: - text = "=> Send header"; - break; - case CURLINFO_DATA_OUT: - text = "=> Send data"; - break; - case CURLINFO_SSL_DATA_OUT: - text = "=> Send SSL data"; - break; - case CURLINFO_HEADER_IN: - text = "<= Recv header"; - break; - case CURLINFO_DATA_IN: - text = "<= Recv data"; - break; - case CURLINFO_SSL_DATA_IN: - text = "<= Recv SSL data"; - break; - } - - dump(text, stderr, (unsigned char *)data, size, config->trace_ascii); - return 0; -} - -int main(void) -{ - CURL *curl; - CURLcode res; - struct data config; - - config.trace_ascii = 1; /* enable ascii tracing */ - - curl = curl_easy_init(); - if(curl) { - curl_easy_setopt(curl, CURLOPT_DEBUGFUNCTION, my_trace); - curl_easy_setopt(curl, CURLOPT_DEBUGDATA, &config); - - /* the DEBUGFUNCTION has no effect until we enable VERBOSE */ - curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); - - /* example.com is redirected, so we tell libcurl to follow redirection */ - curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); - - curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/"); - res = curl_easy_perform(curl); - /* Check for errors */ - if(res != CURLE_OK) - fprintf(stderr, "curl_easy_perform() failed: %s\n", - curl_easy_strerror(res)); - - /* always cleanup */ - curl_easy_cleanup(curl); - } - return 0; -} diff --git a/plugins/FTPFileYM/curl/docs/examples/evhiperfifo.c b/plugins/FTPFileYM/curl/docs/examples/evhiperfifo.c deleted file mode 100644 index c2e87fcc56..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/evhiperfifo.c +++ /dev/null @@ -1,442 +0,0 @@ -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at http://curl.haxx.se/docs/copyright.html. - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the COPYING file. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ***************************************************************************/ -/* Example application source code using the multi socket interface to - * download many files at once. - * - * This example features the same basic functionality as hiperfifo.c does, - * but this uses libev instead of libevent. - * - * Written by Jeff Pohlmeyer, converted to use libev by Markus Koetter - -Requires libev and a (POSIX?) system that has mkfifo(). - -This is an adaptation of libcurl's "hipev.c" and libevent's "event-test.c" -sample programs. - -When running, the program creates the named pipe "hiper.fifo" - -Whenever there is input into the fifo, the program reads the input as a list -of URL's and creates some new easy handles to fetch each URL via the -curl_multi "hiper" API. - - -Thus, you can try a single URL: - % echo http://www.yahoo.com > hiper.fifo - -Or a whole bunch of them: - % cat my-url-list > hiper.fifo - -The fifo buffer is handled almost instantly, so you can even add more URL's -while the previous requests are still being downloaded. - -Note: - For the sake of simplicity, URL length is limited to 1023 char's ! - -This is purely a demo app, all retrieved data is simply discarded by the write -callback. - -*/ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <sys/time.h> -#include <time.h> -#include <unistd.h> -#include <sys/poll.h> -#include <curl/curl.h> -#include <ev.h> -#include <fcntl.h> -#include <sys/stat.h> -#include <errno.h> - -#define DPRINT(x...) printf(x) - -#define MSG_OUT stdout /* Send info to stdout, change to stderr if you want */ - - -/* Global information, common to all connections */ -typedef struct _GlobalInfo -{ - struct ev_loop *loop; - struct ev_io fifo_event; - struct ev_timer timer_event; - CURLM *multi; - int still_running; - FILE* input; -} GlobalInfo; - - -/* Information associated with a specific easy handle */ -typedef struct _ConnInfo -{ - CURL *easy; - char *url; - GlobalInfo *global; - char error[CURL_ERROR_SIZE]; -} ConnInfo; - - -/* Information associated with a specific socket */ -typedef struct _SockInfo -{ - curl_socket_t sockfd; - CURL *easy; - int action; - long timeout; - struct ev_io ev; - int evset; - GlobalInfo *global; -} SockInfo; - -static void timer_cb(EV_P_ struct ev_timer *w, int revents); - -/* Update the event timer after curl_multi library calls */ -static int multi_timer_cb(CURLM *multi, long timeout_ms, GlobalInfo *g) -{ - DPRINT("%s %li\n", __PRETTY_FUNCTION__, timeout_ms); - ev_timer_stop(g->loop, &g->timer_event); - if (timeout_ms > 0) - { - double t = timeout_ms / 1000; - ev_timer_init(&g->timer_event, timer_cb, t, 0.); - ev_timer_start(g->loop, &g->timer_event); - }else - timer_cb(g->loop, &g->timer_event, 0); - return 0; -} - -/* Die if we get a bad CURLMcode somewhere */ -static void mcode_or_die(const char *where, CURLMcode code) -{ - if ( CURLM_OK != code ) - { - const char *s; - switch ( code ) - { - case CURLM_CALL_MULTI_PERFORM: s="CURLM_CALL_MULTI_PERFORM"; break; - case CURLM_BAD_HANDLE: s="CURLM_BAD_HANDLE"; break; - case CURLM_BAD_EASY_HANDLE: s="CURLM_BAD_EASY_HANDLE"; break; - case CURLM_OUT_OF_MEMORY: s="CURLM_OUT_OF_MEMORY"; break; - case CURLM_INTERNAL_ERROR: s="CURLM_INTERNAL_ERROR"; break; - case CURLM_UNKNOWN_OPTION: s="CURLM_UNKNOWN_OPTION"; break; - case CURLM_LAST: s="CURLM_LAST"; break; - default: s="CURLM_unknown"; - break; - case CURLM_BAD_SOCKET: s="CURLM_BAD_SOCKET"; - fprintf(MSG_OUT, "ERROR: %s returns %s\n", where, s); - /* ignore this error */ - return; - } - fprintf(MSG_OUT, "ERROR: %s returns %s\n", where, s); - exit(code); - } -} - - - -/* Check for completed transfers, and remove their easy handles */ -static void check_multi_info(GlobalInfo *g) -{ - char *eff_url; - CURLMsg *msg; - int msgs_left; - ConnInfo *conn; - CURL *easy; - CURLcode res; - - fprintf(MSG_OUT, "REMAINING: %d\n", g->still_running); - while ((msg = curl_multi_info_read(g->multi, &msgs_left))) { - if (msg->msg == CURLMSG_DONE) { - easy = msg->easy_handle; - res = msg->data.result; - curl_easy_getinfo(easy, CURLINFO_PRIVATE, &conn); - curl_easy_getinfo(easy, CURLINFO_EFFECTIVE_URL, &eff_url); - fprintf(MSG_OUT, "DONE: %s => (%d) %s\n", eff_url, res, conn->error); - curl_multi_remove_handle(g->multi, easy); - free(conn->url); - curl_easy_cleanup(easy); - free(conn); - } - } -} - - - -/* Called by libevent when we get action on a multi socket */ -static void event_cb(EV_P_ struct ev_io *w, int revents) -{ - DPRINT("%s w %p revents %i\n", __PRETTY_FUNCTION__, w, revents); - GlobalInfo *g = (GlobalInfo*) w->data; - CURLMcode rc; - - int action = (revents&EV_READ?CURL_POLL_IN:0)| - (revents&EV_WRITE?CURL_POLL_OUT:0); - rc = curl_multi_socket_action(g->multi, w->fd, action, &g->still_running); - mcode_or_die("event_cb: curl_multi_socket_action", rc); - check_multi_info(g); - if ( g->still_running <= 0 ) - { - fprintf(MSG_OUT, "last transfer done, kill timeout\n"); - ev_timer_stop(g->loop, &g->timer_event); - } -} - -/* Called by libevent when our timeout expires */ -static void timer_cb(EV_P_ struct ev_timer *w, int revents) -{ - DPRINT("%s w %p revents %i\n", __PRETTY_FUNCTION__, w, revents); - - GlobalInfo *g = (GlobalInfo *)w->data; - CURLMcode rc; - - rc = curl_multi_socket_action(g->multi, CURL_SOCKET_TIMEOUT, 0, &g->still_running); - mcode_or_die("timer_cb: curl_multi_socket_action", rc); - check_multi_info(g); -} - -/* Clean up the SockInfo structure */ -static void remsock(SockInfo *f, GlobalInfo *g) -{ - printf("%s \n", __PRETTY_FUNCTION__); - if ( f ) - { - if ( f->evset ) - ev_io_stop(g->loop, &f->ev); - free(f); - } -} - - - -/* Assign information to a SockInfo structure */ -static void setsock(SockInfo*f, curl_socket_t s, CURL*e, int act, GlobalInfo*g) -{ - printf("%s \n", __PRETTY_FUNCTION__); - - int kind = (act&CURL_POLL_IN?EV_READ:0)|(act&CURL_POLL_OUT?EV_WRITE:0); - - f->sockfd = s; - f->action = act; - f->easy = e; - if ( f->evset ) - ev_io_stop(g->loop, &f->ev); - ev_io_init(&f->ev, event_cb, f->sockfd, kind); - f->ev.data = g; - f->evset=1; - ev_io_start(g->loop, &f->ev); -} - - - -/* Initialize a new SockInfo structure */ -static void addsock(curl_socket_t s, CURL *easy, int action, GlobalInfo *g) -{ - SockInfo *fdp = calloc(sizeof(SockInfo), 1); - - fdp->global = g; - setsock(fdp, s, easy, action, g); - curl_multi_assign(g->multi, s, fdp); -} - -/* CURLMOPT_SOCKETFUNCTION */ -static int sock_cb(CURL *e, curl_socket_t s, int what, void *cbp, void *sockp) -{ - DPRINT("%s e %p s %i what %i cbp %p sockp %p\n", - __PRETTY_FUNCTION__, e, s, what, cbp, sockp); - - GlobalInfo *g = (GlobalInfo*) cbp; - SockInfo *fdp = (SockInfo*) sockp; - const char *whatstr[]={ "none", "IN", "OUT", "INOUT", "REMOVE"}; - - fprintf(MSG_OUT, - "socket callback: s=%d e=%p what=%s ", s, e, whatstr[what]); - if ( what == CURL_POLL_REMOVE ) - { - fprintf(MSG_OUT, "\n"); - remsock(fdp, g); - } else - { - if ( !fdp ) - { - fprintf(MSG_OUT, "Adding data: %s\n", whatstr[what]); - addsock(s, e, what, g); - } else - { - fprintf(MSG_OUT, - "Changing action from %s to %s\n", - whatstr[fdp->action], whatstr[what]); - setsock(fdp, s, e, what, g); - } - } - return 0; -} - - -/* CURLOPT_WRITEFUNCTION */ -static size_t write_cb(void *ptr, size_t size, size_t nmemb, void *data) -{ - size_t realsize = size * nmemb; - ConnInfo *conn = (ConnInfo*) data; - (void)ptr; - (void)conn; - return realsize; -} - - -/* CURLOPT_PROGRESSFUNCTION */ -static int prog_cb (void *p, double dltotal, double dlnow, double ult, - double uln) -{ - ConnInfo *conn = (ConnInfo *)p; - (void)ult; - (void)uln; - - fprintf(MSG_OUT, "Progress: %s (%g/%g)\n", conn->url, dlnow, dltotal); - return 0; -} - - -/* Create a new easy handle, and add it to the global curl_multi */ -static void new_conn(char *url, GlobalInfo *g ) -{ - ConnInfo *conn; - CURLMcode rc; - - conn = calloc(1, sizeof(ConnInfo)); - memset(conn, 0, sizeof(ConnInfo)); - conn->error[0]='\0'; - - conn->easy = curl_easy_init(); - if ( !conn->easy ) - { - fprintf(MSG_OUT, "curl_easy_init() failed, exiting!\n"); - exit(2); - } - conn->global = g; - conn->url = strdup(url); - curl_easy_setopt(conn->easy, CURLOPT_URL, conn->url); - curl_easy_setopt(conn->easy, CURLOPT_WRITEFUNCTION, write_cb); - curl_easy_setopt(conn->easy, CURLOPT_WRITEDATA, conn); - curl_easy_setopt(conn->easy, CURLOPT_VERBOSE, 1L); - curl_easy_setopt(conn->easy, CURLOPT_ERRORBUFFER, conn->error); - curl_easy_setopt(conn->easy, CURLOPT_PRIVATE, conn); - curl_easy_setopt(conn->easy, CURLOPT_NOPROGRESS, 0L); - curl_easy_setopt(conn->easy, CURLOPT_PROGRESSFUNCTION, prog_cb); - curl_easy_setopt(conn->easy, CURLOPT_PROGRESSDATA, conn); - curl_easy_setopt(conn->easy, CURLOPT_LOW_SPEED_TIME, 3L); - curl_easy_setopt(conn->easy, CURLOPT_LOW_SPEED_LIMIT, 10L); - - fprintf(MSG_OUT, - "Adding easy %p to multi %p (%s)\n", conn->easy, g->multi, url); - rc = curl_multi_add_handle(g->multi, conn->easy); - mcode_or_die("new_conn: curl_multi_add_handle", rc); - - /* note that the add_handle() will set a time-out to trigger very soon so - that the necessary socket_action() call will be called by this app */ -} - -/* This gets called whenever data is received from the fifo */ -static void fifo_cb(EV_P_ struct ev_io *w, int revents) -{ - char s[1024]; - long int rv=0; - int n=0; - GlobalInfo *g = (GlobalInfo *)w->data; - - do - { - s[0]='\0'; - rv=fscanf(g->input, "%1023s%n", s, &n); - s[n]='\0'; - if ( n && s[0] ) - { - new_conn(s,g); /* if we read a URL, go get it! */ - } else break; - } while ( rv != EOF ); -} - -/* Create a named pipe and tell libevent to monitor it */ -static int init_fifo (GlobalInfo *g) -{ - struct stat st; - static const char *fifo = "hiper.fifo"; - curl_socket_t sockfd; - - fprintf(MSG_OUT, "Creating named pipe \"%s\"\n", fifo); - if ( lstat (fifo, &st) == 0 ) - { - if ( (st.st_mode & S_IFMT) == S_IFREG ) - { - errno = EEXIST; - perror("lstat"); - exit (1); - } - } - unlink(fifo); - if ( mkfifo (fifo, 0600) == -1 ) - { - perror("mkfifo"); - exit (1); - } - sockfd = open(fifo, O_RDWR | O_NONBLOCK, 0); - if ( sockfd == -1 ) - { - perror("open"); - exit (1); - } - g->input = fdopen(sockfd, "r"); - - fprintf(MSG_OUT, "Now, pipe some URL's into > %s\n", fifo); - ev_io_init(&g->fifo_event, fifo_cb, sockfd, EV_READ); - ev_io_start(g->loop, &g->fifo_event); - return(0); -} - -int main(int argc, char **argv) -{ - GlobalInfo g; - CURLMcode rc; - (void)argc; - (void)argv; - - memset(&g, 0, sizeof(GlobalInfo)); - g.loop = ev_default_loop(0); - - init_fifo(&g); - g.multi = curl_multi_init(); - - ev_timer_init(&g.timer_event, timer_cb, 0., 0.); - g.timer_event.data = &g; - g.fifo_event.data = &g; - curl_multi_setopt(g.multi, CURLMOPT_SOCKETFUNCTION, sock_cb); - curl_multi_setopt(g.multi, CURLMOPT_SOCKETDATA, &g); - curl_multi_setopt(g.multi, CURLMOPT_TIMERFUNCTION, multi_timer_cb); - curl_multi_setopt(g.multi, CURLMOPT_TIMERDATA, &g); - - /* we don't call any curl_multi_socket*() function yet as we have no handles - added! */ - - ev_loop(g.loop, 0); - curl_multi_cleanup(g.multi); - return 0; -} diff --git a/plugins/FTPFileYM/curl/docs/examples/externalsocket.c b/plugins/FTPFileYM/curl/docs/examples/externalsocket.c deleted file mode 100644 index 1b326c8b29..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/externalsocket.c +++ /dev/null @@ -1,153 +0,0 @@ -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at http://curl.haxx.se/docs/copyright.html. - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the COPYING file. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ***************************************************************************/ -/* - * This is an example demonstrating how an application can pass in a custom - * socket to libcurl to use. This example also handles the connect itself. - */ -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <curl/curl.h> - -#ifdef WIN32 -#include <windows.h> -#include <winsock2.h> -#include <ws2tcpip.h> -#define close closesocket -#else -#include <sys/types.h> /* socket types */ -#include <sys/socket.h> /* socket definitions */ -#include <netinet/in.h> -#include <arpa/inet.h> /* inet (3) funtions */ -#include <unistd.h> /* misc. UNIX functions */ -#endif - -#include <errno.h> - -/* The IP address and port number to connect to */ -#define IPADDR "127.0.0.1" -#define PORTNUM 80 - -#ifndef INADDR_NONE -#define INADDR_NONE 0xffffffff -#endif - -static size_t write_data(void *ptr, size_t size, size_t nmemb, void *stream) -{ - int written = fwrite(ptr, size, nmemb, (FILE *)stream); - return written; -} - -static curl_socket_t opensocket(void *clientp, - curlsocktype purpose, - struct curl_sockaddr *address) -{ - curl_socket_t sockfd; - (void)purpose; - (void)address; - sockfd = *(curl_socket_t *)clientp; - /* the actual externally set socket is passed in via the OPENSOCKETDATA - option */ - return sockfd; -} - -static int sockopt_callback(void *clientp, curl_socket_t curlfd, - curlsocktype purpose) -{ - (void)clientp; - (void)curlfd; - (void)purpose; - /* This return code was added in libcurl 7.21.5 */ - return CURL_SOCKOPT_ALREADY_CONNECTED; -} - -int main(void) -{ - CURL *curl; - CURLcode res; - struct sockaddr_in servaddr; /* socket address structure */ - curl_socket_t sockfd; - -#ifdef WIN32 - WSADATA wsaData; - int initwsa; - - if((initwsa = WSAStartup(MAKEWORD(2,0), &wsaData)) != 0) { - printf("WSAStartup failed: %d\n", initwsa); - return 1; - } -#endif - - curl = curl_easy_init(); - if(curl) { - /* - * Note that libcurl will internally think that you connect to the host - * and port that you specify in the URL option. - */ - curl_easy_setopt(curl, CURLOPT_URL, "http://99.99.99.99:9999"); - - /* Create the socket "manually" */ - if( (sockfd = socket(AF_INET, SOCK_STREAM, 0)) == CURL_SOCKET_BAD ) { - printf("Error creating listening socket.\n"); - return 3; - } - - memset(&servaddr, 0, sizeof(servaddr)); - servaddr.sin_family = AF_INET; - servaddr.sin_port = htons(PORTNUM); - - if (INADDR_NONE == (servaddr.sin_addr.s_addr = inet_addr(IPADDR))) - return 2; - - if(connect(sockfd,(struct sockaddr *) &servaddr, sizeof(servaddr)) == - -1) { - close(sockfd); - printf("client error: connect: %s\n", strerror(errno)); - return 1; - } - - /* no progress meter please */ - curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 1L); - - /* send all data to this function */ - curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data); - - /* call this function to get a socket */ - curl_easy_setopt(curl, CURLOPT_OPENSOCKETFUNCTION, opensocket); - curl_easy_setopt(curl, CURLOPT_OPENSOCKETDATA, &sockfd); - - /* call this function to set options for the socket */ - curl_easy_setopt(curl, CURLOPT_SOCKOPTFUNCTION, sockopt_callback); - - curl_easy_setopt(curl, CURLOPT_VERBOSE, 1); - - res = curl_easy_perform(curl); - - curl_easy_cleanup(curl); - - if(res) { - printf("libcurl error: %d\n", res); - return 4; - } - } - return 0; -} diff --git a/plugins/FTPFileYM/curl/docs/examples/fileupload.c b/plugins/FTPFileYM/curl/docs/examples/fileupload.c deleted file mode 100644 index 665eca0af9..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/fileupload.c +++ /dev/null @@ -1,86 +0,0 @@ -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at http://curl.haxx.se/docs/copyright.html. - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the COPYING file. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ***************************************************************************/ -#include <stdio.h> -#include <curl/curl.h> -#include <sys/stat.h> -#include <fcntl.h> - -int main(void) -{ - CURL *curl; - CURLcode res; - struct stat file_info; - double speed_upload, total_time; - FILE *fd; - - fd = fopen("debugit", "rb"); /* open file to upload */ - if(!fd) { - - return 1; /* can't continue */ - } - - /* to get the file size */ - if(fstat(fileno(fd), &file_info) != 0) { - - return 1; /* can't continue */ - } - - curl = curl_easy_init(); - if(curl) { - /* upload to this place */ - curl_easy_setopt(curl, CURLOPT_URL, - "file:///home/dast/src/curl/debug/new"); - - /* tell it to "upload" to the URL */ - curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L); - - /* set where to read from (on Windows you need to use READFUNCTION too) */ - curl_easy_setopt(curl, CURLOPT_READDATA, fd); - - /* and give the size of the upload (optional) */ - curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE, - (curl_off_t)file_info.st_size); - - /* enable verbose for easier tracing */ - curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); - - res = curl_easy_perform(curl); - /* Check for errors */ - if(res != CURLE_OK) { - fprintf(stderr, "curl_easy_perform() failed: %s\n", - curl_easy_strerror(res)); - - } - else { - /* now extract transfer info */ - curl_easy_getinfo(curl, CURLINFO_SPEED_UPLOAD, &speed_upload); - curl_easy_getinfo(curl, CURLINFO_TOTAL_TIME, &total_time); - - fprintf(stderr, "Speed: %.3f bytes/sec during %.3f seconds\n", - speed_upload, total_time); - - } - /* always cleanup */ - curl_easy_cleanup(curl); - } - return 0; -} diff --git a/plugins/FTPFileYM/curl/docs/examples/fopen.c b/plugins/FTPFileYM/curl/docs/examples/fopen.c deleted file mode 100644 index 6fe5c0f9fb..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/fopen.c +++ /dev/null @@ -1,527 +0,0 @@ -/***************************************************************************** - * - * This example source code introduces a c library buffered I/O interface to - * URL reads it supports fopen(), fread(), fgets(), feof(), fclose(), - * rewind(). Supported functions have identical prototypes to their normal c - * lib namesakes and are preceaded by url_ . - * - * Using this code you can replace your program's fopen() with url_fopen() - * and fread() with url_fread() and it become possible to read remote streams - * instead of (only) local files. Local files (ie those that can be directly - * fopened) will drop back to using the underlying clib implementations - * - * See the main() function at the bottom that shows an app that retrives from a - * specified url using fgets() and fread() and saves as two output files. - * - * Copyright (c) 2003 Simtec Electronics - * - * Re-implemented by Vincent Sanders <vince@kyllikki.org> with extensive - * reference to original curl example code - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This example requires libcurl 7.9.7 or later. - */ - -#include <stdio.h> -#include <string.h> -#ifndef WIN32 -# include <sys/time.h> -#endif -#include <stdlib.h> -#include <errno.h> - -#include <curl/curl.h> - -enum fcurl_type_e { - CFTYPE_NONE=0, - CFTYPE_FILE=1, - CFTYPE_CURL=2 -}; - -struct fcurl_data -{ - enum fcurl_type_e type; /* type of handle */ - union { - CURL *curl; - FILE *file; - } handle; /* handle */ - - char *buffer; /* buffer to store cached data*/ - size_t buffer_len; /* currently allocated buffers length */ - size_t buffer_pos; /* end of data in buffer*/ - int still_running; /* Is background url fetch still in progress */ -}; - -typedef struct fcurl_data URL_FILE; - -/* exported functions */ -URL_FILE *url_fopen(const char *url,const char *operation); -int url_fclose(URL_FILE *file); -int url_feof(URL_FILE *file); -size_t url_fread(void *ptr, size_t size, size_t nmemb, URL_FILE *file); -char * url_fgets(char *ptr, size_t size, URL_FILE *file); -void url_rewind(URL_FILE *file); - -/* we use a global one for convenience */ -CURLM *multi_handle; - -/* curl calls this routine to get more data */ -static size_t write_callback(char *buffer, - size_t size, - size_t nitems, - void *userp) -{ - char *newbuff; - size_t rembuff; - - URL_FILE *url = (URL_FILE *)userp; - size *= nitems; - - rembuff=url->buffer_len - url->buffer_pos; /* remaining space in buffer */ - - if(size > rembuff) { - /* not enough space in buffer */ - newbuff=realloc(url->buffer,url->buffer_len + (size - rembuff)); - if(newbuff==NULL) { - fprintf(stderr,"callback buffer grow failed\n"); - size=rembuff; - } - else { - /* realloc suceeded increase buffer size*/ - url->buffer_len+=size - rembuff; - url->buffer=newbuff; - } - } - - memcpy(&url->buffer[url->buffer_pos], buffer, size); - url->buffer_pos += size; - - return size; -} - -/* use to attempt to fill the read buffer up to requested number of bytes */ -static int fill_buffer(URL_FILE *file, size_t want) -{ - fd_set fdread; - fd_set fdwrite; - fd_set fdexcep; - struct timeval timeout; - int rc; - - /* only attempt to fill buffer if transactions still running and buffer - * doesnt exceed required size already - */ - if((!file->still_running) || (file->buffer_pos > want)) - return 0; - - /* attempt to fill buffer */ - do { - int maxfd = -1; - long curl_timeo = -1; - - FD_ZERO(&fdread); - FD_ZERO(&fdwrite); - FD_ZERO(&fdexcep); - - /* set a suitable timeout to fail on */ - timeout.tv_sec = 60; /* 1 minute */ - timeout.tv_usec = 0; - - curl_multi_timeout(multi_handle, &curl_timeo); - if(curl_timeo >= 0) { - timeout.tv_sec = curl_timeo / 1000; - if(timeout.tv_sec > 1) - timeout.tv_sec = 1; - else - timeout.tv_usec = (curl_timeo % 1000) * 1000; - } - - /* get file descriptors from the transfers */ - curl_multi_fdset(multi_handle, &fdread, &fdwrite, &fdexcep, &maxfd); - - /* In a real-world program you OF COURSE check the return code of the - function calls. On success, the value of maxfd is guaranteed to be - greater or equal than -1. We call select(maxfd + 1, ...), specially - in case of (maxfd == -1), we call select(0, ...), which is basically - equal to sleep. */ - - rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout); - - switch(rc) { - case -1: - /* select error */ - break; - - case 0: - default: - /* timeout or readable/writable sockets */ - curl_multi_perform(multi_handle, &file->still_running); - break; - } - } while(file->still_running && (file->buffer_pos < want)); - return 1; -} - -/* use to remove want bytes from the front of a files buffer */ -static int use_buffer(URL_FILE *file,int want) -{ - /* sort out buffer */ - if((file->buffer_pos - want) <=0) { - /* ditch buffer - write will recreate */ - if(file->buffer) - free(file->buffer); - - file->buffer=NULL; - file->buffer_pos=0; - file->buffer_len=0; - } - else { - /* move rest down make it available for later */ - memmove(file->buffer, - &file->buffer[want], - (file->buffer_pos - want)); - - file->buffer_pos -= want; - } - return 0; -} - -URL_FILE *url_fopen(const char *url,const char *operation) -{ - /* this code could check for URLs or types in the 'url' and - basicly use the real fopen() for standard files */ - - URL_FILE *file; - (void)operation; - - file = malloc(sizeof(URL_FILE)); - if(!file) - return NULL; - - memset(file, 0, sizeof(URL_FILE)); - - if((file->handle.file=fopen(url,operation))) - file->type = CFTYPE_FILE; /* marked as URL */ - - else { - file->type = CFTYPE_CURL; /* marked as URL */ - file->handle.curl = curl_easy_init(); - - curl_easy_setopt(file->handle.curl, CURLOPT_URL, url); - curl_easy_setopt(file->handle.curl, CURLOPT_WRITEDATA, file); - curl_easy_setopt(file->handle.curl, CURLOPT_VERBOSE, 0L); - curl_easy_setopt(file->handle.curl, CURLOPT_WRITEFUNCTION, write_callback); - - if(!multi_handle) - multi_handle = curl_multi_init(); - - curl_multi_add_handle(multi_handle, file->handle.curl); - - /* lets start the fetch */ - curl_multi_perform(multi_handle, &file->still_running); - - if((file->buffer_pos == 0) && (!file->still_running)) { - /* if still_running is 0 now, we should return NULL */ - - /* make sure the easy handle is not in the multi handle anymore */ - curl_multi_remove_handle(multi_handle, file->handle.curl); - - /* cleanup */ - curl_easy_cleanup(file->handle.curl); - - free(file); - - file = NULL; - } - } - return file; -} - -int url_fclose(URL_FILE *file) -{ - int ret=0;/* default is good return */ - - switch(file->type) { - case CFTYPE_FILE: - ret=fclose(file->handle.file); /* passthrough */ - break; - - case CFTYPE_CURL: - /* make sure the easy handle is not in the multi handle anymore */ - curl_multi_remove_handle(multi_handle, file->handle.curl); - - /* cleanup */ - curl_easy_cleanup(file->handle.curl); - break; - - default: /* unknown or supported type - oh dear */ - ret=EOF; - errno=EBADF; - break; - } - - if(file->buffer) - free(file->buffer);/* free any allocated buffer space */ - - free(file); - - return ret; -} - -int url_feof(URL_FILE *file) -{ - int ret=0; - - switch(file->type) { - case CFTYPE_FILE: - ret=feof(file->handle.file); - break; - - case CFTYPE_CURL: - if((file->buffer_pos == 0) && (!file->still_running)) - ret = 1; - break; - - default: /* unknown or supported type - oh dear */ - ret=-1; - errno=EBADF; - break; - } - return ret; -} - -size_t url_fread(void *ptr, size_t size, size_t nmemb, URL_FILE *file) -{ - size_t want; - - switch(file->type) { - case CFTYPE_FILE: - want=fread(ptr,size,nmemb,file->handle.file); - break; - - case CFTYPE_CURL: - want = nmemb * size; - - fill_buffer(file,want); - - /* check if theres data in the buffer - if not fill_buffer() - * either errored or EOF */ - if(!file->buffer_pos) - return 0; - - /* ensure only available data is considered */ - if(file->buffer_pos < want) - want = file->buffer_pos; - - /* xfer data to caller */ - memcpy(ptr, file->buffer, want); - - use_buffer(file,want); - - want = want / size; /* number of items */ - break; - - default: /* unknown or supported type - oh dear */ - want=0; - errno=EBADF; - break; - - } - return want; -} - -char *url_fgets(char *ptr, size_t size, URL_FILE *file) -{ - size_t want = size - 1;/* always need to leave room for zero termination */ - size_t loop; - - switch(file->type) { - case CFTYPE_FILE: - ptr = fgets(ptr,size,file->handle.file); - break; - - case CFTYPE_CURL: - fill_buffer(file,want); - - /* check if theres data in the buffer - if not fill either errored or - * EOF */ - if(!file->buffer_pos) - return NULL; - - /* ensure only available data is considered */ - if(file->buffer_pos < want) - want = file->buffer_pos; - - /*buffer contains data */ - /* look for newline or eof */ - for(loop=0;loop < want;loop++) { - if(file->buffer[loop] == '\n') { - want=loop+1;/* include newline */ - break; - } - } - - /* xfer data to caller */ - memcpy(ptr, file->buffer, want); - ptr[want]=0;/* allways null terminate */ - - use_buffer(file,want); - - break; - - default: /* unknown or supported type - oh dear */ - ptr=NULL; - errno=EBADF; - break; - } - - return ptr;/*success */ -} - -void url_rewind(URL_FILE *file) -{ - switch(file->type) { - case CFTYPE_FILE: - rewind(file->handle.file); /* passthrough */ - break; - - case CFTYPE_CURL: - /* halt transaction */ - curl_multi_remove_handle(multi_handle, file->handle.curl); - - /* restart */ - curl_multi_add_handle(multi_handle, file->handle.curl); - - /* ditch buffer - write will recreate - resets stream pos*/ - if(file->buffer) - free(file->buffer); - - file->buffer=NULL; - file->buffer_pos=0; - file->buffer_len=0; - - break; - - default: /* unknown or supported type - oh dear */ - break; - } -} - -/* Small main program to retrive from a url using fgets and fread saving the - * output to two test files (note the fgets method will corrupt binary files if - * they contain 0 chars */ -int main(int argc, char *argv[]) -{ - URL_FILE *handle; - FILE *outf; - - int nread; - char buffer[256]; - const char *url; - - if(argc < 2) - url="http://192.168.7.3/testfile";/* default to testurl */ - else - url=argv[1];/* use passed url */ - - /* copy from url line by line with fgets */ - outf=fopen("fgets.test","w+"); - if(!outf) { - perror("couldn't open fgets output file\n"); - return 1; - } - - handle = url_fopen(url, "r"); - if(!handle) { - printf("couldn't url_fopen() %s\n", url); - fclose(outf); - return 2; - } - - while(!url_feof(handle)) { - url_fgets(buffer,sizeof(buffer),handle); - fwrite(buffer,1,strlen(buffer),outf); - } - - url_fclose(handle); - - fclose(outf); - - - /* Copy from url with fread */ - outf=fopen("fread.test","w+"); - if(!outf) { - perror("couldn't open fread output file\n"); - return 1; - } - - handle = url_fopen("testfile", "r"); - if(!handle) { - printf("couldn't url_fopen() testfile\n"); - fclose(outf); - return 2; - } - - do { - nread = url_fread(buffer, 1,sizeof(buffer), handle); - fwrite(buffer,1,nread,outf); - } while(nread); - - url_fclose(handle); - - fclose(outf); - - - /* Test rewind */ - outf=fopen("rewind.test","w+"); - if(!outf) { - perror("couldn't open fread output file\n"); - return 1; - } - - handle = url_fopen("testfile", "r"); - if(!handle) { - printf("couldn't url_fopen() testfile\n"); - fclose(outf); - return 2; - } - - nread = url_fread(buffer, 1,sizeof(buffer), handle); - fwrite(buffer,1,nread,outf); - url_rewind(handle); - - buffer[0]='\n'; - fwrite(buffer,1,1,outf); - - nread = url_fread(buffer, 1,sizeof(buffer), handle); - fwrite(buffer,1,nread,outf); - - - url_fclose(handle); - - fclose(outf); - - - return 0;/* all done */ -} diff --git a/plugins/FTPFileYM/curl/docs/examples/ftp-wildcard.c b/plugins/FTPFileYM/curl/docs/examples/ftp-wildcard.c deleted file mode 100644 index 5a2a10311b..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/ftp-wildcard.c +++ /dev/null @@ -1,148 +0,0 @@ -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at http://curl.haxx.se/docs/copyright.html. - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the COPYING file. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ***************************************************************************/ -#include <curl/curl.h> -#include <stdio.h> - -struct callback_data { - FILE *output; -}; - -static long file_is_comming(struct curl_fileinfo *finfo, - struct callback_data *data, - int remains); - -static long file_is_downloaded(struct callback_data *data); - -static size_t write_it(char *buff, size_t size, size_t nmemb, - void *cb_data); - -int main(int argc, char **argv) -{ - int rc = CURLE_OK; - - /* curl easy handle */ - CURL *handle; - - /* help data */ - struct callback_data data = { 0 }; - - /* global initialization */ - rc = curl_global_init(CURL_GLOBAL_ALL); - if(rc) - return rc; - - /* initialization of easy handle */ - handle = curl_easy_init(); - if(!handle) { - curl_global_cleanup(); - return CURLE_OUT_OF_MEMORY; - } - - /* turn on wildcard matching */ - curl_easy_setopt(handle, CURLOPT_WILDCARDMATCH, 1L); - - /* callback is called before download of concrete file started */ - curl_easy_setopt(handle, CURLOPT_CHUNK_BGN_FUNCTION, file_is_comming); - - /* callback is called after data from the file have been transferred */ - curl_easy_setopt(handle, CURLOPT_CHUNK_END_FUNCTION, file_is_downloaded); - - /* this callback will write contents into files */ - curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, write_it); - - /* put transfer data into callbacks */ - curl_easy_setopt(handle, CURLOPT_CHUNK_DATA, &data); - curl_easy_setopt(handle, CURLOPT_WRITEDATA, &data); - - /* curl_easy_setopt(handle, CURLOPT_VERBOSE, 1L); */ - - /* set an URL containing wildcard pattern (only in the last part) */ - if(argc == 2) - curl_easy_setopt(handle, CURLOPT_URL, argv[1]); - else - curl_easy_setopt(handle, CURLOPT_URL, "ftp://example.com/test/*"); - - /* and start transfer! */ - rc = curl_easy_perform(handle); - - curl_easy_cleanup(handle); - curl_global_cleanup(); - return rc; -} - -static long file_is_comming(struct curl_fileinfo *finfo, - struct callback_data *data, - int remains) -{ - printf("%3d %40s %10luB ", remains, finfo->filename, - (unsigned long)finfo->size); - - switch(finfo->filetype) { - case CURLFILETYPE_DIRECTORY: - printf(" DIR\n"); - break; - case CURLFILETYPE_FILE: - printf("FILE "); - break; - default: - printf("OTHER\n"); - break; - } - - if(finfo->filetype == CURLFILETYPE_FILE) { - /* do not transfer files >= 50B */ - if(finfo->size > 50) { - printf("SKIPPED\n"); - return CURL_CHUNK_BGN_FUNC_SKIP; - } - - data->output = fopen(finfo->filename, "w"); - if(!data->output) { - return CURL_CHUNK_BGN_FUNC_FAIL; - } - } - - return CURL_CHUNK_BGN_FUNC_OK; -} - -static long file_is_downloaded(struct callback_data *data) -{ - if(data->output) { - printf("DOWNLOADED\n"); - fclose(data->output); - data->output = 0x0; - } - return CURL_CHUNK_END_FUNC_OK; -} - -static size_t write_it(char *buff, size_t size, size_t nmemb, - void *cb_data) -{ - struct callback_data *data = cb_data; - size_t written = 0; - if(data->output) - written = fwrite(buff, size, nmemb, data->output); - else - /* listing output */ - written = fwrite(buff, size, nmemb, stdout); - return written; -} diff --git a/plugins/FTPFileYM/curl/docs/examples/ftpget.c b/plugins/FTPFileYM/curl/docs/examples/ftpget.c deleted file mode 100644 index bcb42bb302..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/ftpget.c +++ /dev/null @@ -1,94 +0,0 @@ -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at http://curl.haxx.se/docs/copyright.html. - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the COPYING file. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ***************************************************************************/ -#include <stdio.h> - -#include <curl/curl.h> - -/* - * This is an example showing how to get a single file from an FTP server. - * It delays the actual destination file creation until the first write - * callback so that it won't create an empty file in case the remote file - * doesn't exist or something else fails. - */ - -struct FtpFile { - const char *filename; - FILE *stream; -}; - -static size_t my_fwrite(void *buffer, size_t size, size_t nmemb, void *stream) -{ - struct FtpFile *out=(struct FtpFile *)stream; - if(out && !out->stream) { - /* open file for writing */ - out->stream=fopen(out->filename, "wb"); - if(!out->stream) - return -1; /* failure, can't open file to write */ - } - return fwrite(buffer, size, nmemb, out->stream); -} - - -int main(void) -{ - CURL *curl; - CURLcode res; - struct FtpFile ftpfile={ - "curl.tar.gz", /* name to store the file as if succesful */ - NULL - }; - - curl_global_init(CURL_GLOBAL_DEFAULT); - - curl = curl_easy_init(); - if(curl) { - /* - * You better replace the URL with one that works! - */ - curl_easy_setopt(curl, CURLOPT_URL, - "ftp://ftp.example.com/pub/www/utilities/curl/curl-7.9.2.tar.gz"); - /* Define our callback to get called when there's data to be written */ - curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, my_fwrite); - /* Set a pointer to our struct to pass to the callback */ - curl_easy_setopt(curl, CURLOPT_WRITEDATA, &ftpfile); - - /* Switch on full protocol/debug output */ - curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); - - res = curl_easy_perform(curl); - - /* always cleanup */ - curl_easy_cleanup(curl); - - if(CURLE_OK != res) { - /* we failed */ - fprintf(stderr, "curl told us %d\n", res); - } - } - - if(ftpfile.stream) - fclose(ftpfile.stream); /* close the local file */ - - curl_global_cleanup(); - - return 0; -} diff --git a/plugins/FTPFileYM/curl/docs/examples/ftpgetinfo.c b/plugins/FTPFileYM/curl/docs/examples/ftpgetinfo.c deleted file mode 100644 index dfdcf78b7c..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/ftpgetinfo.c +++ /dev/null @@ -1,89 +0,0 @@ -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at http://curl.haxx.se/docs/copyright.html. - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the COPYING file. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ***************************************************************************/ -#include <stdio.h> -#include <string.h> - -#include <curl/curl.h> - -/* - * This is an example showing how to check a single file's size and mtime - * from an FTP server. - */ - -static size_t throw_away(void *ptr, size_t size, size_t nmemb, void *data) -{ - (void)ptr; - (void)data; - /* we are not interested in the headers itself, - so we only return the size we would have saved ... */ - return (size_t)(size * nmemb); -} - -int main(void) -{ - char ftpurl[] = "ftp://ftp.example.com/gnu/binutils/binutils-2.19.1.tar.bz2"; - CURL *curl; - CURLcode res; - long filetime = -1; - double filesize = 0.0; - const char *filename = strrchr(ftpurl, '/') + 1; - - curl_global_init(CURL_GLOBAL_DEFAULT); - - curl = curl_easy_init(); - if(curl) { - curl_easy_setopt(curl, CURLOPT_URL, ftpurl); - /* No download if the file */ - curl_easy_setopt(curl, CURLOPT_NOBODY, 1L); - /* Ask for filetime */ - curl_easy_setopt(curl, CURLOPT_FILETIME, 1L); - /* No header output: TODO 14.1 http-style HEAD output for ftp */ - curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, throw_away); - curl_easy_setopt(curl, CURLOPT_HEADER, 0L); - /* Switch on full protocol/debug output */ - /* curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); */ - - res = curl_easy_perform(curl); - - if(CURLE_OK == res) { - /* http://curl.haxx.se/libcurl/c/curl_easy_getinfo.html */ - res = curl_easy_getinfo(curl, CURLINFO_FILETIME, &filetime); - if((CURLE_OK == res) && (filetime >= 0)) { - time_t file_time = (time_t)filetime; - printf("filetime %s: %s", filename, ctime(&file_time)); - } - res = curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &filesize); - if((CURLE_OK == res) && (filesize>0.0)) - printf("filesize %s: %0.0f bytes\n", filename, filesize); - } else { - /* we failed */ - fprintf(stderr, "curl told us %d\n", res); - } - - /* always cleanup */ - curl_easy_cleanup(curl); - } - - curl_global_cleanup(); - - return 0; -} diff --git a/plugins/FTPFileYM/curl/docs/examples/ftpgetresp.c b/plugins/FTPFileYM/curl/docs/examples/ftpgetresp.c deleted file mode 100644 index db96a3a13b..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/ftpgetresp.c +++ /dev/null @@ -1,76 +0,0 @@ -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at http://curl.haxx.se/docs/copyright.html. - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the COPYING file. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ***************************************************************************/ -#include <stdio.h> - -#include <curl/curl.h> - -/* - * Similar to ftpget.c but this also stores the received response-lines - * in a separate file using our own callback! - * - * This functionality was introduced in libcurl 7.9.3. - */ - -static size_t -write_response(void *ptr, size_t size, size_t nmemb, void *data) -{ - FILE *writehere = (FILE *)data; - return fwrite(ptr, size, nmemb, writehere); -} - -int main(void) -{ - CURL *curl; - CURLcode res; - FILE *ftpfile; - FILE *respfile; - - /* local file name to store the file as */ - ftpfile = fopen("ftp-list", "wb"); /* b is binary, needed on win32 */ - - /* local file name to store the FTP server's response lines in */ - respfile = fopen("ftp-responses", "wb"); /* b is binary, needed on win32 */ - - curl = curl_easy_init(); - if(curl) { - /* Get a file listing from sunet */ - curl_easy_setopt(curl, CURLOPT_URL, "ftp://ftp.example.com/"); - curl_easy_setopt(curl, CURLOPT_WRITEDATA, ftpfile); - /* If you intend to use this on windows with a libcurl DLL, you must use - CURLOPT_WRITEFUNCTION as well */ - curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, write_response); - curl_easy_setopt(curl, CURLOPT_WRITEHEADER, respfile); - res = curl_easy_perform(curl); - /* Check for errors */ - if(res != CURLE_OK) - fprintf(stderr, "curl_easy_perform() failed: %s\n", - curl_easy_strerror(res)); - - /* always cleanup */ - curl_easy_cleanup(curl); - } - - fclose(ftpfile); /* close the local file */ - fclose(respfile); /* close the response file */ - - return 0; -} diff --git a/plugins/FTPFileYM/curl/docs/examples/ftpsget.c b/plugins/FTPFileYM/curl/docs/examples/ftpsget.c deleted file mode 100644 index 0cfe32024a..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/ftpsget.c +++ /dev/null @@ -1,101 +0,0 @@ -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at http://curl.haxx.se/docs/copyright.html. - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the COPYING file. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ***************************************************************************/ - -#include <stdio.h> - -#include <curl/curl.h> - -/* - * This is an example showing how to get a single file from an FTPS server. - * It delays the actual destination file creation until the first write - * callback so that it won't create an empty file in case the remote file - * doesn't exist or something else fails. - */ - -struct FtpFile { - const char *filename; - FILE *stream; -}; - -static size_t my_fwrite(void *buffer, size_t size, size_t nmemb, - void *stream) -{ - struct FtpFile *out=(struct FtpFile *)stream; - if(out && !out->stream) { - /* open file for writing */ - out->stream=fopen(out->filename, "wb"); - if(!out->stream) - return -1; /* failure, can't open file to write */ - } - return fwrite(buffer, size, nmemb, out->stream); -} - - -int main(void) -{ - CURL *curl; - CURLcode res; - struct FtpFile ftpfile={ - "yourfile.bin", /* name to store the file as if succesful */ - NULL - }; - - curl_global_init(CURL_GLOBAL_DEFAULT); - - curl = curl_easy_init(); - if(curl) { - /* - * You better replace the URL with one that works! Note that we use an - * FTP:// URL with standard explicit FTPS. You can also do FTPS:// URLs if - * you want to do the rarer kind of transfers: implicit. - */ - curl_easy_setopt(curl, CURLOPT_URL, - "ftp://user@server/home/user/file.txt"); - /* Define our callback to get called when there's data to be written */ - curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, my_fwrite); - /* Set a pointer to our struct to pass to the callback */ - curl_easy_setopt(curl, CURLOPT_WRITEDATA, &ftpfile); - - /* We activate SSL and we require it for both control and data */ - curl_easy_setopt(curl, CURLOPT_USE_SSL, CURLUSESSL_ALL); - - /* Switch on full protocol/debug output */ - curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); - - res = curl_easy_perform(curl); - - /* always cleanup */ - curl_easy_cleanup(curl); - - if(CURLE_OK != res) { - /* we failed */ - fprintf(stderr, "curl told us %d\n", res); - } - } - - if(ftpfile.stream) - fclose(ftpfile.stream); /* close the local file */ - - curl_global_cleanup(); - - return 0; -} diff --git a/plugins/FTPFileYM/curl/docs/examples/ftpupload.c b/plugins/FTPFileYM/curl/docs/examples/ftpupload.c deleted file mode 100644 index e79f8d842a..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/ftpupload.c +++ /dev/null @@ -1,140 +0,0 @@ -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at http://curl.haxx.se/docs/copyright.html. - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the COPYING file. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ***************************************************************************/ -#include <stdio.h> -#include <string.h> - -#include <curl/curl.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <errno.h> -#ifdef WIN32 -#include <io.h> -#else -#include <unistd.h> -#endif - -/* - * This example shows an FTP upload, with a rename of the file just after - * a successful upload. - * - * Example based on source code provided by Erick Nuwendam. Thanks! - */ - -#define LOCAL_FILE "/tmp/uploadthis.txt" -#define UPLOAD_FILE_AS "while-uploading.txt" -#define REMOTE_URL "ftp://example.com/" UPLOAD_FILE_AS -#define RENAME_FILE_TO "renamed-and-fine.txt" - -/* NOTE: if you want this example to work on Windows with libcurl as a - DLL, you MUST also provide a read callback with CURLOPT_READFUNCTION. - Failing to do so will give you a crash since a DLL may not use the - variable's memory when passed in to it from an app like this. */ -static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *stream) -{ - curl_off_t nread; - /* in real-world cases, this would probably get this data differently - as this fread() stuff is exactly what the library already would do - by default internally */ - size_t retcode = fread(ptr, size, nmemb, stream); - - nread = (curl_off_t)retcode; - - fprintf(stderr, "*** We read %" CURL_FORMAT_CURL_OFF_T - " bytes from file\n", nread); - return retcode; -} - -int main(void) -{ - CURL *curl; - CURLcode res; - FILE *hd_src; - struct stat file_info; - curl_off_t fsize; - - struct curl_slist *headerlist=NULL; - static const char buf_1 [] = "RNFR " UPLOAD_FILE_AS; - static const char buf_2 [] = "RNTO " RENAME_FILE_TO; - - /* get the file size of the local file */ - if(stat(LOCAL_FILE, &file_info)) { - printf("Couldnt open '%s': %s\n", LOCAL_FILE, strerror(errno)); - return 1; - } - fsize = (curl_off_t)file_info.st_size; - - printf("Local file size: %" CURL_FORMAT_CURL_OFF_T " bytes.\n", fsize); - - /* get a FILE * of the same file */ - hd_src = fopen(LOCAL_FILE, "rb"); - - /* In windows, this will init the winsock stuff */ - curl_global_init(CURL_GLOBAL_ALL); - - /* get a curl handle */ - curl = curl_easy_init(); - if(curl) { - /* build a list of commands to pass to libcurl */ - headerlist = curl_slist_append(headerlist, buf_1); - headerlist = curl_slist_append(headerlist, buf_2); - - /* we want to use our own read function */ - curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_callback); - - /* enable uploading */ - curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L); - - /* specify target */ - curl_easy_setopt(curl,CURLOPT_URL, REMOTE_URL); - - /* pass in that last of FTP commands to run after the transfer */ - curl_easy_setopt(curl, CURLOPT_POSTQUOTE, headerlist); - - /* now specify which file to upload */ - curl_easy_setopt(curl, CURLOPT_READDATA, hd_src); - - /* Set the size of the file to upload (optional). If you give a *_LARGE - option you MUST make sure that the type of the passed-in argument is a - curl_off_t. If you use CURLOPT_INFILESIZE (without _LARGE) you must - make sure that to pass in a type 'long' argument. */ - curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE, - (curl_off_t)fsize); - - /* Now run off and do what you've been told! */ - res = curl_easy_perform(curl); - /* Check for errors */ - if(res != CURLE_OK) - fprintf(stderr, "curl_easy_perform() failed: %s\n", - curl_easy_strerror(res)); - - /* clean up the FTP commands list */ - curl_slist_free_all (headerlist); - - /* always cleanup */ - curl_easy_cleanup(curl); - } - fclose(hd_src); /* close the local file */ - - curl_global_cleanup(); - return 0; -} diff --git a/plugins/FTPFileYM/curl/docs/examples/ftpuploadresume.c b/plugins/FTPFileYM/curl/docs/examples/ftpuploadresume.c deleted file mode 100644 index 55b8986c7c..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/ftpuploadresume.c +++ /dev/null @@ -1,174 +0,0 @@ -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at http://curl.haxx.se/docs/copyright.html. - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the COPYING file. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ***************************************************************************/ -/* Upload to FTP, resuming failed transfers - * - * Compile for MinGW like this: - * gcc -Wall -pedantic -std=c99 ftpuploadwithresume.c -o ftpuploadresume.exe - * -lcurl -lmsvcr70 - * - * Written by Philip Bock - */ - -#include <stdlib.h> -#include <stdio.h> - -#include <curl/curl.h> - -#if defined(_MSC_VER) && (_MSC_VER < 1300) -# error _snscanf requires MSVC 7.0 or later. -#endif - -/* The MinGW headers are missing a few Win32 function definitions, - you shouldn't need this if you use VC++ */ -#if defined(__MINGW32__) && !defined(__MINGW64__) -int __cdecl _snscanf(const char * input, size_t length, const char * format, ...); -#endif - - -/* parse headers for Content-Length */ -size_t getcontentlengthfunc(void *ptr, size_t size, size_t nmemb, void *stream) -{ - int r; - long len = 0; - - /* _snscanf() is Win32 specific */ - r = _snscanf(ptr, size * nmemb, "Content-Length: %ld\n", &len); - - if (r) /* Microsoft: we don't read the specs */ - *((long *) stream) = len; - - return size * nmemb; -} - -/* discard downloaded data */ -size_t discardfunc(void *ptr, size_t size, size_t nmemb, void *stream) -{ - return size * nmemb; -} - -/* read data to upload */ -size_t readfunc(void *ptr, size_t size, size_t nmemb, void *stream) -{ - FILE *f = stream; - size_t n; - - if (ferror(f)) - return CURL_READFUNC_ABORT; - - n = fread(ptr, size, nmemb, f) * size; - - return n; -} - - -int upload(CURL *curlhandle, const char * remotepath, const char * localpath, - long timeout, long tries) -{ - FILE *f; - long uploaded_len = 0; - CURLcode r = CURLE_GOT_NOTHING; - int c; - - f = fopen(localpath, "rb"); - if (f == NULL) { - perror(NULL); - return 0; - } - - curl_easy_setopt(curlhandle, CURLOPT_UPLOAD, 1L); - - curl_easy_setopt(curlhandle, CURLOPT_URL, remotepath); - - if (timeout) - curl_easy_setopt(curlhandle, CURLOPT_FTP_RESPONSE_TIMEOUT, timeout); - - curl_easy_setopt(curlhandle, CURLOPT_HEADERFUNCTION, getcontentlengthfunc); - curl_easy_setopt(curlhandle, CURLOPT_HEADERDATA, &uploaded_len); - - curl_easy_setopt(curlhandle, CURLOPT_WRITEFUNCTION, discardfunc); - - curl_easy_setopt(curlhandle, CURLOPT_READFUNCTION, readfunc); - curl_easy_setopt(curlhandle, CURLOPT_READDATA, f); - - curl_easy_setopt(curlhandle, CURLOPT_FTPPORT, "-"); /* disable passive mode */ - curl_easy_setopt(curlhandle, CURLOPT_FTP_CREATE_MISSING_DIRS, 1L); - - curl_easy_setopt(curlhandle, CURLOPT_VERBOSE, 1L); - - for (c = 0; (r != CURLE_OK) && (c < tries); c++) { - /* are we resuming? */ - if (c) { /* yes */ - /* determine the length of the file already written */ - - /* - * With NOBODY and NOHEADER, libcurl will issue a SIZE - * command, but the only way to retrieve the result is - * to parse the returned Content-Length header. Thus, - * getcontentlengthfunc(). We need discardfunc() above - * because HEADER will dump the headers to stdout - * without it. - */ - curl_easy_setopt(curlhandle, CURLOPT_NOBODY, 1L); - curl_easy_setopt(curlhandle, CURLOPT_HEADER, 1L); - - r = curl_easy_perform(curlhandle); - if (r != CURLE_OK) - continue; - - curl_easy_setopt(curlhandle, CURLOPT_NOBODY, 0L); - curl_easy_setopt(curlhandle, CURLOPT_HEADER, 0L); - - fseek(f, uploaded_len, SEEK_SET); - - curl_easy_setopt(curlhandle, CURLOPT_APPEND, 1L); - } - else { /* no */ - curl_easy_setopt(curlhandle, CURLOPT_APPEND, 0L); - } - - r = curl_easy_perform(curlhandle); - } - - fclose(f); - - if (r == CURLE_OK) - return 1; - else { - fprintf(stderr, "%s\n", curl_easy_strerror(r)); - return 0; - } -} - -int main(int c, char **argv) -{ - CURL *curlhandle = NULL; - - curl_global_init(CURL_GLOBAL_ALL); - curlhandle = curl_easy_init(); - - upload(curlhandle, "ftp://user:pass@example.com/path/file", "C:\\file", 0, 3); - - curl_easy_cleanup(curlhandle); - curl_global_cleanup(); - - return 0; -} diff --git a/plugins/FTPFileYM/curl/docs/examples/getinfo.c b/plugins/FTPFileYM/curl/docs/examples/getinfo.c deleted file mode 100644 index acbe1e1af8..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/getinfo.c +++ /dev/null @@ -1,53 +0,0 @@ -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at http://curl.haxx.se/docs/copyright.html. - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the COPYING file. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ***************************************************************************/ -#include <stdio.h> -#include <curl/curl.h> - -int main(void) -{ - CURL *curl; - CURLcode res; - - /* http://curl.haxx.se/libcurl/c/curl_easy_init.html */ - curl = curl_easy_init(); - if(curl) { - /* http://curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTURL */ - curl_easy_setopt(curl, CURLOPT_URL, "http://www.example.com/"); - /* http://curl.haxx.se/libcurl/c/curl_easy_perform.html */ - res = curl_easy_perform(curl); - - if(CURLE_OK == res) { - char *ct; - /* ask for the content-type */ - /* http://curl.haxx.se/libcurl/c/curl_easy_getinfo.html */ - res = curl_easy_getinfo(curl, CURLINFO_CONTENT_TYPE, &ct); - - if((CURLE_OK == res) && ct) - printf("We received Content-Type: %s\n", ct); - } - - /* always cleanup */ - /* http://curl.haxx.se/libcurl/c/curl_easy_cleanup.html */ - curl_easy_cleanup(curl); - } - return 0; -} diff --git a/plugins/FTPFileYM/curl/docs/examples/getinmemory.c b/plugins/FTPFileYM/curl/docs/examples/getinmemory.c deleted file mode 100644 index 78e6deb102..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/getinmemory.c +++ /dev/null @@ -1,112 +0,0 @@ -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at http://curl.haxx.se/docs/copyright.html. - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the COPYING file. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ***************************************************************************/ -/* Example source code to show how the callback function can be used to - * download data into a chunk of memory instead of storing it in a file. - */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include <curl/curl.h> - -struct MemoryStruct { - char *memory; - size_t size; -}; - - -static size_t -WriteMemoryCallback(void *contents, size_t size, size_t nmemb, void *userp) -{ - size_t realsize = size * nmemb; - struct MemoryStruct *mem = (struct MemoryStruct *)userp; - - mem->memory = realloc(mem->memory, mem->size + realsize + 1); - if (mem->memory == NULL) { - /* out of memory! */ - printf("not enough memory (realloc returned NULL)\n"); - exit(EXIT_FAILURE); - } - - memcpy(&(mem->memory[mem->size]), contents, realsize); - mem->size += realsize; - mem->memory[mem->size] = 0; - - return realsize; -} - - -int main(void) -{ - CURL *curl_handle; - - struct MemoryStruct chunk; - - chunk.memory = malloc(1); /* will be grown as needed by the realloc above */ - chunk.size = 0; /* no data at this point */ - - curl_global_init(CURL_GLOBAL_ALL); - - /* init the curl session */ - curl_handle = curl_easy_init(); - - /* specify URL to get */ - curl_easy_setopt(curl_handle, CURLOPT_URL, "http://www.example.com/"); - - /* send all data to this function */ - curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, WriteMemoryCallback); - - /* we pass our 'chunk' struct to the callback function */ - curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *)&chunk); - - /* some servers don't like requests that are made without a user-agent - field, so we provide one */ - curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, "libcurl-agent/1.0"); - - /* get it! */ - curl_easy_perform(curl_handle); - - /* cleanup curl stuff */ - curl_easy_cleanup(curl_handle); - - /* - * Now, our chunk.memory points to a memory block that is chunk.size - * bytes big and contains the remote file. - * - * Do something nice with it! - * - * You should be aware of the fact that at this point we might have an - * allocated data block, and nothing has yet deallocated that data. So when - * you're done with it, you should free() it as a nice application. - */ - - printf("%lu bytes retrieved\n", (long)chunk.size); - - if(chunk.memory) - free(chunk.memory); - - /* we're done with libcurl, so clean it up */ - curl_global_cleanup(); - - return 0; -} diff --git a/plugins/FTPFileYM/curl/docs/examples/ghiper.c b/plugins/FTPFileYM/curl/docs/examples/ghiper.c deleted file mode 100644 index 9a3f46d3fa..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/ghiper.c +++ /dev/null @@ -1,452 +0,0 @@ -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at http://curl.haxx.se/docs/copyright.html. - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the COPYING file. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ***************************************************************************/ -/* Example application source code using the multi socket interface to - * download many files at once. - * - * Written by Jeff Pohlmeyer - -Requires glib-2.x and a (POSIX?) system that has mkfifo(). - -This is an adaptation of libcurl's "hipev.c" and libevent's "event-test.c" -sample programs, adapted to use glib's g_io_channel in place of libevent. - -When running, the program creates the named pipe "hiper.fifo" - -Whenever there is input into the fifo, the program reads the input as a list -of URL's and creates some new easy handles to fetch each URL via the -curl_multi "hiper" API. - - -Thus, you can try a single URL: - % echo http://www.yahoo.com > hiper.fifo - -Or a whole bunch of them: - % cat my-url-list > hiper.fifo - -The fifo buffer is handled almost instantly, so you can even add more URL's -while the previous requests are still being downloaded. - -This is purely a demo app, all retrieved data is simply discarded by the write -callback. - -*/ - - -#include <glib.h> -#include <sys/stat.h> -#include <unistd.h> -#include <fcntl.h> -#include <stdlib.h> -#include <stdio.h> -#include <errno.h> -#include <curl/curl.h> - - -#define MSG_OUT g_print /* Change to "g_error" to write to stderr */ -#define SHOW_VERBOSE 0 /* Set to non-zero for libcurl messages */ -#define SHOW_PROGRESS 0 /* Set to non-zero to enable progress callback */ - - - -/* Global information, common to all connections */ -typedef struct _GlobalInfo { - CURLM *multi; - guint timer_event; - int still_running; -} GlobalInfo; - - - -/* Information associated with a specific easy handle */ -typedef struct _ConnInfo { - CURL *easy; - char *url; - GlobalInfo *global; - char error[CURL_ERROR_SIZE]; -} ConnInfo; - - -/* Information associated with a specific socket */ -typedef struct _SockInfo { - curl_socket_t sockfd; - CURL *easy; - int action; - long timeout; - GIOChannel *ch; - guint ev; - GlobalInfo *global; -} SockInfo; - - - - -/* Die if we get a bad CURLMcode somewhere */ -static void mcode_or_die(const char *where, CURLMcode code) { - if ( CURLM_OK != code ) { - const char *s; - switch (code) { - case CURLM_CALL_MULTI_PERFORM: s="CURLM_CALL_MULTI_PERFORM"; break; - case CURLM_BAD_HANDLE: s="CURLM_BAD_HANDLE"; break; - case CURLM_BAD_EASY_HANDLE: s="CURLM_BAD_EASY_HANDLE"; break; - case CURLM_OUT_OF_MEMORY: s="CURLM_OUT_OF_MEMORY"; break; - case CURLM_INTERNAL_ERROR: s="CURLM_INTERNAL_ERROR"; break; - case CURLM_BAD_SOCKET: s="CURLM_BAD_SOCKET"; break; - case CURLM_UNKNOWN_OPTION: s="CURLM_UNKNOWN_OPTION"; break; - case CURLM_LAST: s="CURLM_LAST"; break; - default: s="CURLM_unknown"; - } - MSG_OUT("ERROR: %s returns %s\n", where, s); - exit(code); - } -} - - - -/* Check for completed transfers, and remove their easy handles */ -static void check_multi_info(GlobalInfo *g) -{ - char *eff_url; - CURLMsg *msg; - int msgs_left; - ConnInfo *conn; - CURL *easy; - CURLcode res; - - MSG_OUT("REMAINING: %d\n", g->still_running); - while ((msg = curl_multi_info_read(g->multi, &msgs_left))) { - if (msg->msg == CURLMSG_DONE) { - easy = msg->easy_handle; - res = msg->data.result; - curl_easy_getinfo(easy, CURLINFO_PRIVATE, &conn); - curl_easy_getinfo(easy, CURLINFO_EFFECTIVE_URL, &eff_url); - MSG_OUT("DONE: %s => (%d) %s\n", eff_url, res, conn->error); - curl_multi_remove_handle(g->multi, easy); - free(conn->url); - curl_easy_cleanup(easy); - free(conn); - } - } -} - - - -/* Called by glib when our timeout expires */ -static gboolean timer_cb(gpointer data) -{ - GlobalInfo *g = (GlobalInfo *)data; - CURLMcode rc; - - rc = curl_multi_socket_action(g->multi, - CURL_SOCKET_TIMEOUT, 0, &g->still_running); - mcode_or_die("timer_cb: curl_multi_socket_action", rc); - check_multi_info(g); - return FALSE; -} - - - -/* Update the event timer after curl_multi library calls */ -static int update_timeout_cb(CURLM *multi, long timeout_ms, void *userp) -{ - struct timeval timeout; - GlobalInfo *g=(GlobalInfo *)userp; - timeout.tv_sec = timeout_ms/1000; - timeout.tv_usec = (timeout_ms%1000)*1000; - - MSG_OUT("*** update_timeout_cb %ld => %ld:%ld ***\n", - timeout_ms, timeout.tv_sec, timeout.tv_usec); - - g->timer_event = g_timeout_add(timeout_ms, timer_cb, g); - return 0; -} - - - - -/* Called by glib when we get action on a multi socket */ -static gboolean event_cb(GIOChannel *ch, GIOCondition condition, gpointer data) -{ - GlobalInfo *g = (GlobalInfo*) data; - CURLMcode rc; - int fd=g_io_channel_unix_get_fd(ch); - - int action = - (condition & G_IO_IN ? CURL_CSELECT_IN : 0) | - (condition & G_IO_OUT ? CURL_CSELECT_OUT : 0); - - rc = curl_multi_socket_action(g->multi, fd, action, &g->still_running); - mcode_or_die("event_cb: curl_multi_socket_action", rc); - - check_multi_info(g); - if(g->still_running) { - return TRUE; - } else { - MSG_OUT("last transfer done, kill timeout\n"); - if (g->timer_event) { g_source_remove(g->timer_event); } - return FALSE; - } -} - - - -/* Clean up the SockInfo structure */ -static void remsock(SockInfo *f) -{ - if (!f) { return; } - if (f->ev) { g_source_remove(f->ev); } - g_free(f); -} - - - -/* Assign information to a SockInfo structure */ -static void setsock(SockInfo*f, curl_socket_t s, CURL*e, int act, GlobalInfo*g) -{ - GIOCondition kind = - (act&CURL_POLL_IN?G_IO_IN:0)|(act&CURL_POLL_OUT?G_IO_OUT:0); - - f->sockfd = s; - f->action = act; - f->easy = e; - if (f->ev) { g_source_remove(f->ev); } - f->ev=g_io_add_watch(f->ch, kind, event_cb,g); - -} - - - -/* Initialize a new SockInfo structure */ -static void addsock(curl_socket_t s, CURL *easy, int action, GlobalInfo *g) -{ - SockInfo *fdp = g_malloc0(sizeof(SockInfo)); - - fdp->global = g; - fdp->ch=g_io_channel_unix_new(s); - setsock(fdp, s, easy, action, g); - curl_multi_assign(g->multi, s, fdp); -} - - - -/* CURLMOPT_SOCKETFUNCTION */ -static int sock_cb(CURL *e, curl_socket_t s, int what, void *cbp, void *sockp) -{ - GlobalInfo *g = (GlobalInfo*) cbp; - SockInfo *fdp = (SockInfo*) sockp; - static const char *whatstr[]={ "none", "IN", "OUT", "INOUT", "REMOVE" }; - - MSG_OUT("socket callback: s=%d e=%p what=%s ", s, e, whatstr[what]); - if (what == CURL_POLL_REMOVE) { - MSG_OUT("\n"); - remsock(fdp); - } else { - if (!fdp) { - MSG_OUT("Adding data: %s%s\n", - what&CURL_POLL_IN?"READ":"", - what&CURL_POLL_OUT?"WRITE":"" ); - addsock(s, e, what, g); - } - else { - MSG_OUT( - "Changing action from %d to %d\n", fdp->action, what); - setsock(fdp, s, e, what, g); - } - } - return 0; -} - - - -/* CURLOPT_WRITEFUNCTION */ -static size_t write_cb(void *ptr, size_t size, size_t nmemb, void *data) -{ - size_t realsize = size * nmemb; - ConnInfo *conn = (ConnInfo*) data; - (void)ptr; - (void)conn; - return realsize; -} - - - -/* CURLOPT_PROGRESSFUNCTION */ -static int prog_cb (void *p, double dltotal, double dlnow, double ult, double uln) -{ - ConnInfo *conn = (ConnInfo *)p; - MSG_OUT("Progress: %s (%g/%g)\n", conn->url, dlnow, dltotal); - return 0; -} - - - -/* Create a new easy handle, and add it to the global curl_multi */ -static void new_conn(char *url, GlobalInfo *g ) -{ - ConnInfo *conn; - CURLMcode rc; - - conn = g_malloc0(sizeof(ConnInfo)); - - conn->error[0]='\0'; - - conn->easy = curl_easy_init(); - if (!conn->easy) { - MSG_OUT("curl_easy_init() failed, exiting!\n"); - exit(2); - } - conn->global = g; - conn->url = g_strdup(url); - curl_easy_setopt(conn->easy, CURLOPT_URL, conn->url); - curl_easy_setopt(conn->easy, CURLOPT_WRITEFUNCTION, write_cb); - curl_easy_setopt(conn->easy, CURLOPT_WRITEDATA, &conn); - curl_easy_setopt(conn->easy, CURLOPT_VERBOSE, (long)SHOW_VERBOSE); - curl_easy_setopt(conn->easy, CURLOPT_ERRORBUFFER, conn->error); - curl_easy_setopt(conn->easy, CURLOPT_PRIVATE, conn); - curl_easy_setopt(conn->easy, CURLOPT_NOPROGRESS, SHOW_PROGRESS?0L:1L); - curl_easy_setopt(conn->easy, CURLOPT_PROGRESSFUNCTION, prog_cb); - curl_easy_setopt(conn->easy, CURLOPT_PROGRESSDATA, conn); - curl_easy_setopt(conn->easy, CURLOPT_FOLLOWLOCATION, 1L); - curl_easy_setopt(conn->easy, CURLOPT_CONNECTTIMEOUT, 30L); - curl_easy_setopt(conn->easy, CURLOPT_LOW_SPEED_LIMIT, 1L); - curl_easy_setopt(conn->easy, CURLOPT_LOW_SPEED_TIME, 30L); - - MSG_OUT("Adding easy %p to multi %p (%s)\n", conn->easy, g->multi, url); - rc =curl_multi_add_handle(g->multi, conn->easy); - mcode_or_die("new_conn: curl_multi_add_handle", rc); - - /* note that the add_handle() will set a time-out to trigger very soon so - that the necessary socket_action() call will be called by this app */ -} - - -/* This gets called by glib whenever data is received from the fifo */ -static gboolean fifo_cb (GIOChannel *ch, GIOCondition condition, gpointer data) -{ - #define BUF_SIZE 1024 - gsize len, tp; - gchar *buf, *tmp, *all=NULL; - GIOStatus rv; - - do { - GError *err=NULL; - rv = g_io_channel_read_line (ch,&buf,&len,&tp,&err); - if ( buf ) { - if (tp) { buf[tp]='\0'; } - new_conn(buf,(GlobalInfo*)data); - g_free(buf); - } else { - buf = g_malloc(BUF_SIZE+1); - while (TRUE) { - buf[BUF_SIZE]='\0'; - g_io_channel_read_chars(ch,buf,BUF_SIZE,&len,&err); - if (len) { - buf[len]='\0'; - if (all) { - tmp=all; - all=g_strdup_printf("%s%s", tmp, buf); - g_free(tmp); - } else { - all = g_strdup(buf); - } - } else { - break; - } - } - if (all) { - new_conn(all,(GlobalInfo*)data); - g_free(all); - } - g_free(buf); - } - if ( err ) { - g_error("fifo_cb: %s", err->message); - g_free(err); - break; - } - } while ( (len) && (rv == G_IO_STATUS_NORMAL) ); - return TRUE; -} - - - - -int init_fifo(void) -{ - struct stat st; - const char *fifo = "hiper.fifo"; - int socket; - - if (lstat (fifo, &st) == 0) { - if ((st.st_mode & S_IFMT) == S_IFREG) { - errno = EEXIST; - perror("lstat"); - exit (1); - } - } - - unlink (fifo); - if (mkfifo (fifo, 0600) == -1) { - perror("mkfifo"); - exit (1); - } - - socket = open (fifo, O_RDWR | O_NONBLOCK, 0); - - if (socket == -1) { - perror("open"); - exit (1); - } - MSG_OUT("Now, pipe some URL's into > %s\n", fifo); - - return socket; - -} - - - - -int main(int argc, char **argv) -{ - GlobalInfo *g; - CURLMcode rc; - GMainLoop*gmain; - int fd; - GIOChannel* ch; - g=g_malloc0(sizeof(GlobalInfo)); - - fd=init_fifo(); - ch=g_io_channel_unix_new(fd); - g_io_add_watch(ch,G_IO_IN,fifo_cb,g); - gmain=g_main_loop_new(NULL,FALSE); - g->multi = curl_multi_init(); - curl_multi_setopt(g->multi, CURLMOPT_SOCKETFUNCTION, sock_cb); - curl_multi_setopt(g->multi, CURLMOPT_SOCKETDATA, g); - curl_multi_setopt(g->multi, CURLMOPT_TIMERFUNCTION, update_timeout_cb); - curl_multi_setopt(g->multi, CURLMOPT_TIMERDATA, g); - - /* we don't call any curl_multi_socket*() function yet as we have no handles - added! */ - - g_main_loop_run(gmain); - curl_multi_cleanup(g->multi); - return 0; -} diff --git a/plugins/FTPFileYM/curl/docs/examples/hiperfifo.c b/plugins/FTPFileYM/curl/docs/examples/hiperfifo.c deleted file mode 100644 index 6036643b16..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/hiperfifo.c +++ /dev/null @@ -1,418 +0,0 @@ -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at http://curl.haxx.se/docs/copyright.html. - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the COPYING file. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ***************************************************************************/ -/* Example application source code using the multi socket interface to - download many files at once. - -Written by Jeff Pohlmeyer - -Requires libevent and a (POSIX?) system that has mkfifo(). - -This is an adaptation of libcurl's "hipev.c" and libevent's "event-test.c" -sample programs. - -When running, the program creates the named pipe "hiper.fifo" - -Whenever there is input into the fifo, the program reads the input as a list -of URL's and creates some new easy handles to fetch each URL via the -curl_multi "hiper" API. - - -Thus, you can try a single URL: - % echo http://www.yahoo.com > hiper.fifo - -Or a whole bunch of them: - % cat my-url-list > hiper.fifo - -The fifo buffer is handled almost instantly, so you can even add more URL's -while the previous requests are still being downloaded. - -Note: - For the sake of simplicity, URL length is limited to 1023 char's ! - -This is purely a demo app, all retrieved data is simply discarded by the write -callback. - -*/ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <sys/time.h> -#include <time.h> -#include <unistd.h> -#include <sys/poll.h> -#include <curl/curl.h> -#include <event.h> -#include <fcntl.h> -#include <sys/stat.h> -#include <errno.h> - - -#define MSG_OUT stdout /* Send info to stdout, change to stderr if you want */ - - -/* Global information, common to all connections */ -typedef struct _GlobalInfo { - struct event fifo_event; - struct event timer_event; - CURLM *multi; - int still_running; - FILE* input; -} GlobalInfo; - - -/* Information associated with a specific easy handle */ -typedef struct _ConnInfo { - CURL *easy; - char *url; - GlobalInfo *global; - char error[CURL_ERROR_SIZE]; -} ConnInfo; - - -/* Information associated with a specific socket */ -typedef struct _SockInfo { - curl_socket_t sockfd; - CURL *easy; - int action; - long timeout; - struct event ev; - int evset; - GlobalInfo *global; -} SockInfo; - - - -/* Update the event timer after curl_multi library calls */ -static int multi_timer_cb(CURLM *multi, long timeout_ms, GlobalInfo *g) -{ - struct timeval timeout; - (void)multi; /* unused */ - - timeout.tv_sec = timeout_ms/1000; - timeout.tv_usec = (timeout_ms%1000)*1000; - fprintf(MSG_OUT, "multi_timer_cb: Setting timeout to %ld ms\n", timeout_ms); - evtimer_add(&g->timer_event, &timeout); - return 0; -} - -/* Die if we get a bad CURLMcode somewhere */ -static void mcode_or_die(const char *where, CURLMcode code) -{ - if ( CURLM_OK != code ) { - const char *s; - switch (code) { - case CURLM_CALL_MULTI_PERFORM: s="CURLM_CALL_MULTI_PERFORM"; break; - case CURLM_BAD_HANDLE: s="CURLM_BAD_HANDLE"; break; - case CURLM_BAD_EASY_HANDLE: s="CURLM_BAD_EASY_HANDLE"; break; - case CURLM_OUT_OF_MEMORY: s="CURLM_OUT_OF_MEMORY"; break; - case CURLM_INTERNAL_ERROR: s="CURLM_INTERNAL_ERROR"; break; - case CURLM_UNKNOWN_OPTION: s="CURLM_UNKNOWN_OPTION"; break; - case CURLM_LAST: s="CURLM_LAST"; break; - default: s="CURLM_unknown"; - break; - case CURLM_BAD_SOCKET: s="CURLM_BAD_SOCKET"; - fprintf(MSG_OUT, "ERROR: %s returns %s\n", where, s); - /* ignore this error */ - return; - } - fprintf(MSG_OUT, "ERROR: %s returns %s\n", where, s); - exit(code); - } -} - - - -/* Check for completed transfers, and remove their easy handles */ -static void check_multi_info(GlobalInfo *g) -{ - char *eff_url; - CURLMsg *msg; - int msgs_left; - ConnInfo *conn; - CURL *easy; - CURLcode res; - - fprintf(MSG_OUT, "REMAINING: %d\n", g->still_running); - while ((msg = curl_multi_info_read(g->multi, &msgs_left))) { - if (msg->msg == CURLMSG_DONE) { - easy = msg->easy_handle; - res = msg->data.result; - curl_easy_getinfo(easy, CURLINFO_PRIVATE, &conn); - curl_easy_getinfo(easy, CURLINFO_EFFECTIVE_URL, &eff_url); - fprintf(MSG_OUT, "DONE: %s => (%d) %s\n", eff_url, res, conn->error); - curl_multi_remove_handle(g->multi, easy); - free(conn->url); - curl_easy_cleanup(easy); - free(conn); - } - } -} - - - -/* Called by libevent when we get action on a multi socket */ -static void event_cb(int fd, short kind, void *userp) -{ - GlobalInfo *g = (GlobalInfo*) userp; - CURLMcode rc; - - int action = - (kind & EV_READ ? CURL_CSELECT_IN : 0) | - (kind & EV_WRITE ? CURL_CSELECT_OUT : 0); - - rc = curl_multi_socket_action(g->multi, fd, action, &g->still_running); - mcode_or_die("event_cb: curl_multi_socket_action", rc); - - check_multi_info(g); - if ( g->still_running <= 0 ) { - fprintf(MSG_OUT, "last transfer done, kill timeout\n"); - if (evtimer_pending(&g->timer_event, NULL)) { - evtimer_del(&g->timer_event); - } - } -} - - - -/* Called by libevent when our timeout expires */ -static void timer_cb(int fd, short kind, void *userp) -{ - GlobalInfo *g = (GlobalInfo *)userp; - CURLMcode rc; - (void)fd; - (void)kind; - - rc = curl_multi_socket_action(g->multi, - CURL_SOCKET_TIMEOUT, 0, &g->still_running); - mcode_or_die("timer_cb: curl_multi_socket_action", rc); - check_multi_info(g); -} - - - -/* Clean up the SockInfo structure */ -static void remsock(SockInfo *f) -{ - if (f) { - if (f->evset) - event_del(&f->ev); - free(f); - } -} - - - -/* Assign information to a SockInfo structure */ -static void setsock(SockInfo*f, curl_socket_t s, CURL*e, int act, GlobalInfo*g) -{ - int kind = - (act&CURL_POLL_IN?EV_READ:0)|(act&CURL_POLL_OUT?EV_WRITE:0)|EV_PERSIST; - - f->sockfd = s; - f->action = act; - f->easy = e; - if (f->evset) - event_del(&f->ev); - event_set(&f->ev, f->sockfd, kind, event_cb, g); - f->evset=1; - event_add(&f->ev, NULL); -} - - - -/* Initialize a new SockInfo structure */ -static void addsock(curl_socket_t s, CURL *easy, int action, GlobalInfo *g) { - SockInfo *fdp = calloc(sizeof(SockInfo), 1); - - fdp->global = g; - setsock(fdp, s, easy, action, g); - curl_multi_assign(g->multi, s, fdp); -} - -/* CURLMOPT_SOCKETFUNCTION */ -static int sock_cb(CURL *e, curl_socket_t s, int what, void *cbp, void *sockp) -{ - GlobalInfo *g = (GlobalInfo*) cbp; - SockInfo *fdp = (SockInfo*) sockp; - const char *whatstr[]={ "none", "IN", "OUT", "INOUT", "REMOVE" }; - - fprintf(MSG_OUT, - "socket callback: s=%d e=%p what=%s ", s, e, whatstr[what]); - if (what == CURL_POLL_REMOVE) { - fprintf(MSG_OUT, "\n"); - remsock(fdp); - } - else { - if (!fdp) { - fprintf(MSG_OUT, "Adding data: %s\n", whatstr[what]); - addsock(s, e, what, g); - } - else { - fprintf(MSG_OUT, - "Changing action from %s to %s\n", - whatstr[fdp->action], whatstr[what]); - setsock(fdp, s, e, what, g); - } - } - return 0; -} - - - -/* CURLOPT_WRITEFUNCTION */ -static size_t write_cb(void *ptr, size_t size, size_t nmemb, void *data) -{ - size_t realsize = size * nmemb; - ConnInfo *conn = (ConnInfo*) data; - (void)ptr; - (void)conn; - return realsize; -} - - -/* CURLOPT_PROGRESSFUNCTION */ -static int prog_cb (void *p, double dltotal, double dlnow, double ult, - double uln) -{ - ConnInfo *conn = (ConnInfo *)p; - (void)ult; - (void)uln; - - fprintf(MSG_OUT, "Progress: %s (%g/%g)\n", conn->url, dlnow, dltotal); - return 0; -} - - -/* Create a new easy handle, and add it to the global curl_multi */ -static void new_conn(char *url, GlobalInfo *g ) -{ - ConnInfo *conn; - CURLMcode rc; - - conn = calloc(1, sizeof(ConnInfo)); - memset(conn, 0, sizeof(ConnInfo)); - conn->error[0]='\0'; - - conn->easy = curl_easy_init(); - if (!conn->easy) { - fprintf(MSG_OUT, "curl_easy_init() failed, exiting!\n"); - exit(2); - } - conn->global = g; - conn->url = strdup(url); - curl_easy_setopt(conn->easy, CURLOPT_URL, conn->url); - curl_easy_setopt(conn->easy, CURLOPT_WRITEFUNCTION, write_cb); - curl_easy_setopt(conn->easy, CURLOPT_WRITEDATA, &conn); - curl_easy_setopt(conn->easy, CURLOPT_VERBOSE, 1L); - curl_easy_setopt(conn->easy, CURLOPT_ERRORBUFFER, conn->error); - curl_easy_setopt(conn->easy, CURLOPT_PRIVATE, conn); - curl_easy_setopt(conn->easy, CURLOPT_NOPROGRESS, 0L); - curl_easy_setopt(conn->easy, CURLOPT_PROGRESSFUNCTION, prog_cb); - curl_easy_setopt(conn->easy, CURLOPT_PROGRESSDATA, conn); - fprintf(MSG_OUT, - "Adding easy %p to multi %p (%s)\n", conn->easy, g->multi, url); - rc = curl_multi_add_handle(g->multi, conn->easy); - mcode_or_die("new_conn: curl_multi_add_handle", rc); - - /* note that the add_handle() will set a time-out to trigger very soon so - that the necessary socket_action() call will be called by this app */ -} - -/* This gets called whenever data is received from the fifo */ -static void fifo_cb(int fd, short event, void *arg) -{ - char s[1024]; - long int rv=0; - int n=0; - GlobalInfo *g = (GlobalInfo *)arg; - (void)fd; /* unused */ - (void)event; /* unused */ - - do { - s[0]='\0'; - rv=fscanf(g->input, "%1023s%n", s, &n); - s[n]='\0'; - if ( n && s[0] ) { - new_conn(s,arg); /* if we read a URL, go get it! */ - } else break; - } while ( rv != EOF); -} - -/* Create a named pipe and tell libevent to monitor it */ -static int init_fifo (GlobalInfo *g) -{ - struct stat st; - static const char *fifo = "hiper.fifo"; - curl_socket_t sockfd; - - fprintf(MSG_OUT, "Creating named pipe \"%s\"\n", fifo); - if (lstat (fifo, &st) == 0) { - if ((st.st_mode & S_IFMT) == S_IFREG) { - errno = EEXIST; - perror("lstat"); - exit (1); - } - } - unlink(fifo); - if (mkfifo (fifo, 0600) == -1) { - perror("mkfifo"); - exit (1); - } - sockfd = open(fifo, O_RDWR | O_NONBLOCK, 0); - if (sockfd == -1) { - perror("open"); - exit (1); - } - g->input = fdopen(sockfd, "r"); - - fprintf(MSG_OUT, "Now, pipe some URL's into > %s\n", fifo); - event_set(&g->fifo_event, sockfd, EV_READ | EV_PERSIST, fifo_cb, g); - event_add(&g->fifo_event, NULL); - return (0); -} - -int main(int argc, char **argv) -{ - GlobalInfo g; - (void)argc; - (void)argv; - - memset(&g, 0, sizeof(GlobalInfo)); - event_init(); - init_fifo(&g); - g.multi = curl_multi_init(); - evtimer_set(&g.timer_event, timer_cb, &g); - - /* setup the generic multi interface options we want */ - curl_multi_setopt(g.multi, CURLMOPT_SOCKETFUNCTION, sock_cb); - curl_multi_setopt(g.multi, CURLMOPT_SOCKETDATA, &g); - curl_multi_setopt(g.multi, CURLMOPT_TIMERFUNCTION, multi_timer_cb); - curl_multi_setopt(g.multi, CURLMOPT_TIMERDATA, &g); - - /* we don't call any curl_multi_socket*() function yet as we have no handles - added! */ - - event_dispatch(); - curl_multi_cleanup(g.multi); - return 0; -} diff --git a/plugins/FTPFileYM/curl/docs/examples/href_extractor.c b/plugins/FTPFileYM/curl/docs/examples/href_extractor.c deleted file mode 100644 index 4b307a29e4..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/href_extractor.c +++ /dev/null @@ -1,86 +0,0 @@ -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) 2012, Daniel Stenberg, <daniel@haxx.se>, et al. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at http://curl.haxx.se/docs/copyright.html. - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the COPYING file. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ***************************************************************************/ - -/* - * This example uses the "Streaming HTML parser" to extract the href pieces in - * a streaming manner from a downloaded HTML. Kindly donated by MichaÅ‚ - * Kowalczyk. - * - * The parser is found at - * http://code.google.com/p/htmlstreamparser/ - */ - -#include <stdio.h> -#include <curl/curl.h> -#include <htmlstreamparser.h> - - -static size_t write_callback(void *buffer, size_t size, size_t nmemb, - void *hsp) -{ - size_t realsize = size * nmemb, p; - for (p = 0; p < realsize; p++) { - html_parser_char_parse(hsp, ((char *)buffer)[p]); - if (html_parser_cmp_tag(hsp, "a", 1)) - if (html_parser_cmp_attr(hsp, "href", 4)) - if (html_parser_is_in(hsp, HTML_VALUE_ENDED)) { - html_parser_val(hsp)[html_parser_val_length(hsp)] = '\0'; - printf("%s\n", html_parser_val(hsp)); - } - } - return realsize; -} - -int main(int argc, char *argv[]) -{ - char tag[1], attr[4], val[128]; - CURL *curl; - HTMLSTREAMPARSER *hsp; - - if (argc != 2) { - printf("Usage: %s URL\n", argv[0]); - return EXIT_FAILURE; - } - - curl = curl_easy_init(); - - hsp = html_parser_init(); - - html_parser_set_tag_to_lower(hsp, 1); - html_parser_set_attr_to_lower(hsp, 1); - html_parser_set_tag_buffer(hsp, tag, sizeof(tag)); - html_parser_set_attr_buffer(hsp, attr, sizeof(attr)); - html_parser_set_val_buffer(hsp, val, sizeof(val)-1); - - curl_easy_setopt(curl, CURLOPT_URL, argv[1]); - curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_callback); - curl_easy_setopt(curl, CURLOPT_WRITEDATA, hsp); - curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1); - - curl_easy_perform(curl); - - curl_easy_cleanup(curl); - - html_parser_cleanup(hsp); - - return EXIT_SUCCESS; -} diff --git a/plugins/FTPFileYM/curl/docs/examples/htmltidy.c b/plugins/FTPFileYM/curl/docs/examples/htmltidy.c deleted file mode 100644 index a36e331bfe..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/htmltidy.c +++ /dev/null @@ -1,130 +0,0 @@ -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at http://curl.haxx.se/docs/copyright.html. - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the COPYING file. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ***************************************************************************/ -/* Download a document and use libtidy to parse the HTML. - * Written by Jeff Pohlmeyer - * - * LibTidy => http://tidy.sourceforge.net - * - * gcc -Wall -I/usr/local/include tidycurl.c -lcurl -ltidy -o tidycurl - * - */ - -#include <stdio.h> -#include <tidy/tidy.h> -#include <tidy/buffio.h> -#include <curl/curl.h> - -/* curl write callback, to fill tidy's input buffer... */ -uint write_cb(char *in, uint size, uint nmemb, TidyBuffer *out) -{ - uint r; - r = size * nmemb; - tidyBufAppend( out, in, r ); - return(r); -} - -/* Traverse the document tree */ -void dumpNode(TidyDoc doc, TidyNode tnod, int indent ) -{ - TidyNode child; - for ( child = tidyGetChild(tnod); child; child = tidyGetNext(child) ) - { - ctmbstr name = tidyNodeGetName( child ); - if ( name ) - { - /* if it has a name, then it's an HTML tag ... */ - TidyAttr attr; - printf( "%*.*s%s ", indent, indent, "<", name); - /* walk the attribute list */ - for ( attr=tidyAttrFirst(child); attr; attr=tidyAttrNext(attr) ) { - printf(tidyAttrName(attr)); - tidyAttrValue(attr)?printf("=\"%s\" ", - tidyAttrValue(attr)):printf(" "); - } - printf( ">\n"); - } - else { - /* if it doesn't have a name, then it's probably text, cdata, etc... */ - TidyBuffer buf; - tidyBufInit(&buf); - tidyNodeGetText(doc, child, &buf); - printf("%*.*s\n", indent, indent, buf.bp?(char *)buf.bp:""); - tidyBufFree(&buf); - } - dumpNode( doc, child, indent + 4 ); /* recursive */ - } -} - - -int main(int argc, char **argv ) -{ - CURL *curl; - char curl_errbuf[CURL_ERROR_SIZE]; - TidyDoc tdoc; - TidyBuffer docbuf = {0}; - TidyBuffer tidy_errbuf = {0}; - int err; - if ( argc == 2) { - curl = curl_easy_init(); - curl_easy_setopt(curl, CURLOPT_URL, argv[1]); - curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, curl_errbuf); - curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0L); - curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); - curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_cb); - - tdoc = tidyCreate(); - tidyOptSetBool(tdoc, TidyForceOutput, yes); /* try harder */ - tidyOptSetInt(tdoc, TidyWrapLen, 4096); - tidySetErrorBuffer( tdoc, &tidy_errbuf ); - tidyBufInit(&docbuf); - - curl_easy_setopt(curl, CURLOPT_WRITEDATA, &docbuf); - err=curl_easy_perform(curl); - if ( !err ) { - err = tidyParseBuffer(tdoc, &docbuf); /* parse the input */ - if ( err >= 0 ) { - err = tidyCleanAndRepair(tdoc); /* fix any problems */ - if ( err >= 0 ) { - err = tidyRunDiagnostics(tdoc); /* load tidy error buffer */ - if ( err >= 0 ) { - dumpNode( tdoc, tidyGetRoot(tdoc), 0 ); /* walk the tree */ - fprintf(stderr, "%s\n", tidy_errbuf.bp); /* show errors */ - } - } - } - } - else - fprintf(stderr, "%s\n", curl_errbuf); - - /* clean-up */ - curl_easy_cleanup(curl); - tidyBufFree(&docbuf); - tidyBufFree(&tidy_errbuf); - tidyRelease(tdoc); - return(err); - - } - else - printf( "usage: %s <url>\n", argv[0] ); - - return(0); -} diff --git a/plugins/FTPFileYM/curl/docs/examples/htmltitle.cpp b/plugins/FTPFileYM/curl/docs/examples/htmltitle.cpp deleted file mode 100644 index 55a7935acc..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/htmltitle.cpp +++ /dev/null @@ -1,313 +0,0 @@ -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at http://curl.haxx.se/docs/copyright.html. - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the COPYING file. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ***************************************************************************/ -// Get a web page, parse it with libxml. -// -// Written by Lars Nilsson -// -// GNU C++ compile command line suggestion (edit paths accordingly): -// -// g++ -Wall -I/opt/curl/include -I/opt/libxml/include/libxml2 htmltitle.cc \ -// -o htmltitle -L/opt/curl/lib -L/opt/libxml/lib -lcurl -lxml2 - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <string> -#include <curl/curl.h> -#include <libxml/HTMLparser.h> - -// -// Case-insensitive string comparison -// - -#ifdef _MSC_VER -#define COMPARE(a, b) (!stricmp((a), (b))) -#else -#define COMPARE(a, b) (!strcasecmp((a), (b))) -#endif - -// -// libxml callback context structure -// - -struct Context -{ - Context(): addTitle(false) { } - - bool addTitle; - std::string title; -}; - -// -// libcurl variables for error strings and returned data - -static char errorBuffer[CURL_ERROR_SIZE]; -static std::string buffer; - -// -// libcurl write callback function -// - -static int writer(char *data, size_t size, size_t nmemb, - std::string *writerData) -{ - if (writerData == NULL) - return 0; - - writerData->append(data, size*nmemb); - - return size * nmemb; -} - -// -// libcurl connection initialization -// - -static bool init(CURL *&conn, char *url) -{ - CURLcode code; - - conn = curl_easy_init(); - - if (conn == NULL) - { - fprintf(stderr, "Failed to create CURL connection\n"); - - exit(EXIT_FAILURE); - } - - code = curl_easy_setopt(conn, CURLOPT_ERRORBUFFER, errorBuffer); - if (code != CURLE_OK) - { - fprintf(stderr, "Failed to set error buffer [%d]\n", code); - - return false; - } - - code = curl_easy_setopt(conn, CURLOPT_URL, url); - if (code != CURLE_OK) - { - fprintf(stderr, "Failed to set URL [%s]\n", errorBuffer); - - return false; - } - - code = curl_easy_setopt(conn, CURLOPT_FOLLOWLOCATION, 1L); - if (code != CURLE_OK) - { - fprintf(stderr, "Failed to set redirect option [%s]\n", errorBuffer); - - return false; - } - - code = curl_easy_setopt(conn, CURLOPT_WRITEFUNCTION, writer); - if (code != CURLE_OK) - { - fprintf(stderr, "Failed to set writer [%s]\n", errorBuffer); - - return false; - } - - code = curl_easy_setopt(conn, CURLOPT_WRITEDATA, &buffer); - if (code != CURLE_OK) - { - fprintf(stderr, "Failed to set write data [%s]\n", errorBuffer); - - return false; - } - - return true; -} - -// -// libxml start element callback function -// - -static void StartElement(void *voidContext, - const xmlChar *name, - const xmlChar **attributes) -{ - Context *context = (Context *)voidContext; - - if (COMPARE((char *)name, "TITLE")) - { - context->title = ""; - context->addTitle = true; - } - (void) attributes; -} - -// -// libxml end element callback function -// - -static void EndElement(void *voidContext, - const xmlChar *name) -{ - Context *context = (Context *)voidContext; - - if (COMPARE((char *)name, "TITLE")) - context->addTitle = false; -} - -// -// Text handling helper function -// - -static void handleCharacters(Context *context, - const xmlChar *chars, - int length) -{ - if (context->addTitle) - context->title.append((char *)chars, length); -} - -// -// libxml PCDATA callback function -// - -static void Characters(void *voidContext, - const xmlChar *chars, - int length) -{ - Context *context = (Context *)voidContext; - - handleCharacters(context, chars, length); -} - -// -// libxml CDATA callback function -// - -static void cdata(void *voidContext, - const xmlChar *chars, - int length) -{ - Context *context = (Context *)voidContext; - - handleCharacters(context, chars, length); -} - -// -// libxml SAX callback structure -// - -static htmlSAXHandler saxHandler = -{ - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - StartElement, - EndElement, - NULL, - Characters, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - cdata, - NULL -}; - -// -// Parse given (assumed to be) HTML text and return the title -// - -static void parseHtml(const std::string &html, - std::string &title) -{ - htmlParserCtxtPtr ctxt; - Context context; - - ctxt = htmlCreatePushParserCtxt(&saxHandler, &context, "", 0, "", - XML_CHAR_ENCODING_NONE); - - htmlParseChunk(ctxt, html.c_str(), html.size(), 0); - htmlParseChunk(ctxt, "", 0, 1); - - htmlFreeParserCtxt(ctxt); - - title = context.title; -} - -int main(int argc, char *argv[]) -{ - CURL *conn = NULL; - CURLcode code; - std::string title; - - // Ensure one argument is given - - if (argc != 2) - { - fprintf(stderr, "Usage: %s <url>\n", argv[0]); - - exit(EXIT_FAILURE); - } - - curl_global_init(CURL_GLOBAL_DEFAULT); - - // Initialize CURL connection - - if (!init(conn, argv[1])) - { - fprintf(stderr, "Connection initializion failed\n"); - - exit(EXIT_FAILURE); - } - - // Retrieve content for the URL - - code = curl_easy_perform(conn); - curl_easy_cleanup(conn); - - if (code != CURLE_OK) - { - fprintf(stderr, "Failed to get '%s' [%s]\n", argv[1], errorBuffer); - - exit(EXIT_FAILURE); - } - - // Parse the (assumed) HTML code - - parseHtml(buffer, title); - - // Display the extracted title - - printf("Title: %s\n", title.c_str()); - - return EXIT_SUCCESS; -} diff --git a/plugins/FTPFileYM/curl/docs/examples/http-post.c b/plugins/FTPFileYM/curl/docs/examples/http-post.c deleted file mode 100644 index f1975b1ec3..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/http-post.c +++ /dev/null @@ -1,55 +0,0 @@ -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at http://curl.haxx.se/docs/copyright.html. - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the COPYING file. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ***************************************************************************/ -#include <stdio.h> -#include <curl/curl.h> - -int main(void) -{ - CURL *curl; - CURLcode res; - - /* In windows, this will init the winsock stuff */ - curl_global_init(CURL_GLOBAL_ALL); - - /* get a curl handle */ - curl = curl_easy_init(); - if(curl) { - /* First set the URL that is about to receive our POST. This URL can - just as well be a https:// URL if that is what should receive the - data. */ - curl_easy_setopt(curl, CURLOPT_URL, "http://postit.example.com/moo.cgi"); - /* Now specify the POST data */ - curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "name=daniel&project=curl"); - - /* Perform the request, res will get the return code */ - res = curl_easy_perform(curl); - /* Check for errors */ - if(res != CURLE_OK) - fprintf(stderr, "curl_easy_perform() failed: %s\n", - curl_easy_strerror(res)); - - /* always cleanup */ - curl_easy_cleanup(curl); - } - curl_global_cleanup(); - return 0; -} diff --git a/plugins/FTPFileYM/curl/docs/examples/httpcustomheader.c b/plugins/FTPFileYM/curl/docs/examples/httpcustomheader.c deleted file mode 100644 index 07ff95997f..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/httpcustomheader.c +++ /dev/null @@ -1,61 +0,0 @@ -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at http://curl.haxx.se/docs/copyright.html. - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the COPYING file. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ***************************************************************************/ -#include <stdio.h> -#include <curl/curl.h> - -int main(void) -{ - CURL *curl; - CURLcode res; - - curl = curl_easy_init(); - if(curl) { - struct curl_slist *chunk = NULL; - - chunk = curl_slist_append(chunk, "Accept: moo"); - chunk = curl_slist_append(chunk, "Another: yes"); - - /* request with the built-in Accept: */ - curl_easy_setopt(curl, CURLOPT_URL, "localhost"); - curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); - res = curl_easy_perform(curl); - /* Check for errors */ - if(res != CURLE_OK) - fprintf(stderr, "curl_easy_perform() failed: %s\n", - curl_easy_strerror(res)); - - /* redo request with our own custom Accept: */ - res = curl_easy_setopt(curl, CURLOPT_HTTPHEADER, chunk); - res = curl_easy_perform(curl); - /* Check for errors */ - if(res != CURLE_OK) - fprintf(stderr, "curl_easy_perform() failed: %s\n", - curl_easy_strerror(res)); - - /* always cleanup */ - curl_easy_cleanup(curl); - - /* free the custom headers */ - curl_slist_free_all(chunk); - } - return 0; -} diff --git a/plugins/FTPFileYM/curl/docs/examples/httpput.c b/plugins/FTPFileYM/curl/docs/examples/httpput.c deleted file mode 100644 index fbbca9448b..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/httpput.c +++ /dev/null @@ -1,125 +0,0 @@ -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at http://curl.haxx.se/docs/copyright.html. - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the COPYING file. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ***************************************************************************/ -#include <stdio.h> -#include <fcntl.h> -#include <sys/stat.h> -#include <unistd.h> - -#include <curl/curl.h> - -/* - * This example shows a HTTP PUT operation. PUTs a file given as a command - * line argument to the URL also given on the command line. - * - * This example also uses its own read callback. - * - * Here's an article on how to setup a PUT handler for Apache: - * http://www.apacheweek.com/features/put - */ - -static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *stream) -{ - size_t retcode; - curl_off_t nread; - - /* in real-world cases, this would probably get this data differently - as this fread() stuff is exactly what the library already would do - by default internally */ - retcode = fread(ptr, size, nmemb, stream); - - nread = (curl_off_t)retcode; - - fprintf(stderr, "*** We read %" CURL_FORMAT_CURL_OFF_T - " bytes from file\n", nread); - - return retcode; -} - -int main(int argc, char **argv) -{ - CURL *curl; - CURLcode res; - FILE * hd_src ; - int hd ; - struct stat file_info; - - char *file; - char *url; - - if(argc < 3) - return 1; - - file= argv[1]; - url = argv[2]; - - /* get the file size of the local file */ - hd = open(file, O_RDONLY) ; - fstat(hd, &file_info); - close(hd) ; - - /* get a FILE * of the same file, could also be made with - fdopen() from the previous descriptor, but hey this is just - an example! */ - hd_src = fopen(file, "rb"); - - /* In windows, this will init the winsock stuff */ - curl_global_init(CURL_GLOBAL_ALL); - - /* get a curl handle */ - curl = curl_easy_init(); - if(curl) { - /* we want to use our own read function */ - curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_callback); - - /* enable uploading */ - curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L); - - /* HTTP PUT please */ - curl_easy_setopt(curl, CURLOPT_PUT, 1L); - - /* specify target URL, and note that this URL should include a file - name, not only a directory */ - curl_easy_setopt(curl, CURLOPT_URL, url); - - /* now specify which file to upload */ - curl_easy_setopt(curl, CURLOPT_READDATA, hd_src); - - /* provide the size of the upload, we specicially typecast the value - to curl_off_t since we must be sure to use the correct data size */ - curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE, - (curl_off_t)file_info.st_size); - - /* Now run off and do what you've been told! */ - res = curl_easy_perform(curl); - /* Check for errors */ - if(res != CURLE_OK) - fprintf(stderr, "curl_easy_perform() failed: %s\n", - curl_easy_strerror(res)); - - /* always cleanup */ - curl_easy_cleanup(curl); - } - fclose(hd_src); /* close the local file */ - - curl_global_cleanup(); - return 0; -} diff --git a/plugins/FTPFileYM/curl/docs/examples/https.c b/plugins/FTPFileYM/curl/docs/examples/https.c deleted file mode 100644 index bd9a33ba6d..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/https.c +++ /dev/null @@ -1,74 +0,0 @@ -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at http://curl.haxx.se/docs/copyright.html. - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the COPYING file. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ***************************************************************************/ -#include <stdio.h> -#include <curl/curl.h> - -int main(void) -{ - CURL *curl; - CURLcode res; - - curl_global_init(CURL_GLOBAL_DEFAULT); - - curl = curl_easy_init(); - if(curl) { - curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); - -#ifdef SKIP_PEER_VERIFICATION - /* - * If you want to connect to a site who isn't using a certificate that is - * signed by one of the certs in the CA bundle you have, you can skip the - * verification of the server's certificate. This makes the connection - * A LOT LESS SECURE. - * - * If you have a CA cert for the server stored someplace else than in the - * default bundle, then the CURLOPT_CAPATH option might come handy for - * you. - */ - curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L); -#endif - -#ifdef SKIP_HOSTNAME_VERIFICATION - /* - * If the site you're connecting to uses a different host name that what - * they have mentioned in their server certificate's commonName (or - * subjectAltName) fields, libcurl will refuse to connect. You can skip - * this check, but this will make the connection less secure. - */ - curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L); -#endif - - /* Perform the request, res will get the return code */ - res = curl_easy_perform(curl); - /* Check for errors */ - if(res != CURLE_OK) - fprintf(stderr, "curl_easy_perform() failed: %s\n", - curl_easy_strerror(res)); - - /* always cleanup */ - curl_easy_cleanup(curl); - } - - curl_global_cleanup(); - - return 0; -} diff --git a/plugins/FTPFileYM/curl/docs/examples/makefile.dj b/plugins/FTPFileYM/curl/docs/examples/makefile.dj deleted file mode 100644 index c18ef8a708..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/makefile.dj +++ /dev/null @@ -1,60 +0,0 @@ -#*************************************************************************** -# _ _ ____ _ -# Project ___| | | | _ \| | -# / __| | | | |_) | | -# | (__| |_| | _ <| |___ -# \___|\___/|_| \_\_____| -# -# Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. -# -# This software is licensed as described in the file COPYING, which -# you should have received as part of this distribution. The terms -# are also available at http://curl.haxx.se/docs/copyright.html. -# -# You may opt to use, copy, modify, merge, publish, distribute and/or sell -# copies of the Software, and permit persons to whom the Software is -# furnished to do so, under the terms of the COPYING file. -# -# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -# KIND, either express or implied. -# -########################################################################### -# -# Adapted for djgpp / Watt-32 / DOS by -# Gisle Vanem <gvanem@broadpark.no> -# - -TOPDIR = ../.. - -include $(TOPDIR)/packages/DOS/common.dj - -CFLAGS += -DFALSE=0 -DTRUE=1 - -LIBS = $(TOPDIR)/lib/libcurl.a - -ifeq ($(USE_SSL),1) - LIBS += $(OPENSSL_ROOT)/lib/libssl.a $(OPENSSL_ROOT)/lib/libcrypt.a -endif - -ifeq ($(USE_IDNA),1) - LIBS += $(LIBIDN_ROOT)/lib/dj_obj/libidn.a -liconv -endif - -LIBS += $(WATT32_ROOT)/lib/libwatt.a $(ZLIB_ROOT)/libz.a - -include Makefile.inc - -PROGRAMS = $(patsubst %,%.exe,$(check_PROGRAMS)) - -all: $(PROGRAMS) - @echo Welcome to libcurl example program - -%.exe: %.c - $(CC) $(CFLAGS) -o $@ $^ $(LIBS) - @echo - -clean vclean realclean: - - rm -f $(PROGRAMS) depend.dj - --include depend.dj - diff --git a/plugins/FTPFileYM/curl/docs/examples/multi-app.c b/plugins/FTPFileYM/curl/docs/examples/multi-app.c deleted file mode 100644 index a5f71c5ac6..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/multi-app.c +++ /dev/null @@ -1,153 +0,0 @@ -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at http://curl.haxx.se/docs/copyright.html. - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the COPYING file. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ***************************************************************************/ -/* This is an example application source code using the multi interface. */ - -#include <stdio.h> -#include <string.h> - -/* somewhat unix-specific */ -#include <sys/time.h> -#include <unistd.h> - -/* curl stuff */ -#include <curl/curl.h> - -/* - * Download a HTTP file and upload an FTP file simultaneously. - */ - -#define HANDLECOUNT 2 /* Number of simultaneous transfers */ -#define HTTP_HANDLE 0 /* Index for the HTTP transfer */ -#define FTP_HANDLE 1 /* Index for the FTP transfer */ - -int main(void) -{ - CURL *handles[HANDLECOUNT]; - CURLM *multi_handle; - - int still_running; /* keep number of running handles */ - int i; - - CURLMsg *msg; /* for picking up messages with the transfer status */ - int msgs_left; /* how many messages are left */ - - /* Allocate one CURL handle per transfer */ - for (i=0; i<HANDLECOUNT; i++) - handles[i] = curl_easy_init(); - - /* set the options (I left out a few, you'll get the point anyway) */ - curl_easy_setopt(handles[HTTP_HANDLE], CURLOPT_URL, "http://example.com"); - - curl_easy_setopt(handles[FTP_HANDLE], CURLOPT_URL, "ftp://example.com"); - curl_easy_setopt(handles[FTP_HANDLE], CURLOPT_UPLOAD, 1L); - - /* init a multi stack */ - multi_handle = curl_multi_init(); - - /* add the individual transfers */ - for (i=0; i<HANDLECOUNT; i++) - curl_multi_add_handle(multi_handle, handles[i]); - - /* we start some action by calling perform right away */ - curl_multi_perform(multi_handle, &still_running); - - do { - struct timeval timeout; - int rc; /* select() return code */ - - fd_set fdread; - fd_set fdwrite; - fd_set fdexcep; - int maxfd = -1; - - long curl_timeo = -1; - - FD_ZERO(&fdread); - FD_ZERO(&fdwrite); - FD_ZERO(&fdexcep); - - /* set a suitable timeout to play around with */ - timeout.tv_sec = 1; - timeout.tv_usec = 0; - - curl_multi_timeout(multi_handle, &curl_timeo); - if(curl_timeo >= 0) { - timeout.tv_sec = curl_timeo / 1000; - if(timeout.tv_sec > 1) - timeout.tv_sec = 1; - else - timeout.tv_usec = (curl_timeo % 1000) * 1000; - } - - /* get file descriptors from the transfers */ - curl_multi_fdset(multi_handle, &fdread, &fdwrite, &fdexcep, &maxfd); - - /* In a real-world program you OF COURSE check the return code of the - function calls. On success, the value of maxfd is guaranteed to be - greater or equal than -1. We call select(maxfd + 1, ...), specially in - case of (maxfd == -1), we call select(0, ...), which is basically equal - to sleep. */ - - rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout); - - switch(rc) { - case -1: - /* select error */ - break; - case 0: /* timeout */ - default: /* action */ - curl_multi_perform(multi_handle, &still_running); - break; - } - } while(still_running); - - /* See how the transfers went */ - while ((msg = curl_multi_info_read(multi_handle, &msgs_left))) { - if (msg->msg == CURLMSG_DONE) { - int idx, found = 0; - - /* Find out which handle this message is about */ - for (idx=0; idx<HANDLECOUNT; idx++) { - found = (msg->easy_handle == handles[idx]); - if(found) - break; - } - - switch (idx) { - case HTTP_HANDLE: - printf("HTTP transfer completed with status %d\n", msg->data.result); - break; - case FTP_HANDLE: - printf("FTP transfer completed with status %d\n", msg->data.result); - break; - } - } - } - - curl_multi_cleanup(multi_handle); - - /* Free the CURL handles */ - for (i=0; i<HANDLECOUNT; i++) - curl_easy_cleanup(handles[i]); - - return 0; -} diff --git a/plugins/FTPFileYM/curl/docs/examples/multi-debugcallback.c b/plugins/FTPFileYM/curl/docs/examples/multi-debugcallback.c deleted file mode 100644 index 8eedcee5b5..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/multi-debugcallback.c +++ /dev/null @@ -1,205 +0,0 @@ -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at http://curl.haxx.se/docs/copyright.html. - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the COPYING file. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ***************************************************************************/ -/* This is an example showing the multi interface and the debug callback. */ - -#include <stdio.h> -#include <string.h> - -/* somewhat unix-specific */ -#include <sys/time.h> -#include <unistd.h> - -/* curl stuff */ -#include <curl/curl.h> - -typedef char bool; -#define TRUE 1 - -static -void dump(const char *text, - FILE *stream, unsigned char *ptr, size_t size, - bool nohex) -{ - size_t i; - size_t c; - - unsigned int width=0x10; - - if(nohex) - /* without the hex output, we can fit more on screen */ - width = 0x40; - - fprintf(stream, "%s, %10.10ld bytes (0x%8.8lx)\n", - text, (long)size, (long)size); - - for(i=0; i<size; i+= width) { - - fprintf(stream, "%4.4lx: ", (long)i); - - if(!nohex) { - /* hex not disabled, show it */ - for(c = 0; c < width; c++) - if(i+c < size) - fprintf(stream, "%02x ", ptr[i+c]); - else - fputs(" ", stream); - } - - for(c = 0; (c < width) && (i+c < size); c++) { - /* check for 0D0A; if found, skip past and start a new line of output */ - if (nohex && (i+c+1 < size) && ptr[i+c]==0x0D && ptr[i+c+1]==0x0A) { - i+=(c+2-width); - break; - } - fprintf(stream, "%c", - (ptr[i+c]>=0x20) && (ptr[i+c]<0x80)?ptr[i+c]:'.'); - /* check again for 0D0A, to avoid an extra \n if it's at width */ - if (nohex && (i+c+2 < size) && ptr[i+c+1]==0x0D && ptr[i+c+2]==0x0A) { - i+=(c+3-width); - break; - } - } - fputc('\n', stream); /* newline */ - } - fflush(stream); -} - -static -int my_trace(CURL *handle, curl_infotype type, - unsigned char *data, size_t size, - void *userp) -{ - const char *text; - - (void)userp; - (void)handle; /* prevent compiler warning */ - - switch (type) { - case CURLINFO_TEXT: - fprintf(stderr, "== Info: %s", data); - default: /* in case a new one is introduced to shock us */ - return 0; - - case CURLINFO_HEADER_OUT: - text = "=> Send header"; - break; - case CURLINFO_DATA_OUT: - text = "=> Send data"; - break; - case CURLINFO_HEADER_IN: - text = "<= Recv header"; - break; - case CURLINFO_DATA_IN: - text = "<= Recv data"; - break; - } - - dump(text, stderr, data, size, TRUE); - return 0; -} - -/* - * Simply download a HTTP file. - */ -int main(void) -{ - CURL *http_handle; - CURLM *multi_handle; - - int still_running; /* keep number of running handles */ - - http_handle = curl_easy_init(); - - /* set the options (I left out a few, you'll get the point anyway) */ - curl_easy_setopt(http_handle, CURLOPT_URL, "http://www.example.com/"); - - curl_easy_setopt(http_handle, CURLOPT_DEBUGFUNCTION, my_trace); - curl_easy_setopt(http_handle, CURLOPT_VERBOSE, 1L); - - /* init a multi stack */ - multi_handle = curl_multi_init(); - - /* add the individual transfers */ - curl_multi_add_handle(multi_handle, http_handle); - - /* we start some action by calling perform right away */ - curl_multi_perform(multi_handle, &still_running); - - do { - struct timeval timeout; - int rc; /* select() return code */ - - fd_set fdread; - fd_set fdwrite; - fd_set fdexcep; - int maxfd = -1; - - long curl_timeo = -1; - - FD_ZERO(&fdread); - FD_ZERO(&fdwrite); - FD_ZERO(&fdexcep); - - /* set a suitable timeout to play around with */ - timeout.tv_sec = 1; - timeout.tv_usec = 0; - - curl_multi_timeout(multi_handle, &curl_timeo); - if(curl_timeo >= 0) { - timeout.tv_sec = curl_timeo / 1000; - if(timeout.tv_sec > 1) - timeout.tv_sec = 1; - else - timeout.tv_usec = (curl_timeo % 1000) * 1000; - } - - /* get file descriptors from the transfers */ - curl_multi_fdset(multi_handle, &fdread, &fdwrite, &fdexcep, &maxfd); - - /* In a real-world program you OF COURSE check the return code of the - function calls. On success, the value of maxfd is guaranteed to be - greater or equal than -1. We call select(maxfd + 1, ...), specially in - case of (maxfd == -1), we call select(0, ...), which is basically equal - to sleep. */ - - rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout); - - switch(rc) { - case -1: - /* select error */ - still_running = 0; - printf("select() returns error, this is badness\n"); - break; - case 0: - default: - /* timeout or readable/writable sockets */ - curl_multi_perform(multi_handle, &still_running); - break; - } - } while(still_running); - - curl_multi_cleanup(multi_handle); - - curl_easy_cleanup(http_handle); - - return 0; -} diff --git a/plugins/FTPFileYM/curl/docs/examples/multi-double.c b/plugins/FTPFileYM/curl/docs/examples/multi-double.c deleted file mode 100644 index 91422e6e2d..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/multi-double.c +++ /dev/null @@ -1,119 +0,0 @@ -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at http://curl.haxx.se/docs/copyright.html. - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the COPYING file. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ***************************************************************************/ -#include <stdio.h> -#include <string.h> - -/* somewhat unix-specific */ -#include <sys/time.h> -#include <unistd.h> - -/* curl stuff */ -#include <curl/curl.h> - -/* - * Simply download two HTTP files! - */ -int main(void) -{ - CURL *http_handle; - CURL *http_handle2; - CURLM *multi_handle; - - int still_running; /* keep number of running handles */ - - http_handle = curl_easy_init(); - http_handle2 = curl_easy_init(); - - /* set options */ - curl_easy_setopt(http_handle, CURLOPT_URL, "http://www.example.com/"); - - /* set options */ - curl_easy_setopt(http_handle2, CURLOPT_URL, "http://localhost/"); - - /* init a multi stack */ - multi_handle = curl_multi_init(); - - /* add the individual transfers */ - curl_multi_add_handle(multi_handle, http_handle); - curl_multi_add_handle(multi_handle, http_handle2); - - /* we start some action by calling perform right away */ - curl_multi_perform(multi_handle, &still_running); - - do { - struct timeval timeout; - int rc; /* select() return code */ - - fd_set fdread; - fd_set fdwrite; - fd_set fdexcep; - int maxfd = -1; - - long curl_timeo = -1; - - FD_ZERO(&fdread); - FD_ZERO(&fdwrite); - FD_ZERO(&fdexcep); - - /* set a suitable timeout to play around with */ - timeout.tv_sec = 1; - timeout.tv_usec = 0; - - curl_multi_timeout(multi_handle, &curl_timeo); - if(curl_timeo >= 0) { - timeout.tv_sec = curl_timeo / 1000; - if(timeout.tv_sec > 1) - timeout.tv_sec = 1; - else - timeout.tv_usec = (curl_timeo % 1000) * 1000; - } - - /* get file descriptors from the transfers */ - curl_multi_fdset(multi_handle, &fdread, &fdwrite, &fdexcep, &maxfd); - - /* In a real-world program you OF COURSE check the return code of the - function calls. On success, the value of maxfd is guaranteed to be - greater or equal than -1. We call select(maxfd + 1, ...), specially in - case of (maxfd == -1), we call select(0, ...), which is basically equal - to sleep. */ - - rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout); - - switch(rc) { - case -1: - /* select error */ - break; - case 0: - default: - /* timeout or readable/writable sockets */ - curl_multi_perform(multi_handle, &still_running); - break; - } - } while(still_running); - - curl_multi_cleanup(multi_handle); - - curl_easy_cleanup(http_handle); - curl_easy_cleanup(http_handle2); - - return 0; -} diff --git a/plugins/FTPFileYM/curl/docs/examples/multi-post.c b/plugins/FTPFileYM/curl/docs/examples/multi-post.c deleted file mode 100644 index 965a2c3f69..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/multi-post.c +++ /dev/null @@ -1,148 +0,0 @@ -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at http://curl.haxx.se/docs/copyright.html. - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the COPYING file. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ***************************************************************************/ -/* This is an example application source code using the multi interface - * to do a multipart formpost without "blocking". */ -#include <stdio.h> -#include <string.h> -#include <sys/time.h> - -#include <curl/curl.h> - -int main(void) -{ - CURL *curl; - - CURLM *multi_handle; - int still_running; - - struct curl_httppost *formpost=NULL; - struct curl_httppost *lastptr=NULL; - struct curl_slist *headerlist=NULL; - static const char buf[] = "Expect:"; - - /* Fill in the file upload field. This makes libcurl load data from - the given file name when curl_easy_perform() is called. */ - curl_formadd(&formpost, - &lastptr, - CURLFORM_COPYNAME, "sendfile", - CURLFORM_FILE, "postit2.c", - CURLFORM_END); - - /* Fill in the filename field */ - curl_formadd(&formpost, - &lastptr, - CURLFORM_COPYNAME, "filename", - CURLFORM_COPYCONTENTS, "postit2.c", - CURLFORM_END); - - /* Fill in the submit field too, even if this is rarely needed */ - curl_formadd(&formpost, - &lastptr, - CURLFORM_COPYNAME, "submit", - CURLFORM_COPYCONTENTS, "send", - CURLFORM_END); - - curl = curl_easy_init(); - multi_handle = curl_multi_init(); - - /* initalize custom header list (stating that Expect: 100-continue is not - wanted */ - headerlist = curl_slist_append(headerlist, buf); - if(curl && multi_handle) { - - /* what URL that receives this POST */ - curl_easy_setopt(curl, CURLOPT_URL, "http://www.example.com/upload.cgi"); - curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); - - curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headerlist); - curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost); - - curl_multi_add_handle(multi_handle, curl); - - curl_multi_perform(multi_handle, &still_running); - - do { - struct timeval timeout; - int rc; /* select() return code */ - - fd_set fdread; - fd_set fdwrite; - fd_set fdexcep; - int maxfd = -1; - - long curl_timeo = -1; - - FD_ZERO(&fdread); - FD_ZERO(&fdwrite); - FD_ZERO(&fdexcep); - - /* set a suitable timeout to play around with */ - timeout.tv_sec = 1; - timeout.tv_usec = 0; - - curl_multi_timeout(multi_handle, &curl_timeo); - if(curl_timeo >= 0) { - timeout.tv_sec = curl_timeo / 1000; - if(timeout.tv_sec > 1) - timeout.tv_sec = 1; - else - timeout.tv_usec = (curl_timeo % 1000) * 1000; - } - - /* get file descriptors from the transfers */ - curl_multi_fdset(multi_handle, &fdread, &fdwrite, &fdexcep, &maxfd); - - /* In a real-world program you OF COURSE check the return code of the - function calls. On success, the value of maxfd is guaranteed to be - greater or equal than -1. We call select(maxfd + 1, ...), specially in - case of (maxfd == -1), we call select(0, ...), which is basically equal - to sleep. */ - - rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout); - - switch(rc) { - case -1: - /* select error */ - break; - case 0: - default: - /* timeout or readable/writable sockets */ - printf("perform!\n"); - curl_multi_perform(multi_handle, &still_running); - printf("running: %d!\n", still_running); - break; - } - } while(still_running); - - curl_multi_cleanup(multi_handle); - - /* always cleanup */ - curl_easy_cleanup(curl); - - /* then cleanup the formpost chain */ - curl_formfree(formpost); - - /* free slist */ - curl_slist_free_all (headerlist); - } - return 0; -} diff --git a/plugins/FTPFileYM/curl/docs/examples/multi-single.c b/plugins/FTPFileYM/curl/docs/examples/multi-single.c deleted file mode 100644 index aeda71419b..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/multi-single.c +++ /dev/null @@ -1,116 +0,0 @@ -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at http://curl.haxx.se/docs/copyright.html. - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the COPYING file. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ***************************************************************************/ -/* This is a very simple example using the multi interface. */ - -#include <stdio.h> -#include <string.h> - -/* somewhat unix-specific */ -#include <sys/time.h> -#include <unistd.h> - -/* curl stuff */ -#include <curl/curl.h> - -/* - * Simply download a HTTP file. - */ -int main(void) -{ - CURL *http_handle; - CURLM *multi_handle; - - int still_running; /* keep number of running handles */ - - http_handle = curl_easy_init(); - - /* set the options (I left out a few, you'll get the point anyway) */ - curl_easy_setopt(http_handle, CURLOPT_URL, "http://www.example.com/"); - - /* init a multi stack */ - multi_handle = curl_multi_init(); - - /* add the individual transfers */ - curl_multi_add_handle(multi_handle, http_handle); - - /* we start some action by calling perform right away */ - curl_multi_perform(multi_handle, &still_running); - - do { - struct timeval timeout; - int rc; /* select() return code */ - - fd_set fdread; - fd_set fdwrite; - fd_set fdexcep; - int maxfd = -1; - - long curl_timeo = -1; - - FD_ZERO(&fdread); - FD_ZERO(&fdwrite); - FD_ZERO(&fdexcep); - - /* set a suitable timeout to play around with */ - timeout.tv_sec = 1; - timeout.tv_usec = 0; - - curl_multi_timeout(multi_handle, &curl_timeo); - if(curl_timeo >= 0) { - timeout.tv_sec = curl_timeo / 1000; - if(timeout.tv_sec > 1) - timeout.tv_sec = 1; - else - timeout.tv_usec = (curl_timeo % 1000) * 1000; - } - - /* get file descriptors from the transfers */ - curl_multi_fdset(multi_handle, &fdread, &fdwrite, &fdexcep, &maxfd); - - /* In a real-world program you OF COURSE check the return code of the - function calls. On success, the value of maxfd is guaranteed to be - greater or equal than -1. We call select(maxfd + 1, ...), specially in - case of (maxfd == -1), we call select(0, ...), which is basically equal - to sleep. */ - - rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout); - - switch(rc) { - case -1: - /* select error */ - still_running = 0; - printf("select() returns error, this is badness\n"); - break; - case 0: - default: - /* timeout or readable/writable sockets */ - curl_multi_perform(multi_handle, &still_running); - break; - } - } while(still_running); - - curl_multi_cleanup(multi_handle); - - curl_easy_cleanup(http_handle); - - return 0; -} diff --git a/plugins/FTPFileYM/curl/docs/examples/multithread.c b/plugins/FTPFileYM/curl/docs/examples/multithread.c deleted file mode 100644 index 831a07467a..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/multithread.c +++ /dev/null @@ -1,93 +0,0 @@ -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at http://curl.haxx.se/docs/copyright.html. - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the COPYING file. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ***************************************************************************/ -/* A multi-threaded example that uses pthreads extensively to fetch - * X remote files at once */ - -#include <stdio.h> -#include <pthread.h> -#include <curl/curl.h> - -#define NUMT 4 - -/* - List of URLs to fetch. - - If you intend to use a SSL-based protocol here you MUST setup the OpenSSL - callback functions as described here: - - http://www.openssl.org/docs/crypto/threads.html#DESCRIPTION - -*/ -const char * const urls[NUMT]= { - "http://curl.haxx.se/", - "ftp://cool.haxx.se/", - "http://www.contactor.se/", - "www.haxx.se" -}; - -static void *pull_one_url(void *url) -{ - CURL *curl; - - curl = curl_easy_init(); - curl_easy_setopt(curl, CURLOPT_URL, url); - curl_easy_perform(curl); /* ignores error */ - curl_easy_cleanup(curl); - - return NULL; -} - - -/* - int pthread_create(pthread_t *new_thread_ID, - const pthread_attr_t *attr, - void * (*start_func)(void *), void *arg); -*/ - -int main(int argc, char **argv) -{ - pthread_t tid[NUMT]; - int i; - int error; - - /* Must initialize libcurl before any threads are started */ - curl_global_init(CURL_GLOBAL_ALL); - - for(i=0; i< NUMT; i++) { - error = pthread_create(&tid[i], - NULL, /* default attributes please */ - pull_one_url, - (void *)urls[i]); - if(0 != error) - fprintf(stderr, "Couldn't run thread number %d, errno %d\n", i, error); - else - fprintf(stderr, "Thread %d, gets %s\n", i, urls[i]); - } - - /* now wait for all threads to terminate */ - for(i=0; i< NUMT; i++) { - error = pthread_join(tid[i], NULL); - fprintf(stderr, "Thread %d terminated\n", i); - } - - return 0; -} diff --git a/plugins/FTPFileYM/curl/docs/examples/opensslthreadlock.c b/plugins/FTPFileYM/curl/docs/examples/opensslthreadlock.c deleted file mode 100644 index ad54f08ea5..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/opensslthreadlock.c +++ /dev/null @@ -1,94 +0,0 @@ -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at http://curl.haxx.se/docs/copyright.html. - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the COPYING file. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ***************************************************************************/ -/* Example source code to show one way to set the necessary OpenSSL locking - * callbacks if you want to do multi-threaded transfers with HTTPS/FTPS with - * libcurl built to use OpenSSL. - * - * This is not a complete stand-alone example. - * - * Author: Jeremy Brown - */ - - -#include <stdio.h> -#include <pthread.h> -#include <openssl/err.h> - -#define MUTEX_TYPE pthread_mutex_t -#define MUTEX_SETUP(x) pthread_mutex_init(&(x), NULL) -#define MUTEX_CLEANUP(x) pthread_mutex_destroy(&(x)) -#define MUTEX_LOCK(x) pthread_mutex_lock(&(x)) -#define MUTEX_UNLOCK(x) pthread_mutex_unlock(&(x)) -#define THREAD_ID pthread_self( ) - - -void handle_error(const char *file, int lineno, const char *msg){ - fprintf(stderr, "** %s:%d %s\n", file, lineno, msg); - ERR_print_errors_fp(stderr); - /* exit(-1); */ - } - -/* This array will store all of the mutexes available to OpenSSL. */ -static MUTEX_TYPE *mutex_buf= NULL; - - -static void locking_function(int mode, int n, const char * file, int line) -{ - if (mode & CRYPTO_LOCK) - MUTEX_LOCK(mutex_buf[n]); - else - MUTEX_UNLOCK(mutex_buf[n]); -} - -static unsigned long id_function(void) -{ - return ((unsigned long)THREAD_ID); -} - -int thread_setup(void) -{ - int i; - - mutex_buf = malloc(CRYPTO_num_locks( ) * sizeof(MUTEX_TYPE)); - if (!mutex_buf) - return 0; - for (i = 0; i < CRYPTO_num_locks( ); i++) - MUTEX_SETUP(mutex_buf[i]); - CRYPTO_set_id_callback(id_function); - CRYPTO_set_locking_callback(locking_function); - return 1; -} - -int thread_cleanup(void) -{ - int i; - - if (!mutex_buf) - return 0; - CRYPTO_set_id_callback(NULL); - CRYPTO_set_locking_callback(NULL); - for (i = 0; i < CRYPTO_num_locks( ); i++) - MUTEX_CLEANUP(mutex_buf[i]); - free(mutex_buf); - mutex_buf = NULL; - return 1; -} diff --git a/plugins/FTPFileYM/curl/docs/examples/persistant.c b/plugins/FTPFileYM/curl/docs/examples/persistant.c deleted file mode 100644 index 0917dfdb81..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/persistant.c +++ /dev/null @@ -1,64 +0,0 @@ -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at http://curl.haxx.se/docs/copyright.html. - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the COPYING file. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ***************************************************************************/ -#include <stdio.h> -#include <unistd.h> -#include <curl/curl.h> - -int main(void) -{ - CURL *curl; - CURLcode res; - - curl_global_init(CURL_GLOBAL_ALL); - - curl = curl_easy_init(); - if(curl) { - curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); - curl_easy_setopt(curl, CURLOPT_HEADER, 1L); - - /* get the first document */ - curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/"); - - /* Perform the request, res will get the return code */ - res = curl_easy_perform(curl); - /* Check for errors */ - if(res != CURLE_OK) - fprintf(stderr, "curl_easy_perform() failed: %s\n", - curl_easy_strerror(res)); - - /* get another document from the same server using the same - connection */ - curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/docs/"); - - /* Perform the request, res will get the return code */ - res = curl_easy_perform(curl); - /* Check for errors */ - if(res != CURLE_OK) - fprintf(stderr, "curl_easy_perform() failed: %s\n", - curl_easy_strerror(res)); - - /* always cleanup */ - curl_easy_cleanup(curl); - } - - return 0; -} diff --git a/plugins/FTPFileYM/curl/docs/examples/pop3s.c b/plugins/FTPFileYM/curl/docs/examples/pop3s.c deleted file mode 100644 index 44d7c80d0f..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/pop3s.c +++ /dev/null @@ -1,73 +0,0 @@ -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at http://curl.haxx.se/docs/copyright.html. - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the COPYING file. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ***************************************************************************/ -#include <stdio.h> -#include <curl/curl.h> - -int main(void) -{ - CURL *curl; - CURLcode res; - - curl = curl_easy_init(); - if(curl) { - /* Set username and password */ - curl_easy_setopt(curl, CURLOPT_USERPWD, "user:password"); - - /* This will only fetch the message with ID "1" of the given mailbox */ - curl_easy_setopt(curl, CURLOPT_URL, "pop3s://user@pop.example.com/1"); - -#ifdef SKIP_PEER_VERIFICATION - /* - * If you want to connect to a site who isn't using a certificate that is - * signed by one of the certs in the CA bundle you have, you can skip the - * verification of the server's certificate. This makes the connection - * A LOT LESS SECURE. - * - * If you have a CA cert for the server stored someplace else than in the - * default bundle, then the CURLOPT_CAPATH option might come handy for - * you. - */ - curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L); -#endif - -#ifdef SKIP_HOSTNAME_VERFICATION - /* - * If the site you're connecting to uses a different host name that what - * they have mentioned in their server certificate's commonName (or - * subjectAltName) fields, libcurl will refuse to connect. You can skip - * this check, but this will make the connection less secure. - */ - curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L); -#endif - - /* Perform the request, res will get the return code */ - res = curl_easy_perform(curl); - /* Check for errors */ - if(res != CURLE_OK) - fprintf(stderr, "curl_easy_perform() failed: %s\n", - curl_easy_strerror(res)); - - /* always cleanup */ - curl_easy_cleanup(curl); - } - return 0; -} diff --git a/plugins/FTPFileYM/curl/docs/examples/pop3slist.c b/plugins/FTPFileYM/curl/docs/examples/pop3slist.c deleted file mode 100644 index 9d9668fa0a..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/pop3slist.c +++ /dev/null @@ -1,73 +0,0 @@ -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at http://curl.haxx.se/docs/copyright.html. - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the COPYING file. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ***************************************************************************/ -#include <stdio.h> -#include <curl/curl.h> - -int main(void) -{ - CURL *curl; - CURLcode res; - - curl = curl_easy_init(); - if(curl) { - /* Set username and password */ - curl_easy_setopt(curl, CURLOPT_USERPWD, "user:password"); - - /* This will list every message of the given mailbox */ - curl_easy_setopt(curl, CURLOPT_URL, "pop3s://user@pop.example.com/"); - -#ifdef SKIP_PEER_VERIFICATION - /* - * If you want to connect to a site who isn't using a certificate that is - * signed by one of the certs in the CA bundle you have, you can skip the - * verification of the server's certificate. This makes the connection - * A LOT LESS SECURE. - * - * If you have a CA cert for the server stored someplace else than in the - * default bundle, then the CURLOPT_CAPATH option might come handy for - * you. - */ - curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L); -#endif - -#ifdef SKIP_HOSTNAME_VERFICATION - /* - * If the site you're connecting to uses a different host name that what - * they have mentioned in their server certificate's commonName (or - * subjectAltName) fields, libcurl will refuse to connect. You can skip - * this check, but this will make the connection less secure. - */ - curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L); -#endif - - /* Perform the request, res will get the return code */ - res = curl_easy_perform(curl); - /* Check for errors */ - if(res != CURLE_OK) - fprintf(stderr, "curl_easy_perform() failed: %s\n", - curl_easy_strerror(res)); - - /* always cleanup */ - curl_easy_cleanup(curl); - } - return 0; -} diff --git a/plugins/FTPFileYM/curl/docs/examples/post-callback.c b/plugins/FTPFileYM/curl/docs/examples/post-callback.c deleted file mode 100644 index 3e1cfb0605..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/post-callback.c +++ /dev/null @@ -1,143 +0,0 @@ -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at http://curl.haxx.se/docs/copyright.html. - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the COPYING file. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ***************************************************************************/ -/* An example source code that issues a HTTP POST and we provide the actual - * data through a read callback. - */ -#include <stdio.h> -#include <string.h> -#include <curl/curl.h> - -const char data[]="this is what we post to the silly web server"; - -struct WriteThis { - const char *readptr; - long sizeleft; -}; - -static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *userp) -{ - struct WriteThis *pooh = (struct WriteThis *)userp; - - if(size*nmemb < 1) - return 0; - - if(pooh->sizeleft) { - *(char *)ptr = pooh->readptr[0]; /* copy one single byte */ - pooh->readptr++; /* advance pointer */ - pooh->sizeleft--; /* less data left */ - return 1; /* we return 1 byte at a time! */ - } - - return 0; /* no more data left to deliver */ -} - -int main(void) -{ - CURL *curl; - CURLcode res; - - struct WriteThis pooh; - - pooh.readptr = data; - pooh.sizeleft = (long)strlen(data); - - /* In windows, this will init the winsock stuff */ - res = curl_global_init(CURL_GLOBAL_DEFAULT); - /* Check for errors */ - if(res != CURLE_OK) { - fprintf(stderr, "curl_global_init() failed: %s\n", - curl_easy_strerror(res)); - return 1; - } - - /* get a curl handle */ - curl = curl_easy_init(); - if(curl) { - /* First set the URL that is about to receive our POST. */ - curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/index.cgi"); - - /* Now specify we want to POST data */ - curl_easy_setopt(curl, CURLOPT_POST, 1L); - - /* we want to use our own read function */ - curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_callback); - - /* pointer to pass to our read function */ - curl_easy_setopt(curl, CURLOPT_READDATA, &pooh); - - /* get verbose debug output please */ - curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); - - /* - If you use POST to a HTTP 1.1 server, you can send data without knowing - the size before starting the POST if you use chunked encoding. You - enable this by adding a header like "Transfer-Encoding: chunked" with - CURLOPT_HTTPHEADER. With HTTP 1.0 or without chunked transfer, you must - specify the size in the request. - */ -#ifdef USE_CHUNKED - { - struct curl_slist *chunk = NULL; - - chunk = curl_slist_append(chunk, "Transfer-Encoding: chunked"); - res = curl_easy_setopt(curl, CURLOPT_HTTPHEADER, chunk); - /* use curl_slist_free_all() after the *perform() call to free this - list again */ - } -#else - /* Set the expected POST size. If you want to POST large amounts of data, - consider CURLOPT_POSTFIELDSIZE_LARGE */ - curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, pooh.sizeleft); -#endif - -#ifdef DISABLE_EXPECT - /* - Using POST with HTTP 1.1 implies the use of a "Expect: 100-continue" - header. You can disable this header with CURLOPT_HTTPHEADER as usual. - NOTE: if you want chunked transfer too, you need to combine these two - since you can only set one list of headers with CURLOPT_HTTPHEADER. */ - - /* A less good option would be to enforce HTTP 1.0, but that might also - have other implications. */ - { - struct curl_slist *chunk = NULL; - - chunk = curl_slist_append(chunk, "Expect:"); - res = curl_easy_setopt(curl, CURLOPT_HTTPHEADER, chunk); - /* use curl_slist_free_all() after the *perform() call to free this - list again */ - } -#endif - - /* Perform the request, res will get the return code */ - res = curl_easy_perform(curl); - /* Check for errors */ - if(res != CURLE_OK) - fprintf(stderr, "curl_easy_perform() failed: %s\n", - curl_easy_strerror(res)); - - /* always cleanup */ - curl_easy_cleanup(curl); - } - curl_global_cleanup(); - return 0; -} diff --git a/plugins/FTPFileYM/curl/docs/examples/postit2.c b/plugins/FTPFileYM/curl/docs/examples/postit2.c deleted file mode 100644 index 67dcc1330b..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/postit2.c +++ /dev/null @@ -1,103 +0,0 @@ -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at http://curl.haxx.se/docs/copyright.html. - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the COPYING file. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ***************************************************************************/ -/* Example code that uploads a file name 'foo' to a remote script that accepts - * "HTML form based" (as described in RFC1738) uploads using HTTP POST. - * - * The imaginary form we'll fill in looks like: - * - * <form method="post" enctype="multipart/form-data" action="examplepost.cgi"> - * Enter file: <input type="file" name="sendfile" size="40"> - * Enter file name: <input type="text" name="filename" size="30"> - * <input type="submit" value="send" name="submit"> - * </form> - * - * This exact source code has not been verified to work. - */ - -#include <stdio.h> -#include <string.h> - -#include <curl/curl.h> - -int main(int argc, char *argv[]) -{ - CURL *curl; - CURLcode res; - - struct curl_httppost *formpost=NULL; - struct curl_httppost *lastptr=NULL; - struct curl_slist *headerlist=NULL; - static const char buf[] = "Expect:"; - - curl_global_init(CURL_GLOBAL_ALL); - - /* Fill in the file upload field */ - curl_formadd(&formpost, - &lastptr, - CURLFORM_COPYNAME, "sendfile", - CURLFORM_FILE, "postit2.c", - CURLFORM_END); - - /* Fill in the filename field */ - curl_formadd(&formpost, - &lastptr, - CURLFORM_COPYNAME, "filename", - CURLFORM_COPYCONTENTS, "postit2.c", - CURLFORM_END); - - - /* Fill in the submit field too, even if this is rarely needed */ - curl_formadd(&formpost, - &lastptr, - CURLFORM_COPYNAME, "submit", - CURLFORM_COPYCONTENTS, "send", - CURLFORM_END); - - curl = curl_easy_init(); - /* initalize custom header list (stating that Expect: 100-continue is not - wanted */ - headerlist = curl_slist_append(headerlist, buf); - if(curl) { - /* what URL that receives this POST */ - curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/examplepost.cgi"); - if ( (argc == 2) && (!strcmp(argv[1], "noexpectheader")) ) - /* only disable 100-continue header if explicitly requested */ - curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headerlist); - curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost); - - /* Perform the request, res will get the return code */ - res = curl_easy_perform(curl); - /* Check for errors */ - if(res != CURLE_OK) - fprintf(stderr, "curl_easy_perform() failed: %s\n", - curl_easy_strerror(res)); - - /* always cleanup */ - curl_easy_cleanup(curl); - - /* then cleanup the formpost chain */ - curl_formfree(formpost); - /* free slist */ - curl_slist_free_all (headerlist); - } - return 0; -} diff --git a/plugins/FTPFileYM/curl/docs/examples/progressfunc.c b/plugins/FTPFileYM/curl/docs/examples/progressfunc.c deleted file mode 100644 index 51a9c9b5e5..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/progressfunc.c +++ /dev/null @@ -1,84 +0,0 @@ -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at http://curl.haxx.se/docs/copyright.html. - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the COPYING file. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ***************************************************************************/ -#include <stdio.h> -#include <curl/curl.h> - -#define STOP_DOWNLOAD_AFTER_THIS_MANY_BYTES 6000 -#define MINIMAL_PROGRESS_FUNCTIONALITY_INTERVAL 3 - -struct myprogress { - double lastruntime; - CURL *curl; -}; - -static int progress(void *p, - double dltotal, double dlnow, - double ultotal, double ulnow) -{ - struct myprogress *myp = (struct myprogress *)p; - CURL *curl = myp->curl; - double curtime = 0; - - curl_easy_getinfo(curl, CURLINFO_TOTAL_TIME, &curtime); - - /* under certain circumstances it may be desirable for certain functionality - to only run every N seconds, in order to do this the transaction time can - be used */ - if((curtime - myp->lastruntime) >= MINIMAL_PROGRESS_FUNCTIONALITY_INTERVAL) { - myp->lastruntime = curtime; - fprintf(stderr, "TOTAL TIME: %f \r\n", curtime); - } - - fprintf(stderr, "UP: %g of %g DOWN: %g of %g\r\n", - ulnow, ultotal, dlnow, dltotal); - - if(dlnow > STOP_DOWNLOAD_AFTER_THIS_MANY_BYTES) - return 1; - return 0; -} - -int main(void) -{ - CURL *curl; - CURLcode res = CURLE_OK; - struct myprogress prog; - - curl = curl_easy_init(); - if(curl) { - prog.lastruntime = 0; - prog.curl = curl; - - curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/"); - curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, progress); - /* pass the struct pointer into the progress function */ - curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, &prog); - curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0L); - res = curl_easy_perform(curl); - - if(res != CURLE_OK) - fprintf(stderr, "%s\n", curl_easy_strerror(res)); - - /* always cleanup */ - curl_easy_cleanup(curl); - } - return (int)res; -} diff --git a/plugins/FTPFileYM/curl/docs/examples/rtsp.c b/plugins/FTPFileYM/curl/docs/examples/rtsp.c deleted file mode 100644 index 669780a9bc..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/rtsp.c +++ /dev/null @@ -1,271 +0,0 @@ -/* - * Copyright (c) 2011, Jim Hollinger - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Jim Hollinger nor the names of its contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#if defined (WIN32) -# include <conio.h> /* _getch() */ -#else -# include <termios.h> -# include <unistd.h> - -static int _getch(void) -{ - struct termios oldt, newt; - int ch; - tcgetattr( STDIN_FILENO, &oldt ); - newt = oldt; - newt.c_lflag &= ~( ICANON | ECHO ); - tcsetattr( STDIN_FILENO, TCSANOW, &newt ); - ch = getchar(); - tcsetattr( STDIN_FILENO, TCSANOW, &oldt ); - return ch; -} -#endif - -#include <curl/curl.h> - -#define VERSION_STR "V1.0" - -/* error handling macros */ -#define my_curl_easy_setopt(A, B, C) \ - if ((res = curl_easy_setopt((A), (B), (C))) != CURLE_OK) \ - fprintf(stderr, "curl_easy_setopt(%s, %s, %s) failed: %d\n", \ - #A, #B, #C, res); - -#define my_curl_easy_perform(A) \ - if ((res = curl_easy_perform((A))) != CURLE_OK) \ - fprintf(stderr, "curl_easy_perform(%s) failed: %d\n", #A, res); - - -/* send RTSP OPTIONS request */ -static void rtsp_options(CURL *curl, const char *uri) -{ - CURLcode res = CURLE_OK; - printf("\nRTSP: OPTIONS %s\n", uri); - my_curl_easy_setopt(curl, CURLOPT_RTSP_STREAM_URI, uri); - my_curl_easy_setopt(curl, CURLOPT_RTSP_REQUEST, (long)CURL_RTSPREQ_OPTIONS); - my_curl_easy_perform(curl); -} - - -/* send RTSP DESCRIBE request and write sdp response to a file */ -static void rtsp_describe(CURL *curl, const char *uri, - const char *sdp_filename) -{ - CURLcode res = CURLE_OK; - FILE *sdp_fp = fopen(sdp_filename, "wt"); - printf("\nRTSP: DESCRIBE %s\n", uri); - if (sdp_fp == NULL) { - fprintf(stderr, "Could not open '%s' for writing\n", sdp_filename); - sdp_fp = stdout; - } - else { - printf("Writing SDP to '%s'\n", sdp_filename); - } - my_curl_easy_setopt(curl, CURLOPT_WRITEDATA, sdp_fp); - my_curl_easy_setopt(curl, CURLOPT_RTSP_REQUEST, (long)CURL_RTSPREQ_DESCRIBE); - my_curl_easy_perform(curl); - my_curl_easy_setopt(curl, CURLOPT_WRITEDATA, stdout); - if (sdp_fp != stdout) { - fclose(sdp_fp); - } -} - -/* send RTSP SETUP request */ -static void rtsp_setup(CURL *curl, const char *uri, const char *transport) -{ - CURLcode res = CURLE_OK; - printf("\nRTSP: SETUP %s\n", uri); - printf(" TRANSPORT %s\n", transport); - my_curl_easy_setopt(curl, CURLOPT_RTSP_STREAM_URI, uri); - my_curl_easy_setopt(curl, CURLOPT_RTSP_TRANSPORT, transport); - my_curl_easy_setopt(curl, CURLOPT_RTSP_REQUEST, (long)CURL_RTSPREQ_SETUP); - my_curl_easy_perform(curl); -} - - -/* send RTSP PLAY request */ -static void rtsp_play(CURL *curl, const char *uri, const char *range) -{ - CURLcode res = CURLE_OK; - printf("\nRTSP: PLAY %s\n", uri); - my_curl_easy_setopt(curl, CURLOPT_RTSP_STREAM_URI, uri); - my_curl_easy_setopt(curl, CURLOPT_RANGE, range); - my_curl_easy_setopt(curl, CURLOPT_RTSP_REQUEST, (long)CURL_RTSPREQ_PLAY); - my_curl_easy_perform(curl); -} - - -/* send RTSP TEARDOWN request */ -static void rtsp_teardown(CURL *curl, const char *uri) -{ - CURLcode res = CURLE_OK; - printf("\nRTSP: TEARDOWN %s\n", uri); - my_curl_easy_setopt(curl, CURLOPT_RTSP_REQUEST, (long)CURL_RTSPREQ_TEARDOWN); - my_curl_easy_perform(curl); -} - - -/* convert url into an sdp filename */ -static void get_sdp_filename(const char *url, char *sdp_filename) -{ - const char *s = strrchr(url, '/'); - strcpy(sdp_filename, "video.sdp"); - if (s != NULL) { - s++; - if (s[0] != '\0') { - sprintf(sdp_filename, "%s.sdp", s); - } - } -} - - -/* scan sdp file for media control attribute */ -static void get_media_control_attribute(const char *sdp_filename, - char *control) -{ - int max_len = 256; - char *s = malloc(max_len); - FILE *sdp_fp = fopen(sdp_filename, "rt"); - control[0] = '\0'; - if (sdp_fp != NULL) { - while (fgets(s, max_len - 2, sdp_fp) != NULL) { - sscanf(s, " a = control: %s", control); - } - fclose(sdp_fp); - } - free(s); -} - - -/* main app */ -int main(int argc, char * const argv[]) -{ -#if 1 - const char *transport = "RTP/AVP;unicast;client_port=1234-1235"; /* UDP */ -#else - const char *transport = "RTP/AVP/TCP;unicast;client_port=1234-1235"; /* TCP */ -#endif - const char *range = "0.000-"; - int rc = EXIT_SUCCESS; - char *base_name = NULL; - - printf("\nRTSP request %s\n", VERSION_STR); - printf(" Project web site: http://code.google.com/p/rtsprequest/\n"); - printf(" Requires cURL V7.20 or greater\n\n"); - - /* check command line */ - if ((argc != 2) && (argc != 3)) { - base_name = strrchr(argv[0], '/'); - if (base_name == NULL) { - base_name = strrchr(argv[0], '\\'); - } - if (base_name == NULL) { - base_name = argv[0]; - } else { - base_name++; - } - printf("Usage: %s url [transport]\n", base_name); - printf(" url of video server\n"); - printf(" transport (optional) specifier for media stream protocol\n"); - printf(" default transport: %s\n", transport); - printf("Example: %s rtsp://192.168.0.2/media/video1\n\n", base_name); - rc = EXIT_FAILURE; - } else { - const char *url = argv[1]; - char *uri = malloc(strlen(url) + 32); - char *sdp_filename = malloc(strlen(url) + 32); - char *control = malloc(strlen(url) + 32); - CURLcode res; - get_sdp_filename(url, sdp_filename); - if (argc == 3) { - transport = argv[2]; - } - - /* initialize curl */ - res = curl_global_init(CURL_GLOBAL_ALL); - if (res == CURLE_OK) { - curl_version_info_data *data = curl_version_info(CURLVERSION_NOW); - CURL *curl; - fprintf(stderr, " cURL V%s loaded\n", data->version); - - /* initialize this curl session */ - curl = curl_easy_init(); - if (curl != NULL) { - my_curl_easy_setopt(curl, CURLOPT_VERBOSE, 0L); - my_curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 1L); - my_curl_easy_setopt(curl, CURLOPT_WRITEHEADER, stdout); - my_curl_easy_setopt(curl, CURLOPT_URL, url); - - /* request server options */ - sprintf(uri, "%s", url); - rtsp_options(curl, uri); - - /* request session description and write response to sdp file */ - rtsp_describe(curl, uri, sdp_filename); - - /* get media control attribute from sdp file */ - get_media_control_attribute(sdp_filename, control); - - /* setup media stream */ - sprintf(uri, "%s/%s", url, control); - rtsp_setup(curl, uri, transport); - - /* start playing media stream */ - sprintf(uri, "%s/", url); - rtsp_play(curl, uri, range); - printf("Playing video, press any key to stop ..."); - _getch(); - printf("\n"); - - /* teardown session */ - rtsp_teardown(curl, uri); - - /* cleanup */ - curl_easy_cleanup(curl); - curl = NULL; - } else { - fprintf(stderr, "curl_easy_init() failed\n"); - } - curl_global_cleanup(); - } else { - fprintf(stderr, "curl_global_init(%s) failed: %d\n", - "CURL_GLOBAL_ALL", res); - } - free(control); - free(sdp_filename); - free(uri); - } - - return rc; -} diff --git a/plugins/FTPFileYM/curl/docs/examples/sampleconv.c b/plugins/FTPFileYM/curl/docs/examples/sampleconv.c deleted file mode 100644 index 3db316096c..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/sampleconv.c +++ /dev/null @@ -1,107 +0,0 @@ -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at http://curl.haxx.se/docs/copyright.html. - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the COPYING file. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ***************************************************************************/ -/* - This is a simple example showing how a program on a non-ASCII platform - would invoke callbacks to do its own codeset conversions instead of - using the built-in iconv functions in libcurl. - - The IBM-1047 EBCDIC codeset is used for this example but the code - would be similar for other non-ASCII codesets. - - Three callback functions are created below: - my_conv_from_ascii_to_ebcdic, - my_conv_from_ebcdic_to_ascii, and - my_conv_from_utf8_to_ebcdic - - The "platform_xxx" calls represent platform-specific conversion routines. - - */ - -#include <stdio.h> -#include <curl/curl.h> - -CURLcode my_conv_from_ascii_to_ebcdic(char *buffer, size_t length) -{ - char *tempptrin, *tempptrout; - size_t bytes = length; - int rc; - tempptrin = tempptrout = buffer; - rc = platform_a2e(&tempptrin, &bytes, &tempptrout, &bytes); - if (rc == PLATFORM_CONV_OK) { - return(CURLE_OK); - } else { - return(CURLE_CONV_FAILED); - } -} - -CURLcode my_conv_from_ebcdic_to_ascii(char *buffer, size_t length) -{ - char *tempptrin, *tempptrout; - size_t bytes = length; - int rc; - tempptrin = tempptrout = buffer; - rc = platform_e2a(&tempptrin, &bytes, &tempptrout, &bytes); - if (rc == PLATFORM_CONV_OK) { - return(CURLE_OK); - } else { - return(CURLE_CONV_FAILED); - } -} - -CURLcode my_conv_from_utf8_to_ebcdic(char *buffer, size_t length) -{ - char *tempptrin, *tempptrout; - size_t bytes = length; - int rc; - tempptrin = tempptrout = buffer; - rc = platform_u2e(&tempptrin, &bytes, &tempptrout, &bytes); - if (rc == PLATFORM_CONV_OK) { - return(CURLE_OK); - } else { - return(CURLE_CONV_FAILED); - } -} - -int main(void) -{ - CURL *curl; - CURLcode res; - - curl = curl_easy_init(); - if(curl) { - curl_easy_setopt(curl, CURLOPT_URL, "http://example.com"); - - /* use platform-specific functions for codeset conversions */ - curl_easy_setopt(curl, CURLOPT_CONV_FROM_NETWORK_FUNCTION, - my_conv_from_ascii_to_ebcdic); - curl_easy_setopt(curl, CURLOPT_CONV_TO_NETWORK_FUNCTION, - my_conv_from_ebcdic_to_ascii); - curl_easy_setopt(curl, CURLOPT_CONV_FROM_UTF8_FUNCTION, - my_conv_from_utf8_to_ebcdic); - - res = curl_easy_perform(curl); - - /* always cleanup */ - curl_easy_cleanup(curl); - } - return 0; -} diff --git a/plugins/FTPFileYM/curl/docs/examples/sendrecv.c b/plugins/FTPFileYM/curl/docs/examples/sendrecv.c deleted file mode 100644 index 88fddf59f8..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/sendrecv.c +++ /dev/null @@ -1,135 +0,0 @@ -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at http://curl.haxx.se/docs/copyright.html. - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the COPYING file. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ***************************************************************************/ -/* An example of curl_easy_send() and curl_easy_recv() usage. */ - -#include <stdio.h> -#include <string.h> -#include <curl/curl.h> - -/* Auxiliary function that waits on the socket. */ -static int wait_on_socket(curl_socket_t sockfd, int for_recv, long timeout_ms) -{ - struct timeval tv; - fd_set infd, outfd, errfd; - int res; - - tv.tv_sec = timeout_ms / 1000; - tv.tv_usec= (timeout_ms % 1000) * 1000; - - FD_ZERO(&infd); - FD_ZERO(&outfd); - FD_ZERO(&errfd); - - FD_SET(sockfd, &errfd); /* always check for error */ - - if(for_recv) - { - FD_SET(sockfd, &infd); - } - else - { - FD_SET(sockfd, &outfd); - } - - /* select() returns the number of signalled sockets or -1 */ - res = select(sockfd + 1, &infd, &outfd, &errfd, &tv); - return res; -} - -int main(void) -{ - CURL *curl; - CURLcode res; - /* Minimalistic http request */ - const char *request = "GET / HTTP/1.0\r\nHost: example.com\r\n\r\n"; - curl_socket_t sockfd; /* socket */ - long sockextr; - size_t iolen; - curl_off_t nread; - - curl = curl_easy_init(); - if(curl) { - curl_easy_setopt(curl, CURLOPT_URL, "http://example.com"); - /* Do not do the transfer - only connect to host */ - curl_easy_setopt(curl, CURLOPT_CONNECT_ONLY, 1L); - res = curl_easy_perform(curl); - - if(CURLE_OK != res) - { - printf("Error: %s\n", strerror(res)); - return 1; - } - - /* Extract the socket from the curl handle - we'll need it for waiting. - * Note that this API takes a pointer to a 'long' while we use - * curl_socket_t for sockets otherwise. - */ - res = curl_easy_getinfo(curl, CURLINFO_LASTSOCKET, &sockextr); - - if(CURLE_OK != res) - { - printf("Error: %s\n", curl_easy_strerror(res)); - return 1; - } - - sockfd = sockextr; - - /* wait for the socket to become ready for sending */ - if(!wait_on_socket(sockfd, 0, 60000L)) - { - printf("Error: timeout.\n"); - return 1; - } - - puts("Sending request."); - /* Send the request. Real applications should check the iolen - * to see if all the request has been sent */ - res = curl_easy_send(curl, request, strlen(request), &iolen); - - if(CURLE_OK != res) - { - printf("Error: %s\n", curl_easy_strerror(res)); - return 1; - } - puts("Reading response."); - - /* read the response */ - for(;;) - { - char buf[1024]; - - wait_on_socket(sockfd, 1, 60000L); - res = curl_easy_recv(curl, buf, 1024, &iolen); - - if(CURLE_OK != res) - break; - - nread = (curl_off_t)iolen; - - printf("Received %" CURL_FORMAT_CURL_OFF_T " bytes.\n", nread); - } - - /* always cleanup */ - curl_easy_cleanup(curl); - } - return 0; -} diff --git a/plugins/FTPFileYM/curl/docs/examples/sepheaders.c b/plugins/FTPFileYM/curl/docs/examples/sepheaders.c deleted file mode 100644 index afa14fc85f..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/sepheaders.c +++ /dev/null @@ -1,85 +0,0 @@ -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at http://curl.haxx.se/docs/copyright.html. - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the COPYING file. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ***************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> - -#include <curl/curl.h> - -static size_t write_data(void *ptr, size_t size, size_t nmemb, void *stream) -{ - int written = fwrite(ptr, size, nmemb, (FILE *)stream); - return written; -} - -int main(void) -{ - CURL *curl_handle; - static const char *headerfilename = "head.out"; - FILE *headerfile; - static const char *bodyfilename = "body.out"; - FILE *bodyfile; - - curl_global_init(CURL_GLOBAL_ALL); - - /* init the curl session */ - curl_handle = curl_easy_init(); - - /* set URL to get */ - curl_easy_setopt(curl_handle, CURLOPT_URL, "http://example.com"); - - /* no progress meter please */ - curl_easy_setopt(curl_handle, CURLOPT_NOPROGRESS, 1L); - - /* send all data to this function */ - curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, write_data); - - /* open the files */ - headerfile = fopen(headerfilename,"w"); - if (headerfile == NULL) { - curl_easy_cleanup(curl_handle); - return -1; - } - bodyfile = fopen(bodyfilename,"w"); - if (bodyfile == NULL) { - curl_easy_cleanup(curl_handle); - return -1; - } - - /* we want the headers to this file handle */ - curl_easy_setopt(curl_handle, CURLOPT_WRITEHEADER, headerfile); - - /* - * Notice here that if you want the actual data sent anywhere else but - * stdout, you should consider using the CURLOPT_WRITEDATA option. */ - - /* get it! */ - curl_easy_perform(curl_handle); - - /* close the header file */ - fclose(headerfile); - - /* cleanup curl stuff */ - curl_easy_cleanup(curl_handle); - - return 0; -} diff --git a/plugins/FTPFileYM/curl/docs/examples/sftpget.c b/plugins/FTPFileYM/curl/docs/examples/sftpget.c deleted file mode 100644 index 8317462e9c..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/sftpget.c +++ /dev/null @@ -1,106 +0,0 @@ -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at http://curl.haxx.se/docs/copyright.html. - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the COPYING file. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ***************************************************************************/ - -#include <stdio.h> - -#include <curl/curl.h> - -/* define this to switch off the use of ssh-agent in this program */ -#undef DISABLE_SSH_AGENT - -/* - * This is an example showing how to get a single file from an SFTP server. - * It delays the actual destination file creation until the first write - * callback so that it won't create an empty file in case the remote file - * doesn't exist or something else fails. - */ - -struct FtpFile { - const char *filename; - FILE *stream; -}; - -static size_t my_fwrite(void *buffer, size_t size, size_t nmemb, - void *stream) -{ - struct FtpFile *out=(struct FtpFile *)stream; - if(out && !out->stream) { - /* open file for writing */ - out->stream=fopen(out->filename, "wb"); - if(!out->stream) - return -1; /* failure, can't open file to write */ - } - return fwrite(buffer, size, nmemb, out->stream); -} - - -int main(void) -{ - CURL *curl; - CURLcode res; - struct FtpFile ftpfile={ - "yourfile.bin", /* name to store the file as if succesful */ - NULL - }; - - curl_global_init(CURL_GLOBAL_DEFAULT); - - curl = curl_easy_init(); - if(curl) { - /* - * You better replace the URL with one that works! - */ - curl_easy_setopt(curl, CURLOPT_URL, - "sftp://user@server/home/user/file.txt"); - /* Define our callback to get called when there's data to be written */ - curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, my_fwrite); - /* Set a pointer to our struct to pass to the callback */ - curl_easy_setopt(curl, CURLOPT_WRITEDATA, &ftpfile); - -#ifndef DISABLE_SSH_AGENT - /* We activate ssh agent. For this to work you need - to have ssh-agent running (type set | grep SSH_AGENT to check) or - pageant on Windows (there is an icon in systray if so) */ - curl_easy_setopt(curl, CURLOPT_SSH_AUTH_TYPES, CURLSSH_AUTH_AGENT); -#endif - - /* Switch on full protocol/debug output */ - curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); - - res = curl_easy_perform(curl); - - /* always cleanup */ - curl_easy_cleanup(curl); - - if(CURLE_OK != res) { - /* we failed */ - fprintf(stderr, "curl told us %d\n", res); - } - } - - if(ftpfile.stream) - fclose(ftpfile.stream); /* close the local file */ - - curl_global_cleanup(); - - return 0; -} diff --git a/plugins/FTPFileYM/curl/docs/examples/simplepost.c b/plugins/FTPFileYM/curl/docs/examples/simplepost.c deleted file mode 100644 index 8657771f46..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/simplepost.c +++ /dev/null @@ -1,53 +0,0 @@ -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at http://curl.haxx.se/docs/copyright.html. - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the COPYING file. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ***************************************************************************/ -#include <stdio.h> -#include <string.h> -#include <curl/curl.h> - -int main(void) -{ - CURL *curl; - CURLcode res; - - static const char *postthis="moo mooo moo moo"; - - curl = curl_easy_init(); - if(curl) { - curl_easy_setopt(curl, CURLOPT_URL, "http://example.com"); - curl_easy_setopt(curl, CURLOPT_POSTFIELDS, postthis); - - /* if we don't provide POSTFIELDSIZE, libcurl will strlen() by - itself */ - curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, (long)strlen(postthis)); - - /* Perform the request, res will get the return code */ - res = curl_easy_perform(curl); - /* Check for errors */ - if(res != CURLE_OK) - fprintf(stderr, "curl_easy_perform() failed: %s\n", - curl_easy_strerror(res)); - - /* always cleanup */ - curl_easy_cleanup(curl); - } - return 0; -} diff --git a/plugins/FTPFileYM/curl/docs/examples/simplesmtp.c b/plugins/FTPFileYM/curl/docs/examples/simplesmtp.c deleted file mode 100644 index df85162424..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/simplesmtp.c +++ /dev/null @@ -1,87 +0,0 @@ -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at http://curl.haxx.se/docs/copyright.html. - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the COPYING file. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ***************************************************************************/ -#include <stdio.h> -#include <string.h> -#include <curl/curl.h> - -int main(void) -{ - CURL *curl; - CURLcode res; - struct curl_slist *recipients = NULL; - - /* value for envelope reverse-path */ - static const char *from = "<bradh@example.com>"; - - /* this becomes the envelope forward-path */ - static const char *to = "<bradh@example.net>"; - - curl = curl_easy_init(); - if(curl) { - /* this is the URL for your mailserver - you can also use an smtps:// URL - * here */ - curl_easy_setopt(curl, CURLOPT_URL, "smtp://mail.example.net."); - - /* Note that this option isn't strictly required, omitting it will result in - * libcurl will sent the MAIL FROM command with no sender data. All - * autoresponses should have an empty reverse-path, and should be directed - * to the address in the reverse-path which triggered them. Otherwise, they - * could cause an endless loop. See RFC 5321 Section 4.5.5 for more details. - */ - curl_easy_setopt(curl, CURLOPT_MAIL_FROM, from); - - /* Note that the CURLOPT_MAIL_RCPT takes a list, not a char array. */ - recipients = curl_slist_append(recipients, to); - curl_easy_setopt(curl, CURLOPT_MAIL_RCPT, recipients); - - /* You provide the payload (headers and the body of the message) as the - * "data" element. There are two choices, either: - * - provide a callback function and specify the function name using the - * CURLOPT_READFUNCTION option; or - * - just provide a FILE pointer that can be used to read the data from. - * The easiest case is just to read from standard input, (which is available - * as a FILE pointer) as shown here. - */ - curl_easy_setopt(curl, CURLOPT_READDATA, stdin); - - /* send the message (including headers) */ - res = curl_easy_perform(curl); - /* Check for errors */ - if(res != CURLE_OK) - fprintf(stderr, "curl_easy_perform() failed: %s\n", - curl_easy_strerror(res)); - - /* free the list of recipients */ - curl_slist_free_all(recipients); - - /* curl won't send the QUIT command until you call cleanup, so you should be - * able to re-use this connection for additional messages (setting - * CURLOPT_MAIL_FROM and CURLOPT_MAIL_RCPT as required, and calling - * curl_easy_perform() again. It may not be a good idea to keep the - * connection open for a very long time though (more than a few minutes may - * result in the server timing out the connection), and you do want to clean - * up in the end. - */ - curl_easy_cleanup(curl); - } - return 0; -} diff --git a/plugins/FTPFileYM/curl/docs/examples/simplessl.c b/plugins/FTPFileYM/curl/docs/examples/simplessl.c deleted file mode 100644 index 74c58461a6..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/simplessl.c +++ /dev/null @@ -1,138 +0,0 @@ -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at http://curl.haxx.se/docs/copyright.html. - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the COPYING file. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ***************************************************************************/ -#include <stdio.h> - -#include <curl/curl.h> - -/* some requirements for this to work: - 1. set pCertFile to the file with the client certificate - 2. if the key is passphrase protected, set pPassphrase to the - passphrase you use - 3. if you are using a crypto engine: - 3.1. set a #define USE_ENGINE - 3.2. set pEngine to the name of the crypto engine you use - 3.3. set pKeyName to the key identifier you want to use - 4. if you don't use a crypto engine: - 4.1. set pKeyName to the file name of your client key - 4.2. if the format of the key file is DER, set pKeyType to "DER" - - !! verify of the server certificate is not implemented here !! - - **** This example only works with libcurl 7.9.3 and later! **** - -*/ - -int main(void) -{ - int i; - CURL *curl; - CURLcode res; - FILE *headerfile; - const char *pPassphrase = NULL; - - static const char *pCertFile = "testcert.pem"; - static const char *pCACertFile="cacert.pem"; - - const char *pKeyName; - const char *pKeyType; - - const char *pEngine; - -#ifdef USE_ENGINE - pKeyName = "rsa_test"; - pKeyType = "ENG"; - pEngine = "chil"; /* for nChiper HSM... */ -#else - pKeyName = "testkey.pem"; - pKeyType = "PEM"; - pEngine = NULL; -#endif - - headerfile = fopen("dumpit", "w"); - - curl_global_init(CURL_GLOBAL_DEFAULT); - - curl = curl_easy_init(); - if(curl) { - /* what call to write: */ - curl_easy_setopt(curl, CURLOPT_URL, "HTTPS://your.favourite.ssl.site"); - curl_easy_setopt(curl, CURLOPT_WRITEHEADER, headerfile); - - for(i = 0; i < 1; i++) /* single-iteration loop, just to break out from */ - { - if (pEngine) /* use crypto engine */ - { - if (curl_easy_setopt(curl, CURLOPT_SSLENGINE,pEngine) != CURLE_OK) - { /* load the crypto engine */ - fprintf(stderr,"can't set crypto engine\n"); - break; - } - if (curl_easy_setopt(curl, CURLOPT_SSLENGINE_DEFAULT,1L) != CURLE_OK) - { /* set the crypto engine as default */ - /* only needed for the first time you load - a engine in a curl object... */ - fprintf(stderr,"can't set crypto engine as default\n"); - break; - } - } - /* cert is stored PEM coded in file... */ - /* since PEM is default, we needn't set it for PEM */ - curl_easy_setopt(curl,CURLOPT_SSLCERTTYPE,"PEM"); - - /* set the cert for client authentication */ - curl_easy_setopt(curl,CURLOPT_SSLCERT,pCertFile); - - /* sorry, for engine we must set the passphrase - (if the key has one...) */ - if (pPassphrase) - curl_easy_setopt(curl,CURLOPT_KEYPASSWD,pPassphrase); - - /* if we use a key stored in a crypto engine, - we must set the key type to "ENG" */ - curl_easy_setopt(curl,CURLOPT_SSLKEYTYPE,pKeyType); - - /* set the private key (file or ID in engine) */ - curl_easy_setopt(curl,CURLOPT_SSLKEY,pKeyName); - - /* set the file with the certs vaildating the server */ - curl_easy_setopt(curl,CURLOPT_CAINFO,pCACertFile); - - /* disconnect if we can't validate server's cert */ - curl_easy_setopt(curl,CURLOPT_SSL_VERIFYPEER,1L); - - /* Perform the request, res will get the return code */ - res = curl_easy_perform(curl); - /* Check for errors */ - if(res != CURLE_OK) - fprintf(stderr, "curl_easy_perform() failed: %s\n", - curl_easy_strerror(res)); - - /* we are done... */ - } - /* always cleanup */ - curl_easy_cleanup(curl); - } - - curl_global_cleanup(); - - return 0; -} diff --git a/plugins/FTPFileYM/curl/docs/examples/smooth-gtk-thread.c b/plugins/FTPFileYM/curl/docs/examples/smooth-gtk-thread.c deleted file mode 100644 index 932f6e3963..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/smooth-gtk-thread.c +++ /dev/null @@ -1,228 +0,0 @@ -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at http://curl.haxx.se/docs/copyright.html. - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the COPYING file. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ***************************************************************************/ -/* This is a multi threaded application that uses a progress bar to show - * status. It uses Gtk+ to make a smooth pulse. - * - * Written by Jud Bishop after studying the other examples provided with - * libcurl. - * - * To compile (on a single line): - * gcc -ggdb `pkg-config --cflags --libs gtk+-2.0` -lcurl -lssl -lcrypto - * -lgthread-2.0 -dl smooth-gtk-thread.c -o smooth-gtk-thread - */ - -#include <stdio.h> -#include <gtk/gtk.h> -#include <glib.h> -#include <unistd.h> -#include <pthread.h> - -#include <curl/curl.h> - -#define NUMT 4 - -pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; -int j = 0; -gint num_urls = 9; /* Just make sure this is less than urls[]*/ -const char * const urls[]= { - "90022", - "90023", - "90024", - "90025", - "90026", - "90027", - "90028", - "90029", - "90030" -}; - -size_t write_file(void *ptr, size_t size, size_t nmemb, FILE *stream) -{ - /* printf("write_file\n"); */ - return fwrite(ptr, size, nmemb, stream); -} - -/* http://xoap.weather.com/weather/local/46214?cc=*&dayf=5&unit=i */ -void *pull_one_url(void *NaN) -{ - CURL *curl; - CURLcode res; - gchar *http; - FILE *outfile; - - /* Stop threads from entering unless j is incremented */ - pthread_mutex_lock(&lock); - while ( j < num_urls ) - { - printf("j = %d\n", j); - - http = - g_strdup_printf("xoap.weather.com/weather/local/%s?cc=*&dayf=5&unit=i\n", - urls[j]); - - printf( "http %s", http ); - - curl = curl_easy_init(); - if(curl) - { - - outfile = fopen(urls[j], "w"); - /* printf("fopen\n"); */ - - /* Set the URL and transfer type */ - curl_easy_setopt(curl, CURLOPT_URL, http); - - /* Write to the file */ - curl_easy_setopt(curl, CURLOPT_WRITEDATA, outfile); - curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_file); - - j++; /* critical line */ - pthread_mutex_unlock(&lock); - - res = curl_easy_perform(curl); - - fclose(outfile); - printf("fclose\n"); - - curl_easy_cleanup(curl); - } - g_free (http); - - /* Adds more latency, testing the mutex.*/ - sleep(1); - - } /* end while */ - return NULL; -} - - -gboolean pulse_bar(gpointer data) -{ - gdk_threads_enter(); - gtk_progress_bar_pulse (GTK_PROGRESS_BAR (data)); - gdk_threads_leave(); - - /* Return true so the function will be called again; - * returning false removes this timeout function. - */ - return TRUE; -} - -void *create_thread(void *progress_bar) -{ - pthread_t tid[NUMT]; - int i; - int error; - - /* Make sure I don't create more threads than urls. */ - for(i=0; i < NUMT && i < num_urls ; i++) { - error = pthread_create(&tid[i], - NULL, /* default attributes please */ - pull_one_url, - NULL); - if(0 != error) - fprintf(stderr, "Couldn't run thread number %d, errno %d\n", i, error); - else - fprintf(stderr, "Thread %d, gets %s\n", i, urls[i]); - } - - /* Wait for all threads to terminate. */ - for(i=0; i < NUMT && i < num_urls; i++) { - error = pthread_join(tid[i], NULL); - fprintf(stderr, "Thread %d terminated\n", i); - } - - /* This stops the pulsing if you have it turned on in the progress bar - section */ - g_source_remove(GPOINTER_TO_INT(g_object_get_data(G_OBJECT(progress_bar), - "pulse_id"))); - - /* This destroys the progress bar */ - gtk_widget_destroy(progress_bar); - - /* [Un]Comment this out to kill the program rather than pushing close. */ - /* gtk_main_quit(); */ - - - return NULL; - -} - -static gboolean cb_delete(GtkWidget *window, gpointer data) -{ - gtk_main_quit(); - return FALSE; -} - -int main(int argc, char **argv) -{ - GtkWidget *top_window, *outside_frame, *inside_frame, *progress_bar; - - /* Must initialize libcurl before any threads are started */ - curl_global_init(CURL_GLOBAL_ALL); - - /* Init thread */ - g_thread_init(NULL); - gdk_threads_init (); - gdk_threads_enter (); - - gtk_init(&argc, &argv); - - /* Base window */ - top_window = gtk_window_new(GTK_WINDOW_TOPLEVEL); - - /* Frame */ - outside_frame = gtk_frame_new(NULL); - gtk_frame_set_shadow_type(GTK_FRAME(outside_frame), GTK_SHADOW_OUT); - gtk_container_add(GTK_CONTAINER(top_window), outside_frame); - - /* Frame */ - inside_frame = gtk_frame_new(NULL); - gtk_frame_set_shadow_type(GTK_FRAME(inside_frame), GTK_SHADOW_IN); - gtk_container_set_border_width(GTK_CONTAINER(inside_frame), 5); - gtk_container_add(GTK_CONTAINER(outside_frame), inside_frame); - - /* Progress bar */ - progress_bar = gtk_progress_bar_new(); - gtk_progress_bar_pulse (GTK_PROGRESS_BAR (progress_bar)); - /* Make uniform pulsing */ - gint pulse_ref = g_timeout_add (300, pulse_bar, progress_bar); - g_object_set_data(G_OBJECT(progress_bar), "pulse_id", - GINT_TO_POINTER(pulse_ref)); - gtk_container_add(GTK_CONTAINER(inside_frame), progress_bar); - - gtk_widget_show_all(top_window); - printf("gtk_widget_show_all\n"); - - g_signal_connect(G_OBJECT (top_window), "delete-event", - G_CALLBACK(cb_delete), NULL); - - if (!g_thread_create(&create_thread, progress_bar, FALSE, NULL) != 0) - g_warning("can't create the thread"); - - gtk_main(); - gdk_threads_leave(); - printf("gdk_threads_leave\n"); - - return 0; -} - diff --git a/plugins/FTPFileYM/curl/docs/examples/smtp-multi.c b/plugins/FTPFileYM/curl/docs/examples/smtp-multi.c deleted file mode 100644 index 6462aff2d5..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/smtp-multi.c +++ /dev/null @@ -1,203 +0,0 @@ -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at http://curl.haxx.se/docs/copyright.html. - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the COPYING file. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ***************************************************************************/ -/* This is an example application source code sending SMTP mail using the - * multi interface. - */ - -#include <string.h> -#include <curl/curl.h> - -/* - * This is the list of basic details you need to tweak to get things right. - */ -#define USERNAME "user@example.com" -#define PASSWORD "123qwerty" -#define SMTPSERVER "smtp.example.com" -#define SMTPPORT ":587" /* it is a colon+port string, but you can set it - to "" to use the default port */ -#define RECIPIENT "<recipient@example.com>" -#define MAILFROM "<realuser@example.com>" - -#define MULTI_PERFORM_HANG_TIMEOUT 60 * 1000 - -/* Note that you should include the actual meta data headers here as well if - you want the mail to have a Subject, another From:, show a To: or whatever - you think your mail should feature! */ -static const char *text[]={ - "one\n", - "two\n", - "three\n", - " Hello, this is CURL email SMTP\n", - NULL -}; - -struct WriteThis { - int counter; -}; - -static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *userp) -{ - struct WriteThis *pooh = (struct WriteThis *)userp; - const char *data; - - if(size*nmemb < 1) - return 0; - - data = text[pooh->counter]; - - if(data) { - size_t len = strlen(data); - memcpy(ptr, data, len); - pooh->counter++; /* advance pointer */ - return len; - } - return 0; /* no more data left to deliver */ -} - -static struct timeval tvnow(void) -{ - /* - ** time() returns the value of time in seconds since the Epoch. - */ - struct timeval now; - now.tv_sec = (long)time(NULL); - now.tv_usec = 0; - return now; -} - -static long tvdiff(struct timeval newer, struct timeval older) -{ - return (newer.tv_sec-older.tv_sec)*1000+ - (newer.tv_usec-older.tv_usec)/1000; -} - -int main(void) -{ - CURL *curl; - CURLM *mcurl; - int still_running = 1; - struct timeval mp_start; - struct WriteThis pooh; - struct curl_slist* rcpt_list = NULL; - - pooh.counter = 0; - - curl_global_init(CURL_GLOBAL_DEFAULT); - - curl = curl_easy_init(); - if(!curl) - return 1; - - mcurl = curl_multi_init(); - if(!mcurl) - return 2; - - rcpt_list = curl_slist_append(rcpt_list, RECIPIENT); - /* more addresses can be added here - rcpt_list = curl_slist_append(rcpt_list, "<others@example.com>"); - */ - - curl_easy_setopt(curl, CURLOPT_URL, "smtp://" SMTPSERVER SMTPPORT); - curl_easy_setopt(curl, CURLOPT_USERNAME, USERNAME); - curl_easy_setopt(curl, CURLOPT_PASSWORD, PASSWORD); - curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_callback); - curl_easy_setopt(curl, CURLOPT_MAIL_FROM, MAILFROM); - curl_easy_setopt(curl, CURLOPT_MAIL_RCPT, rcpt_list); - curl_easy_setopt(curl, CURLOPT_USE_SSL, (long)CURLUSESSL_ALL); - curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L); - curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L); - curl_easy_setopt(curl, CURLOPT_READDATA, &pooh); - curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); - curl_easy_setopt(curl, CURLOPT_SSLVERSION, 0L); - curl_easy_setopt(curl, CURLOPT_SSL_SESSIONID_CACHE, 0L); - curl_multi_add_handle(mcurl, curl); - - mp_start = tvnow(); - - /* we start some action by calling perform right away */ - curl_multi_perform(mcurl, &still_running); - - while(still_running) { - struct timeval timeout; - int rc; /* select() return code */ - - fd_set fdread; - fd_set fdwrite; - fd_set fdexcep; - int maxfd = -1; - - long curl_timeo = -1; - - FD_ZERO(&fdread); - FD_ZERO(&fdwrite); - FD_ZERO(&fdexcep); - - /* set a suitable timeout to play around with */ - timeout.tv_sec = 1; - timeout.tv_usec = 0; - - curl_multi_timeout(mcurl, &curl_timeo); - if(curl_timeo >= 0) { - timeout.tv_sec = curl_timeo / 1000; - if(timeout.tv_sec > 1) - timeout.tv_sec = 1; - else - timeout.tv_usec = (curl_timeo % 1000) * 1000; - } - - /* get file descriptors from the transfers */ - curl_multi_fdset(mcurl, &fdread, &fdwrite, &fdexcep, &maxfd); - - /* In a real-world program you OF COURSE check the return code of the - function calls. On success, the value of maxfd is guaranteed to be - greater or equal than -1. We call select(maxfd + 1, ...), specially in - case of (maxfd == -1), we call select(0, ...), which is basically equal - to sleep. */ - - rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout); - - if (tvdiff(tvnow(), mp_start) > MULTI_PERFORM_HANG_TIMEOUT) { - fprintf(stderr, "ABORTING TEST, since it seems " - "that it would have run forever.\n"); - break; - } - - switch(rc) { - case -1: - /* select error */ - break; - case 0: /* timeout */ - default: /* action */ - curl_multi_perform(mcurl, &still_running); - break; - } - } - - curl_slist_free_all(rcpt_list); - curl_multi_remove_handle(mcurl, curl); - curl_multi_cleanup(mcurl); - curl_easy_cleanup(curl); - curl_global_cleanup(); - return 0; -} - - diff --git a/plugins/FTPFileYM/curl/docs/examples/smtp-tls.c b/plugins/FTPFileYM/curl/docs/examples/smtp-tls.c deleted file mode 100644 index 3635c103f2..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/smtp-tls.c +++ /dev/null @@ -1,152 +0,0 @@ -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at http://curl.haxx.se/docs/copyright.html. - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the COPYING file. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ***************************************************************************/ -#include <stdio.h> -#include <string.h> -#include <curl/curl.h> - -/* This is a simple example showing how to send mail using libcurl's SMTP - * capabilities. It builds on the simplesmtp.c example, adding some - * authentication and transport security. - */ - -#define FROM "<sender@example.org>" -#define TO "<addressee@example.net>" -#define CC "<info@example.org>" - -static const char *payload_text[]={ - "Date: Mon, 29 Nov 2010 21:54:29 +1100\n", - "To: " TO "\n", - "From: " FROM "(Example User)\n", - "Cc: " CC "(Another example User)\n", - "Message-ID: <dcd7cb36-11db-487a-9f3a-e652a9458efd@rfcpedant.example.org>\n", - "Subject: SMTP TLS example message\n", - "\n", /* empty line to divide headers from body, see RFC5322 */ - "The body of the message starts here.\n", - "\n", - "It could be a lot of lines, could be MIME encoded, whatever.\n", - "Check RFC5322.\n", - NULL -}; - -struct upload_status { - int lines_read; -}; - -static size_t payload_source(void *ptr, size_t size, size_t nmemb, void *userp) -{ - struct upload_status *upload_ctx = (struct upload_status *)userp; - const char *data; - - if ((size == 0) || (nmemb == 0) || ((size*nmemb) < 1)) { - return 0; - } - - data = payload_text[upload_ctx->lines_read]; - - if (data) { - size_t len = strlen(data); - memcpy(ptr, data, len); - upload_ctx->lines_read ++; - return len; - } - return 0; -} - - -int main(void) -{ - CURL *curl; - CURLcode res; - struct curl_slist *recipients = NULL; - struct upload_status upload_ctx; - - upload_ctx.lines_read = 0; - - curl = curl_easy_init(); - if (curl) { - /* This is the URL for your mailserver. Note the use of port 587 here, - * instead of the normal SMTP port (25). Port 587 is commonly used for - * secure mail submission (see RFC4403), but you should use whatever - * matches your server configuration. */ - curl_easy_setopt(curl, CURLOPT_URL, "smtp://mainserver.example.net:587"); - - /* In this example, we'll start with a plain text connection, and upgrade - * to Transport Layer Security (TLS) using the STARTTLS command. Be careful - * of using CURLUSESSL_TRY here, because if TLS upgrade fails, the transfer - * will continue anyway - see the security discussion in the libcurl - * tutorial for more details. */ - curl_easy_setopt(curl, CURLOPT_USE_SSL, (long)CURLUSESSL_ALL); - - /* If your server doesn't have a valid certificate, then you can disable - * part of the Transport Layer Security protection by setting the - * CURLOPT_SSL_VERIFYPEER and CURLOPT_SSL_VERIFYHOST options to 0 (false). - * curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L); - * curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L); - * That is, in general, a bad idea. It is still better than sending your - * authentication details in plain text though. - * Instead, you should get the issuer certificate (or the host certificate - * if the certificate is self-signed) and add it to the set of certificates - * that are known to libcurl using CURLOPT_CAINFO and/or CURLOPT_CAPATH. See - * docs/SSLCERTS for more information. - */ - curl_easy_setopt(curl, CURLOPT_CAINFO, "/path/to/certificate.pem"); - - /* A common reason for requiring transport security is to protect - * authentication details (user names and passwords) from being "snooped" - * on the network. Here is how the user name and password are provided: */ - curl_easy_setopt(curl, CURLOPT_USERNAME, "user@example.net"); - curl_easy_setopt(curl, CURLOPT_PASSWORD, "P@ssw0rd"); - - /* value for envelope reverse-path */ - curl_easy_setopt(curl, CURLOPT_MAIL_FROM, FROM); - /* Add two recipients, in this particular case they correspond to the - * To: and Cc: addressees in the header, but they could be any kind of - * recipient. */ - recipients = curl_slist_append(recipients, TO); - recipients = curl_slist_append(recipients, CC); - curl_easy_setopt(curl, CURLOPT_MAIL_RCPT, recipients); - - /* In this case, we're using a callback function to specify the data. You - * could just use the CURLOPT_READDATA option to specify a FILE pointer to - * read from. - */ - curl_easy_setopt(curl, CURLOPT_READFUNCTION, payload_source); - curl_easy_setopt(curl, CURLOPT_READDATA, &upload_ctx); - - /* Since the traffic will be encrypted, it is very useful to turn on debug - * information within libcurl to see what is happening during the transfer. - */ - curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); - - /* send the message (including headers) */ - res = curl_easy_perform(curl); - /* Check for errors */ - if(res != CURLE_OK) - fprintf(stderr, "curl_easy_perform() failed: %s\n", - curl_easy_strerror(res)); - - /* free the list of recipients and clean up */ - curl_slist_free_all(recipients); - curl_easy_cleanup(curl); - } - return 0; -} diff --git a/plugins/FTPFileYM/curl/docs/examples/synctime.c b/plugins/FTPFileYM/curl/docs/examples/synctime.c deleted file mode 100644 index 14d77de277..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/synctime.c +++ /dev/null @@ -1,366 +0,0 @@ -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at http://curl.haxx.se/docs/copyright.html. - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the COPYING file. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ***************************************************************************/ -/* This example code only builds as-is on Windows. - * - * While Unix/Linux user, you do not need this software. - * You can achieve the same result as synctime using curl, awk and date. - * Set proxy as according to your network, but beware of proxy Cache-Control. - * - * To set your system clock, root access is required. - * # date -s "`curl -sI http://nist.time.gov/timezone.cgi?UTC/s/0 \ - * | awk -F': ' '/Date: / {print $2}'`" - * - * To view remote webserver date and time. - * $ curl -sI http://nist.time.gov/timezone.cgi?UTC/s/0 \ - * | awk -F': ' '/Date: / {print $2}' - * - * Synchronising your computer clock via Internet time server usually relies - * on DAYTIME, TIME, or NTP protocols. These protocols provide good accurate - * time synchronisation but it does not work very well through a - * firewall/proxy. Some adjustment has to be made to the firewall/proxy for - * these protocols to work properly. - * - * There is an indirect method. Since most webserver provide server time in - * their HTTP header, therefore you could synchronise your computer clock - * using HTTP protocol which has no problem with firewall/proxy. - * - * For this software to work, you should take note of these items. - * 1. Your firewall/proxy must allow your computer to surf internet. - * 2. Webserver system time must in sync with the NTP time server, - * or at least provide an accurate time keeping. - * 3. Webserver HTTP header does not provide the milliseconds units, - * so there is no way to get very accurate time. - * 4. This software could only provide an accuracy of +- a few seconds, - * as Round-Trip delay time is not taken into consideration. - * Compensation of network, firewall/proxy delay cannot be simply divide - * the Round-Trip delay time by half. - * 5. Win32 SetSystemTime() API will set your computer clock according to - * GMT/UTC time. Therefore your computer timezone must be properly set. - * 6. Webserver data should not be cached by the proxy server. Some - * webserver provide Cache-Control to prevent caching. - * - * References: - * http://tf.nist.gov/timefreq/service/its.htm - * http://tf.nist.gov/timefreq/service/firewall.htm - * - * Usage: - * This software will synchronise your computer clock only when you issue - * it with --synctime. By default, it only display the webserver's clock. - * - * Written by: Frank (contributed to libcurl) - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL THE AUTHOR OF THIS SOFTWARE BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - * - */ - -#include <stdio.h> -#include <time.h> -#ifndef __CYGWIN__ -#include <windows.h> -#endif -#include <curl/curl.h> - - -#define MAX_STRING 256 -#define MAX_STRING1 MAX_STRING+1 - -typedef struct -{ - char http_proxy[MAX_STRING1]; - char proxy_user[MAX_STRING1]; - char timeserver[MAX_STRING1]; -} conf_t; - -const char DefaultTimeServer[4][MAX_STRING1] = -{ - "http://nist.time.gov/timezone.cgi?UTC/s/0", - "http://www.google.com/", - "http://www.worldtimeserver.com/current_time_in_UTC.aspx", - "http://www.worldtime.com/cgi-bin/wt.cgi" -}; - -const char *DayStr[] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; -const char *MthStr[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", - "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; - -int ShowAllHeader; -int AutoSyncTime; -SYSTEMTIME SYSTime; -SYSTEMTIME LOCALTime; - -#define HTTP_COMMAND_HEAD 0 -#define HTTP_COMMAND_GET 1 - - -size_t SyncTime_CURL_WriteOutput(void *ptr, size_t size, size_t nmemb, - void *stream) -{ - fwrite(ptr, size, nmemb, stream); - return(nmemb*size); -} - -size_t SyncTime_CURL_WriteHeader(void *ptr, size_t size, size_t nmemb, - void *stream) -{ - int i, RetVal; - char TmpStr1[26], TmpStr2[26]; - - if (ShowAllHeader == 1) - fprintf(stderr, "%s", (char *)(ptr)); - - if (strncmp((char *)(ptr), "Date:", 5) == 0) { - if (ShowAllHeader == 0) - fprintf(stderr, "HTTP Server. %s", (char *)(ptr)); - - if (AutoSyncTime == 1) { - *TmpStr1 = 0; - *TmpStr2 = 0; - if (strlen((char *)(ptr)) > 50) /* Can prevent buffer overflow to - TmpStr1 & 2? */ - AutoSyncTime = 0; - else { - RetVal = sscanf ((char *)(ptr), "Date: %s %hu %s %hu %hu:%hu:%hu", - TmpStr1, &SYSTime.wDay, TmpStr2, &SYSTime.wYear, - &SYSTime.wHour, &SYSTime.wMinute, &SYSTime.wSecond); - - if (RetVal == 7) { - - SYSTime.wMilliseconds = 500; /* adjust to midpoint, 0.5 sec */ - for (i=0; i<12; i++) { - if (strcmp(MthStr[i], TmpStr2) == 0) { - SYSTime.wMonth = i+1; - break; - } - } - AutoSyncTime = 3; /* Computer clock will be adjusted */ - } - else { - AutoSyncTime = 0; /* Error in sscanf() fields conversion */ - } - } - } - } - - if (strncmp((char *)(ptr), "X-Cache: HIT", 12) == 0) { - fprintf(stderr, "ERROR: HTTP Server data is cached." - " Server Date is no longer valid.\n"); - AutoSyncTime = 0; - } - return(nmemb*size); -} - -void SyncTime_CURL_Init(CURL *curl, char *proxy_port, - char *proxy_user_password) -{ - if (strlen(proxy_port) > 0) - curl_easy_setopt(curl, CURLOPT_PROXY, proxy_port); - - if (strlen(proxy_user_password) > 0) - curl_easy_setopt(curl, CURLOPT_PROXYUSERPWD, proxy_user_password); - - /* Trick Webserver by claiming that you are using Microsoft WinXP SP2, IE6 */ - curl_easy_setopt(curl, CURLOPT_USERAGENT, - "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"); - curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, *SyncTime_CURL_WriteOutput); - curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, *SyncTime_CURL_WriteHeader); -} - -int SyncTime_CURL_Fetch(CURL *curl, char *URL_Str, char *OutFileName, - int HttpGetBody) -{ - FILE *outfile; - CURLcode res; - - outfile = NULL; - if (HttpGetBody == HTTP_COMMAND_HEAD) - curl_easy_setopt(curl, CURLOPT_NOBODY, 1L); - else { - outfile = fopen(OutFileName, "wb"); - curl_easy_setopt(curl, CURLOPT_WRITEDATA, outfile); - } - - curl_easy_setopt(curl, CURLOPT_URL, URL_Str); - res = curl_easy_perform(curl); - if (outfile != NULL) - fclose(outfile); - return res; /* (CURLE_OK) */ -} - -void showUsage(void) -{ - fprintf(stderr, "SYNCTIME: Synchronising computer clock with time server" - " using HTTP protocol.\n"); - fprintf(stderr, "Usage : SYNCTIME [Option]\n"); - fprintf(stderr, "Options :\n"); - fprintf(stderr, " --server=WEBSERVER Use this time server instead" - " of default.\n"); - fprintf(stderr, " --showall Show all HTTP header.\n"); - fprintf(stderr, " --synctime Synchronising computer clock" - " with time server.\n"); - fprintf(stderr, " --proxy-user=USER[:PASS] Set proxy username and" - " password.\n"); - fprintf(stderr, " --proxy=HOST[:PORT] Use HTTP proxy on given" - " port.\n"); - fprintf(stderr, " --help Print this help.\n"); - fprintf(stderr, "\n"); - return; -} - -int conf_init(conf_t *conf) -{ - int i; - - *conf->http_proxy = 0; - for (i=0; i<MAX_STRING1; i++) - conf->proxy_user[i] = 0; /* Clean up password from memory */ - *conf->timeserver = 0; - return 1; -} - -int main(int argc, char *argv[]) -{ - CURL *curl; - conf_t conf[1]; - int OptionIndex; - struct tm *lt; - struct tm *gmt; - time_t tt; - time_t tt_local; - time_t tt_gmt; - double tzonediffFloat; - int tzonediffWord; - char timeBuf[61]; - char tzoneBuf[16]; - int RetValue; - - OptionIndex = 0; - ShowAllHeader = 0; /* Do not show HTTP Header */ - AutoSyncTime = 0; /* Do not synchronise computer clock */ - RetValue = 0; /* Successful Exit */ - conf_init(conf); - - if (argc > 1) { - while (OptionIndex < argc) { - if (strncmp(argv[OptionIndex], "--server=", 9) == 0) - snprintf(conf->timeserver, MAX_STRING, "%s", &argv[OptionIndex][9]); - - if (strcmp(argv[OptionIndex], "--showall") == 0) - ShowAllHeader = 1; - - if (strcmp(argv[OptionIndex], "--synctime") == 0) - AutoSyncTime = 1; - - if (strncmp(argv[OptionIndex], "--proxy-user=", 13) == 0) - snprintf(conf->proxy_user, MAX_STRING, "%s", &argv[OptionIndex][13]); - - if (strncmp(argv[OptionIndex], "--proxy=", 8) == 0) - snprintf(conf->http_proxy, MAX_STRING, "%s", &argv[OptionIndex][8]); - - if ((strcmp(argv[OptionIndex], "--help") == 0) || - (strcmp(argv[OptionIndex], "/?") == 0)) { - showUsage(); - return 0; - } - OptionIndex++; - } - } - - if (*conf->timeserver == 0) /* Use default server for time information */ - snprintf(conf->timeserver, MAX_STRING, "%s", DefaultTimeServer[0]); - - /* Init CURL before usage */ - curl_global_init(CURL_GLOBAL_ALL); - curl = curl_easy_init(); - if (curl) { - SyncTime_CURL_Init(curl, conf->http_proxy, conf->proxy_user); - - /* Calculating time diff between GMT and localtime */ - tt = time(0); - lt = localtime(&tt); - tt_local = mktime(lt); - gmt = gmtime(&tt); - tt_gmt = mktime(gmt); - tzonediffFloat = difftime(tt_local, tt_gmt); - tzonediffWord = (int)(tzonediffFloat/3600.0); - - if ((double)(tzonediffWord * 3600) == tzonediffFloat) - snprintf(tzoneBuf, 15, "%+03d'00'", tzonediffWord); - else - snprintf(tzoneBuf, 15, "%+03d'30'", tzonediffWord); - - /* Get current system time and local time */ - GetSystemTime(&SYSTime); - GetLocalTime(&LOCALTime); - snprintf(timeBuf, 60, "%s, %02d %s %04d %02d:%02d:%02d.%03d, ", - DayStr[LOCALTime.wDayOfWeek], LOCALTime.wDay, - MthStr[LOCALTime.wMonth-1], LOCALTime.wYear, - LOCALTime.wHour, LOCALTime.wMinute, LOCALTime.wSecond, - LOCALTime.wMilliseconds); - - fprintf(stderr, "Fetch: %s\n\n", conf->timeserver); - fprintf(stderr, "Before HTTP. Date: %s%s\n\n", timeBuf, tzoneBuf); - - /* HTTP HEAD command to the Webserver */ - SyncTime_CURL_Fetch(curl, conf->timeserver, "index.htm", - HTTP_COMMAND_HEAD); - - GetLocalTime(&LOCALTime); - snprintf(timeBuf, 60, "%s, %02d %s %04d %02d:%02d:%02d.%03d, ", - DayStr[LOCALTime.wDayOfWeek], LOCALTime.wDay, - MthStr[LOCALTime.wMonth-1], LOCALTime.wYear, - LOCALTime.wHour, LOCALTime.wMinute, LOCALTime.wSecond, - LOCALTime.wMilliseconds); - fprintf(stderr, "\nAfter HTTP. Date: %s%s\n", timeBuf, tzoneBuf); - - if (AutoSyncTime == 3) { - /* Synchronising computer clock */ - if (!SetSystemTime(&SYSTime)) { /* Set system time */ - fprintf(stderr, "ERROR: Unable to set system time.\n"); - RetValue = 1; - } - else { - /* Successfully re-adjusted computer clock */ - GetLocalTime(&LOCALTime); - snprintf(timeBuf, 60, "%s, %02d %s %04d %02d:%02d:%02d.%03d, ", - DayStr[LOCALTime.wDayOfWeek], LOCALTime.wDay, - MthStr[LOCALTime.wMonth-1], LOCALTime.wYear, - LOCALTime.wHour, LOCALTime.wMinute, LOCALTime.wSecond, - LOCALTime.wMilliseconds); - fprintf(stderr, "\nNew System's Date: %s%s\n", timeBuf, tzoneBuf); - } - } - - /* Cleanup before exit */ - conf_init(conf); - curl_easy_cleanup(curl); - } - return RetValue; -} diff --git a/plugins/FTPFileYM/curl/docs/examples/threaded-ssl.c b/plugins/FTPFileYM/curl/docs/examples/threaded-ssl.c deleted file mode 100644 index a7e9c2de16..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/threaded-ssl.c +++ /dev/null @@ -1,162 +0,0 @@ -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at http://curl.haxx.se/docs/copyright.html. - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the COPYING file. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ***************************************************************************/ -/* A multi-threaded example that uses pthreads and fetches 4 remote files at - * once over HTTPS. The lock callbacks and stuff assume OpenSSL or GnuTLS - * (libgcrypt) so far. - * - * OpenSSL docs for this: - * http://www.openssl.org/docs/crypto/threads.html - * gcrypt docs for this: - * http://gnupg.org/documentation/manuals/gcrypt/Multi_002dThreading.html - */ - -#define USE_OPENSSL /* or USE_GNUTLS accordingly */ - -#include <stdio.h> -#include <pthread.h> -#include <curl/curl.h> - -#define NUMT 4 - -/* we have this global to let the callback get easy access to it */ -static pthread_mutex_t *lockarray; - -#ifdef USE_OPENSSL -#include <openssl/crypto.h> -static void lock_callback(int mode, int type, char *file, int line) -{ - (void)file; - (void)line; - if (mode & CRYPTO_LOCK) { - pthread_mutex_lock(&(lockarray[type])); - } - else { - pthread_mutex_unlock(&(lockarray[type])); - } -} - -static unsigned long thread_id(void) -{ - unsigned long ret; - - ret=(unsigned long)pthread_self(); - return(ret); -} - -static void init_locks(void) -{ - int i; - - lockarray=(pthread_mutex_t *)OPENSSL_malloc(CRYPTO_num_locks() * - sizeof(pthread_mutex_t)); - for (i=0; i<CRYPTO_num_locks(); i++) { - pthread_mutex_init(&(lockarray[i]),NULL); - } - - CRYPTO_set_id_callback((unsigned long (*)())thread_id); - CRYPTO_set_locking_callback((void (*)())lock_callback); -} - -static void kill_locks(void) -{ - int i; - - CRYPTO_set_locking_callback(NULL); - for (i=0; i<CRYPTO_num_locks(); i++) - pthread_mutex_destroy(&(lockarray[i])); - - OPENSSL_free(lockarray); -} -#endif - -#ifdef USE_GNUTLS -#include <gcrypt.h> -#include <errno.h> - -GCRY_THREAD_OPTION_PTHREAD_IMPL; - -void init_locks(void) -{ - gcry_control(GCRYCTL_SET_THREAD_CBS); -} - -#define kill_locks() -#endif - -/* List of URLs to fetch.*/ -const char * const urls[]= { - "https://www.example.com/", - "https://www2.example.com/", - "https://www3.example.com/", - "https://www4.example.com/", -}; - -static void *pull_one_url(void *url) -{ - CURL *curl; - - curl = curl_easy_init(); - curl_easy_setopt(curl, CURLOPT_URL, url); - /* this example doesn't verify the server's certificate, which means we - might be downloading stuff from an impostor */ - curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L); - curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L); - curl_easy_perform(curl); /* ignores error */ - curl_easy_cleanup(curl); - - return NULL; -} - -int main(int argc, char **argv) -{ - pthread_t tid[NUMT]; - int i; - int error; - (void)argc; /* we don't use any arguments in this example */ - (void)argv; - - /* Must initialize libcurl before any threads are started */ - curl_global_init(CURL_GLOBAL_ALL); - - init_locks(); - - for(i=0; i< NUMT; i++) { - error = pthread_create(&tid[i], - NULL, /* default attributes please */ - pull_one_url, - (void *)urls[i]); - if(0 != error) - fprintf(stderr, "Couldn't run thread number %d, errno %d\n", i, error); - else - fprintf(stderr, "Thread %d, gets %s\n", i, urls[i]); - } - - /* now wait for all threads to terminate */ - for(i=0; i< NUMT; i++) { - error = pthread_join(tid[i], NULL); - fprintf(stderr, "Thread %d terminated\n", i); - } - - kill_locks(); - - return 0; -} diff --git a/plugins/FTPFileYM/curl/docs/examples/url2file.c b/plugins/FTPFileYM/curl/docs/examples/url2file.c deleted file mode 100644 index 64d27c88f2..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/url2file.c +++ /dev/null @@ -1,81 +0,0 @@ -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at http://curl.haxx.se/docs/copyright.html. - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the COPYING file. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ***************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> - -#include <curl/curl.h> - -static size_t write_data(void *ptr, size_t size, size_t nmemb, void *stream) -{ - size_t written = fwrite(ptr, size, nmemb, (FILE *)stream); - return written; -} - -int main(int argc, char *argv[]) -{ - CURL *curl_handle; - static const char *pagefilename = "page.out"; - FILE *pagefile; - - if(argc < 2 ) { - printf("Usage: %s <URL>\n", argv[0]); - return 1; - } - - curl_global_init(CURL_GLOBAL_ALL); - - /* init the curl session */ - curl_handle = curl_easy_init(); - - /* set URL to get here */ - curl_easy_setopt(curl_handle, CURLOPT_URL, argv[1]); - - /* Switch on full protocol/debug output while testing */ - curl_easy_setopt(curl_handle, CURLOPT_VERBOSE, 1L); - - /* disable progress meter, set to 0L to enable and disable debug output */ - curl_easy_setopt(curl_handle, CURLOPT_NOPROGRESS, 1L); - - /* send all data to this function */ - curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, write_data); - - /* open the file */ - pagefile = fopen(pagefilename, "wb"); - if (pagefile) { - - /* write the page body to this file handle. CURLOPT_FILE is also known as - CURLOPT_WRITEDATA*/ - curl_easy_setopt(curl_handle, CURLOPT_FILE, pagefile); - - /* get it! */ - curl_easy_perform(curl_handle); - - /* close the header file */ - fclose(pagefile); - } - - /* cleanup curl stuff */ - curl_easy_cleanup(curl_handle); - - return 0; -} diff --git a/plugins/FTPFileYM/curl/docs/examples/version-check.pl b/plugins/FTPFileYM/curl/docs/examples/version-check.pl deleted file mode 100644 index 92f0808d61..0000000000 --- a/plugins/FTPFileYM/curl/docs/examples/version-check.pl +++ /dev/null @@ -1,105 +0,0 @@ -#!/usr/bin/env perl -#*************************************************************************** -# _ _ ____ _ -# Project ___| | | | _ \| | -# / __| | | | |_) | | -# | (__| |_| | _ <| |___ -# \___|\___/|_| \_\_____| -# -# Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al. -# -# This software is licensed as described in the file COPYING, which -# you should have received as part of this distribution. The terms -# are also available at http://curl.haxx.se/docs/copyright.html. -# -# You may opt to use, copy, modify, merge, publish, distribute and/or sell -# copies of the Software, and permit persons to whom the Software is -# furnished to do so, under the terms of the COPYING file. -# -# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -# KIND, either express or implied. -# -########################################################################### - -# This script accepts a source file as input on the command line. -# -# It first loads the 'symbols-in-versions' document and stores a lookup -# table for all known symbols for which version they were introduced. -# -# It then scans the given source file to dig up all symbols starting with CURL. -# Finally, it sorts the internal list of found symbols (using the version -# number as sort key) and then it outputs the most recent version number and -# the symbols from that version that are used. -# -# Usage: -# -# version-check.pl [source file] -# - -open(S, "<../libcurl/symbols-in-versions") || die; - -my %doc; -my %rem; -while(<S>) { - if(/(^CURL[^ \n]*) *(.*)/) { - my ($sym, $rest)=($1, $2); - my @a=split(/ +/, $rest); - - $doc{$sym}=$a[0]; # when it was introduced - - if($a[2]) { - # this symbol is documented to have been present the last time - # in this release - $rem{$sym}=$a[2]; - } - } - -} - -close(S); - -sub age { - my ($ver)=@_; - - my @s=split(/\./, $ver); - return $s[0]*10000+$s[1]*100+$s[2]; -} - -my %used; -open(C, "<$ARGV[0]") || die; - -while(<C>) { - if(/\W(CURL[_A-Z0-9v]+)\W/) { - #print "$1\n"; - $used{$1}++; - } -} - -close(C); - -sub sortversions { - my $r = age($doc{$a}) <=> age($doc{$b}); - if(!$r) { - $r = $a cmp $b; - } - return $r; -} - -my @recent = reverse sort sortversions keys %used; - -# the most recent symbol -my $newsym = $recent[0]; -# the most recent version -my $newver = $doc{$newsym}; - -print "The scanned source uses these symbols introduced in $newver:\n"; - -for my $w (@recent) { - if($doc{$w} eq $newver) { - printf " $w\n"; - next; - } - last; -} - - diff --git a/plugins/FTPFileYM/curl/docs/libcurl/ABI b/plugins/FTPFileYM/curl/docs/libcurl/ABI deleted file mode 100644 index 3ec0e04de0..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/ABI +++ /dev/null @@ -1,69 +0,0 @@ - _ _ ____ _ - ___| | | | _ \| | - / __| | | | |_) | | - | (__| |_| | _ <| |___ - \___|\___/|_| \_\_____| - - libcurl's binary interface - -ABI - Application Binary Interface - - First, allow me to define the word for this context: ABI describes the - low-level interface between an application program and a library. Calling - conventions, function arguments, return values, struct sizes/defines and - more. - - For a longer description, see - http://en.wikipedia.org/wiki/Application_binary_interface - -Upgrades - - In the vast majority of all cases, a typical libcurl upgrade does not break - the ABI at all. Your application can remain using libcurl just as before, - only with less bugs and possibly with added new features. You need to read - the release notes, and if they mention an ABI break/soname bump, you may - have to verify that your application still builds fine and uses libcurl as - it now is defined to work. - -Version Numbers - - In libcurl land, you really can't tell by the libcurl version number if that - libcurl is binary compatible or not with another libcurl version. - -Soname Bumps - - Whenever there are changes done to the library that will cause an ABI - breakage, that may require your application to get attention or possibly be - changed to adhere to new things, we will bump the soname. Then the library - will get a different output name and thus can in fact be installed in - parallel with an older installed lib (on most systems). Thus, old - applications built against the previous ABI version will remain working and - using the older lib, while newer applications build and use the newer one. - - During the first seven years of libcurl releases, there have only been four - ABI breakages. - -Downgrades - - Going to an older libcurl version from one you're currently using can be a - tricky thing. Mostly we add features and options to newer libcurls as that - won't break ABI or hamper existing applications. This has the implication - that going backwards may get you in a situation where you pick a libcurl - that doesn't support the options your application needs. Or possibly you - even downgrade so far so you cross an ABI break border and thus a different - soname, and then your application may need to adapt to the modified ABI. - -History - - The previous major library soname number bumps (breaking backwards - compatibility) have happened the following times: - - 0 - libcurl 7.1, August 2000 - - 1 - libcurl 7.5 December 2000 - - 2 - libcurl 7.7 March 2001 - - 3 - libcurl 7.12.0 June 2004 - - 4 - libcurl 7.16.0 October 2006 diff --git a/plugins/FTPFileYM/curl/docs/libcurl/Makefile.am b/plugins/FTPFileYM/curl/docs/libcurl/Makefile.am deleted file mode 100644 index 3114e2b3b0..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/Makefile.am +++ /dev/null @@ -1,102 +0,0 @@ -#*************************************************************************** -# _ _ ____ _ -# Project ___| | | | _ \| | -# / __| | | | |_) | | -# | (__| |_| | _ <| |___ -# \___|\___/|_| \_\_____| -# -# Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. -# -# This software is licensed as described in the file COPYING, which -# you should have received as part of this distribution. The terms -# are also available at http://curl.haxx.se/docs/copyright.html. -# -# You may opt to use, copy, modify, merge, publish, distribute and/or sell -# copies of the Software, and permit persons to whom the Software is -# furnished to do so, under the terms of the COPYING file. -# -# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -# KIND, either express or implied. -# -########################################################################### - -AUTOMAKE_OPTIONS = foreign no-dependencies - -man_MANS = curl_easy_cleanup.3 curl_easy_getinfo.3 curl_easy_init.3 \ - curl_easy_perform.3 curl_easy_setopt.3 curl_easy_duphandle.3 \ - curl_formadd.3 curl_formfree.3 curl_getdate.3 curl_getenv.3 \ - curl_slist_append.3 curl_slist_free_all.3 curl_version.3 \ - curl_version_info.3 curl_escape.3 curl_unescape.3 curl_free.3 \ - curl_strequal.3 curl_mprintf.3 curl_global_init.3 curl_global_cleanup.3 \ - curl_multi_add_handle.3 curl_multi_cleanup.3 curl_multi_fdset.3 \ - curl_multi_info_read.3 curl_multi_init.3 curl_multi_perform.3 \ - curl_multi_remove_handle.3 curl_share_cleanup.3 curl_share_init.3 \ - curl_share_setopt.3 libcurl.3 libcurl-easy.3 libcurl-multi.3 \ - libcurl-share.3 libcurl-errors.3 curl_easy_strerror.3 \ - curl_multi_strerror.3 curl_share_strerror.3 curl_global_init_mem.3 \ - libcurl-tutorial.3 curl_easy_reset.3 curl_easy_escape.3 \ - curl_easy_unescape.3 curl_multi_setopt.3 curl_multi_socket.3 \ - curl_multi_timeout.3 curl_formget.3 curl_multi_assign.3 \ - curl_easy_pause.3 curl_easy_recv.3 curl_easy_send.3 \ - curl_multi_socket_action.3 curl_multi_wait.3 - -HTMLPAGES = curl_easy_cleanup.html curl_easy_getinfo.html \ - curl_easy_init.html curl_easy_perform.html curl_easy_setopt.html \ - curl_easy_duphandle.html curl_formadd.html curl_formfree.html \ - curl_getdate.html curl_getenv.html curl_slist_append.html \ - curl_slist_free_all.html curl_version.html curl_version_info.html \ - curl_escape.html curl_unescape.html curl_free.html curl_strequal.html \ - curl_mprintf.html curl_global_init.html curl_global_cleanup.html \ - curl_multi_add_handle.html curl_multi_cleanup.html \ - curl_multi_fdset.html curl_multi_info_read.html curl_multi_init.html \ - curl_multi_perform.html curl_multi_remove_handle.html \ - curl_share_cleanup.html curl_share_init.html curl_share_setopt.html \ - libcurl.html libcurl-multi.html libcurl-easy.html libcurl-share.html \ - libcurl-errors.html curl_easy_strerror.html curl_multi_strerror.html \ - curl_share_strerror.html curl_global_init_mem.html \ - libcurl-tutorial.html curl_easy_reset.html curl_easy_escape.html \ - curl_easy_unescape.html curl_multi_setopt.html curl_multi_socket.html \ - curl_multi_timeout.html curl_formget.html curl_multi_assign.html \ - curl_easy_pause.html curl_easy_recv.html curl_easy_send.html \ - curl_multi_socket_action.html curl_multi_wait.html - -PDFPAGES = curl_easy_cleanup.pdf curl_easy_getinfo.pdf \ - curl_easy_init.pdf curl_easy_perform.pdf curl_easy_setopt.pdf \ - curl_easy_duphandle.pdf curl_formadd.pdf curl_formfree.pdf \ - curl_getdate.pdf curl_getenv.pdf curl_slist_append.pdf \ - curl_slist_free_all.pdf curl_version.pdf curl_version_info.pdf \ - curl_escape.pdf curl_unescape.pdf curl_free.pdf curl_strequal.pdf \ - curl_mprintf.pdf curl_global_init.pdf curl_global_cleanup.pdf \ - curl_multi_add_handle.pdf curl_multi_cleanup.pdf curl_multi_fdset.pdf \ - curl_multi_info_read.pdf curl_multi_init.pdf curl_multi_perform.pdf \ - curl_multi_remove_handle.pdf curl_share_cleanup.pdf curl_share_init.pdf \ - curl_share_setopt.pdf libcurl.pdf libcurl-multi.pdf libcurl-easy.pdf \ - libcurl-share.pdf libcurl-errors.pdf curl_easy_strerror.pdf \ - curl_multi_strerror.pdf curl_share_strerror.pdf \ - curl_global_init_mem.pdf libcurl-tutorial.pdf curl_easy_reset.pdf \ - curl_easy_escape.pdf curl_easy_unescape.pdf curl_multi_setopt.pdf \ - curl_multi_socket.pdf curl_multi_timeout.pdf curl_formget.pdf \ - curl_multi_assign.pdf curl_easy_pause.pdf curl_easy_recv.pdf \ - curl_easy_send.pdf curl_multi_socket_action.pdf curl_multi_wait.pdf - -CLEANFILES = $(HTMLPAGES) $(PDFPAGES) - -EXTRA_DIST = $(man_MANS) $(HTMLPAGES) index.html $(PDFPAGES) libcurl.m4 ABI \ - symbols-in-versions symbols.pl -MAN2HTML= roffit --mandir=. < $< >$@ - -SUFFIXES = .3 .html - -html: $(HTMLPAGES) - -.3.html: - $(MAN2HTML) - -pdf: $(PDFPAGES) - -.3.pdf: - @(foo=`echo $@ | sed -e 's/\.[0-9]$$//g'`; \ - groff -Tps -man $< >$$foo.ps; \ - ps2pdf $$foo.ps $@; \ - rm $$foo.ps; \ - echo "converted $< to $@") diff --git a/plugins/FTPFileYM/curl/docs/libcurl/Makefile.in b/plugins/FTPFileYM/curl/docs/libcurl/Makefile.in deleted file mode 100644 index f8603856e8..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/Makefile.in +++ /dev/null @@ -1,652 +0,0 @@ -# Makefile.in generated by automake 1.11.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software -# Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -#*************************************************************************** -# _ _ ____ _ -# Project ___| | | | _ \| | -# / __| | | | |_) | | -# | (__| |_| | _ <| |___ -# \___|\___/|_| \_\_____| -# -# Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. -# -# This software is licensed as described in the file COPYING, which -# you should have received as part of this distribution. The terms -# are also available at http://curl.haxx.se/docs/copyright.html. -# -# You may opt to use, copy, modify, merge, publish, distribute and/or sell -# copies of the Software, and permit persons to whom the Software is -# furnished to do so, under the terms of the COPYING file. -# -# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -# KIND, either express or implied. -# -########################################################################### -VPATH = @srcdir@ -am__make_dryrun = \ - { \ - am__dry=no; \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ - | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ - *) \ - for am__flg in $$MAKEFLAGS; do \ - case $$am__flg in \ - *=*|--*) ;; \ - *n*) am__dry=yes; break;; \ - esac; \ - done;; \ - esac; \ - test $$am__dry = yes; \ - } -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -subdir = docs/libcurl -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/curl-compilers.m4 \ - $(top_srcdir)/m4/curl-confopts.m4 \ - $(top_srcdir)/m4/curl-functions.m4 \ - $(top_srcdir)/m4/curl-openssl.m4 \ - $(top_srcdir)/m4/curl-override.m4 \ - $(top_srcdir)/m4/curl-reentrant.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/xc-cc-check.m4 \ - $(top_srcdir)/m4/xc-translit.m4 \ - $(top_srcdir)/m4/xc-val-flgs.m4 \ - $(top_srcdir)/m4/zz40-xc-ovr.m4 \ - $(top_srcdir)/m4/zz50-xc-ovr.m4 \ - $(top_srcdir)/m4/zz60-xc-ovr.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/lib/curl_config.h \ - $(top_builddir)/include/curl/curlbuild.h -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -depcomp = -am__depfiles_maybe = -SOURCES = -DIST_SOURCES = -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; -am__install_max = 40 -am__nobase_strip_setup = \ - srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` -am__nobase_strip = \ - for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" -am__nobase_list = $(am__nobase_strip_setup); \ - for p in $$list; do echo "$$p $$p"; done | \ - sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ - $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ - if (++n[$$2] == $(am__install_max)) \ - { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ - END { for (dir in files) print dir, files[dir] }' -am__base_list = \ - sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ - sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' -am__uninstall_files_from_dir = { \ - test -z "$$files" \ - || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ - || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ - $(am__cd) "$$dir" && rm -f $$files; }; \ - } -man3dir = $(mandir)/man3 -am__installdirs = "$(DESTDIR)$(man3dir)" -MANS = $(man_MANS) -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AR = @AR@ -AS = @AS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BLANK_AT_MAKETIME = @BLANK_AT_MAKETIME@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CFLAG_CURL_SYMBOL_HIDING = @CFLAG_CURL_SYMBOL_HIDING@ -CONFIGURE_OPTIONS = @CONFIGURE_OPTIONS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CPPFLAG_CURL_STATICLIB = @CPPFLAG_CURL_STATICLIB@ -CURLVERSION = @CURLVERSION@ -CURL_CA_BUNDLE = @CURL_CA_BUNDLE@ -CURL_CFLAG_EXTRAS = @CURL_CFLAG_EXTRAS@ -CURL_DISABLE_DICT = @CURL_DISABLE_DICT@ -CURL_DISABLE_FILE = @CURL_DISABLE_FILE@ -CURL_DISABLE_FTP = @CURL_DISABLE_FTP@ -CURL_DISABLE_GOPHER = @CURL_DISABLE_GOPHER@ -CURL_DISABLE_HTTP = @CURL_DISABLE_HTTP@ -CURL_DISABLE_IMAP = @CURL_DISABLE_IMAP@ -CURL_DISABLE_LDAP = @CURL_DISABLE_LDAP@ -CURL_DISABLE_LDAPS = @CURL_DISABLE_LDAPS@ -CURL_DISABLE_POP3 = @CURL_DISABLE_POP3@ -CURL_DISABLE_PROXY = @CURL_DISABLE_PROXY@ -CURL_DISABLE_RTSP = @CURL_DISABLE_RTSP@ -CURL_DISABLE_SMTP = @CURL_DISABLE_SMTP@ -CURL_DISABLE_TELNET = @CURL_DISABLE_TELNET@ -CURL_DISABLE_TFTP = @CURL_DISABLE_TFTP@ -CURL_NETWORK_AND_TIME_LIBS = @CURL_NETWORK_AND_TIME_LIBS@ -CURL_NETWORK_LIBS = @CURL_NETWORK_LIBS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_SHARED = @ENABLE_SHARED@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GREP = @GREP@ -HAVE_GNUTLS_SRP = @HAVE_GNUTLS_SRP@ -HAVE_LDAP_SSL = @HAVE_LDAP_SSL@ -HAVE_LIBZ = @HAVE_LIBZ@ -HAVE_NSS_INITCONTEXT = @HAVE_NSS_INITCONTEXT@ -HAVE_SSLEAY_SRP = @HAVE_SSLEAY_SRP@ -IDN_ENABLED = @IDN_ENABLED@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -IPV6_ENABLED = @IPV6_ENABLED@ -KRB4_ENABLED = @KRB4_ENABLED@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBCURL_LIBS = @LIBCURL_LIBS@ -LIBMETALINK_CPPFLAGS = @LIBMETALINK_CPPFLAGS@ -LIBMETALINK_LDFLAGS = @LIBMETALINK_LDFLAGS@ -LIBMETALINK_LIBS = @LIBMETALINK_LIBS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MANOPT = @MANOPT@ -MKDIR_P = @MKDIR_P@ -NM = @NM@ -NMEDIT = @NMEDIT@ -NROFF = @NROFF@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PKGADD_NAME = @PKGADD_NAME@ -PKGADD_PKG = @PKGADD_PKG@ -PKGADD_VENDOR = @PKGADD_VENDOR@ -PKGCONFIG = @PKGCONFIG@ -RANDOM_FILE = @RANDOM_FILE@ -RANLIB = @RANLIB@ -REQUIRE_LIB_DEPS = @REQUIRE_LIB_DEPS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SSL_ENABLED = @SSL_ENABLED@ -STRIP = @STRIP@ -SUPPORT_FEATURES = @SUPPORT_FEATURES@ -SUPPORT_PROTOCOLS = @SUPPORT_PROTOCOLS@ -USE_ARES = @USE_ARES@ -USE_AXTLS = @USE_AXTLS@ -USE_CYASSL = @USE_CYASSL@ -USE_DARWINSSL = @USE_DARWINSSL@ -USE_GNUTLS = @USE_GNUTLS@ -USE_GNUTLS_NETTLE = @USE_GNUTLS_NETTLE@ -USE_LIBRTMP = @USE_LIBRTMP@ -USE_LIBSSH2 = @USE_LIBSSH2@ -USE_NSS = @USE_NSS@ -USE_OPENLDAP = @USE_OPENLDAP@ -USE_POLARSSL = @USE_POLARSSL@ -USE_SCHANNEL = @USE_SCHANNEL@ -USE_SSLEAY = @USE_SSLEAY@ -USE_WINDOWS_SSPI = @USE_WINDOWS_SSPI@ -VERSION = @VERSION@ -VERSIONED_FLAVOUR = @VERSIONED_FLAVOUR@ -VERSIONNUM = @VERSIONNUM@ -ZLIB_LIBS = @ZLIB_LIBS@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -libext = @libext@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -subdirs = @subdirs@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -AUTOMAKE_OPTIONS = foreign no-dependencies -man_MANS = curl_easy_cleanup.3 curl_easy_getinfo.3 curl_easy_init.3 \ - curl_easy_perform.3 curl_easy_setopt.3 curl_easy_duphandle.3 \ - curl_formadd.3 curl_formfree.3 curl_getdate.3 curl_getenv.3 \ - curl_slist_append.3 curl_slist_free_all.3 curl_version.3 \ - curl_version_info.3 curl_escape.3 curl_unescape.3 curl_free.3 \ - curl_strequal.3 curl_mprintf.3 curl_global_init.3 curl_global_cleanup.3 \ - curl_multi_add_handle.3 curl_multi_cleanup.3 curl_multi_fdset.3 \ - curl_multi_info_read.3 curl_multi_init.3 curl_multi_perform.3 \ - curl_multi_remove_handle.3 curl_share_cleanup.3 curl_share_init.3 \ - curl_share_setopt.3 libcurl.3 libcurl-easy.3 libcurl-multi.3 \ - libcurl-share.3 libcurl-errors.3 curl_easy_strerror.3 \ - curl_multi_strerror.3 curl_share_strerror.3 curl_global_init_mem.3 \ - libcurl-tutorial.3 curl_easy_reset.3 curl_easy_escape.3 \ - curl_easy_unescape.3 curl_multi_setopt.3 curl_multi_socket.3 \ - curl_multi_timeout.3 curl_formget.3 curl_multi_assign.3 \ - curl_easy_pause.3 curl_easy_recv.3 curl_easy_send.3 \ - curl_multi_socket_action.3 curl_multi_wait.3 - -HTMLPAGES = curl_easy_cleanup.html curl_easy_getinfo.html \ - curl_easy_init.html curl_easy_perform.html curl_easy_setopt.html \ - curl_easy_duphandle.html curl_formadd.html curl_formfree.html \ - curl_getdate.html curl_getenv.html curl_slist_append.html \ - curl_slist_free_all.html curl_version.html curl_version_info.html \ - curl_escape.html curl_unescape.html curl_free.html curl_strequal.html \ - curl_mprintf.html curl_global_init.html curl_global_cleanup.html \ - curl_multi_add_handle.html curl_multi_cleanup.html \ - curl_multi_fdset.html curl_multi_info_read.html curl_multi_init.html \ - curl_multi_perform.html curl_multi_remove_handle.html \ - curl_share_cleanup.html curl_share_init.html curl_share_setopt.html \ - libcurl.html libcurl-multi.html libcurl-easy.html libcurl-share.html \ - libcurl-errors.html curl_easy_strerror.html curl_multi_strerror.html \ - curl_share_strerror.html curl_global_init_mem.html \ - libcurl-tutorial.html curl_easy_reset.html curl_easy_escape.html \ - curl_easy_unescape.html curl_multi_setopt.html curl_multi_socket.html \ - curl_multi_timeout.html curl_formget.html curl_multi_assign.html \ - curl_easy_pause.html curl_easy_recv.html curl_easy_send.html \ - curl_multi_socket_action.html curl_multi_wait.html - -PDFPAGES = curl_easy_cleanup.pdf curl_easy_getinfo.pdf \ - curl_easy_init.pdf curl_easy_perform.pdf curl_easy_setopt.pdf \ - curl_easy_duphandle.pdf curl_formadd.pdf curl_formfree.pdf \ - curl_getdate.pdf curl_getenv.pdf curl_slist_append.pdf \ - curl_slist_free_all.pdf curl_version.pdf curl_version_info.pdf \ - curl_escape.pdf curl_unescape.pdf curl_free.pdf curl_strequal.pdf \ - curl_mprintf.pdf curl_global_init.pdf curl_global_cleanup.pdf \ - curl_multi_add_handle.pdf curl_multi_cleanup.pdf curl_multi_fdset.pdf \ - curl_multi_info_read.pdf curl_multi_init.pdf curl_multi_perform.pdf \ - curl_multi_remove_handle.pdf curl_share_cleanup.pdf curl_share_init.pdf \ - curl_share_setopt.pdf libcurl.pdf libcurl-multi.pdf libcurl-easy.pdf \ - libcurl-share.pdf libcurl-errors.pdf curl_easy_strerror.pdf \ - curl_multi_strerror.pdf curl_share_strerror.pdf \ - curl_global_init_mem.pdf libcurl-tutorial.pdf curl_easy_reset.pdf \ - curl_easy_escape.pdf curl_easy_unescape.pdf curl_multi_setopt.pdf \ - curl_multi_socket.pdf curl_multi_timeout.pdf curl_formget.pdf \ - curl_multi_assign.pdf curl_easy_pause.pdf curl_easy_recv.pdf \ - curl_easy_send.pdf curl_multi_socket_action.pdf curl_multi_wait.pdf - -CLEANFILES = $(HTMLPAGES) $(PDFPAGES) -EXTRA_DIST = $(man_MANS) $(HTMLPAGES) index.html $(PDFPAGES) libcurl.m4 ABI \ - symbols-in-versions symbols.pl - -MAN2HTML = roffit --mandir=. < $< >$@ -SUFFIXES = .3 .html -all: all-am - -.SUFFIXES: -.SUFFIXES: .3 .html .pdf -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign docs/libcurl/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --foreign docs/libcurl/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs -install-man3: $(man_MANS) - @$(NORMAL_INSTALL) - @list1=''; \ - list2='$(man_MANS)'; \ - test -n "$(man3dir)" \ - && test -n "`echo $$list1$$list2`" \ - || exit 0; \ - echo " $(MKDIR_P) '$(DESTDIR)$(man3dir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(man3dir)" || exit 1; \ - { for i in $$list1; do echo "$$i"; done; \ - if test -n "$$list2"; then \ - for i in $$list2; do echo "$$i"; done \ - | sed -n '/\.3[a-z]*$$/p'; \ - fi; \ - } | while read p; do \ - if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ - echo "$$d$$p"; echo "$$p"; \ - done | \ - sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^3][0-9a-z]*$$,3,;x' \ - -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ - sed 'N;N;s,\n, ,g' | { \ - list=; while read file base inst; do \ - if test "$$base" = "$$inst"; then list="$$list $$file"; else \ - echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man3dir)/$$inst'"; \ - $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man3dir)/$$inst" || exit $$?; \ - fi; \ - done; \ - for i in $$list; do echo "$$i"; done | $(am__base_list) | \ - while read files; do \ - test -z "$$files" || { \ - echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man3dir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(man3dir)" || exit $$?; }; \ - done; } - -uninstall-man3: - @$(NORMAL_UNINSTALL) - @list=''; test -n "$(man3dir)" || exit 0; \ - files=`{ for i in $$list; do echo "$$i"; done; \ - l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ - sed -n '/\.3[a-z]*$$/p'; \ - } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^3][0-9a-z]*$$,3,;x' \ - -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ - dir='$(DESTDIR)$(man3dir)'; $(am__uninstall_files_from_dir) -tags: TAGS -TAGS: - -ctags: CTAGS -CTAGS: - - -distdir: $(DISTFILES) - @list='$(MANS)'; if test -n "$$list"; then \ - list=`for p in $$list; do \ - if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ - if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \ - if test -n "$$list" && \ - grep 'ab help2man is required to generate this page' $$list >/dev/null; then \ - echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \ - grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \ - echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \ - echo " typically \`make maintainer-clean' will remove them" >&2; \ - exit 1; \ - else :; fi; \ - else :; fi - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(MANS) -installdirs: - for dir in "$(DESTDIR)$(man3dir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -clean-generic: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-generic - -dvi: dvi-am - -dvi-am: - -html-am: - -info: info-am - -info-am: - -install-data-am: install-man - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: install-man3 - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-man - -uninstall-man: uninstall-man3 - -.MAKE: install-am install-strip - -.PHONY: all all-am check check-am clean clean-generic clean-libtool \ - distclean distclean-generic distclean-libtool distdir dvi \ - dvi-am html html-am info info-am install install-am \ - install-data install-data-am install-dvi install-dvi-am \ - install-exec install-exec-am install-html install-html-am \ - install-info install-info-am install-man install-man3 \ - install-pdf install-pdf-am install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - uninstall uninstall-am uninstall-man uninstall-man3 - - -html: $(HTMLPAGES) - -.3.html: - $(MAN2HTML) - -pdf: $(PDFPAGES) - -.3.pdf: - @(foo=`echo $@ | sed -e 's/\.[0-9]$$//g'`; \ - groff -Tps -man $< >$$foo.ps; \ - ps2pdf $$foo.ps $@; \ - rm $$foo.ps; \ - echo "converted $< to $@") - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_cleanup.3 b/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_cleanup.3 deleted file mode 100644 index d8a3f9fcfc..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_cleanup.3 +++ /dev/null @@ -1,57 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at http://curl.haxx.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" ************************************************************************** -.\" -.TH curl_easy_cleanup 3 "22 aug 2007" "libcurl 7.17.0" "libcurl Manual" -.SH NAME -curl_easy_cleanup - End a libcurl easy session -.SH SYNOPSIS -.B #include <curl/curl.h> - -.BI "void curl_easy_cleanup(CURL *" handle ");" - -.SH DESCRIPTION -This function must be the last function to call for an easy session. It is the -opposite of the \fIcurl_easy_init(3)\fP function and must be called with the -same \fIhandle\fP as input that the curl_easy_init call returned. - -This will effectively close all connections this handle has used and possibly -has kept open until now. Don't call this function if you intend to transfer -more files. - -Occasionally you may get your progress callback or header callback called from -within \fIcurl_easy_cleanup(3)\fP (if previously set for the handle using -\fIcurl_easy_setopt(3)\fP). Like if libcurl decides to shut down the -connection and the protocol is of a kind that requires a command/response -sequence before disconnect. Examples of such protocols are FTP, POP3 and IMAP. - -Any uses of the \fBhandle\fP after this function has been called and have -returned, are illegal. This kills the handle and all memory associated with -it! - -With libcurl versions prior to 7.17.: when you've called this, you can safely -remove all the strings you've previously told libcurl to use, as it won't use -them anymore now. -.SH RETURN VALUE -None -.SH "SEE ALSO" -.BR curl_easy_init "(3), " - diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_cleanup.html b/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_cleanup.html deleted file mode 100644 index 2ea921d88c..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_cleanup.html +++ /dev/null @@ -1,62 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> -<html><head> -<title>curl_easy_cleanup man page</title> -<meta name="generator" content="roffit"> -<STYLE type="text/css"> -P.level0 { - padding-left: 2em; -} - -P.level1 { - padding-left: 4em; -} - -P.level2 { - padding-left: 6em; -} - -span.emphasis { - font-style: italic; -} - -span.bold { - font-weight: bold; -} - -span.manpage { - font-weight: bold; -} - -h2.nroffsh { - background-color: #e0e0e0; -} - -span.nroffip { - font-weight: bold; - font-size: 120%; - font-family: monospace; -} - -p.roffit { - text-align: center; - font-size: 80%; -} -</STYLE> -</head><body> - -<p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2> -<p class="level0">curl_easy_cleanup - End a libcurl easy session <a name="SYNOPSIS"></a><h2 class="nroffsh">SYNOPSIS</h2> -<p class="level0"><span Class="bold">#include <curl/curl.h></span> -<p class="level0"><span Class="bold">void curl_easy_cleanup(CURL * handle );</span> -<p class="level0"><a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2> -<p class="level0">This function must be the last function to call for an easy session. It is the opposite of the <a class="emphasis" href="./curl_easy_init.html">curl_easy_init(3)</a> function and must be called with the same <span Class="emphasis">handle</span> as input that the curl_easy_init call returned. -<p class="level0">This will effectively close all connections this handle has used and possibly has kept open until now. Don't call this function if you intend to transfer more files. -<p class="level0">Occasionally you may get your progress callback or header callback called from within <a class="emphasis" href="./curl_easy_cleanup.html">curl_easy_cleanup(3)</a> (if previously set for the handle using <a class="emphasis" href="./curl_easy_setopt.html">curl_easy_setopt(3)</a>). Like if libcurl decides to shut down the connection and the protocol is of a kind that requires a command/response sequence before disconnect. Examples of such protocols are FTP, POP3 and IMAP. -<p class="level0">Any uses of the <span Class="bold">handle</span> after this function has been called and have returned, are illegal. This kills the handle and all memory associated with it! -<p class="level0">With libcurl versions prior to 7.17.: when you've called this, you can safely remove all the strings you've previously told libcurl to use, as it won't use them anymore now. <a name="RETURN"></a><h2 class="nroffsh">RETURN VALUE</h2> -<p class="level0">None <a name="SEE"></a><h2 class="nroffsh">SEE ALSO</h2> -<p class="level0"><a class="manpage" href="./curl_easy_init.html">curl_easy_init (3)</a> <span Class="manpage"> </span> -<p class="level0"><p class="roffit"> - This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>. -</body></html> diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_cleanup.pdf b/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_cleanup.pdf Binary files differdeleted file mode 100644 index 85981a50c2..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_cleanup.pdf +++ /dev/null diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_duphandle.3 b/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_duphandle.3 deleted file mode 100644 index e53ced48b1..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_duphandle.3 +++ /dev/null @@ -1,51 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at http://curl.haxx.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" ************************************************************************** -.TH curl_easy_duphandle 3 "18 September 2001" "libcurl 7.9" "libcurl Manual" -.SH NAME -curl_easy_duphandle - Clone a libcurl session handle -.SH SYNOPSIS -.B #include <curl/curl.h> - -.BI "CURL *curl_easy_duphandle(CURL *"handle ");" - -.SH DESCRIPTION -This function will return a new curl handle, a duplicate, using all the -options previously set in the input curl \fIhandle\fP. Both handles can -subsequently be used independently and they must both be freed with -\fIcurl_easy_cleanup(3)\fP. - -All strings that the input handle has been told to point to (as opposed to -copy) with previous calls to \fIcurl_easy_setopt(3)\fP using char * inputs, -will be pointed to by the new handle as well. You must therefore make sure to -keep the data around until both handles have been cleaned up. - -The new handle will \fBnot\fP inherit any state information, no connections, -no SSL sessions and no cookies. - -\fBNote\fP that even in multi-threaded programs, this function must be called -in a synchronous way, the input handle may not be in use when cloned. -.SH RETURN VALUE -If this function returns NULL, something went wrong and no valid handle was -returned. -.SH "SEE ALSO" -.BR curl_easy_init "(3)," curl_easy_cleanup "(3)," curl_global_init "(3) - diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_duphandle.html b/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_duphandle.html deleted file mode 100644 index f84f0d375e..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_duphandle.html +++ /dev/null @@ -1,61 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> -<html><head> -<title>curl_easy_duphandle man page</title> -<meta name="generator" content="roffit"> -<STYLE type="text/css"> -P.level0 { - padding-left: 2em; -} - -P.level1 { - padding-left: 4em; -} - -P.level2 { - padding-left: 6em; -} - -span.emphasis { - font-style: italic; -} - -span.bold { - font-weight: bold; -} - -span.manpage { - font-weight: bold; -} - -h2.nroffsh { - background-color: #e0e0e0; -} - -span.nroffip { - font-weight: bold; - font-size: 120%; - font-family: monospace; -} - -p.roffit { - text-align: center; - font-size: 80%; -} -</STYLE> -</head><body> - -<p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2> -<p class="level0">curl_easy_duphandle - Clone a libcurl session handle <a name="SYNOPSIS"></a><h2 class="nroffsh">SYNOPSIS</h2> -<p class="level0"><span Class="bold">#include <curl/curl.h></span> -<p class="level0"><span Class="bold">CURL *curl_easy_duphandle(CURL *handle );</span> -<p class="level0"><a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2> -<p class="level0">This function will return a new curl handle, a duplicate, using all the options previously set in the input curl <span Class="emphasis">handle</span>. Both handles can subsequently be used independently and they must both be freed with <a class="emphasis" href="./curl_easy_cleanup.html">curl_easy_cleanup(3)</a>. -<p class="level0">All strings that the input handle has been told to point to (as opposed to copy) with previous calls to <a class="emphasis" href="./curl_easy_setopt.html">curl_easy_setopt(3)</a> using char * inputs, will be pointed to by the new handle as well. You must therefore make sure to keep the data around until both handles have been cleaned up. -<p class="level0">The new handle will <span Class="bold">not</span> inherit any state information, no connections, no SSL sessions and no cookies. -<p class="level0"><span Class="bold">Note</span> that even in multi-threaded programs, this function must be called in a synchronous way, the input handle may not be in use when cloned. <a name="RETURN"></a><h2 class="nroffsh">RETURN VALUE</h2> -<p class="level0">If this function returns NULL, something went wrong and no valid handle was returned. <a name="SEE"></a><h2 class="nroffsh">SEE ALSO</h2> -<p class="level0"><a class="manpage" href="./curl_easy_init.html">curl_easy_init (3)</a> <a class="manpage" href="./curl_easy_cleanup.html"> curl_easy_cleanup (3)</a> <a class="manpage" href="./curl_global_init.html"> curl_global_init (3)</a> -<p class="level0"><p class="roffit"> - This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>. -</body></html> diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_duphandle.pdf b/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_duphandle.pdf Binary files differdeleted file mode 100644 index f2511632cb..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_duphandle.pdf +++ /dev/null diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_escape.3 b/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_escape.3 deleted file mode 100644 index 3a98e6fe80..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_escape.3 +++ /dev/null @@ -1,46 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at http://curl.haxx.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" ************************************************************************** -.\" -.TH curl_easy_escape 3 "7 April 2006" "libcurl 7.15.4" "libcurl Manual" -.SH NAME -curl_easy_escape - URL encodes the given string -.SH SYNOPSIS -.B #include <curl/curl.h> -.sp -.BI "char *curl_easy_escape( CURL *" curl ", char *" url ", int "length " );" -.ad -.SH DESCRIPTION -This function converts the given input string to an URL encoded string and -returns that as a new allocated string. All input characters that are not a-z, -A-Z, 0-9, '-', '.', '_' or '~' are converted to their "URL escaped" version -(%NN where NN is a two-digit hexadecimal number). - -If the \fBlength\fP argument is set to 0 (zero), \fIcurl_easy_escape(3)\fP -uses strlen() on the input \fBurl\fP to find out the size. - -You must \fIcurl_free(3)\fP the returned string when you're done with it. -.SH AVAILABILITY -Added in 7.15.4 and replaces the old \fIcurl_escape(3)\fP function. -.SH RETURN VALUE -A pointer to a zero terminated string or NULL if it failed. -.SH "SEE ALSO" -.BR curl_easy_unescape "(3), " curl_free "(3), " RFC 2396 diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_escape.html b/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_escape.html deleted file mode 100644 index 64b65dcc79..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_escape.html +++ /dev/null @@ -1,60 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> -<html><head> -<title>curl_easy_escape man page</title> -<meta name="generator" content="roffit"> -<STYLE type="text/css"> -P.level0 { - padding-left: 2em; -} - -P.level1 { - padding-left: 4em; -} - -P.level2 { - padding-left: 6em; -} - -span.emphasis { - font-style: italic; -} - -span.bold { - font-weight: bold; -} - -span.manpage { - font-weight: bold; -} - -h2.nroffsh { - background-color: #e0e0e0; -} - -span.nroffip { - font-weight: bold; - font-size: 120%; - font-family: monospace; -} - -p.roffit { - text-align: center; - font-size: 80%; -} -</STYLE> -</head><body> - -<p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2> -<p class="level0">curl_easy_escape - URL encodes the given string <a name="SYNOPSIS"></a><h2 class="nroffsh">SYNOPSIS</h2> -<p class="level0"><span Class="bold">#include <curl/curl.h></span> -<p class="level0"><span Class="bold">char *curl_easy_escape( CURL * curl , char * url , int length );</span> -<p class="level0"><a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2> -<p class="level0">This function converts the given input string to an URL encoded string and returns that as a new allocated string. All input characters that are not a-z, A-Z, 0-9, '-', '.', '_' or '~' are converted to their "URL escaped" version (%NN where NN is a two-digit hexadecimal number). -<p class="level0">If the <span Class="bold">length</span> argument is set to 0 (zero), <a class="emphasis" href="./curl_easy_escape.html">curl_easy_escape(3)</a> uses strlen() on the input <span Class="bold">url</span> to find out the size. -<p class="level0">You must <a class="emphasis" href="./curl_free.html">curl_free(3)</a> the returned string when you're done with it. <a name="AVAILABILITY"></a><h2 class="nroffsh">AVAILABILITY</h2> -<p class="level0">Added in 7.15.4 and replaces the old <a class="emphasis" href="./curl_escape.html">curl_escape(3)</a> function. <a name="RETURN"></a><h2 class="nroffsh">RETURN VALUE</h2> -<p class="level0">A pointer to a zero terminated string or NULL if it failed. <a name="SEE"></a><h2 class="nroffsh">SEE ALSO</h2> -<p class="level0"><a class="manpage" href="./curl_easy_unescape.html">curl_easy_unescape (3)</a> <a class="manpage" href="./curl_free.html"> curl_free (3)</a> <span Class="manpage"> <a href="http://www.ietf.org/rfc/rfc2396.txt">RFC 2396</a></span> <p class="roffit"> - This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>. -</body></html> diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_escape.pdf b/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_escape.pdf deleted file mode 100644 index 3503261f70..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_escape.pdf +++ /dev/null @@ -1,113 +0,0 @@ -%PDF-1.4 -%Çì¢ -5 0 obj -<</Length 6 0 R/Filter /FlateDecode>> -stream -xœ…VÛnÛF}×WR"q½K.ohQ@q@…"§2À -ƒ!)‰µtx©?ôúÑ]^%Ùè6»s9sæ¿%¨|µŸÑqrµqa_N(ì'_'L¡ýˆŽð.Àžü#ØMš;\\ß"žÁqÂLJLüö4ù¬Eu‘=$aùí!)£ð1ÙjÖV‡,ý"
ºaÚ”PêjBQ‡¼xZÿ3ømb K†>#îcpâÛ2¾å@°šhë¹>Å|ÑÊlbûæÄíÃBþe‹yqê‚ÁLi¦2ËÁ€»Í -åqRBuH`ŸJ7˜³›.q6Ä߉´™DY|bz¾Ç[“(¥©ÉŠ-¡*R±o2•b˜ŒÎ1;‡xêÜíýúæãíòv8Ú–Ü ýŠ(«ã~–U\É7røE%Ä.Ñ!,àí%ªp-k|‹ ]mízÉM‚Ž›U{†Ê†ð˜Ã|¿=6‹ú}¡x¸I¼`¢3²öÄ«0‹áÔ,í ꥈ¢:óŽóá^–ˆ}u8EÎTº[ý§zàÙû4ôà×Åíõfù1XÞ¬O¹4´ÛdŠKÁ!-aW‹¨JsQ.Nxã2Â|Ó<!½¤MQ½È:Ë&îùm‹Pù‚xfXVÜÞ’‰ª<Åc]A©hU¡Q>¡Hªº2Ÿ°‚°„DXº7¹/'½ ûa9qF½Èò(¬’XÕÃ)%–eà19ÃR*š¸æY©JQÒ7Œª¤è2(9~Ï3˜Ì€þ¦Æ߈0îhò×Ãò¦ÿNÕ%ÙŠVEZ4Çw¾ßÄÂ~¤¼Q(©Šßœ4Ç°˜¼&ó5´)µ(%A¶Úë5<Ì¿¤ßêIGO¾éxZnÄé>à舧ïÙ\û'Œ“(=¢RŠúø%)¶:iêê‚rð%ªŽL[½ÜÉäÏæÀ&ŒQó…Ié…ÒÇI±»a!.ï€Ì¾>&¢’9—I%!¢XÎsRä[}v>˜Ô&ÎXW.þ$8Ž çðnÎëU©inqfq“Ó¡rZ£¨Ÿ6?•—ѪB·>gÝ(8Œ+€0õÿé9ÒÊ°\N,æõÍ,Óç„(N°l©vŸ£t¶Ê…ºÃA¬ÃØØ”AîÊÁâ„9ÝÅvSî -Ýr°×Ü×’ÑöªÀ}Éí.I4š9f9%à[^Ouî7ÌAŠÅ¹Hà)V-möÔ»XªX·+¼WA<G´æŸ`ÞˆëÔ±û±\Íß-WËàþv‹{ÞéÒÇRhR.áÖ<faÔ®Ü<‹/Ðò ã',z@Ž9Þ“Ôž»’™}ŸµÍ"¸Û¬á“Î,9‡ióÕÝBaÕï©Ë ÍÇÊ粡©y*P¾”È‚œÀ_ÇTH5ìz…2µ¾[ Ýa_`§3ª…i–Ĥíü8aì¾ò>zFX,`¾º½yõa¸Z4ˆMW{»[ŠÍÙÙ\áÆw:¹xÊ\d–Å‘§gµ<”Ö^^¾ëQÛ¼¿¾xL³[Žk¦å;jôLfÁÍV³šçÇ–>£Ç“zøÕ]vç/÷E{,ÒLJ•kA<«»Ãä_‹`ò;¾þBàÈ“endstream -endobj -6 0 obj -1222 -endobj -4 0 obj -<</Type/Page/MediaBox [0 0 595 842] -/Rotate 0/Parent 3 0 R -/Resources<</ProcSet[/PDF /Text] -/ExtGState 11 0 R -/Font 12 0 R ->> -/Contents 5 0 R ->> -endobj -3 0 obj -<< /Type /Pages /Kids [ -4 0 R -] /Count 1 ->> -endobj -1 0 obj -<</Type /Catalog /Pages 3 0 R -/Metadata 14 0 R ->> -endobj -7 0 obj -<</Type/ExtGState -/OPM 1>>endobj -11 0 obj -<</R7 -7 0 R>> -endobj -12 0 obj -<</R10 -10 0 R/R9 -9 0 R/R8 -8 0 R>> -endobj -10 0 obj -<</BaseFont/Times-Italic/Type/Font -/Subtype/Type1>> -endobj -9 0 obj -<</BaseFont/Times-Bold/Type/Font -/Subtype/Type1>> -endobj -8 0 obj -<</BaseFont/Times-Roman/Type/Font -/Encoding 13 0 R/Subtype/Type1>> -endobj -13 0 obj -<</Type/Encoding/Differences[ -126/tilde -140/fi]>> -endobj -14 0 obj -<</Type/Metadata -/Subtype/XML/Length 1346>>stream -<?xpacket begin='' id='W5M0MpCehiHzreSzNTczkc9d'?> -<?adobe-xap-filters esc="CRLF"?> -<x:xmpmeta xmlns:x='adobe:ns:meta/' x:xmptk='XMP toolkit 2.9.1-13, framework 1.6'> -<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' xmlns:iX='http://ns.adobe.com/iX/1.0/'> -<rdf:Description rdf:about='uuid:ba8f4ead-a861-11ed-0000-e20d2ea3735f' xmlns:pdf='http://ns.adobe.com/pdf/1.3/' pdf:Producer='GPL Ghostscript 9.05'/> -<rdf:Description rdf:about='uuid:ba8f4ead-a861-11ed-0000-e20d2ea3735f' xmlns:xmp='http://ns.adobe.com/xap/1.0/'><xmp:ModifyDate>2013-02-06T11:08:40+01:00</xmp:ModifyDate> -<xmp:CreateDate>2013-02-06T11:08:40+01:00</xmp:CreateDate> -<xmp:CreatorTool>groff version 1.22.1</xmp:CreatorTool></rdf:Description> -<rdf:Description rdf:about='uuid:ba8f4ead-a861-11ed-0000-e20d2ea3735f' xmlns:xapMM='http://ns.adobe.com/xap/1.0/mm/' xapMM:DocumentID='uuid:ba8f4ead-a861-11ed-0000-e20d2ea3735f'/> -<rdf:Description rdf:about='uuid:ba8f4ead-a861-11ed-0000-e20d2ea3735f' xmlns:dc='http://purl.org/dc/elements/1.1/' dc:format='application/pdf'><dc:title><rdf:Alt><rdf:li xml:lang='x-default'>Untitled</rdf:li></rdf:Alt></dc:title></rdf:Description> -</rdf:RDF> -</x:xmpmeta> - - -<?xpacket end='w'?> -endstream -endobj -2 0 obj -<</Producer(GPL Ghostscript 9.05) -/CreationDate(D:20130206110840+01'00') -/ModDate(D:20130206110840+01'00') -/Creator(groff version 1.22.1)>>endobj -xref -0 15 -0000000000 65535 f -0000001546 00000 n -0000003436 00000 n -0000001487 00000 n -0000001327 00000 n -0000000015 00000 n -0000001307 00000 n -0000001611 00000 n -0000001865 00000 n -0000001800 00000 n -0000001732 00000 n -0000001652 00000 n -0000001682 00000 n -0000001947 00000 n -0000002013 00000 n -trailer -<< /Size 15 /Root 1 0 R /Info 2 0 R -/ID [<D603BA540007FA8CB8E3C3596BB0E427><D603BA540007FA8CB8E3C3596BB0E427>] ->> -startxref -3590 -%%EOF diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_getinfo.3 b/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_getinfo.3 deleted file mode 100644 index 44e377b941..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_getinfo.3 +++ /dev/null @@ -1,292 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at http://curl.haxx.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" ************************************************************************** -.\" -.TH curl_easy_getinfo 3 "11 Feb 2009" "libcurl 7.19.4" "libcurl Manual" -.SH NAME -curl_easy_getinfo - extract information from a curl handle -.SH SYNOPSIS -.B #include <curl/curl.h> - -.B "CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ... );" - -.SH DESCRIPTION -Request internal information from the curl session with this function. The -third argument \fBMUST\fP be a pointer to a long, a pointer to a char *, a -pointer to a struct curl_slist * or a pointer to a double (as this -documentation describes further down). The data pointed-to will be filled in -accordingly and can be relied upon only if the function returns CURLE_OK. Use -this function AFTER a performed transfer if you want to get transfer- oriented -data. - -You should not free the memory returned by this function unless it is -explicitly mentioned below. -.SH AVAILABLE INFORMATION -The following information can be extracted: -.IP CURLINFO_EFFECTIVE_URL -Pass a pointer to a char pointer to receive the last used effective URL. -.IP CURLINFO_RESPONSE_CODE -Pass a pointer to a long to receive the last received HTTP, FTP or SMTP -response code. This option was previously known as CURLINFO_HTTP_CODE in -libcurl 7.10.7 and earlier. The value will be zero if no server response code -has been received. Note that a proxy's CONNECT response should be read with -\fICURLINFO_HTTP_CONNECTCODE\fP and not this. - -Support for SMTP responses added in 7.25.0. -.IP CURLINFO_HTTP_CONNECTCODE -Pass a pointer to a long to receive the last received proxy response code to a -CONNECT request. -.IP CURLINFO_FILETIME -Pass a pointer to a long to receive the remote time of the retrieved document -(in number of seconds since 1 jan 1970 in the GMT/UTC time zone). If you get --1, it can be because of many reasons (unknown, the server hides it or the -server doesn't support the command that tells document time etc) and the time -of the document is unknown. Note that you must tell the server to collect this -information before the transfer is made, by using the CURLOPT_FILETIME option -to \fIcurl_easy_setopt(3)\fP or you will unconditionally get a -1 back. (Added -in 7.5) -.IP CURLINFO_TOTAL_TIME -Pass a pointer to a double to receive the total time in seconds for the -previous transfer, including name resolving, TCP connect etc. -.IP CURLINFO_NAMELOOKUP_TIME -Pass a pointer to a double to receive the time, in seconds, it took from the -start until the name resolving was completed. -.IP CURLINFO_CONNECT_TIME -Pass a pointer to a double to receive the time, in seconds, it took from the -start until the connect to the remote host (or proxy) was completed. -.IP CURLINFO_APPCONNECT_TIME -Pass a pointer to a double to receive the time, in seconds, it took from the -start until the SSL/SSH connect/handshake to the remote host was completed. -This time is most often very near to the PRETRANSFER time, except for cases -such as HTTP pippelining where the pretransfer time can be delayed due to -waits in line for the pipeline and more. (Added in 7.19.0) -.IP CURLINFO_PRETRANSFER_TIME -Pass a pointer to a double to receive the time, in seconds, it took from the -start until the file transfer is just about to begin. This includes all -pre-transfer commands and negotiations that are specific to the particular -protocol(s) involved. It does \fInot\fP involve the sending of the protocol- -specific request that triggers a transfer. -.IP CURLINFO_STARTTRANSFER_TIME -Pass a pointer to a double to receive the time, in seconds, it took from the -start until the first byte is received by libcurl. This includes -CURLINFO_PRETRANSFER_TIME and also the time the server needs to calculate the -result. -.IP CURLINFO_REDIRECT_TIME -Pass a pointer to a double to receive the total time, in seconds, it took for -all redirection steps include name lookup, connect, pretransfer and transfer -before final transaction was started. CURLINFO_REDIRECT_TIME contains the -complete execution time for multiple redirections. (Added in 7.9.7) -.IP CURLINFO_REDIRECT_COUNT -Pass a pointer to a long to receive the total number of redirections that were -actually followed. (Added in 7.9.7) -.IP CURLINFO_REDIRECT_URL -Pass a pointer to a char pointer to receive the URL a redirect \fIwould\fP -take you to if you would enable CURLOPT_FOLLOWLOCATION. This can come very -handy if you think using the built-in libcurl redirect logic isn't good enough -for you but you would still prefer to avoid implementing all the magic of -figuring out the new URL. (Added in 7.18.2) -.IP CURLINFO_SIZE_UPLOAD -Pass a pointer to a double to receive the total amount of bytes that were -uploaded. -.IP CURLINFO_SIZE_DOWNLOAD -Pass a pointer to a double to receive the total amount of bytes that were -downloaded. The amount is only for the latest transfer and will be reset again -for each new transfer. -.IP CURLINFO_SPEED_DOWNLOAD -Pass a pointer to a double to receive the average download speed that curl -measured for the complete download. Measured in bytes/second. -.IP CURLINFO_SPEED_UPLOAD -Pass a pointer to a double to receive the average upload speed that curl -measured for the complete upload. Measured in bytes/second. -.IP CURLINFO_HEADER_SIZE -Pass a pointer to a long to receive the total size of all the headers -received. Measured in number of bytes. -.IP CURLINFO_REQUEST_SIZE -Pass a pointer to a long to receive the total size of the issued -requests. This is so far only for HTTP requests. Note that this may be more -than one request if FOLLOWLOCATION is true. -.IP CURLINFO_SSL_VERIFYRESULT -Pass a pointer to a long to receive the result of the certification -verification that was requested (using the CURLOPT_SSL_VERIFYPEER option to -\fIcurl_easy_setopt(3)\fP). -.IP CURLINFO_SSL_ENGINES -Pass the address of a 'struct curl_slist *' to receive a linked-list of -OpenSSL crypto-engines supported. Note that engines are normally implemented -in separate dynamic libraries. Hence not all the returned engines may be -available at run-time. \fBNOTE:\fP you must call \fIcurl_slist_free_all(3)\fP -on the list pointer once you're done with it, as libcurl will not free the -data for you. (Added in 7.12.3) -.IP CURLINFO_CONTENT_LENGTH_DOWNLOAD -Pass a pointer to a double to receive the content-length of the download. This -is the value read from the Content-Length: field. Since 7.19.4, this returns -1 -if the size isn't known. -.IP CURLINFO_CONTENT_LENGTH_UPLOAD -Pass a pointer to a double to receive the specified size of the upload. Since -7.19.4, this returns -1 if the size isn't known. -.IP CURLINFO_CONTENT_TYPE -Pass a pointer to a char pointer to receive the content-type of the downloaded -object. This is the value read from the Content-Type: field. If you get NULL, -it means that the server didn't send a valid Content-Type header or that the -protocol used doesn't support this. -.IP CURLINFO_PRIVATE -Pass a pointer to a char pointer to receive the pointer to the private data -associated with the curl handle (set with the CURLOPT_PRIVATE option to -\fIcurl_easy_setopt(3)\fP). Please note that for internal reasons, the -value is returned as a char pointer, although effectively being a 'void *'. -(Added in 7.10.3) -.IP CURLINFO_HTTPAUTH_AVAIL -Pass a pointer to a long to receive a bitmask indicating the authentication -method(s) available. The meaning of the bits is explained in the -CURLOPT_HTTPAUTH option for \fIcurl_easy_setopt(3)\fP. (Added in 7.10.8) -.IP CURLINFO_PROXYAUTH_AVAIL -Pass a pointer to a long to receive a bitmask indicating the authentication -method(s) available for your proxy authentication. (Added in 7.10.8) -.IP CURLINFO_OS_ERRNO -Pass a pointer to a long to receive the errno variable from a connect failure. -Note that the value is only set on failure, it is not reset upon a -successful operation. (Added in 7.12.2) -.IP CURLINFO_NUM_CONNECTS -Pass a pointer to a long to receive how many new connections libcurl had to -create to achieve the previous transfer (only the successful connects are -counted). Combined with \fICURLINFO_REDIRECT_COUNT\fP you are able to know -how many times libcurl successfully reused existing connection(s) or not. See -the Connection Options of \fIcurl_easy_setopt(3)\fP to see how libcurl tries -to make persistent connections to save time. (Added in 7.12.3) -.IP CURLINFO_PRIMARY_IP -Pass a pointer to a char pointer to receive the pointer to a zero-terminated -string holding the IP address of the most recent connection done with this -\fBcurl\fP handle. This string may be IPv6 if that's enabled. Note that you -get a pointer to a memory area that will be re-used at next request so you -need to copy the string if you want to keep the information. (Added in 7.19.0) -.IP CURLINFO_PRIMARY_PORT -Pass a pointer to a long to receive the destination port of the most recent -connection done with this \fBcurl\fP handle. (Added in 7.21.0) -.IP CURLINFO_LOCAL_IP -Pass a pointer to a char pointer to receive the pointer to a zero-terminated -string holding the local (source) IP address of the most recent connection done -with this \fBcurl\fP handle. This string may be IPv6 if that's enabled. The -same restrictions apply as to \fICURLINFO_PRIMARY_IP\fP. (Added in 7.21.0) -.IP CURLINFO_LOCAL_PORT -Pass a pointer to a long to receive the local (source) port of the most recent -connection done with this \fBcurl\fP handle. (Added in 7.21.0) -.IP CURLINFO_COOKIELIST -Pass a pointer to a 'struct curl_slist *' to receive a linked-list of all -cookies cURL knows (expired ones, too). Don't forget to -\fIcurl_slist_free_all(3)\fP the list after it has been used. If there are no -cookies (cookies for the handle have not been enabled or simply none have been -received) 'struct curl_slist *' will be set to point to NULL. (Added in -7.14.1) -.IP CURLINFO_LASTSOCKET -Pass a pointer to a long to receive the last socket used by this curl -session. If the socket is no longer valid, -1 is returned. When you finish -working with the socket, you must call curl_easy_cleanup() as usual and let -libcurl close the socket and cleanup other resources associated with the -handle. This is typically used in combination with \fICURLOPT_CONNECT_ONLY\fP. -(Added in 7.15.2) - -NOTE: this API is not really working on win64, since the SOCKET type on win64 -is 64 bit large while its 'long' is only 32 bits. -.IP CURLINFO_FTP_ENTRY_PATH -Pass a pointer to a char pointer to receive a pointer to a string holding the -path of the entry path. That is the initial path libcurl ended up in when -logging on to the remote FTP server. This stores a NULL as pointer if -something is wrong. (Added in 7.15.4) - -Also works for SFTP since 7.21.4 -.IP CURLINFO_CERTINFO -Pass a pointer to a 'struct curl_certinfo *' and you'll get it set to point to -struct that holds a number of linked lists with info about the certificate -chain, assuming you had CURLOPT_CERTINFO enabled when the previous request was -done. The struct reports how many certs it found and then you can extract info -for each of those certs by following the linked lists. The info chain is -provided in a series of data in the format "name:content" where the content is -for the specific named data. See also the certinfo.c example. NOTE: this -option is only available in libcurl built with OpenSSL support. (Added in -7.19.1) -.IP CURLINFO_CONDITION_UNMET -Pass a pointer to a long to receive the number 1 if the condition provided in -the previous request didn't match (see \fICURLOPT_TIMECONDITION\fP). Alas, if -this returns a 1 you know that the reason you didn't get data in return is -because it didn't fulfill the condition. The long ths argument points to will -get a zero stored if the condition instead was met. (Added in 7.19.4) -.IP CURLINFO_RTSP_SESSION_ID -Pass a pointer to a char pointer to receive a pointer to a string holding the -most recent RTSP Session ID. - -Applications wishing to resume an RTSP session on another connection should -retreive this info before closing the active connection. -.IP CURLINFO_RTSP_CLIENT_CSEQ -Pass a pointer to a long to receive the next CSeq that will be used by the -application. -.IP CURLINFO_RTSP_SERVER_CSEQ -Pass a pointer to a long to receive the next server CSeq that will be expected -by the application. - -\fI(NOTE: listening for server initiated requests is currently -unimplemented).\fP - -Applications wishing to resume an RTSP session on another connection should -retreive this info before closing the active connection. -.IP CURLINFO_RTSP_CSEQ_RECV -Pass a pointer to a long to receive the most recently received CSeq from the -server. If your application encounters a \fICURLE_RTSP_CSEQ_ERROR\fP then you -may wish to troubleshoot and/or fix the CSeq mismatch by peeking at this value. -.SH TIMES -.nf -An overview of the six time values available from curl_easy_getinfo() - -curl_easy_perform() - | - |--NAMELOOKUP - |--|--CONNECT - |--|--|--APPCONNECT - |--|--|--|--PRETRANSFER - |--|--|--|--|--STARTTRANSFER - |--|--|--|--|--|--TOTAL - |--|--|--|--|--|--REDIRECT -.fi -.IP NAMELOOKUP -\fICURLINFO_NAMELOOKUP_TIME\fP. The time it took from the start until the name -resolving was completed. -.IP CONNECT -\fICURLINFO_CONNECT_TIME\fP. The time it took from the start until the connect -to the remote host (or proxy) was completed. -.IP APPCONNECT -\fICURLINFO_APPCONNECT_TIME\fP. The time it took from the start until the SSL -connect/handshake with the remote host was completed. (Added in in 7.19.0) -.IP PRETRANSFER -\fICURLINFO_PRETRANSFER_TIME\fP. The time it took from the start until the -file transfer is just about to begin. This includes all pre-transfer commands -and negotiations that are specific to the particular protocol(s) involved. -.IP STARTTRANSFER -\fICURLINFO_STARTTRANSFER_TIME\fP. The time it took from the start until the -first byte is received by libcurl. -.IP TOTAL -\fICURLINFO_TOTAL_TIME\fP. Total time of the previous request. -.IP REDIRECT -\fICURLINFO_REDIRECT_TIME\fP. The time it took for all redirection steps -include name lookup, connect, pretransfer and transfer before final -transaction was started. So, this is zero if no redirection took place. -.SH RETURN VALUE -If the operation was successful, CURLE_OK is returned. Otherwise an -appropriate error code will be returned. -.SH "SEE ALSO" -.BR curl_easy_setopt "(3)" diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_getinfo.html b/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_getinfo.html deleted file mode 100644 index 5b3c4c300b..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_getinfo.html +++ /dev/null @@ -1,167 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> -<html><head> -<title>curl_easy_getinfo man page</title> -<meta name="generator" content="roffit"> -<STYLE type="text/css"> -P.level0 { - padding-left: 2em; -} - -P.level1 { - padding-left: 4em; -} - -P.level2 { - padding-left: 6em; -} - -span.emphasis { - font-style: italic; -} - -span.bold { - font-weight: bold; -} - -span.manpage { - font-weight: bold; -} - -h2.nroffsh { - background-color: #e0e0e0; -} - -span.nroffip { - font-weight: bold; - font-size: 120%; - font-family: monospace; -} - -p.roffit { - text-align: center; - font-size: 80%; -} -</STYLE> -</head><body> - -<p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2> -<p class="level0">curl_easy_getinfo - extract information from a curl handle <a name="SYNOPSIS"></a><h2 class="nroffsh">SYNOPSIS</h2> -<p class="level0"><span Class="bold">#include <curl/curl.h></span> -<p class="level0"><span Class="bold">CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ... );</span> -<p class="level0"><a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2> -<p class="level0">Request internal information from the curl session with this function. The third argument <span Class="bold">MUST</span> be a pointer to a long, a pointer to a char *, a pointer to a struct curl_slist * or a pointer to a double (as this documentation describes further down). The data pointed-to will be filled in accordingly and can be relied upon only if the function returns CURLE_OK. Use this function AFTER a performed transfer if you want to get transfer- oriented data. -<p class="level0">You should not free the memory returned by this function unless it is explicitly mentioned below. <a name="AVAILABLE"></a><h2 class="nroffsh">AVAILABLE INFORMATION</h2> -<p class="level0">The following information can be extracted: -<p class="level0"><a name="CURLINFOEFFECTIVEURL"></a><span class="nroffip">CURLINFO_EFFECTIVE_URL</span> -<p class="level1">Pass a pointer to a char pointer to receive the last used effective URL. -<p class="level0"><a name="CURLINFORESPONSECODE"></a><span class="nroffip">CURLINFO_RESPONSE_CODE</span> -<p class="level1">Pass a pointer to a long to receive the last received HTTP, FTP or SMTP response code. This option was previously known as CURLINFO_HTTP_CODE in libcurl 7.10.7 and earlier. The value will be zero if no server response code has been received. Note that a proxy's CONNECT response should be read with <a class="emphasis" href="#CURLINFOHTTPCONNECTCODE">CURLINFO_HTTP_CONNECTCODE</a> and not this. -<p class="level1">Support for SMTP responses added in 7.25.0. -<p class="level0"><a name="CURLINFOHTTPCONNECTCODE"></a><span class="nroffip">CURLINFO_HTTP_CONNECTCODE</span> -<p class="level1">Pass a pointer to a long to receive the last received proxy response code to a CONNECT request. -<p class="level0"><a name="CURLINFOFILETIME"></a><span class="nroffip">CURLINFO_FILETIME</span> -<p class="level1">Pass a pointer to a long to receive the remote time of the retrieved document (in number of seconds since 1 jan 1970 in the GMT/UTC time zone). If you get -1, it can be because of many reasons (unknown, the server hides it or the server doesn't support the command that tells document time etc) and the time of the document is unknown. Note that you must tell the server to collect this information before the transfer is made, by using the CURLOPT_FILETIME option to <a class="emphasis" href="./curl_easy_setopt.html">curl_easy_setopt(3)</a> or you will unconditionally get a -1 back. (Added in 7.5) -<p class="level0"><a name="CURLINFOTOTALTIME"></a><span class="nroffip">CURLINFO_TOTAL_TIME</span> -<p class="level1">Pass a pointer to a double to receive the total time in seconds for the previous transfer, including name resolving, TCP connect etc. -<p class="level0"><a name="CURLINFONAMELOOKUPTIME"></a><span class="nroffip">CURLINFO_NAMELOOKUP_TIME</span> -<p class="level1">Pass a pointer to a double to receive the time, in seconds, it took from the start until the name resolving was completed. -<p class="level0"><a name="CURLINFOCONNECTTIME"></a><span class="nroffip">CURLINFO_CONNECT_TIME</span> -<p class="level1">Pass a pointer to a double to receive the time, in seconds, it took from the start until the connect to the remote host (or proxy) was completed. -<p class="level0"><a name="CURLINFOAPPCONNECTTIME"></a><span class="nroffip">CURLINFO_APPCONNECT_TIME</span> -<p class="level1">Pass a pointer to a double to receive the time, in seconds, it took from the start until the SSL/SSH connect/handshake to the remote host was completed. This time is most often very near to the PRETRANSFER time, except for cases such as HTTP pippelining where the pretransfer time can be delayed due to waits in line for the pipeline and more. (Added in 7.19.0) -<p class="level0"><a name="CURLINFOPRETRANSFERTIME"></a><span class="nroffip">CURLINFO_PRETRANSFER_TIME</span> -<p class="level1">Pass a pointer to a double to receive the time, in seconds, it took from the start until the file transfer is just about to begin. This includes all pre-transfer commands and negotiations that are specific to the particular protocol(s) involved. It does <span Class="emphasis">not</span> involve the sending of the protocol- specific request that triggers a transfer. -<p class="level0"><a name="CURLINFOSTARTTRANSFERTIME"></a><span class="nroffip">CURLINFO_STARTTRANSFER_TIME</span> -<p class="level1">Pass a pointer to a double to receive the time, in seconds, it took from the start until the first byte is received by libcurl. This includes CURLINFO_PRETRANSFER_TIME and also the time the server needs to calculate the result. -<p class="level0"><a name="CURLINFOREDIRECTTIME"></a><span class="nroffip">CURLINFO_REDIRECT_TIME</span> -<p class="level1">Pass a pointer to a double to receive the total time, in seconds, it took for all redirection steps include name lookup, connect, pretransfer and transfer before final transaction was started. CURLINFO_REDIRECT_TIME contains the complete execution time for multiple redirections. (Added in 7.9.7) -<p class="level0"><a name="CURLINFOREDIRECTCOUNT"></a><span class="nroffip">CURLINFO_REDIRECT_COUNT</span> -<p class="level1">Pass a pointer to a long to receive the total number of redirections that were actually followed. (Added in 7.9.7) -<p class="level0"><a name="CURLINFOREDIRECTURL"></a><span class="nroffip">CURLINFO_REDIRECT_URL</span> -<p class="level1">Pass a pointer to a char pointer to receive the URL a redirect <span Class="emphasis">would</span> take you to if you would enable CURLOPT_FOLLOWLOCATION. This can come very handy if you think using the built-in libcurl redirect logic isn't good enough for you but you would still prefer to avoid implementing all the magic of figuring out the new URL. (Added in 7.18.2) -<p class="level0"><a name="CURLINFOSIZEUPLOAD"></a><span class="nroffip">CURLINFO_SIZE_UPLOAD</span> -<p class="level1">Pass a pointer to a double to receive the total amount of bytes that were uploaded. -<p class="level0"><a name="CURLINFOSIZEDOWNLOAD"></a><span class="nroffip">CURLINFO_SIZE_DOWNLOAD</span> -<p class="level1">Pass a pointer to a double to receive the total amount of bytes that were downloaded. The amount is only for the latest transfer and will be reset again for each new transfer. -<p class="level0"><a name="CURLINFOSPEEDDOWNLOAD"></a><span class="nroffip">CURLINFO_SPEED_DOWNLOAD</span> -<p class="level1">Pass a pointer to a double to receive the average download speed that curl measured for the complete download. Measured in bytes/second. -<p class="level0"><a name="CURLINFOSPEEDUPLOAD"></a><span class="nroffip">CURLINFO_SPEED_UPLOAD</span> -<p class="level1">Pass a pointer to a double to receive the average upload speed that curl measured for the complete upload. Measured in bytes/second. -<p class="level0"><a name="CURLINFOHEADERSIZE"></a><span class="nroffip">CURLINFO_HEADER_SIZE</span> -<p class="level1">Pass a pointer to a long to receive the total size of all the headers received. Measured in number of bytes. -<p class="level0"><a name="CURLINFOREQUESTSIZE"></a><span class="nroffip">CURLINFO_REQUEST_SIZE</span> -<p class="level1">Pass a pointer to a long to receive the total size of the issued requests. This is so far only for HTTP requests. Note that this may be more than one request if FOLLOWLOCATION is true. -<p class="level0"><a name="CURLINFOSSLVERIFYRESULT"></a><span class="nroffip">CURLINFO_SSL_VERIFYRESULT</span> -<p class="level1">Pass a pointer to a long to receive the result of the certification verification that was requested (using the CURLOPT_SSL_VERIFYPEER option to <a class="emphasis" href="./curl_easy_setopt.html">curl_easy_setopt(3)</a>). -<p class="level0"><a name="CURLINFOSSLENGINES"></a><span class="nroffip">CURLINFO_SSL_ENGINES</span> -<p class="level1">Pass the address of a 'struct curl_slist *' to receive a linked-list of OpenSSL crypto-engines supported. Note that engines are normally implemented in separate dynamic libraries. Hence not all the returned engines may be available at run-time. <span Class="bold">NOTE:</span> you must call <a class="emphasis" href="./curl_slist_free_all.html">curl_slist_free_all(3)</a> on the list pointer once you're done with it, as libcurl will not free the data for you. (Added in 7.12.3) -<p class="level0"><a name="CURLINFOCONTENTLENGTHDOWNLOAD"></a><span class="nroffip">CURLINFO_CONTENT_LENGTH_DOWNLOAD</span> -<p class="level1">Pass a pointer to a double to receive the content-length of the download. This is the value read from the Content-Length: field. Since 7.19.4, this returns -1 if the size isn't known. -<p class="level0"><a name="CURLINFOCONTENTLENGTHUPLOAD"></a><span class="nroffip">CURLINFO_CONTENT_LENGTH_UPLOAD</span> -<p class="level1">Pass a pointer to a double to receive the specified size of the upload. Since 7.19.4, this returns -1 if the size isn't known. -<p class="level0"><a name="CURLINFOCONTENTTYPE"></a><span class="nroffip">CURLINFO_CONTENT_TYPE</span> -<p class="level1">Pass a pointer to a char pointer to receive the content-type of the downloaded object. This is the value read from the Content-Type: field. If you get NULL, it means that the server didn't send a valid Content-Type header or that the protocol used doesn't support this. -<p class="level0"><a name="CURLINFOPRIVATE"></a><span class="nroffip">CURLINFO_PRIVATE</span> -<p class="level1">Pass a pointer to a char pointer to receive the pointer to the private data associated with the curl handle (set with the CURLOPT_PRIVATE option to <a class="emphasis" href="./curl_easy_setopt.html">curl_easy_setopt(3)</a>). Please note that for internal reasons, the value is returned as a char pointer, although effectively being a 'void *'. (Added in 7.10.3) -<p class="level0"><a name="CURLINFOHTTPAUTHAVAIL"></a><span class="nroffip">CURLINFO_HTTPAUTH_AVAIL</span> -<p class="level1">Pass a pointer to a long to receive a bitmask indicating the authentication method(s) available. The meaning of the bits is explained in the CURLOPT_HTTPAUTH option for <a class="emphasis" href="./curl_easy_setopt.html">curl_easy_setopt(3)</a>. (Added in 7.10.8) -<p class="level0"><a name="CURLINFOPROXYAUTHAVAIL"></a><span class="nroffip">CURLINFO_PROXYAUTH_AVAIL</span> -<p class="level1">Pass a pointer to a long to receive a bitmask indicating the authentication method(s) available for your proxy authentication. (Added in 7.10.8) -<p class="level0"><a name="CURLINFOOSERRNO"></a><span class="nroffip">CURLINFO_OS_ERRNO</span> -<p class="level1">Pass a pointer to a long to receive the errno variable from a connect failure. Note that the value is only set on failure, it is not reset upon a successful operation. (Added in 7.12.2) -<p class="level0"><a name="CURLINFONUMCONNECTS"></a><span class="nroffip">CURLINFO_NUM_CONNECTS</span> -<p class="level1">Pass a pointer to a long to receive how many new connections libcurl had to create to achieve the previous transfer (only the successful connects are counted). Combined with <a class="emphasis" href="#CURLINFOREDIRECTCOUNT">CURLINFO_REDIRECT_COUNT</a> you are able to know how many times libcurl successfully reused existing connection(s) or not. See the Connection Options of <a class="emphasis" href="./curl_easy_setopt.html">curl_easy_setopt(3)</a> to see how libcurl tries to make persistent connections to save time. (Added in 7.12.3) -<p class="level0"><a name="CURLINFOPRIMARYIP"></a><span class="nroffip">CURLINFO_PRIMARY_IP</span> -<p class="level1">Pass a pointer to a char pointer to receive the pointer to a zero-terminated string holding the IP address of the most recent connection done with this <span Class="bold">curl</span> handle. This string may be IPv6 if that's enabled. Note that you get a pointer to a memory area that will be re-used at next request so you need to copy the string if you want to keep the information. (Added in 7.19.0) -<p class="level0"><a name="CURLINFOPRIMARYPORT"></a><span class="nroffip">CURLINFO_PRIMARY_PORT</span> -<p class="level1">Pass a pointer to a long to receive the destination port of the most recent connection done with this <span Class="bold">curl</span> handle. (Added in 7.21.0) -<p class="level0"><a name="CURLINFOLOCALIP"></a><span class="nroffip">CURLINFO_LOCAL_IP</span> -<p class="level1">Pass a pointer to a char pointer to receive the pointer to a zero-terminated string holding the local (source) IP address of the most recent connection done with this <span Class="bold">curl</span> handle. This string may be IPv6 if that's enabled. The same restrictions apply as to <a class="emphasis" href="#CURLINFOPRIMARYIP">CURLINFO_PRIMARY_IP</a>. (Added in 7.21.0) -<p class="level0"><a name="CURLINFOLOCALPORT"></a><span class="nroffip">CURLINFO_LOCAL_PORT</span> -<p class="level1">Pass a pointer to a long to receive the local (source) port of the most recent connection done with this <span Class="bold">curl</span> handle. (Added in 7.21.0) -<p class="level0"><a name="CURLINFOCOOKIELIST"></a><span class="nroffip">CURLINFO_COOKIELIST</span> -<p class="level1">Pass a pointer to a 'struct curl_slist *' to receive a linked-list of all cookies cURL knows (expired ones, too). Don't forget to <a class="emphasis" href="./curl_slist_free_all.html">curl_slist_free_all(3)</a> the list after it has been used. If there are no cookies (cookies for the handle have not been enabled or simply none have been received) 'struct curl_slist *' will be set to point to NULL. (Added in 7.14.1) -<p class="level0"><a name="CURLINFOLASTSOCKET"></a><span class="nroffip">CURLINFO_LASTSOCKET</span> -<p class="level1">Pass a pointer to a long to receive the last socket used by this curl session. If the socket is no longer valid, -1 is returned. When you finish working with the socket, you must call curl_easy_cleanup() as usual and let libcurl close the socket and cleanup other resources associated with the handle. This is typically used in combination with <span Class="emphasis">CURLOPT_CONNECT_ONLY</span>. (Added in 7.15.2) -<p class="level1">NOTE: this API is not really working on win64, since the SOCKET type on win64 is 64 bit large while its 'long' is only 32 bits. -<p class="level0"><a name="CURLINFOFTPENTRYPATH"></a><span class="nroffip">CURLINFO_FTP_ENTRY_PATH</span> -<p class="level1">Pass a pointer to a char pointer to receive a pointer to a string holding the path of the entry path. That is the initial path libcurl ended up in when logging on to the remote FTP server. This stores a NULL as pointer if something is wrong. (Added in 7.15.4) -<p class="level1">Also works for SFTP since 7.21.4 -<p class="level0"><a name="CURLINFOCERTINFO"></a><span class="nroffip">CURLINFO_CERTINFO</span> -<p class="level1">Pass a pointer to a 'struct curl_certinfo *' and you'll get it set to point to struct that holds a number of linked lists with info about the certificate chain, assuming you had CURLOPT_CERTINFO enabled when the previous request was done. The struct reports how many certs it found and then you can extract info for each of those certs by following the linked lists. The info chain is provided in a series of data in the format "name:content" where the content is for the specific named data. See also the certinfo.c example. NOTE: this option is only available in libcurl built with OpenSSL support. (Added in 7.19.1) -<p class="level0"><a name="CURLINFOCONDITIONUNMET"></a><span class="nroffip">CURLINFO_CONDITION_UNMET</span> -<p class="level1">Pass a pointer to a long to receive the number 1 if the condition provided in the previous request didn't match (see <span Class="emphasis">CURLOPT_TIMECONDITION</span>). Alas, if this returns a 1 you know that the reason you didn't get data in return is because it didn't fulfill the condition. The long ths argument points to will get a zero stored if the condition instead was met. (Added in 7.19.4) -<p class="level0"><a name="CURLINFORTSPSESSIONID"></a><span class="nroffip">CURLINFO_RTSP_SESSION_ID</span> -<p class="level1">Pass a pointer to a char pointer to receive a pointer to a string holding the most recent RTSP Session ID. -<p class="level1">Applications wishing to resume an RTSP session on another connection should retreive this info before closing the active connection. -<p class="level0"><a name="CURLINFORTSPCLIENTCSEQ"></a><span class="nroffip">CURLINFO_RTSP_CLIENT_CSEQ</span> -<p class="level1">Pass a pointer to a long to receive the next CSeq that will be used by the application. -<p class="level0"><a name="CURLINFORTSPSERVERCSEQ"></a><span class="nroffip">CURLINFO_RTSP_SERVER_CSEQ</span> -<p class="level1">Pass a pointer to a long to receive the next server CSeq that will be expected by the application. -<p class="level1"><span class="emphasis">(NOTE: listening for server initiated requests is currently unimplemented).</span> -<p class="level1">Applications wishing to resume an RTSP session on another connection should retreive this info before closing the active connection. -<p class="level0"><a name="CURLINFORTSPCSEQRECV"></a><span class="nroffip">CURLINFO_RTSP_CSEQ_RECV</span> -<p class="level1">Pass a pointer to a long to receive the most recently received CSeq from the server. If your application encounters a <span Class="emphasis">CURLE_RTSP_CSEQ_ERROR</span> then you may wish to troubleshoot and/or fix the CSeq mismatch by peeking at this value. <a name="TIMES"></a><h2 class="nroffsh">TIMES</h2> -<p class="level0"> -<p class="level0">An overview of the six time values available from curl_easy_getinfo() -<p class="level0">curl_easy_perform() | |--NAMELOOKUP |--|--CONNECT |--|--|--APPCONNECT |--|--|--|--PRETRANSFER |--|--|--|--|--STARTTRANSFER |--|--|--|--|--|--TOTAL |--|--|--|--|--|--REDIRECT -<p class="level0"> -<p class="level0"><a name="NAMELOOKUP"></a><span class="nroffip">NAMELOOKUP</span> -<p class="level1"><a class="emphasis" href="#CURLINFONAMELOOKUPTIME">CURLINFO_NAMELOOKUP_TIME</a>. The time it took from the start until the name resolving was completed. -<p class="level0"><a name="CONNECT"></a><span class="nroffip">CONNECT</span> -<p class="level1"><a class="emphasis" href="#CURLINFOCONNECTTIME">CURLINFO_CONNECT_TIME</a>. The time it took from the start until the connect to the remote host (or proxy) was completed. -<p class="level0"><a name="APPCONNECT"></a><span class="nroffip">APPCONNECT</span> -<p class="level1"><a class="emphasis" href="#CURLINFOAPPCONNECTTIME">CURLINFO_APPCONNECT_TIME</a>. The time it took from the start until the SSL connect/handshake with the remote host was completed. (Added in in 7.19.0) -<p class="level0"><a name="PRETRANSFER"></a><span class="nroffip">PRETRANSFER</span> -<p class="level1"><a class="emphasis" href="#CURLINFOPRETRANSFERTIME">CURLINFO_PRETRANSFER_TIME</a>. The time it took from the start until the file transfer is just about to begin. This includes all pre-transfer commands and negotiations that are specific to the particular protocol(s) involved. -<p class="level0"><a name="STARTTRANSFER"></a><span class="nroffip">STARTTRANSFER</span> -<p class="level1"><a class="emphasis" href="#CURLINFOSTARTTRANSFERTIME">CURLINFO_STARTTRANSFER_TIME</a>. The time it took from the start until the first byte is received by libcurl. -<p class="level0"><a name="TOTAL"></a><span class="nroffip">TOTAL</span> -<p class="level1"><a class="emphasis" href="#CURLINFOTOTALTIME">CURLINFO_TOTAL_TIME</a>. Total time of the previous request. -<p class="level0"><a name="REDIRECT"></a><span class="nroffip">REDIRECT</span> -<p class="level1"><a class="emphasis" href="#CURLINFOREDIRECTTIME">CURLINFO_REDIRECT_TIME</a>. The time it took for all redirection steps include name lookup, connect, pretransfer and transfer before final transaction was started. So, this is zero if no redirection took place. <a name="RETURN"></a><h2 class="nroffsh">RETURN VALUE</h2> -<p class="level0">If the operation was successful, CURLE_OK is returned. Otherwise an appropriate error code will be returned. <a name="SEE"></a><h2 class="nroffsh">SEE ALSO</h2> -<p class="level0"><a class="manpage" href="./curl_easy_setopt.html">curl_easy_setopt (3)</a> <p class="roffit"> - This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>. -</body></html> diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_getinfo.pdf b/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_getinfo.pdf Binary files differdeleted file mode 100644 index a6d9c75f4e..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_getinfo.pdf +++ /dev/null diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_init.3 b/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_init.3 deleted file mode 100644 index 837ba32a53..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_init.3 +++ /dev/null @@ -1,51 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at http://curl.haxx.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" ************************************************************************** -.TH curl_easy_init 3 "4 March 2002" "libcurl 7.8.1" "libcurl Manual" -.SH NAME -curl_easy_init - Start a libcurl easy session -.SH SYNOPSIS -.B #include <curl/curl.h> - -.BI "CURL *curl_easy_init( );" - -.SH DESCRIPTION -This function must be the first function to call, and it returns a CURL easy -handle that you must use as input to other easy-functions. curl_easy_init -initializes curl and this call \fBMUST\fP have a corresponding call to -\fIcurl_easy_cleanup(3)\fP when the operation is complete. - -If you did not already call \fIcurl_global_init(3)\fP, -\fIcurl_easy_init(3)\fP does it automatically. -This may be lethal in multi-threaded cases, since \fIcurl_global_init(3)\fP is -not thread-safe, and it may result in resource problems because there is -no corresponding cleanup. - -You are strongly advised to not allow this automatic behaviour, by -calling \fIcurl_global_init(3)\fP yourself properly. -See the description in \fBlibcurl\fP(3) of global environment -requirements for details of how to use this function. - -.SH RETURN VALUE -If this function returns NULL, something went wrong and you cannot use the -other curl functions. -.SH "SEE ALSO" -.BR curl_easy_cleanup "(3), " curl_global_init "(3), " curl_easy_reset "(3)" diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_init.html b/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_init.html deleted file mode 100644 index 2f547dcebb..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_init.html +++ /dev/null @@ -1,60 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> -<html><head> -<title>curl_easy_init man page</title> -<meta name="generator" content="roffit"> -<STYLE type="text/css"> -P.level0 { - padding-left: 2em; -} - -P.level1 { - padding-left: 4em; -} - -P.level2 { - padding-left: 6em; -} - -span.emphasis { - font-style: italic; -} - -span.bold { - font-weight: bold; -} - -span.manpage { - font-weight: bold; -} - -h2.nroffsh { - background-color: #e0e0e0; -} - -span.nroffip { - font-weight: bold; - font-size: 120%; - font-family: monospace; -} - -p.roffit { - text-align: center; - font-size: 80%; -} -</STYLE> -</head><body> - -<p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2> -<p class="level0">curl_easy_init - Start a libcurl easy session <a name="SYNOPSIS"></a><h2 class="nroffsh">SYNOPSIS</h2> -<p class="level0"><span Class="bold">#include <curl/curl.h></span> -<p class="level0"><span Class="bold">CURL *curl_easy_init( );</span> -<p class="level0"><a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2> -<p class="level0">This function must be the first function to call, and it returns a CURL easy handle that you must use as input to other easy-functions. curl_easy_init initializes curl and this call <span Class="bold">MUST</span> have a corresponding call to <a class="emphasis" href="./curl_easy_cleanup.html">curl_easy_cleanup(3)</a> when the operation is complete. -<p class="level0">If you did not already call <a class="emphasis" href="./curl_global_init.html">curl_global_init(3)</a>, <a class="emphasis" href="./curl_easy_init.html">curl_easy_init(3)</a> does it automatically. This may be lethal in multi-threaded cases, since <a class="emphasis" href="./curl_global_init.html">curl_global_init(3)</a> is not thread-safe, and it may result in resource problems because there is no corresponding cleanup. -<p class="level0">You are strongly advised to not allow this automatic behaviour, by calling <a class="emphasis" href="./curl_global_init.html">curl_global_init(3)</a> yourself properly. See the description in <span Class="bold">libcurl</span>(3) of global environment requirements for details of how to use this function. -<p class="level0"><a name="RETURN"></a><h2 class="nroffsh">RETURN VALUE</h2> -<p class="level0">If this function returns NULL, something went wrong and you cannot use the other curl functions. <a name="SEE"></a><h2 class="nroffsh">SEE ALSO</h2> -<p class="level0"><a class="manpage" href="./curl_easy_cleanup.html">curl_easy_cleanup (3)</a> <a class="manpage" href="./curl_global_init.html"> curl_global_init (3)</a> <a class="manpage" href="./curl_easy_reset.html"> curl_easy_reset (3)</a> <p class="roffit"> - This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>. -</body></html> diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_init.pdf b/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_init.pdf Binary files differdeleted file mode 100644 index b7320fd55c..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_init.pdf +++ /dev/null diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_pause.3 b/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_pause.3 deleted file mode 100644 index 25d67bfbb9..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_pause.3 +++ /dev/null @@ -1,85 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at http://curl.haxx.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" ************************************************************************** -.TH curl_easy_pause 3 "17 Dec 2007" "libcurl 7.18.0" "libcurl Manual" -.SH NAME -curl_easy_pause - pause and unpause a connection -.SH SYNOPSIS -.B #include <curl/curl.h> - -.BI "CURLcode curl_easy_pause(CURL *"handle ", int "bitmask " );" - -.SH DESCRIPTION -Using this function, you can explicitly mark a running connection to get -paused, and you can unpause a connection that was previously paused. - -A connection can be paused by using this function or by letting the read -or the write callbacks return the proper magic return code -(\fICURL_READFUNC_PAUSE\fP and \fICURL_WRITEFUNC_PAUSE\fP). A write callback -that returns pause signals to the library that it couldn't take care of any -data at all, and that data will then be delivered again to the callback when -the writing is later unpaused. - -NOTE: while it may feel tempting, take care and notice that you cannot call -this function from another thread. - -When this function is called to unpause reading, the chance is high that you -will get your write callback called before this function returns. - -The \fBhandle\fP argument is of course identifying the handle that operates on -the connection you want to pause or unpause. - -The \fBbitmask\fP argument is a set of bits that sets the new state of the -connection. The following bits can be used: -.IP CURLPAUSE_RECV -Pause receiving data. There will be no data received on this connection until -this function is called again without this bit set. Thus, the write callback -(\fICURLOPT_WRITEFUNCTION\fP) won't be called. -.IP CURLPAUSE_SEND -Pause sending data. There will be no data sent on this connection until this -function is called again without this bit set. Thus, the read callback -(\fICURLOPT_READFUNCTION\fP) won't be called. -.IP CURLPAUSE_ALL -Convenience define that pauses both directions. -.IP CURLPAUSE_CONT -Convenience define that unpauses both directions -.SH RETURN VALUE -CURLE_OK (zero) means that the option was set properly, and a non-zero return -code means something wrong occurred after the new state was set. See the -\fIlibcurl-errors(3)\fP man page for the full list with descriptions. -.SH AVAILABILITY -This function was added in libcurl 7.18.0. Before this version, there was no -explicit support for pausing transfers. -.SH "MEMORY USE" -When pausing a read by returning the magic return code from a write callback, -the read data is already in libcurl's internal buffers so it'll have to keep -it in an allocated buffer until the reading is again unpaused using this -function. - -If the downloaded data is compressed and is asked to get uncompressed -automatically on download, libcurl will continue to uncompress the entire -downloaded chunk and it will cache the data uncompressed. This has the side- -effect that if you download something that is compressed a lot, it can result -in a very large data amount needing to be allocated to save the data during -the pause. This said, you should probably consider not using paused reading if -you allow libcurl to uncompress data automatically. -.SH "SEE ALSO" -.BR curl_easy_cleanup "(3), " curl_easy_reset "(3)" diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_pause.html b/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_pause.html deleted file mode 100644 index 1b968beff6..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_pause.html +++ /dev/null @@ -1,73 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> -<html><head> -<title>curl_easy_pause man page</title> -<meta name="generator" content="roffit"> -<STYLE type="text/css"> -P.level0 { - padding-left: 2em; -} - -P.level1 { - padding-left: 4em; -} - -P.level2 { - padding-left: 6em; -} - -span.emphasis { - font-style: italic; -} - -span.bold { - font-weight: bold; -} - -span.manpage { - font-weight: bold; -} - -h2.nroffsh { - background-color: #e0e0e0; -} - -span.nroffip { - font-weight: bold; - font-size: 120%; - font-family: monospace; -} - -p.roffit { - text-align: center; - font-size: 80%; -} -</STYLE> -</head><body> - -<p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2> -<p class="level0">curl_easy_pause - pause and unpause a connection <a name="SYNOPSIS"></a><h2 class="nroffsh">SYNOPSIS</h2> -<p class="level0"><span Class="bold">#include <curl/curl.h></span> -<p class="level0"><span Class="bold">CURLcode curl_easy_pause(CURL *handle , int bitmask );</span> -<p class="level0"><a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2> -<p class="level0">Using this function, you can explicitly mark a running connection to get paused, and you can unpause a connection that was previously paused. -<p class="level0">A connection can be paused by using this function or by letting the read or the write callbacks return the proper magic return code (<span Class="emphasis">CURL_READFUNC_PAUSE</span> and <span Class="emphasis">CURL_WRITEFUNC_PAUSE</span>). A write callback that returns pause signals to the library that it couldn't take care of any data at all, and that data will then be delivered again to the callback when the writing is later unpaused. -<p class="level0">NOTE: while it may feel tempting, take care and notice that you cannot call this function from another thread. -<p class="level0">When this function is called to unpause reading, the chance is high that you will get your write callback called before this function returns. -<p class="level0">The <span Class="bold">handle</span> argument is of course identifying the handle that operates on the connection you want to pause or unpause. -<p class="level0">The <span Class="bold">bitmask</span> argument is a set of bits that sets the new state of the connection. The following bits can be used: -<p class="level0"><a name="CURLPAUSERECV"></a><span class="nroffip">CURLPAUSE_RECV</span> -<p class="level1">Pause receiving data. There will be no data received on this connection until this function is called again without this bit set. Thus, the write callback (<span Class="emphasis">CURLOPT_WRITEFUNCTION</span>) won't be called. -<p class="level0"><a name="CURLPAUSESEND"></a><span class="nroffip">CURLPAUSE_SEND</span> -<p class="level1">Pause sending data. There will be no data sent on this connection until this function is called again without this bit set. Thus, the read callback (<span Class="emphasis">CURLOPT_READFUNCTION</span>) won't be called. -<p class="level0"><a name="CURLPAUSEALL"></a><span class="nroffip">CURLPAUSE_ALL</span> -<p class="level1">Convenience define that pauses both directions. -<p class="level0"><a name="CURLPAUSECONT"></a><span class="nroffip">CURLPAUSE_CONT</span> -<p class="level1">Convenience define that unpauses both directions <a name="RETURN"></a><h2 class="nroffsh">RETURN VALUE</h2> -<p class="level0">CURLE_OK (zero) means that the option was set properly, and a non-zero return code means something wrong occurred after the new state was set. See the <span Class="emphasis">libcurl-errors(3)</span> man page for the full list with descriptions. <a name="AVAILABILITY"></a><h2 class="nroffsh">AVAILABILITY</h2> -<p class="level0">This function was added in libcurl 7.18.0. Before this version, there was no explicit support for pausing transfers. <a name="MEMORY"></a><h2 class="nroffsh">MEMORY USE</h2> -<p class="level0">When pausing a read by returning the magic return code from a write callback, the read data is already in libcurl's internal buffers so it'll have to keep it in an allocated buffer until the reading is again unpaused using this function. -<p class="level0">If the downloaded data is compressed and is asked to get uncompressed automatically on download, libcurl will continue to uncompress the entire downloaded chunk and it will cache the data uncompressed. This has the side- effect that if you download something that is compressed a lot, it can result in a very large data amount needing to be allocated to save the data during the pause. This said, you should probably consider not using paused reading if you allow libcurl to uncompress data automatically. <a name="SEE"></a><h2 class="nroffsh">SEE ALSO</h2> -<p class="level0"><a class="manpage" href="./curl_easy_cleanup.html">curl_easy_cleanup (3)</a> <a class="manpage" href="./curl_easy_reset.html"> curl_easy_reset (3)</a> <p class="roffit"> - This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>. -</body></html> diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_pause.pdf b/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_pause.pdf Binary files differdeleted file mode 100644 index 8ef95acd84..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_pause.pdf +++ /dev/null diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_perform.3 b/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_perform.3 deleted file mode 100644 index 8f8517f228..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_perform.3 +++ /dev/null @@ -1,57 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at http://curl.haxx.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" ************************************************************************** -.TH curl_easy_perform 3 "5 Mar 2001" "libcurl 7.7" "libcurl Manual" -.SH NAME -curl_easy_perform - Perform a file transfer -.SH SYNOPSIS -.B #include <curl/curl.h> -.sp -.BI "CURLcode curl_easy_perform(CURL *" handle ");" -.ad -.SH DESCRIPTION -This function is called after the init and all the \fIcurl_easy_setopt(3)\fP -calls are made, and will perform the transfer as described in the options. It -must be called with the same -.I handle -as input as the curl_easy_init call returned. - -You can do any amount of calls to \fIcurl_easy_perform(3)\fP while using the -same handle. If you intend to transfer more than one file, you are even -encouraged to do so. libcurl will then attempt to re-use the same connection -for the following transfers, thus making the operations faster, less CPU -intense and using less network resources. Just note that you will have to use -\fIcurl_easy_setopt(3)\fP between the invokes to set options for the following -curl_easy_perform. - -You must never call this function simultaneously from two places using the -same handle. Let the function return first before invoking it another time. If -you want parallel transfers, you must use several curl handles. -.SH RETURN VALUE -0 means everything was ok, non-zero means an error occurred as -.I <curl/curl.h> -defines. If the CURLOPT_ERRORBUFFER was set with -.I curl_easy_setopt -there will be a readable error message in the error buffer when non-zero is -returned. -.SH "SEE ALSO" -.BR curl_easy_init "(3), " curl_easy_setopt "(3), " - diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_perform.html b/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_perform.html deleted file mode 100644 index f50024b43a..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_perform.html +++ /dev/null @@ -1,60 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> -<html><head> -<title>curl_easy_perform man page</title> -<meta name="generator" content="roffit"> -<STYLE type="text/css"> -P.level0 { - padding-left: 2em; -} - -P.level1 { - padding-left: 4em; -} - -P.level2 { - padding-left: 6em; -} - -span.emphasis { - font-style: italic; -} - -span.bold { - font-weight: bold; -} - -span.manpage { - font-weight: bold; -} - -h2.nroffsh { - background-color: #e0e0e0; -} - -span.nroffip { - font-weight: bold; - font-size: 120%; - font-family: monospace; -} - -p.roffit { - text-align: center; - font-size: 80%; -} -</STYLE> -</head><body> - -<p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2> -<p class="level0">curl_easy_perform - Perform a file transfer <a name="SYNOPSIS"></a><h2 class="nroffsh">SYNOPSIS</h2> -<p class="level0"><span Class="bold">#include <curl/curl.h></span> -<p class="level0"><span Class="bold">CURLcode curl_easy_perform(CURL * handle );</span> -<p class="level0"><a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2> -<p class="level0">This function is called after the init and all the <a class="emphasis" href="./curl_easy_setopt.html">curl_easy_setopt(3)</a> calls are made, and will perform the transfer as described in the options. It must be called with the same <span Class="emphasis">handle</span> as input as the curl_easy_init call returned. -<p class="level0">You can do any amount of calls to <a class="emphasis" href="./curl_easy_perform.html">curl_easy_perform(3)</a> while using the same handle. If you intend to transfer more than one file, you are even encouraged to do so. libcurl will then attempt to re-use the same connection for the following transfers, thus making the operations faster, less CPU intense and using less network resources. Just note that you will have to use <a class="emphasis" href="./curl_easy_setopt.html">curl_easy_setopt(3)</a> between the invokes to set options for the following curl_easy_perform. -<p class="level0">You must never call this function simultaneously from two places using the same handle. Let the function return first before invoking it another time. If you want parallel transfers, you must use several curl handles. <a name="RETURN"></a><h2 class="nroffsh">RETURN VALUE</h2> -<p class="level0">0 means everything was ok, non-zero means an error occurred as <span Class="emphasis"><curl/curl.h></span> defines. If the CURLOPT_ERRORBUFFER was set with <span Class="emphasis">curl_easy_setopt</span> there will be a readable error message in the error buffer when non-zero is returned. <a name="SEE"></a><h2 class="nroffsh">SEE ALSO</h2> -<p class="level0"><a class="manpage" href="./curl_easy_init.html">curl_easy_init (3)</a> <a class="manpage" href="./curl_easy_setopt.html"> curl_easy_setopt (3)</a> <span Class="manpage"> </span> -<p class="level0"><p class="roffit"> - This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>. -</body></html> diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_perform.pdf b/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_perform.pdf Binary files differdeleted file mode 100644 index 2e36c2957d..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_perform.pdf +++ /dev/null diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_recv.3 b/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_recv.3 deleted file mode 100644 index 0de6037ba7..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_recv.3 +++ /dev/null @@ -1,74 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at http://curl.haxx.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" ************************************************************************** -.\" -.TH curl_easy_recv 3 "29 April 2008" "libcurl 7.18.2" "libcurl Manual" -.SH NAME -curl_easy_recv - receives raw data on an "easy" connection -.SH SYNOPSIS -.B #include <curl/easy.h> -.sp -.BI "CURLcode curl_easy_recv( CURL *" curl ", void *" buffer "," -.BI "size_t " buflen ", size_t *" n ");" -.ad -.SH DESCRIPTION -This function receives raw data from the established connection. You may use -it together with \fIcurl_easy_send(3)\fP to implement custom protocols using -libcurl. This functionality can be particularly useful if you use proxies -and/or SSL encryption: libcurl will take care of proxy negotiation and -connection set-up. - -\fBbuffer\fP is a pointer to your buffer that will get the received -data. \fBbuflen\fP is the maximum amount of data you can get in that -buffer. The variable \fBn\fP points to will receive the number of received -bytes. - -To establish the connection, set \fBCURLOPT_CONNECT_ONLY\fP option before -calling \fIcurl_easy_perform(3)\fP. Note that \fIcurl_easy_recv(3)\fP does not -work on connections that were created without this option. - -You must ensure that the socket has data to read before calling -\fIcurl_easy_recv(3)\fP, otherwise the call will return \fBCURLE_AGAIN\fP - -the socket is used in non-blocking mode internally. Use -\fIcurl_easy_getinfo(3)\fP with \fBCURLINFO_LASTSOCKET\fP to obtain the -socket; use your operating system facilities like \fIselect(2)\fP to check if -it has any data you can read. -.SH AVAILABILITY -Added in 7.18.2. -.SH RETURN VALUE -On success, returns \fBCURLE_OK\fP, stores the received data into -\fBbuffer\fP, and the number of bytes it actually read into \fB*n\fP. - -On failure, returns the appropriate error code. - -If there is no data to read, the function returns \fBCURLE_AGAIN\fP. Use your -operating system facilities to wait until the data is ready, and retry. - -Reading exactly 0 bytes would indicate a closed connection. - -If there's no socket available to use from the previous transfer, this function -returns CURLE_UNSUPPORTED_PROTOCOL. -.SH EXAMPLE -See \fBsendrecv.c\fP in \fBdocs/examples\fP directory for usage example. -.SH "SEE ALSO" -.BR curl_easy_setopt "(3), " curl_easy_perform "(3), " -.BR curl_easy_getinfo "(3), " -.BR curl_easy_send "(3) " diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_recv.html b/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_recv.html deleted file mode 100644 index 48ba906c1d..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_recv.html +++ /dev/null @@ -1,66 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> -<html><head> -<title>curl_easy_recv man page</title> -<meta name="generator" content="roffit"> -<STYLE type="text/css"> -P.level0 { - padding-left: 2em; -} - -P.level1 { - padding-left: 4em; -} - -P.level2 { - padding-left: 6em; -} - -span.emphasis { - font-style: italic; -} - -span.bold { - font-weight: bold; -} - -span.manpage { - font-weight: bold; -} - -h2.nroffsh { - background-color: #e0e0e0; -} - -span.nroffip { - font-weight: bold; - font-size: 120%; - font-family: monospace; -} - -p.roffit { - text-align: center; - font-size: 80%; -} -</STYLE> -</head><body> - -<p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2> -<p class="level0">curl_easy_recv - receives raw data on an "easy" connection <a name="SYNOPSIS"></a><h2 class="nroffsh">SYNOPSIS</h2> -<p class="level0"><span Class="bold">#include <curl/easy.h></span> -<p class="level0"><span Class="bold">CURLcode curl_easy_recv( CURL * curl , void * buffer ,</span> <span Class="bold">size_t buflen , size_t * n );</span> -<p class="level0"><a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2> -<p class="level0">This function receives raw data from the established connection. You may use it together with <a class="emphasis" href="./curl_easy_send.html">curl_easy_send(3)</a> to implement custom protocols using libcurl. This functionality can be particularly useful if you use proxies and/or SSL encryption: libcurl will take care of proxy negotiation and connection set-up. -<p class="level0"><span Class="bold">buffer</span> is a pointer to your buffer that will get the received data. <span Class="bold">buflen</span> is the maximum amount of data you can get in that buffer. The variable <span Class="bold">n</span> points to will receive the number of received bytes. -<p class="level0">To establish the connection, set <span Class="bold">CURLOPT_CONNECT_ONLY</span> option before calling <a class="emphasis" href="./curl_easy_perform.html">curl_easy_perform(3)</a>. Note that <a class="emphasis" href="./curl_easy_recv.html">curl_easy_recv(3)</a> does not work on connections that were created without this option. -<p class="level0">You must ensure that the socket has data to read before calling <a class="emphasis" href="./curl_easy_recv.html">curl_easy_recv(3)</a>, otherwise the call will return <span Class="bold">CURLE_AGAIN</span> - the socket is used in non-blocking mode internally. Use <a class="emphasis" href="./curl_easy_getinfo.html">curl_easy_getinfo(3)</a> with <span Class="bold">CURLINFO_LASTSOCKET</span> to obtain the socket; use your operating system facilities like <span Class="emphasis">select(2)</span> to check if it has any data you can read. <a name="AVAILABILITY"></a><h2 class="nroffsh">AVAILABILITY</h2> -<p class="level0">Added in 7.18.2. <a name="RETURN"></a><h2 class="nroffsh">RETURN VALUE</h2> -<p class="level0">On success, returns <span Class="bold">CURLE_OK</span>, stores the received data into <span Class="bold">buffer</span>, and the number of bytes it actually read into <span Class="bold">*n</span>. -<p class="level0">On failure, returns the appropriate error code. -<p class="level0">If there is no data to read, the function returns <span Class="bold">CURLE_AGAIN</span>. Use your operating system facilities to wait until the data is ready, and retry. -<p class="level0">Reading exactly 0 bytes would indicate a closed connection. -<p class="level0">If there's no socket available to use from the previous transfer, this function returns CURLE_UNSUPPORTED_PROTOCOL. <a name="EXAMPLE"></a><h2 class="nroffsh">EXAMPLE</h2> -<p class="level0">See <span Class="bold">sendrecv.c</span> in <span Class="bold">docs/examples</span> directory for usage example. <a name="SEE"></a><h2 class="nroffsh">SEE ALSO</h2> -<p class="level0"><a class="manpage" href="./curl_easy_setopt.html">curl_easy_setopt (3)</a> <a class="manpage" href="./curl_easy_perform.html"> curl_easy_perform (3)</a> <span Class="manpage"> </span> <a class="manpage" href="./curl_easy_getinfo.html">curl_easy_getinfo (3)</a> <span Class="manpage"> </span> <a class="manpage" href="./curl_easy_send.html">curl_easy_send (3) </a> <p class="roffit"> - This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>. -</body></html> diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_recv.pdf b/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_recv.pdf Binary files differdeleted file mode 100644 index d0cd288f09..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_recv.pdf +++ /dev/null diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_reset.3 b/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_reset.3 deleted file mode 100644 index 592d3ed5c8..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_reset.3 +++ /dev/null @@ -1,43 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at http://curl.haxx.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" ************************************************************************** -.TH curl_easy_reset 3 "31 July 2004" "libcurl 7.12.1" "libcurl Manual" -.SH NAME -curl_easy_reset - reset all options of a libcurl session handle -.SH SYNOPSIS -.B #include <curl/curl.h> - -.BI "void curl_easy_reset(CURL *"handle ");" - -.SH DESCRIPTION -Re-initializes all options previously set on a specified CURL handle to the -default values. This puts back the handle to the same state as it was in when -it was just created with \fIcurl_easy_init(3)\fP. - -It does not change the following information kept in the handle: live -connections, the Session ID cache, the DNS cache, the cookies and shares. -.SH AVAILABILITY -This function was added in libcurl 7.12.1 -.SH RETURN VALUE -Nothing -.SH "SEE ALSO" -.BR curl_easy_init "(3)," curl_easy_cleanup "(3)," curl_easy_setopt "(3) - diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_reset.html b/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_reset.html deleted file mode 100644 index a7dc70c849..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_reset.html +++ /dev/null @@ -1,60 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> -<html><head> -<title>curl_easy_reset man page</title> -<meta name="generator" content="roffit"> -<STYLE type="text/css"> -P.level0 { - padding-left: 2em; -} - -P.level1 { - padding-left: 4em; -} - -P.level2 { - padding-left: 6em; -} - -span.emphasis { - font-style: italic; -} - -span.bold { - font-weight: bold; -} - -span.manpage { - font-weight: bold; -} - -h2.nroffsh { - background-color: #e0e0e0; -} - -span.nroffip { - font-weight: bold; - font-size: 120%; - font-family: monospace; -} - -p.roffit { - text-align: center; - font-size: 80%; -} -</STYLE> -</head><body> - -<p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2> -<p class="level0">curl_easy_reset - reset all options of a libcurl session handle <a name="SYNOPSIS"></a><h2 class="nroffsh">SYNOPSIS</h2> -<p class="level0"><span Class="bold">#include <curl/curl.h></span> -<p class="level0"><span Class="bold">void curl_easy_reset(CURL *handle );</span> -<p class="level0"><a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2> -<p class="level0">Re-initializes all options previously set on a specified CURL handle to the default values. This puts back the handle to the same state as it was in when it was just created with <a class="emphasis" href="./curl_easy_init.html">curl_easy_init(3)</a>. -<p class="level0">It does not change the following information kept in the handle: live connections, the Session ID cache, the DNS cache, the cookies and shares. <a name="AVAILABILITY"></a><h2 class="nroffsh">AVAILABILITY</h2> -<p class="level0">This function was added in libcurl 7.12.1 <a name="RETURN"></a><h2 class="nroffsh">RETURN VALUE</h2> -<p class="level0">Nothing <a name="SEE"></a><h2 class="nroffsh">SEE ALSO</h2> -<p class="level0"><a class="manpage" href="./curl_easy_init.html">curl_easy_init (3)</a> <a class="manpage" href="./curl_easy_cleanup.html"> curl_easy_cleanup (3)</a> <a class="manpage" href="./curl_easy_setopt.html"> curl_easy_setopt (3)</a> -<p class="level0"><p class="roffit"> - This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>. -</body></html> diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_reset.pdf b/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_reset.pdf Binary files differdeleted file mode 100644 index d28fb92840..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_reset.pdf +++ /dev/null diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_send.3 b/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_send.3 deleted file mode 100644 index 777735f92a..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_send.3 +++ /dev/null @@ -1,67 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at http://curl.haxx.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" ************************************************************************** -.\" -.TH curl_easy_send 3 "29 April 2008" "libcurl 7.18.2" "libcurl Manual" -.SH NAME -curl_easy_send - sends raw data over an "easy" connection -.SH SYNOPSIS -.B #include <curl/easy.h> -.sp -.BI "CURLcode curl_easy_send( CURL *" curl ", const void *" buffer "," -.BI " size_t " buflen ", size_t *" n ");" -.ad -.SH DESCRIPTION -This function sends arbitrary data over the established connection. You may -use it together with \fIcurl_easy_recv(3)\fP to implement custom protocols -using libcurl. This functionality can be particularly useful if you use -proxies and/or SSL encryption: libcurl will take care of proxy negotiation and -connection set-up. - -\fBbuffer\fP is a pointer to the data of length \fBbuflen\fP that you want sent. -The variable \fBn\fP points to will receive the number of sent bytes. - -To establish the connection, set \fBCURLOPT_CONNECT_ONLY\fP option before -calling \fIcurl_easy_perform(3)\fP. Note that \fIcurl_easy_send(3)\fP will not -work on connections that were created without this option. - -You must ensure that the socket is writable before calling -\fIcurl_easy_send(3)\fP, otherwise the call will return \fBCURLE_AGAIN\fP - -the socket is used in non-blocking mode internally. Use -\fIcurl_easy_getinfo(3)\fP with \fBCURLINFO_LASTSOCKET\fP to obtain the -socket; use your operating system facilities like \fIselect(2)\fP to check if -it can be written to. -.SH AVAILABILITY -Added in 7.18.2. -.SH RETURN VALUE -On success, returns \fBCURLE_OK\fP and stores the number of bytes actually -sent into \fB*n\fP. Note that this may very well be less than the amount you -wanted to send. - -On failure, returns the appropriate error code. - -If there's no socket available to use from the previous transfer, this function -returns CURLE_UNSUPPORTED_PROTOCOL. -.SH EXAMPLE -See \fBsendrecv.c\fP in \fBdocs/examples\fP directory for usage example. -.SH "SEE ALSO" -.BR curl_easy_setopt "(3), " curl_easy_perform "(3), " curl_easy_getinfo "(3), " -.BR curl_easy_recv "(3) " diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_send.html b/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_send.html deleted file mode 100644 index 4a85a27440..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_send.html +++ /dev/null @@ -1,64 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> -<html><head> -<title>curl_easy_send man page</title> -<meta name="generator" content="roffit"> -<STYLE type="text/css"> -P.level0 { - padding-left: 2em; -} - -P.level1 { - padding-left: 4em; -} - -P.level2 { - padding-left: 6em; -} - -span.emphasis { - font-style: italic; -} - -span.bold { - font-weight: bold; -} - -span.manpage { - font-weight: bold; -} - -h2.nroffsh { - background-color: #e0e0e0; -} - -span.nroffip { - font-weight: bold; - font-size: 120%; - font-family: monospace; -} - -p.roffit { - text-align: center; - font-size: 80%; -} -</STYLE> -</head><body> - -<p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2> -<p class="level0">curl_easy_send - sends raw data over an "easy" connection <a name="SYNOPSIS"></a><h2 class="nroffsh">SYNOPSIS</h2> -<p class="level0"><span Class="bold">#include <curl/easy.h></span> -<p class="level0"><span Class="bold">CURLcode curl_easy_send( CURL * curl , const void * buffer ,</span> <span Class="bold"> size_t buflen , size_t * n );</span> -<p class="level0"><a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2> -<p class="level0">This function sends arbitrary data over the established connection. You may use it together with <a class="emphasis" href="./curl_easy_recv.html">curl_easy_recv(3)</a> to implement custom protocols using libcurl. This functionality can be particularly useful if you use proxies and/or SSL encryption: libcurl will take care of proxy negotiation and connection set-up. -<p class="level0"><span Class="bold">buffer</span> is a pointer to the data of length <span Class="bold">buflen</span> that you want sent. The variable <span Class="bold">n</span> points to will receive the number of sent bytes. -<p class="level0">To establish the connection, set <span Class="bold">CURLOPT_CONNECT_ONLY</span> option before calling <a class="emphasis" href="./curl_easy_perform.html">curl_easy_perform(3)</a>. Note that <a class="emphasis" href="./curl_easy_send.html">curl_easy_send(3)</a> will not work on connections that were created without this option. -<p class="level0">You must ensure that the socket is writable before calling <a class="emphasis" href="./curl_easy_send.html">curl_easy_send(3)</a>, otherwise the call will return <span Class="bold">CURLE_AGAIN</span> - the socket is used in non-blocking mode internally. Use <a class="emphasis" href="./curl_easy_getinfo.html">curl_easy_getinfo(3)</a> with <span Class="bold">CURLINFO_LASTSOCKET</span> to obtain the socket; use your operating system facilities like <span Class="emphasis">select(2)</span> to check if it can be written to. <a name="AVAILABILITY"></a><h2 class="nroffsh">AVAILABILITY</h2> -<p class="level0">Added in 7.18.2. <a name="RETURN"></a><h2 class="nroffsh">RETURN VALUE</h2> -<p class="level0">On success, returns <span Class="bold">CURLE_OK</span> and stores the number of bytes actually sent into <span Class="bold">*n</span>. Note that this may very well be less than the amount you wanted to send. -<p class="level0">On failure, returns the appropriate error code. -<p class="level0">If there's no socket available to use from the previous transfer, this function returns CURLE_UNSUPPORTED_PROTOCOL. <a name="EXAMPLE"></a><h2 class="nroffsh">EXAMPLE</h2> -<p class="level0">See <span Class="bold">sendrecv.c</span> in <span Class="bold">docs/examples</span> directory for usage example. <a name="SEE"></a><h2 class="nroffsh">SEE ALSO</h2> -<p class="level0"><a class="manpage" href="./curl_easy_setopt.html">curl_easy_setopt (3)</a> <a class="manpage" href="./curl_easy_perform.html"> curl_easy_perform (3)</a> <a class="manpage" href="./curl_easy_getinfo.html"> curl_easy_getinfo (3)</a> <span Class="manpage"> </span> <a class="manpage" href="./curl_easy_recv.html">curl_easy_recv (3) </a> <p class="roffit"> - This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>. -</body></html> diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_send.pdf b/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_send.pdf Binary files differdeleted file mode 100644 index 25109249f0..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_send.pdf +++ /dev/null diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_setopt.3 b/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_setopt.3 deleted file mode 100644 index 3d31aef7cf..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_setopt.3 +++ /dev/null @@ -1,2527 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at http://curl.haxx.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" ************************************************************************** -.\" -.TH curl_easy_setopt 3 "1 Jan 2010" "libcurl 7.20.0" "libcurl Manual" -.SH NAME -curl_easy_setopt \- set options for a curl easy handle -.SH SYNOPSIS -#include <curl/curl.h> - -CURLcode curl_easy_setopt(CURL *handle, CURLoption option, parameter); -.SH DESCRIPTION -curl_easy_setopt() is used to tell libcurl how to behave. By using the -appropriate options to \fIcurl_easy_setopt\fP, you can change libcurl's -behavior. All options are set with the \fIoption\fP followed by a -\fIparameter\fP. That parameter can be a \fBlong\fP, a \fBfunction pointer\fP, -an \fBobject pointer\fP or a \fBcurl_off_t\fP, depending on what the specific -option expects. Read this manual carefully as bad input values may cause -libcurl to behave badly! You can only set one option in each function call. A -typical application uses many curl_easy_setopt() calls in the setup phase. - -Options set with this function call are valid for all forthcoming transfers -performed using this \fIhandle\fP. The options are not in any way reset -between transfers, so if you want subsequent transfers with different options, -you must change them between the transfers. You can optionally reset all -options back to internal default with \fIcurl_easy_reset(3)\fP. - -Strings passed to libcurl as 'char *' arguments, are copied by the library; -thus the string storage associated to the pointer argument may be overwritten -after curl_easy_setopt() returns. Exceptions to this rule are described in -the option details below. - -Before version 7.17.0, strings were not copied. Instead the user was forced -keep them available until libcurl no longer needed them. - -The \fIhandle\fP is the return code from a \fIcurl_easy_init(3)\fP or -\fIcurl_easy_duphandle(3)\fP call. -.SH BEHAVIOR OPTIONS -.IP CURLOPT_VERBOSE -Set the parameter to 1 to get the library to display a lot of verbose -information about its operations. Very useful for libcurl and/or protocol -debugging and understanding. The verbose information will be sent to stderr, -or the stream set with \fICURLOPT_STDERR\fP. - -You hardly ever want this set in production use, you will almost always want -this when you debug/report problems. Another neat option for debugging is the -\fICURLOPT_DEBUGFUNCTION\fP. -.IP CURLOPT_HEADER -A parameter set to 1 tells the library to include the header in the body -output. This is only relevant for protocols that actually have headers -preceding the data (like HTTP). -.IP CURLOPT_NOPROGRESS -Pass a long. If set to 1, it tells the library to shut off the progress meter -completely. It will also prevent the \fICURLOPT_PROGRESSFUNCTION\fP from -getting called. - -Future versions of libcurl are likely to not have any built-in progress meter -at all. -.IP CURLOPT_NOSIGNAL -Pass a long. If it is 1, libcurl will not use any functions that -install signal handlers or any functions that cause signals to be sent to the -process. This option is mainly here to allow multi-threaded unix applications -to still set/use all timeout options etc, without risking getting signals. -(Added in 7.10) - -If this option is set and libcurl has been built with the standard name -resolver, timeouts will not occur while the name resolve takes place. -Consider building libcurl with c-ares support to enable asynchronous DNS -lookups, which enables nice timeouts for name resolves without signals. - -Setting \fICURLOPT_NOSIGNAL\fP to 1 makes libcurl NOT ask the system to ignore -SIGPIPE signals, which otherwise are sent by the system when trying to send -data to a socket which is closed in the other end. libcurl makes an effort to -never cause such SIGPIPEs to trigger, but some operating systems have no way -to avoid them and even on those that have there are some corner cases when -they may still happen, contrary to our desire. In addition, using -\fICURLAUTH_NTLM_WB\fP authentication could cause a SIGCHLD signal to be -raised. -.IP CURLOPT_WILDCARDMATCH -Set this option to 1 if you want to transfer multiple files according to a -file name pattern. The pattern can be specified as part of the -\fICURLOPT_URL\fP option, using an fnmatch-like pattern (Shell Pattern -Matching) in the last part of URL (file name). - -By default, libcurl uses its internal wildcard matching implementation. You -can provide your own matching function by the \fICURLOPT_FNMATCH_FUNCTION\fP -option. - -This feature is only supported by the FTP download for now. - -A brief introduction of its syntax follows: -.RS -.IP "* - ASTERISK" -\&ftp://example.com/some/path/\fB*.txt\fP (for all txt's from the root -directory) -.RE -.RS -.IP "? - QUESTION MARK" -Question mark matches any (exactly one) character. - -\&ftp://example.com/some/path/\fBphoto?.jpeg\fP -.RE -.RS -.IP "[ - BRACKET EXPRESSION" -The left bracket opens a bracket expression. The question mark and asterisk have -no special meaning in a bracket expression. Each bracket expression ends by the -right bracket and matches exactly one character. Some examples follow: - -\fB[a-zA-Z0\-9]\fP or \fB[f\-gF\-G]\fP \- character interval - -\fB[abc]\fP - character enumeration - -\fB[^abc]\fP or \fB[!abc]\fP - negation - -\fB[[:\fP\fIname\fP\fB:]]\fP class expression. Supported classes are -\fBalnum\fP,\fBlower\fP, \fBspace\fP, \fBalpha\fP, \fBdigit\fP, \fBprint\fP, -\fBupper\fP, \fBblank\fP, \fBgraph\fP, \fBxdigit\fP. - -\fB[][-!^]\fP - special case \- matches only '\-', ']', '[', '!' or '^'. These -characters have no special purpose. - -\fB[\\[\\]\\\\]\fP - escape syntax. Matches '[', ']' or '\\'. - -Using the rules above, a file name pattern can be constructed: - -\&ftp://example.com/some/path/\fB[a-z[:upper:]\\\\].jpeg\fP -.RE -.PP -(This was added in 7.21.0) -.SH CALLBACK OPTIONS -.IP CURLOPT_WRITEFUNCTION -Pass a pointer to a function that matches the following prototype: -\fBsize_t function( char *ptr, size_t size, size_t nmemb, void *userdata);\fP -This function gets called by libcurl as soon as there is data received that -needs to be saved. The size of the data pointed to by \fIptr\fP is \fIsize\fP -multiplied with \fInmemb\fP, it will not be zero terminated. Return the number -of bytes actually taken care of. If that amount differs from the amount passed -to your function, it'll signal an error to the library. This will abort the -transfer and return \fICURLE_WRITE_ERROR\fP. - -From 7.18.0, the function can return CURL_WRITEFUNC_PAUSE which then will -cause writing to this connection to become paused. See -\fIcurl_easy_pause(3)\fP for further details. - -This function may be called with zero bytes data if the transferred file is -empty. - -Set this option to NULL to get the internal default function. The internal -default function will write the data to the FILE * given with -\fICURLOPT_WRITEDATA\fP. - -Set the \fIuserdata\fP argument with the \fICURLOPT_WRITEDATA\fP option. - -The callback function will be passed as much data as possible in all invokes, -but you cannot possibly make any assumptions. It may be one byte, it may be -thousands. The maximum amount of body data that can be passed to the write -callback is defined in the curl.h header file: CURL_MAX_WRITE_SIZE (the usual -default is 16K). If you however have \fICURLOPT_HEADER\fP set, which sends -header data to the write callback, you can get up to -\fICURL_MAX_HTTP_HEADER\fP bytes of header data passed into it. This usually -means 100K. -.IP CURLOPT_WRITEDATA -Data pointer to pass to the file write function. If you use the -\fICURLOPT_WRITEFUNCTION\fP option, this is the pointer you'll get as -input. If you don't use a callback, you must pass a 'FILE *' as libcurl will -pass this to fwrite() when writing data. - -The internal \fICURLOPT_WRITEFUNCTION\fP will write the data to the FILE * -given with this option, or to stdout if this option hasn't been set. - -If you're using libcurl as a win32 DLL, you \fBMUST\fP use the -\fICURLOPT_WRITEFUNCTION\fP if you set this option or you will experience -crashes. - -This option is also known with the older name \fICURLOPT_FILE\fP, the name -\fICURLOPT_WRITEDATA\fP was introduced in 7.9.7. -.IP CURLOPT_READFUNCTION -Pass a pointer to a function that matches the following prototype: -\fBsize_t function( void *ptr, size_t size, size_t nmemb, void *userdata);\fP -This function gets called by libcurl as soon as it needs to read data in order -to send it to the peer. The data area pointed at by the pointer \fIptr\fP may -be filled with at most \fIsize\fP multiplied with \fInmemb\fP number of -bytes. Your function must return the actual number of bytes that you stored in -that memory area. Returning 0 will signal end-of-file to the library and cause -it to stop the current transfer. - -If you stop the current transfer by returning 0 "pre-maturely" (i.e before the -server expected it, like when you've said you will upload N bytes and you -upload less than N bytes), you may experience that the server "hangs" waiting -for the rest of the data that won't come. - -The read callback may return \fICURL_READFUNC_ABORT\fP to stop the current -operation immediately, resulting in a \fICURLE_ABORTED_BY_CALLBACK\fP error -code from the transfer (Added in 7.12.1) - -From 7.18.0, the function can return CURL_READFUNC_PAUSE which then will cause -reading from this connection to become paused. See \fIcurl_easy_pause(3)\fP -for further details. - -\fBBugs\fP: when doing TFTP uploads, you must return the exact amount of data -that the callback wants, or it will be considered the final packet by the -server end and the transfer will end there. - -If you set this callback pointer to NULL, or don't set it at all, the default -internal read function will be used. It is doing an fread() on the FILE * -userdata set with \fICURLOPT_READDATA\fP. -.IP CURLOPT_READDATA -Data pointer to pass to the file read function. If you use the -\fICURLOPT_READFUNCTION\fP option, this is the pointer you'll get as input. If -you don't specify a read callback but instead rely on the default internal -read function, this data must be a valid readable FILE *. - -If you're using libcurl as a win32 DLL, you MUST use a -\fICURLOPT_READFUNCTION\fP if you set this option. - -This option was also known by the older name \fICURLOPT_INFILE\fP, the name -\fICURLOPT_READDATA\fP was introduced in 7.9.7. -.IP CURLOPT_IOCTLFUNCTION -Pass a pointer to a function that matches the following prototype: -\fBcurlioerr function(CURL *handle, int cmd, void *clientp);\fP. This function -gets called by libcurl when something special I/O-related needs to be done -that the library can't do by itself. For now, rewinding the read data stream -is the only action it can request. The rewinding of the read data stream may -be necessary when doing a HTTP PUT or POST with a multi-pass authentication -method. (Option added in 7.12.3). - -Use \fICURLOPT_SEEKFUNCTION\fP instead to provide seeking! -.IP CURLOPT_IOCTLDATA -Pass a pointer that will be untouched by libcurl and passed as the 3rd -argument in the ioctl callback set with \fICURLOPT_IOCTLFUNCTION\fP. (Option -added in 7.12.3) -.IP CURLOPT_SEEKFUNCTION -Pass a pointer to a function that matches the following prototype: \fBint -function(void *instream, curl_off_t offset, int origin);\fP This function gets -called by libcurl to seek to a certain position in the input stream and can be -used to fast forward a file in a resumed upload (instead of reading all -uploaded bytes with the normal read function/callback). It is also called to -rewind a stream when doing a HTTP PUT or POST with a multi-pass authentication -method. The function shall work like "fseek" or "lseek" and accepted SEEK_SET, -SEEK_CUR and SEEK_END as argument for origin, although (in 7.18.0) libcurl -only passes SEEK_SET. The callback must return 0 (CURL_SEEKFUNC_OK) on -success, 1 (CURL_SEEKFUNC_FAIL) to cause the upload operation to fail or 2 -(CURL_SEEKFUNC_CANTSEEK) to indicate that while the seek failed, libcurl is -free to work around the problem if possible. The latter can sometimes be done -by instead reading from the input or similar. - -If you forward the input arguments directly to "fseek" or "lseek", note that -the data type for \fIoffset\fP is not the same as defined for curl_off_t on -many systems! (Option added in 7.18.0) -.IP CURLOPT_SEEKDATA -Data pointer to pass to the file seek function. If you use the -\fICURLOPT_SEEKFUNCTION\fP option, this is the pointer you'll get as input. If -you don't specify a seek callback, NULL is passed. (Option added in 7.18.0) -.IP CURLOPT_SOCKOPTFUNCTION -Pass a pointer to a function that matches the following prototype: \fBint -function(void *clientp, curl_socket_t curlfd, curlsocktype purpose);\fP. This -function gets called by libcurl after the socket() call but before the -connect() call. The callback's \fIpurpose\fP argument identifies the exact -purpose for this particular socket: - -\fICURLSOCKTYPE_IPCXN\fP for actively created connections or since 7.28.0 -\fICURLSOCKTYPE_ACCEPT\fP for FTP when the connection was setup with PORT/EPSV -(in earlier versions these sockets weren't passed to this callback). - -Future versions of libcurl may support more purposes. It passes the newly -created socket descriptor so additional setsockopt() calls can be done at the -user's discretion. Return 0 (zero) from the callback on success. Return 1 -from the callback function to signal an unrecoverable error to the library and -it will close the socket and return \fICURLE_COULDNT_CONNECT\fP. (Option -added in 7.16.0) - -Added in 7.21.5, the callback function may return -\fICURL_SOCKOPT_ALREADY_CONNECTED\fP, which tells libcurl that the socket is -in fact already connected and then libcurl will not attempt to connect it. -.IP CURLOPT_SOCKOPTDATA -Pass a pointer that will be untouched by libcurl and passed as the first -argument in the sockopt callback set with \fICURLOPT_SOCKOPTFUNCTION\fP. -(Option added in 7.16.0) -.IP CURLOPT_OPENSOCKETFUNCTION -Pass a pointer to a function that matches the following prototype: -\fBcurl_socket_t function(void *clientp, curlsocktype purpose, struct -curl_sockaddr *address);\fP. This function gets called by libcurl instead of -the \fIsocket(2)\fP call. The callback's \fIpurpose\fP argument identifies the -exact purpose for this particular socket: \fICURLSOCKTYPE_IPCXN\fP is for IP -based connections. Future versions of libcurl may support more purposes. It -passes the resolved peer address as a \fIaddress\fP argument so the callback -can modify the address or refuse to connect at all. The callback function -should return the socket or \fICURL_SOCKET_BAD\fP in case no connection could -be established or another error was detected. Any additional -\fIsetsockopt(2)\fP calls can be done on the socket at the user's discretion. -\fICURL_SOCKET_BAD\fP return value from the callback function will signal an -unrecoverable error to the library and it will return -\fICURLE_COULDNT_CONNECT\fP. This return code can be used for IP address -blacklisting. The default behavior is: -.nf - return socket(addr->family, addr->socktype, addr->protocol); -.fi -(Option added in 7.17.1.) -.IP CURLOPT_OPENSOCKETDATA -Pass a pointer that will be untouched by libcurl and passed as the first -argument in the opensocket callback set with \fICURLOPT_OPENSOCKETFUNCTION\fP. -(Option added in 7.17.1.) -.IP CURLOPT_CLOSESOCKETFUNCTION -Pass a pointer to a function that matches the following prototype: \fBint -function(void *clientp, curl_socket_t item);\fP. This function gets called by -libcurl instead of the \fIclose(3)\fP or \fIclosesocket(3)\fP call when -sockets are closed (not for any other file descriptors). This is pretty much -the reverse to the \fICURLOPT_OPENSOCKETFUNCTION\fP option. Return 0 to signal -success and 1 if there was an error. (Option added in 7.21.7) -.IP CURLOPT_CLOSESOCKETDATA -Pass a pointer that will be untouched by libcurl and passed as the first -argument in the closesocket callback set with -\fICURLOPT_CLOSESOCKETFUNCTION\fP. (Option added in 7.21.7) -.IP CURLOPT_PROGRESSFUNCTION -Pass a pointer to a function that matches the following prototype: \fBint -function(void *clientp, double dltotal, double dlnow, double ultotal, double -ulnow); \fP. This function gets called by libcurl instead of its internal -equivalent with a frequent interval during operation (roughly once per second -or sooner) no matter if data is being transferred or not. Unknown/unused -argument values passed to the callback will be set to zero (like if you only -download data, the upload size will remain 0). Returning a non-zero value from -this callback will cause libcurl to abort the transfer and return -\fICURLE_ABORTED_BY_CALLBACK\fP. - -If you transfer data with the multi interface, this function will not be -called during periods of idleness unless you call the appropriate libcurl -function that performs transfers. - -\fICURLOPT_NOPROGRESS\fP must be set to 0 to make this function actually -get called. -.IP CURLOPT_PROGRESSDATA -Pass a pointer that will be untouched by libcurl and passed as the first -argument in the progress callback set with \fICURLOPT_PROGRESSFUNCTION\fP. -.IP CURLOPT_HEADERFUNCTION -Pass a pointer to a function that matches the following prototype: -\fBsize_t function( void *ptr, size_t size, size_t nmemb, void -*userdata);\fP. This function gets called by libcurl as soon as it has -received header data. The header callback will be called once for each header -and only complete header lines are passed on to the callback. Parsing headers -is very easy using this. The size of the data pointed to by \fIptr\fP is -\fIsize\fP multiplied with \fInmemb\fP. Do not assume that the header line is -zero terminated! The pointer named \fIuserdata\fP is the one you set with the -\fICURLOPT_WRITEHEADER\fP option. The callback function must return the number -of bytes actually taken care of. If that amount differs from the amount passed -to your function, it'll signal an error to the library. This will abort the -transfer and return \fICURL_WRITE_ERROR\fP. - -A complete HTTP header that is passed to this function can be up to -\fICURL_MAX_HTTP_HEADER\fP (100K) bytes. - -If this option is not set, or if it is set to NULL, but -\fICURLOPT_HEADERDATA\fP (\fICURLOPT_WRITEHEADER\fP) is set to anything but -NULL, the function used to accept response data will be used instead. That is, -it will be the function specified with \fICURLOPT_WRITEFUNCTION\fP, or if it -is not specified or NULL - the default, stream-writing function. - -It's important to note that the callback will be invoked for the headers of -all responses received after initiating a request and not just the final -response. This includes all responses which occur during authentication -negotiation. If you need to operate on only the headers from the final -response, you will need to collect headers in the callback yourself and use -HTTP status lines, for example, to delimit response boundaries. - -When a server sends a chunked encoded transfer, it may contain a trailer. That -trailer is identical to a HTTP header and if such a trailer is received it is -passed to the application using this callback as well. There are several ways -to detect it being a trailer and not an ordinary header: 1) it comes after the -response-body. 2) it comes after the final header line (CR LF) 3) a Trailer: -header among the regular response-headers mention what header(s) to expect in -the trailer. - -For non-HTTP protocols like FTP, POP3, IMAP and SMTP this function will get -called with the server responses to the commands that libcurl sends. -.IP CURLOPT_WRITEHEADER -(This option is also known as \fBCURLOPT_HEADERDATA\fP) Pass a pointer to be -used to write the header part of the received data to. If you don't use -\fICURLOPT_WRITEFUNCTION\fP or \fICURLOPT_HEADERFUNCTION\fP to take care of -the writing, this must be a valid FILE * as the internal default will then be -a plain fwrite(). See also the \fICURLOPT_HEADERFUNCTION\fP option above on -how to set a custom get-all-headers callback. -.IP CURLOPT_DEBUGFUNCTION -Pass a pointer to a function that matches the following prototype: \fBint -curl_debug_callback (CURL *, curl_infotype, char *, size_t, void *);\fP -\fICURLOPT_DEBUGFUNCTION\fP replaces the standard debug function used when -\fICURLOPT_VERBOSE \fP is in effect. This callback receives debug information, -as specified with the \fBcurl_infotype\fP argument. This function must return -0. The data pointed to by the char * passed to this function WILL NOT be zero -terminated, but will be exactly of the size as told by the size_t argument. - -Available curl_infotype values: -.RS -.IP CURLINFO_TEXT -The data is informational text. -.IP CURLINFO_HEADER_IN -The data is header (or header-like) data received from the peer. -.IP CURLINFO_HEADER_OUT -The data is header (or header-like) data sent to the peer. -.IP CURLINFO_DATA_IN -The data is protocol data received from the peer. -.IP CURLINFO_DATA_OUT -The data is protocol data sent to the peer. -.RE -.IP CURLOPT_DEBUGDATA -Pass a pointer to whatever you want passed in to your -\fICURLOPT_DEBUGFUNCTION\fP in the last void * argument. This pointer is not -used by libcurl, it is only passed to the callback. -.IP CURLOPT_SSL_CTX_FUNCTION -This option does only function for libcurl powered by OpenSSL. If libcurl was -built against another SSL library, this functionality is absent. - -Pass a pointer to a function that matches the following prototype: -\fBCURLcode sslctxfun(CURL *curl, void *sslctx, void *parm);\fP This function -gets called by libcurl just before the initialization of a SSL connection -after having processed all other SSL related options to give a last chance to -an application to modify the behaviour of openssl's ssl initialization. The -\fIsslctx\fP parameter is actually a pointer to an openssl \fISSL_CTX\fP. If -an error is returned no attempt to establish a connection is made and the -perform operation will return the error code from this callback function. Set -the \fIparm\fP argument with the \fICURLOPT_SSL_CTX_DATA\fP option. This -option was introduced in 7.11.0. - -This function will get called on all new connections made to a server, during -the SSL negotiation. The SSL_CTX pointer will be a new one every time. - -To use this properly, a non-trivial amount of knowledge of the openssl -libraries is necessary. For example, using this function allows you to use -openssl callbacks to add additional validation code for certificates, and even -to change the actual URI of a HTTPS request (example used in the lib509 test -case). See also the example section for a replacement of the key, certificate -and trust file settings. -.IP CURLOPT_SSL_CTX_DATA -Data pointer to pass to the ssl context callback set by the option -\fICURLOPT_SSL_CTX_FUNCTION\fP, this is the pointer you'll get as third -parameter, otherwise \fBNULL\fP. (Added in 7.11.0) -.IP CURLOPT_CONV_TO_NETWORK_FUNCTION -.IP CURLOPT_CONV_FROM_NETWORK_FUNCTION -.IP CURLOPT_CONV_FROM_UTF8_FUNCTION -Pass a pointer to a function that matches the following prototype: -\fBCURLcode function(char *ptr, size_t length);\fP - -These three options apply to non-ASCII platforms only. They are available -only if \fBCURL_DOES_CONVERSIONS\fP was defined when libcurl was built. When -this is the case, \fIcurl_version_info(3)\fP will return the CURL_VERSION_CONV -feature bit set. - -The data to be converted is in a buffer pointed to by the ptr parameter. The -amount of data to convert is indicated by the length parameter. The converted -data overlays the input data in the buffer pointed to by the ptr parameter. -CURLE_OK should be returned upon successful conversion. A CURLcode return -value defined by curl.h, such as CURLE_CONV_FAILED, should be returned if an -error was encountered. - -\fBCURLOPT_CONV_TO_NETWORK_FUNCTION\fP and -\fBCURLOPT_CONV_FROM_NETWORK_FUNCTION\fP convert between the host encoding and -the network encoding. They are used when commands or ASCII data are -sent/received over the network. - -\fBCURLOPT_CONV_FROM_UTF8_FUNCTION\fP is called to convert from UTF8 into the -host encoding. It is required only for SSL processing. - -If you set a callback pointer to NULL, or don't set it at all, the built-in -libcurl iconv functions will be used. If HAVE_ICONV was not defined when -libcurl was built, and no callback has been established, conversion will -return the CURLE_CONV_REQD error code. - -If HAVE_ICONV is defined, CURL_ICONV_CODESET_OF_HOST must also be defined. -For example: - - \&#define CURL_ICONV_CODESET_OF_HOST "IBM-1047" - -The iconv code in libcurl will default the network and UTF8 codeset names as -follows: - - \&#define CURL_ICONV_CODESET_OF_NETWORK "ISO8859-1" - - \&#define CURL_ICONV_CODESET_FOR_UTF8 "UTF-8" - -You will need to override these definitions if they are different on your -system. -.IP CURLOPT_INTERLEAVEFUNCTION -Pass a pointer to a function that matches the following prototype: -\fBsize_t function( void *ptr, size_t size, size_t nmemb, void -*userdata)\fP. This function gets called by libcurl as soon as it has received -interleaved RTP data. This function gets called for each $ block and therefore -contains exactly one upper-layer protocol unit (e.g. one RTP packet). Curl -writes the interleaved header as well as the included data for each call. The -first byte is always an ASCII dollar sign. The dollar sign is followed by a -one byte channel identifier and then a 2 byte integer length in network byte -order. See \fIRFC2326 Section 10.12\fP for more information on how RTP -interleaving behaves. If unset or set to NULL, curl will use the default write -function. - -Interleaved RTP poses some challenges for the client application. Since the -stream data is sharing the RTSP control connection, it is critical to service -the RTP in a timely fashion. If the RTP data is not handled quickly, -subsequent response processing may become unreasonably delayed and the -connection may close. The application may use \fICURL_RTSPREQ_RECEIVE\fP to -service RTP data when no requests are desired. If the application makes a -request, (e.g. \fICURL_RTSPREQ_PAUSE\fP) then the response handler will -process any pending RTP data before marking the request as finished. (Added -in 7.20.0) -.IP CURLOPT_INTERLEAVEDATA -This is the userdata pointer that will be passed to -\fICURLOPT_INTERLEAVEFUNCTION\fP when interleaved RTP data is received. (Added -in 7.20.0) -.IP CURLOPT_CHUNK_BGN_FUNCTION -Pass a pointer to a function that matches the following prototype: -\fBlong function (const void *transfer_info, void *ptr, int remains)\fP. This -function gets called by libcurl before a part of the stream is going to be -transferred (if the transfer supports chunks). - -This callback makes sense only when using the \fICURLOPT_WILDCARDMATCH\fP -option for now. - -The target of transfer_info parameter is a "feature depended" structure. For -the FTP wildcard download, the target is curl_fileinfo structure (see -\fIcurl/curl.h\fP). The parameter ptr is a pointer given by -\fICURLOPT_CHUNK_DATA\fP. The parameter remains contains number of chunks -remaining per the transfer. If the feature is not available, the parameter has -zero value. - -Return \fICURL_CHUNK_BGN_FUNC_OK\fP if everything is fine, -\fICURL_CHUNK_BGN_FUNC_SKIP\fP if you want to skip the concrete chunk or -\fICURL_CHUNK_BGN_FUNC_FAIL\fP to tell libcurl to stop if some error occurred. -(This was added in 7.21.0) -.IP CURLOPT_CHUNK_END_FUNCTION -Pass a pointer to a function that matches the following prototype: -\fBlong function(void *ptr)\fP. This function gets called by libcurl as soon -as a part of the stream has been transferred (or skipped). - -Return \fICURL_CHUNK_END_FUNC_OK\fP if everything is fine or -\fBCURL_CHUNK_END_FUNC_FAIL\fP to tell the lib to stop if some error occurred. -(This was added in 7.21.0) -.IP CURLOPT_CHUNK_DATA -Pass a pointer that will be untouched by libcurl and passed as the ptr -argument to the \fICURL_CHUNK_BGN_FUNTION\fP and \fICURL_CHUNK_END_FUNTION\fP. -(This was added in 7.21.0) -.IP CURLOPT_FNMATCH_FUNCTION -Pass a pointer to a function that matches the following prototype: \fBint -function(void *ptr, const char *pattern, const char *string)\fP prototype (see -\fIcurl/curl.h\fP). It is used internally for the wildcard matching feature. - -Return \fICURL_FNMATCHFUNC_MATCH\fP if pattern matches the string, -\fICURL_FNMATCHFUNC_NOMATCH\fP if not or \fICURL_FNMATCHFUNC_FAIL\fP if an -error occurred. (This was added in 7.21.0) -.IP CURLOPT_FNMATCH_DATA -Pass a pointer that will be untouched by libcurl and passed as the ptr argument -to the \fICURL_FNMATCH_FUNCTION\fP. (This was added in 7.21.0) -.SH ERROR OPTIONS -.IP CURLOPT_ERRORBUFFER -Pass a char * to a buffer that the libcurl may store human readable error -messages in. This may be more helpful than just the return code from -\fIcurl_easy_perform\fP. The buffer must be at least CURL_ERROR_SIZE big. -Although this argument is a 'char *', it does not describe an input string. -Therefore the (probably undefined) contents of the buffer is NOT copied by the -library. You must keep the associated storage available until libcurl no -longer needs it. Failing to do so will cause very odd behavior or even -crashes. libcurl will need it until you call \fIcurl_easy_cleanup(3)\fP or you -set the same option again to use a different pointer. - -Use \fICURLOPT_VERBOSE\fP and \fICURLOPT_DEBUGFUNCTION\fP to better -debug/trace why errors happen. - -If the library does not return an error, the buffer may not have been -touched. Do not rely on the contents in those cases. - -.IP CURLOPT_STDERR -Pass a FILE * as parameter. Tell libcurl to use this stream instead of stderr -when showing the progress meter and displaying \fICURLOPT_VERBOSE\fP data. -.IP CURLOPT_FAILONERROR -A parameter set to 1 tells the library to fail silently if the HTTP code -returned is equal to or larger than 400. The default action would be to return -the page normally, ignoring that code. - -This method is not fail-safe and there are occasions where non-successful -response codes will slip through, especially when authentication is involved -(response codes 401 and 407). - -You might get some amounts of headers transferred before this situation is -detected, like when a "100-continue" is received as a response to a -POST/PUT and a 401 or 407 is received immediately afterwards. -.SH NETWORK OPTIONS -.IP CURLOPT_URL -Pass in a pointer to the actual URL to deal with. The parameter should be a -char * to a zero terminated string which must be URL-encoded in the following -format: - -scheme://host:port/path - -For a greater explanation of the format please see RFC3986. - -If the given URL lacks the scheme, or protocol, part ("http://" or "ftp://" -etc), libcurl will attempt to resolve which protocol to use based on the -given host mame. If the protocol is not supported, libcurl will return -(\fICURLE_UNSUPPORTED_PROTOCOL\fP) when you call \fIcurl_easy_perform(3)\fP -or \fIcurl_multi_perform(3)\fP. Use \fIcurl_version_info(3)\fP for detailed -information on which protocols are supported. - -The host part of the URL contains the address of the server that you want to -connect to. This can be the fully qualified domain name of the server, the -local network name of the machine on your network or the IP address of the -server or machine represented by either an IPv4 or IPv6 address. For example: - -http://www.example.com/ - -http://hostname/ - -http://192.168.0.1/ - -http://[2001:1890:1112:1::20]/ - -It is also possible to specify the user name and password as part of the -host, for some protocols, when connecting to servers that require -authentication. - -For example the following types of authentication support this: - -http://user:password@www.example.com - -ftp://user:password@ftp.example.com - -pop3://user:password@mail.example.com - -The port is optional and when not specified libcurl will use the default port -based on the determined or specified protocol: 80 for HTTP, 21 for FTP and 25 -for SMTP, etc. The following examples show how to specify the port: - -http://www.example.com:8080/ - This will connect to a web server using port -8080 rather than 80. - -smtp://mail.example.com:587/ - This will connect to a SMTP server on the -alternative mail port. - -The path part of the URL is protocol specific and whilst some examples are -given below this list is not conclusive: - -.B HTTP - -The path part of a HTTP request specifies the file to retrieve and from what -directory. If the directory is not specified then the web server's root -directory is used. If the file is omitted then the default document will be -retrieved for either the directory specified or the root directory. The -exact resource returned for each URL is entirely dependent on the server's -configuration. - -http://www.example.com - This gets the main page from the web server. - -http://www.example.com/index.html - This returns the main page by explicitly -requesting it. - -http://www.example.com/contactus/ - This returns the default document from -the contactus directory. - -.B FTP - -The path part of an FTP request specifies the file to retrieve and from what -directory. If the file part is omitted then libcurl downloads the directory -listing for the directory specified. If the directory is omitted then -the directory listing for the root / home directory will be returned. - -ftp://ftp.example.com - This retrieves the directory listing for the root -directory. - -ftp://ftp.example.com/readme.txt - This downloads the file readme.txt from the -root directory. - -ftp://ftp.example.com/libcurl/readme.txt - This downloads readme.txt from the -libcurl directory. - -ftp://user:password@ftp.example.com/readme.txt - This retrieves the readme.txt -file from the user's home directory. When a username and password is -specified, everything that is specified in the path part is relative to the -user's home directory. To retrieve files from the root directory or a -directory underneath the root directory then the absolute path must be -specified by prepending an additional forward slash to the beginning of the -path. - -ftp://user:password@ftp.example.com//readme.txt - This retrieves the readme.txt -from the root directory when logging in as a specified user. - -.B SMTP - -The path part of a SMTP request specifies the host name to present during -communication with the mail server. If the path is omitted then libcurl will -attempt to resolve the local computer's host name. However, this may not -return the fully qualified domain name that is required by some mail servers -and specifying this path allows you to set an alternative name, such as -your machine's fully qualified domain name, which you might have obtained -from an external function such as gethostname or getaddrinfo. - -smtp://mail.example.com - This connects to the mail server at example.com and -sends your local computer's host name in the HELO / EHLO command. - -smtp://mail.example.com/client.example.com - This will send client.example.com in -the HELO / EHLO command to the mail server at example.com. - -.B POP3 - -The path part of a POP3 request specifies the mailbox (message) to retrieve. -If the mailbox is not specified then a list of waiting messages is returned -instead. - -pop3://user:password@mail.example.com - This lists the available messages -pop3://user:password@mail.example.com/1 - This retrieves the first message - -.B SCP - -The path part of a SCP request specifies the file to retrieve and from what -directory. The file part may not be omitted. The file is taken as an absolute -path from the root directory on the server. To specify a path relative to -the user's home directory on the server, prepend ~/ to the path portion. -If the user name is not embedded in the URL, it can be set with the -\fICURLOPT_USERPWD\fP or \fBCURLOPT_USERNAME\fP option. - -scp://user@example.com/etc/issue - This specifies the file /etc/issue - -scp://example.com/~/my-file - This specifies the file my-file in the -user's home directory on the server - -.B SFTP - -The path part of a SFTP request specifies the file to retrieve and from what -directory. If the file part is omitted then libcurl downloads the directory -listing for the directory specified. If the path ends in a / then a directory -listing is returned instead of a file. If the path is omitted entirely then -the directory listing for the root / home directory will be returned. -If the user name is not embedded in the URL, it can be set with the -\fICURLOPT_USERPWD\fP or \fBCURLOPT_USERNAME\fP option. - -sftp://user:password@example.com/etc/issue - This specifies the file -/etc/issue - -sftp://user@example.com/~/my-file - This specifies the file my-file in the -user's home directory - -sftp://ssh.example.com/~/Documents/ - This requests a directory listing -of the Documents directory under the user's home directory - -.B LDAP - -The path part of a LDAP request can be used to specify the: Distinguished -Name, Attributes, Scope, Filter and Extension for a LDAP search. Each field -is separated by a question mark and when that field is not required an empty -string with the question mark separator should be included. - -ldap://ldap.example.com/o=My%20Organisation - This will perform a LDAP search -with the DN as My Organisation. - -ldap://ldap.example.com/o=My%20Organisation?postalAddress - This will perform -the same search but will only return postalAddress attributes. - -ldap://ldap.example.com/?rootDomainNamingContext - This specifies an empty DN -and requests information about the rootDomainNamingContext attribute for an -Active Directory server. - -For more information about the individual components of a LDAP URL please -see RFC4516. - -.B NOTES - -Starting with version 7.20.0, the fragment part of the URI will not be sent as -part of the path, which was previously the case. - -\fICURLOPT_URL\fP is the only option that \fBmust\fP be set before -\fIcurl_easy_perform(3)\fP is called. - -\fICURLOPT_PROTOCOLS\fP can be used to limit what protocols libcurl will use -for this transfer, independent of what libcurl has been compiled to -support. That may be useful if you accept the URL from an external source and -want to limit the accessibility. -.IP CURLOPT_PROTOCOLS -Pass a long that holds a bitmask of CURLPROTO_* defines. If used, this bitmask -limits what protocols libcurl may use in the transfer. This allows you to have -a libcurl built to support a wide range of protocols but still limit specific -transfers to only be allowed to use a subset of them. By default libcurl will -accept all protocols it supports. See also -\fICURLOPT_REDIR_PROTOCOLS\fP. (Added in 7.19.4) -.IP CURLOPT_REDIR_PROTOCOLS -Pass a long that holds a bitmask of CURLPROTO_* defines. If used, this bitmask -limits what protocols libcurl may use in a transfer that it follows to in a -redirect when \fICURLOPT_FOLLOWLOCATION\fP is enabled. This allows you to -limit specific transfers to only be allowed to use a subset of protocols in -redirections. By default libcurl will allow all protocols except for FILE and -SCP. This is a difference compared to pre-7.19.4 versions which -unconditionally would follow to all protocols supported. (Added in 7.19.4) -.IP CURLOPT_PROXY -Set HTTP proxy to use. The parameter should be a char * to a zero terminated -string holding the host name or dotted IP address. To specify port number in -this string, append :[port] to the end of the host name. The proxy string may -be prefixed with [protocol]:// since any such prefix will be ignored. The -proxy's port number may optionally be specified with the separate option. If -not specified, libcurl will default to using port 1080 for proxies. -\fICURLOPT_PROXYPORT\fP. - -When you tell the library to use a HTTP proxy, libcurl will transparently -convert operations to HTTP even if you specify an FTP URL etc. This may have -an impact on what other features of the library you can use, such as -\fICURLOPT_QUOTE\fP and similar FTP specifics that don't work unless you -tunnel through the HTTP proxy. Such tunneling is activated with -\fICURLOPT_HTTPPROXYTUNNEL\fP. - -libcurl respects the environment variables \fBhttp_proxy\fP, \fBftp_proxy\fP, -\fBall_proxy\fP etc, if any of those are set. The \fICURLOPT_PROXY\fP option -does however override any possibly set environment variables. - -Setting the proxy string to "" (an empty string) will explicitly disable the -use of a proxy, even if there is an environment variable set for it. - -Since 7.14.1, the proxy host string given in environment variables can be -specified the exact same way as the proxy can be set with \fICURLOPT_PROXY\fP, -include protocol prefix (http://) and embedded user + password. - -Since 7.21.7, the proxy string may be specified with a protocol:// prefix to -specify alternative proxy protocols. Use socks4://, socks4a://, socks5:// or -socks5h:// (the last one to enable socks5 and asking the proxy to do the -resolving, also known as CURLPROXY_SOCKS5_HOSTNAME type) to request the -specific SOCKS version to be used. No protocol specified, http:// and all -others will be treated as HTTP proxies. -.IP CURLOPT_PROXYPORT -Pass a long with this option to set the proxy port to connect to unless it is -specified in the proxy string \fICURLOPT_PROXY\fP. -.IP CURLOPT_PROXYTYPE -Pass a long with this option to set type of the proxy. Available options for -this are \fICURLPROXY_HTTP\fP, \fICURLPROXY_HTTP_1_0\fP (added in 7.19.4), -\fICURLPROXY_SOCKS4\fP (added in 7.10), \fICURLPROXY_SOCKS5\fP, -\fICURLPROXY_SOCKS4A\fP (added in 7.18.0) and \fICURLPROXY_SOCKS5_HOSTNAME\fP -(added in 7.18.0). The HTTP type is default. (Added in 7.10) - -If you set \fBCURLOPT_PROXYTYPE\fP to \fICURLPROXY_HTTP_1_0\fP, it will only -affect how libcurl speaks to a proxy when CONNECT is used. The HTTP version -used for "regular" HTTP requests is instead controlled with -\fICURLOPT_HTTP_VERSION\fP. -.IP CURLOPT_NOPROXY -Pass a pointer to a zero terminated string. The string consists of a comma -separated list of host names that do not require a proxy to get reached, even -if one is specified. The only wildcard available is a single * character, -which matches all hosts, and effectively disables the proxy. Each name in this -list is matched as either a domain which contains the hostname, or the -hostname itself. For example, example.com would match example.com, -example.com:80, and www.example.com, but not www.notanexample.com. (Added in -7.19.4) -.IP CURLOPT_HTTPPROXYTUNNEL -Set the parameter to 1 to make the library tunnel all operations through a -given HTTP proxy. There is a big difference between using a proxy and to -tunnel through it. If you don't know what this means, you probably don't want -this tunneling option. -.IP CURLOPT_SOCKS5_GSSAPI_SERVICE -Pass a char * as parameter to a string holding the name of the service. The -default service name for a SOCKS5 server is rcmd/server-fqdn. This option -allows you to change it. (Added in 7.19.4) -.IP CURLOPT_SOCKS5_GSSAPI_NEC -Pass a long set to 1 to enable or 0 to disable. As part of the gssapi -negotiation a protection mode is negotiated. The RFC1961 says in section -4.3/4.4 it should be protected, but the NEC reference implementation does not. -If enabled, this option allows the unprotected exchange of the protection mode -negotiation. (Added in 7.19.4). -.IP CURLOPT_INTERFACE -Pass a char * as parameter. This sets the interface name to use as outgoing -network interface. The name can be an interface name, an IP address, or a host -name. - -Starting with 7.24.0: If the parameter starts with "if!" then it is treated as -only as interface name and no attempt will ever be named to do treat it as an -IP address or to do name resolution on it. If the parameter starts with -\&"host!" it is treated as either an IP address or a hostname. Hostnames are -resolved synchronously. Using the if! format is highly recommended when using -the multi interfaces to avoid allowing the code to block. If "if!" is -specified but the parameter does not match an existing interface, -CURLE_INTERFACE_FAILED is returned. -.IP CURLOPT_LOCALPORT -Pass a long. This sets the local port number of the socket used for -connection. This can be used in combination with \fICURLOPT_INTERFACE\fP and -you are recommended to use \fICURLOPT_LOCALPORTRANGE\fP as well when this is -set. Valid port numbers are 1 - 65535. (Added in 7.15.2) -.IP CURLOPT_LOCALPORTRANGE -Pass a long. This is the number of attempts libcurl will make to find a -working local port number. It starts with the given \fICURLOPT_LOCALPORT\fP -and adds one to the number for each retry. Setting this to 1 or below will -make libcurl do only one try for the exact port number. Port numbers by nature -are scarce resources that will be busy at times so setting this value to -something too low might cause unnecessary connection setup failures. (Added in -7.15.2) -.IP CURLOPT_DNS_CACHE_TIMEOUT -Pass a long, this sets the timeout in seconds. Name resolves will be kept in -memory for this number of seconds. Set to zero to completely disable -caching, or set to -1 to make the cached entries remain forever. By default, -libcurl caches this info for 60 seconds. - -The name resolve functions of various libc implementations don't re-read name -server information unless explicitly told so (for example, by calling -\fIres_init(3)\fP). This may cause libcurl to keep using the older server even -if DHCP has updated the server info, and this may look like a DNS cache issue -to the casual libcurl-app user. -.IP CURLOPT_DNS_USE_GLOBAL_CACHE -Pass a long. If the value is 1, it tells curl to use a global DNS cache -that will survive between easy handle creations and deletions. This is not -thread-safe and this will use a global variable. - -\fBWARNING:\fP this option is considered obsolete. Stop using it. Switch over -to using the share interface instead! See \fICURLOPT_SHARE\fP and -\fIcurl_share_init(3)\fP. -.IP CURLOPT_BUFFERSIZE -Pass a long specifying your preferred size (in bytes) for the receive buffer -in libcurl. The main point of this would be that the write callback gets -called more often and with smaller chunks. This is just treated as a request, -not an order. You cannot be guaranteed to actually get the given size. (Added -in 7.10) - -This size is by default set as big as possible (CURL_MAX_WRITE_SIZE), so it -only makes sense to use this option if you want it smaller. -.IP CURLOPT_PORT -Pass a long specifying what remote port number to connect to, instead of the -one specified in the URL or the default port for the used protocol. -.IP CURLOPT_TCP_NODELAY -Pass a long specifying whether the TCP_NODELAY option is to be set or cleared -(1 = set, 0 = clear). The option is cleared by default. This will have no -effect after the connection has been established. - -Setting this option will disable TCP's Nagle algorithm. The purpose of this -algorithm is to try to minimize the number of small packets on the network -(where "small packets" means TCP segments less than the Maximum Segment Size -(MSS) for the network). - -Maximizing the amount of data sent per TCP segment is good because it -amortizes the overhead of the send. However, in some cases (most notably -telnet or rlogin) small segments may need to be sent without delay. This is -less efficient than sending larger amounts of data at a time, and can -contribute to congestion on the network if overdone. -.IP CURLOPT_ADDRESS_SCOPE -Pass a long specifying the scope_id value to use when connecting to IPv6 -link-local or site-local addresses. (Added in 7.19.0) -.IP CURLOPT_TCP_KEEPALIVE -Pass a long. If set to 1, TCP keepalive probes will be sent. The delay and -frequency of these probes can be controlled by the \fICURLOPT_TCP_KEEPIDLE\fP -and \fICURLOPT_TCP_KEEPINTVL\fP options, provided the operating system supports -them. Set to 0 (default behavior) to disable keepalive probes (Added in -7.25.0). -.IP CURLOPT_TCP_KEEPIDLE -Pass a long. Sets the delay, in seconds, that the operating system will wait -while the connection is idle before sending keepalive probes. Not all operating -systems support this option. (Added in 7.25.0) -.IP CURLOPT_TCP_KEEPINTVL -Pass a long. Sets the interval, in seconds, that the operating system will wait -between sending keepalive probes. Not all operating systems support this -option. (Added in 7.25.0) -.SH NAMES and PASSWORDS OPTIONS (Authentication) -.IP CURLOPT_NETRC -This parameter controls the preference of libcurl between using user names and -passwords from your \fI~/.netrc\fP file, relative to user names and passwords -in the URL supplied with \fICURLOPT_URL\fP. - -libcurl uses a user name (and supplied or prompted password) supplied with -\fICURLOPT_USERPWD\fP in preference to any of the options controlled by this -parameter. - -Pass a long, set to one of the values described below. -.RS -.IP CURL_NETRC_OPTIONAL -The use of your \fI~/.netrc\fP file is optional, and information in the URL is -to be preferred. The file will be scanned for the host and user name (to -find the password only) or for the host only, to find the first user name and -password after that \fImachine\fP, which ever information is not specified in -the URL. - -Undefined values of the option will have this effect. -.IP CURL_NETRC_IGNORED -The library will ignore the file and use only the information in the URL. - -This is the default. -.IP CURL_NETRC_REQUIRED -This value tells the library that use of the file is required, to ignore the -information in the URL, and to search the file for the host only. -.RE -Only machine name, user name and password are taken into account -(init macros and similar things aren't supported). - -libcurl does not verify that the file has the correct properties set (as the -standard Unix ftp client does). It should only be readable by user. -.IP CURLOPT_NETRC_FILE -Pass a char * as parameter, pointing to a zero terminated string containing -the full path name to the file you want libcurl to use as .netrc file. If this -option is omitted, and \fICURLOPT_NETRC\fP is set, libcurl will attempt to -find a .netrc file in the current user's home directory. (Added in 7.10.9) -.IP CURLOPT_USERPWD -Pass a char * as parameter, which should be [user name]:[password] to use for -the connection. Use \fICURLOPT_HTTPAUTH\fP to decide the authentication method. - -When using NTLM, you can set the domain by prepending it to the user name and -separating the domain and name with a forward (/) or backward slash (\\). Like -this: "domain/user:password" or "domain\\user:password". Some HTTP servers (on -Windows) support this style even for Basic authentication. - -When using HTTP and \fICURLOPT_FOLLOWLOCATION\fP, libcurl might perform -several requests to possibly different hosts. libcurl will only send this user -and password information to hosts using the initial host name (unless -\fICURLOPT_UNRESTRICTED_AUTH\fP is set), so if libcurl follows locations to -other hosts it will not send the user and password to those. This is enforced -to prevent accidental information leakage. -.IP CURLOPT_PROXYUSERPWD -Pass a char * as parameter, which should be [user name]:[password] to use for -the connection to the HTTP proxy. Use \fICURLOPT_PROXYAUTH\fP to decide -the authentication method. -.IP CURLOPT_USERNAME -Pass a char * as parameter, which should be pointing to the zero terminated -user name to use for the transfer. - -\fBCURLOPT_USERNAME\fP sets the user name to be used in protocol -authentication. You should not use this option together with the (older) -CURLOPT_USERPWD option. - -In order to specify the password to be used in conjunction with the user name -use the \fICURLOPT_PASSWORD\fP option. (Added in 7.19.1) -.IP CURLOPT_PASSWORD -Pass a char * as parameter, which should be pointing to the zero terminated -password to use for the transfer. - -The CURLOPT_PASSWORD option should be used in conjunction with -the \fICURLOPT_USERNAME\fP option. (Added in 7.19.1) -.IP CURLOPT_PROXYUSERNAME -Pass a char * as parameter, which should be pointing to the zero terminated -user name to use for the transfer while connecting to Proxy. - -The CURLOPT_PROXYUSERNAME option should be used in same way as the -\fICURLOPT_PROXYUSERPWD\fP is used. In comparison to -\fICURLOPT_PROXYUSERPWD\fP the CURLOPT_PROXYUSERNAME allows the username to -contain a colon, like in the following example: "sip:user@example.com". The -CURLOPT_PROXYUSERNAME option is an alternative way to set the user name while -connecting to Proxy. There is no meaning to use it together with the -\fICURLOPT_PROXYUSERPWD\fP option. - -In order to specify the password to be used in conjunction with the user name -use the \fICURLOPT_PROXYPASSWORD\fP option. (Added in 7.19.1) -.IP CURLOPT_PROXYPASSWORD -Pass a char * as parameter, which should be pointing to the zero terminated -password to use for the transfer while connecting to Proxy. - -The CURLOPT_PROXYPASSWORD option should be used in conjunction with -the \fICURLOPT_PROXYUSERNAME\fP option. (Added in 7.19.1) -.IP CURLOPT_HTTPAUTH -Pass a long as parameter, which is set to a bitmask, to tell libcurl which -authentication method(s) you want it to use. The available bits are listed -below. If more than one bit is set, libcurl will first query the site to see -which authentication methods it supports and then pick the best one you allow -it to use. For some methods, this will induce an extra network round-trip. Set -the actual name and password with the \fICURLOPT_USERPWD\fP option or -with the \fICURLOPT_USERNAME\fP and the \fICURLOPT_PASSWORD\fP options. -(Added in 7.10.6) -.RS -.IP CURLAUTH_BASIC -HTTP Basic authentication. This is the default choice, and the only method -that is in wide-spread use and supported virtually everywhere. This sends -the user name and password over the network in plain text, easily captured by -others. -.IP CURLAUTH_DIGEST -HTTP Digest authentication. Digest authentication is defined in RFC2617 and -is a more secure way to do authentication over public networks than the -regular old-fashioned Basic method. -.IP CURLAUTH_DIGEST_IE -HTTP Digest authentication with an IE flavor. Digest authentication is -defined in RFC2617 and is a more secure way to do authentication over public -networks than the regular old-fashioned Basic method. The IE flavor is simply -that libcurl will use a special "quirk" that IE is known to have used before -version 7 and that some servers require the client to use. (This define was -added in 7.19.3) -.IP CURLAUTH_GSSNEGOTIATE -HTTP GSS-Negotiate authentication. The GSS-Negotiate (also known as plain -\&"Negotiate") method was designed by Microsoft and is used in their web -applications. It is primarily meant as a support for Kerberos5 authentication -but may also be used along with other authentication methods. For more -information see IETF draft draft-brezak-spnego-http-04.txt. - -You need to build libcurl with a suitable GSS-API library for this to work. -.IP CURLAUTH_NTLM -HTTP NTLM authentication. A proprietary protocol invented and used by -Microsoft. It uses a challenge-response and hash concept similar to Digest, to -prevent the password from being eavesdropped. - -You need to build libcurl with either OpenSSL, GnuTLS or NSS support for this -option to work, or build libcurl on Windows. -.IP CURLAUTH_NTLM_WB -NTLM delegating to winbind helper. Authentication is performed by a separate -binary application that is executed when needed. The name of the application -is specified at compile time but is typically /usr/bin/ntlm_auth -(Added in 7.22.0) - -Note that libcurl will fork when necessary to run the winbind application and -kill it when complete, calling waitpid() to await its exit when done. On POSIX -operating systems, killing the process will cause a SIGCHLD signal to be -raised (regardless of whether \fICURLOPT_NOSIGNAL\fP is set), which must be -handled intelligently by the application. In particular, the application must -not unconditionally call wait() in its SIGCHLD signal handler to avoid being -subject to a race condition. This behavior is subject to change in future -versions of libcurl. -.IP CURLAUTH_ANY -This is a convenience macro that sets all bits and thus makes libcurl pick any -it finds suitable. libcurl will automatically select the one it finds most -secure. -.IP CURLAUTH_ANYSAFE -This is a convenience macro that sets all bits except Basic and thus makes -libcurl pick any it finds suitable. libcurl will automatically select the one -it finds most secure. -.IP CURLAUTH_ONLY -This is a meta symbol. Or this value together with a single specific auth -value to force libcurl to probe for un-restricted auth and if not, only that -single auth algorithm is acceptable. (Added in 7.21.3) -.RE -.IP CURLOPT_TLSAUTH_TYPE -Pass a long as parameter, which is set to a bitmask, to tell libcurl which -authentication method(s) you want it to use for TLS authentication. -.RS -.IP CURLOPT_TLSAUTH_SRP -TLS-SRP authentication. Secure Remote Password authentication for TLS is -defined in RFC5054 and provides mutual authentication if both sides have a -shared secret. To use TLS-SRP, you must also set the -\fICURLOPT_TLSAUTH_USERNAME\fP and \fICURLOPT_TLSAUTH_PASSWORD\fP options. - -You need to build libcurl with GnuTLS or OpenSSL with TLS-SRP support for this -to work. (Added in 7.21.4) -.RE -.IP CURLOPT_TLSAUTH_USERNAME -Pass a char * as parameter, which should point to the zero terminated username -to use for the TLS authentication method specified with the -\fICURLOPT_TLSAUTH_TYPE\fP option. Requires that the -\fICURLOPT_TLS_PASSWORD\fP option also be set. (Added in 7.21.4) -.IP CURLOPT_TLSAUTH_PASSWORD -Pass a char * as parameter, which should point to the zero terminated password -to use for the TLS authentication method specified with the -\fICURLOPT_TLSAUTH_TYPE\fP option. Requires that the -\fICURLOPT_TLS_USERNAME\fP option also be set. (Added in 7.21.4) -.IP CURLOPT_PROXYAUTH -Pass a long as parameter, which is set to a bitmask, to tell libcurl which -authentication method(s) you want it to use for your proxy authentication. If -more than one bit is set, libcurl will first query the site to see what -authentication methods it supports and then pick the best one you allow it to -use. For some methods, this will induce an extra network round-trip. Set the -actual name and password with the \fICURLOPT_PROXYUSERPWD\fP option. The -bitmask can be constructed by or'ing together the bits listed above for the -\fICURLOPT_HTTPAUTH\fP option. As of this writing, only Basic, Digest and NTLM -work. (Added in 7.10.7) -.SH HTTP OPTIONS -.IP CURLOPT_AUTOREFERER -Pass a parameter set to 1 to enable this. When enabled, libcurl will -automatically set the Referer: field in requests where it follows a Location: -redirect. -.IP CURLOPT_ACCEPT_ENCODING -Sets the contents of the Accept-Encoding: header sent in a HTTP request, and -enables decoding of a response when a Content-Encoding: header is received. -Three encodings are supported: \fIidentity\fP, which does nothing, -\fIdeflate\fP which requests the server to compress its response using the -zlib algorithm, and \fIgzip\fP which requests the gzip algorithm. If a -zero-length string is set, then an Accept-Encoding: header containing all -supported encodings is sent. - -This is a request, not an order; the server may or may not do it. This option -must be set (to any non-NULL value) or else any unsolicited encoding done by -the server is ignored. See the special file lib/README.encoding for details. - -(This option was called CURLOPT_ENCODING before 7.21.6) -.IP CURLOPT_TRANSFER_ENCODING -Adds a request for compressed Transfer Encoding in the outgoing HTTP -request. If the server supports this and so desires, it can respond with the -HTTP response sent using a compressed Transfer-Encoding that will be -automatically uncompressed by libcurl on reception. - -Transfer-Encoding differs slightly from the Content-Encoding you ask for with -\fBCURLOPT_ACCEPT_ENCODING\fP in that a Transfer-Encoding is strictly meant to -be for the transfer and thus MUST be decoded before the data arrives in the -client. Traditionally, Transfer-Encoding has been much less used and supported -by both HTTP clients and HTTP servers. - -(Added in 7.21.6) -.IP CURLOPT_FOLLOWLOCATION -A parameter set to 1 tells the library to follow any Location: header that the -server sends as part of a HTTP header. - -This means that the library will re-send the same request on the new location -and follow new Location: headers all the way until no more such headers are -returned. \fICURLOPT_MAXREDIRS\fP can be used to limit the number of redirects -libcurl will follow. - -Since 7.19.4, libcurl can limit what protocols it will automatically -follow. The accepted protocols are set with \fICURLOPT_REDIR_PROTOCOLS\fP and -it excludes the FILE protocol by default. -.IP CURLOPT_UNRESTRICTED_AUTH -A parameter set to 1 tells the library it can continue to send authentication -(user+password) when following locations, even when hostname changed. This -option is meaningful only when setting \fICURLOPT_FOLLOWLOCATION\fP. -.IP CURLOPT_MAXREDIRS -Pass a long. The set number will be the redirection limit. If that many -redirections have been followed, the next redirect will cause an error -(\fICURLE_TOO_MANY_REDIRECTS\fP). This option only makes sense if the -\fICURLOPT_FOLLOWLOCATION\fP is used at the same time. Added in 7.15.1: -Setting the limit to 0 will make libcurl refuse any redirect. Set it to -1 for -an infinite number of redirects (which is the default) -.IP CURLOPT_POSTREDIR -Pass a bitmask to control how libcurl acts on redirects after POSTs that get a -301, 302 or 303 response back. A parameter with bit 0 set (value -\fBCURL_REDIR_POST_301\fP) tells the library to respect RFC2616/10.3.2 and not -convert POST requests into GET requests when following a 301 redirection. -Setting bit 1 (value \fBCURL_REDIR_POST_302\fP) makes libcurl maintain the -request method after a 302 redirect whilst setting bit 2 (value -\fBCURL_REDIR_POST_303\fP) makes libcurl maintain the request method after a -303 redirect. The value \fBCURL_REDIR_POST_ALL\fP is a convenience define that -sets all three bits. - -The non-RFC behaviour is ubiquitous in web browsers, so the library does the -conversion by default to maintain consistency. However, a server may require a -POST to remain a POST after such a redirection. This option is meaningful only -when setting \fICURLOPT_FOLLOWLOCATION\fP. (Added in 7.17.1) (This option was -known as CURLOPT_POST301 up to 7.19.0 as it only supported the 301 then) -.IP CURLOPT_PUT -A parameter set to 1 tells the library to use HTTP PUT to transfer data. The -data should be set with \fICURLOPT_READDATA\fP and \fICURLOPT_INFILESIZE\fP. - -This option is deprecated and starting with version 7.12.1 you should instead -use \fICURLOPT_UPLOAD\fP. -.IP CURLOPT_POST -A parameter set to 1 tells the library to do a regular HTTP post. This will -also make the library use a "Content-Type: -application/x-www-form-urlencoded" header. (This is by far the most commonly -used POST method). - -Use one of \fICURLOPT_POSTFIELDS\fP or \fICURLOPT_COPYPOSTFIELDS\fP options to -specify what data to post and \fICURLOPT_POSTFIELDSIZE\fP or -\fICURLOPT_POSTFIELDSIZE_LARGE\fP to set the data size. - -Optionally, you can provide data to POST using the \fICURLOPT_READFUNCTION\fP -and \fICURLOPT_READDATA\fP options but then you must make sure to not set -\fICURLOPT_POSTFIELDS\fP to anything but NULL. When providing data with a -callback, you must transmit it using chunked transfer-encoding or you must set -the size of the data with the \fICURLOPT_POSTFIELDSIZE\fP or -\fICURLOPT_POSTFIELDSIZE_LARGE\fP option. To enable chunked encoding, you -simply pass in the appropriate Transfer-Encoding header, see the -post-callback.c example. - -You can override the default POST Content-Type: header by setting your own -with \fICURLOPT_HTTPHEADER\fP. - -Using POST with HTTP 1.1 implies the use of a "Expect: 100-continue" header. -You can disable this header with \fICURLOPT_HTTPHEADER\fP as usual. - -If you use POST to a HTTP 1.1 server, you can send data without knowing the -size before starting the POST if you use chunked encoding. You enable this by -adding a header like "Transfer-Encoding: chunked" with -\fICURLOPT_HTTPHEADER\fP. With HTTP 1.0 or without chunked transfer, you must -specify the size in the request. - -When setting \fICURLOPT_POST\fP to 1, it will automatically set -\fICURLOPT_NOBODY\fP to 0 (since 7.14.1). - -If you issue a POST request and then want to make a HEAD or GET using the same -re-used handle, you must explicitly set the new request type using -\fICURLOPT_NOBODY\fP or \fICURLOPT_HTTPGET\fP or similar. -.IP CURLOPT_POSTFIELDS -Pass a void * as parameter, which should be the full data to post in a HTTP -POST operation. You must make sure that the data is formatted the way you want -the server to receive it. libcurl will not convert or encode it for you. Most -web servers will assume this data to be url-encoded. - -The pointed data are NOT copied by the library: as a consequence, they must -be preserved by the calling application until the transfer finishes. - -This POST is a normal application/x-www-form-urlencoded kind (and libcurl will -set that Content-Type by default when this option is used), which is the most -commonly used one by HTML forms. See also the \fICURLOPT_POST\fP. Using -\fICURLOPT_POSTFIELDS\fP implies \fICURLOPT_POST\fP. - -If you want to do a zero-byte POST, you need to set -\fICURLOPT_POSTFIELDSIZE\fP explicitly to zero, as simply setting -\fICURLOPT_POSTFIELDS\fP to NULL or "" just effectively disables the sending -of the specified string. libcurl will instead assume that you'll send the POST -data using the read callback! - -Using POST with HTTP 1.1 implies the use of a "Expect: 100-continue" header. -You can disable this header with \fICURLOPT_HTTPHEADER\fP as usual. - -To make multipart/formdata posts (aka RFC2388-posts), check out the -\fICURLOPT_HTTPPOST\fP option. -.IP CURLOPT_POSTFIELDSIZE -If you want to post data to the server without letting libcurl do a strlen() -to measure the data size, this option must be used. When this option is used -you can post fully binary data, which otherwise is likely to fail. If this -size is set to -1, the library will use strlen() to get the size. -.IP CURLOPT_POSTFIELDSIZE_LARGE -Pass a curl_off_t as parameter. Use this to set the size of the -\fICURLOPT_POSTFIELDS\fP data to prevent libcurl from doing strlen() on the -data to figure out the size. This is the large file version of the -\fICURLOPT_POSTFIELDSIZE\fP option. (Added in 7.11.1) -.IP CURLOPT_COPYPOSTFIELDS -Pass a char * as parameter, which should be the full data to post in a HTTP -POST operation. It behaves as the \fICURLOPT_POSTFIELDS\fP option, but the -original data are copied by the library, allowing the application to overwrite -the original data after setting this option. - -Because data are copied, care must be taken when using this option in -conjunction with \fICURLOPT_POSTFIELDSIZE\fP or -\fICURLOPT_POSTFIELDSIZE_LARGE\fP: If the size has not been set prior to -\fICURLOPT_COPYPOSTFIELDS\fP, the data are assumed to be a NUL-terminated -string; else the stored size informs the library about the data byte count to -copy. In any case, the size must not be changed after -\fICURLOPT_COPYPOSTFIELDS\fP, unless another \fICURLOPT_POSTFIELDS\fP or -\fICURLOPT_COPYPOSTFIELDS\fP option is issued. -(Added in 7.17.1) -.IP CURLOPT_HTTPPOST -Tells libcurl you want a multipart/formdata HTTP POST to be made and you -instruct what data to pass on to the server. Pass a pointer to a linked list -of curl_httppost structs as parameter. The easiest way to create such a -list, is to use \fIcurl_formadd(3)\fP as documented. The data in this list -must remain intact until you close this curl handle again with -\fIcurl_easy_cleanup(3)\fP. - -Using POST with HTTP 1.1 implies the use of a "Expect: 100-continue" header. -You can disable this header with \fICURLOPT_HTTPHEADER\fP as usual. - -When setting \fICURLOPT_HTTPPOST\fP, it will automatically set -\fICURLOPT_NOBODY\fP to 0 (since 7.14.1). -.IP CURLOPT_REFERER -Pass a pointer to a zero terminated string as parameter. It will be used to -set the Referer: header in the http request sent to the remote server. This -can be used to fool servers or scripts. You can also set any custom header -with \fICURLOPT_HTTPHEADER\fP. -.IP CURLOPT_USERAGENT -Pass a pointer to a zero terminated string as parameter. It will be used to -set the User-Agent: header in the http request sent to the remote server. This -can be used to fool servers or scripts. You can also set any custom header -with \fICURLOPT_HTTPHEADER\fP. -.IP CURLOPT_HTTPHEADER -Pass a pointer to a linked list of HTTP headers to pass to the server in your -HTTP request. The linked list should be a fully valid list of \fBstruct -curl_slist\fP structs properly filled in. Use \fIcurl_slist_append(3)\fP to -create the list and \fIcurl_slist_free_all(3)\fP to clean up an entire -list. If you add a header that is otherwise generated and used by libcurl -internally, your added one will be used instead. If you add a header with no -content as in 'Accept:' (no data on the right side of the colon), the -internally used header will get disabled. Thus, using this option you can add -new headers, replace internal headers and remove internal headers. To add a -header with no content, make the content be two quotes: \&"". The headers -included in the linked list must not be CRLF-terminated, because curl adds -CRLF after each header item. Failure to comply with this will result in -strange bugs because the server will most likely ignore part of the headers -you specified. - -The first line in a request (containing the method, usually a GET or POST) is -not a header and cannot be replaced using this option. Only the lines -following the request-line are headers. Adding this method line in this list -of headers will only cause your request to send an invalid header. - -Pass a NULL to this to reset back to no custom headers. - -The most commonly replaced headers have "shortcuts" in the options -\fICURLOPT_COOKIE\fP, \fICURLOPT_USERAGENT\fP and \fICURLOPT_REFERER\fP. -.IP CURLOPT_HTTP200ALIASES -Pass a pointer to a linked list of aliases to be treated as valid HTTP 200 -responses. Some servers respond with a custom header response line. For -example, IceCast servers respond with "ICY 200 OK". By including this string -in your list of aliases, the response will be treated as a valid HTTP header -line such as "HTTP/1.0 200 OK". (Added in 7.10.3) - -The linked list should be a fully valid list of struct curl_slist structs, and -be properly filled in. Use \fIcurl_slist_append(3)\fP to create the list and -\fIcurl_slist_free_all(3)\fP to clean up an entire list. - -The alias itself is not parsed for any version strings. Before libcurl 7.16.3, -Libcurl used the value set by option \fICURLOPT_HTTP_VERSION\fP, but starting -with 7.16.3 the protocol is assumed to match HTTP 1.0 when an alias matched. -.IP CURLOPT_COOKIE -Pass a pointer to a zero terminated string as parameter. It will be used to -set a cookie in the http request. The format of the string should be -NAME=CONTENTS, where NAME is the cookie name and CONTENTS is what the cookie -should contain. - -If you need to set multiple cookies, you need to set them all using a single -option and thus you need to concatenate them all in one single string. Set -multiple cookies in one string like this: "name1=content1; name2=content2;" -etc. - -This option sets the cookie header explicitly in the outgoing request(s). If -multiple requests are done due to authentication, followed redirections or -similar, they will all get this cookie passed on. - -Using this option multiple times will only make the latest string override the -previous ones. -.IP CURLOPT_COOKIEFILE -Pass a pointer to a zero terminated string as parameter. It should contain the -name of your file holding cookie data to read. The cookie data may be in -Netscape / Mozilla cookie data format or just regular HTTP-style headers -dumped to a file. - -Given an empty or non-existing file or by passing the empty string (""), this -option will enable cookies for this curl handle, making it understand and -parse received cookies and then use matching cookies in future requests. - -If you use this option multiple times, you just add more files to read. -Subsequent files will add more cookies. -.IP CURLOPT_COOKIEJAR -Pass a file name as char *, zero terminated. This will make libcurl write all -internally known cookies to the specified file when \fIcurl_easy_cleanup(3)\fP -is called. If no cookies are known, no file will be created. Specify "-" to -instead have the cookies written to stdout. Using this option also enables -cookies for this session, so if you for example follow a location it will make -matching cookies get sent accordingly. - -If the cookie jar file can't be created or written to (when the -\fIcurl_easy_cleanup(3)\fP is called), libcurl will not and cannot report an -error for this. Using \fICURLOPT_VERBOSE\fP or \fICURLOPT_DEBUGFUNCTION\fP -will get a warning to display, but that is the only visible feedback you get -about this possibly lethal situation. -.IP CURLOPT_COOKIESESSION -Pass a long set to 1 to mark this as a new cookie "session". It will force -libcurl to ignore all cookies it is about to load that are "session cookies" -from the previous session. By default, libcurl always stores and loads all -cookies, independent if they are session cookies or not. Session cookies are -cookies without expiry date and they are meant to be alive and existing for -this "session" only. -.IP CURLOPT_COOKIELIST -Pass a char * to a cookie string. Cookie can be either in Netscape / Mozilla -format or just regular HTTP-style header (Set-Cookie: ...) format. If cURL -cookie engine was not enabled it will enable its cookie engine. Passing a -magic string \&"ALL" will erase all cookies known by cURL. (Added in 7.14.1) -Passing the special string \&"SESS" will only erase all session cookies known -by cURL. (Added in 7.15.4) Passing the special string \&"FLUSH" will write -all cookies known by cURL to the file specified by \fICURLOPT_COOKIEJAR\fP. -(Added in 7.17.1) -.IP CURLOPT_HTTPGET -Pass a long. If the long is 1, this forces the HTTP request to get back -to GET. Usable if a POST, HEAD, PUT, or a custom request has been used -previously using the same curl handle. - -When setting \fICURLOPT_HTTPGET\fP to 1, it will automatically set -\fICURLOPT_NOBODY\fP to 0 (since 7.14.1). -.IP CURLOPT_HTTP_VERSION -Pass a long, set to one of the values described below. They force libcurl to -use the specific HTTP versions. This is not sensible to do unless you have a -good reason. -.RS -.IP CURL_HTTP_VERSION_NONE -We don't care about what version the library uses. libcurl will use whatever -it thinks fit. -.IP CURL_HTTP_VERSION_1_0 -Enforce HTTP 1.0 requests. -.IP CURL_HTTP_VERSION_1_1 -Enforce HTTP 1.1 requests. -.RE -.IP CURLOPT_IGNORE_CONTENT_LENGTH -Ignore the Content-Length header. This is useful for Apache 1.x (and similar -servers) which will report incorrect content length for files over 2 -gigabytes. If this option is used, curl will not be able to accurately report -progress, and will simply stop the download when the server ends the -connection. (added in 7.14.1) -.IP CURLOPT_HTTP_CONTENT_DECODING -Pass a long to tell libcurl how to act on content decoding. If set to zero, -content decoding will be disabled. If set to 1 it is enabled. Libcurl has no -default content decoding but requires you to use \fICURLOPT_ENCODING\fP for -that. (added in 7.16.2) -.IP CURLOPT_HTTP_TRANSFER_DECODING -Pass a long to tell libcurl how to act on transfer decoding. If set to zero, -transfer decoding will be disabled, if set to 1 it is enabled -(default). libcurl does chunked transfer decoding by default unless this -option is set to zero. (added in 7.16.2) -.SH SMTP OPTIONS -.IP CURLOPT_MAIL_FROM -Pass a pointer to a zero terminated string as parameter. This should be used -to specify the sender's email address when sending SMTP mail with libcurl. - -An originator email address should be specified with angled brackets (<>) -around it, which if not specified, will be added by libcurl from version -7.21.4 onwards. Failing to provide such brackets may cause the server to -reject the email. - -If this parameter is not specified then an empty address will be sent to the -mail server which may or may not cause the email to be rejected. - -(Added in 7.20.0) -.IP CURLOPT_MAIL_RCPT -Pass a pointer to a linked list of recipients to pass to the server in your -SMTP mail request. The linked list should be a fully valid list of \fBstruct -curl_slist\fP structs properly filled in. Use \fIcurl_slist_append(3)\fP to -create the list and \fIcurl_slist_free_all(3)\fP to clean up an entire list. - -Each recipient should be specified within a pair of angled brackets (<>), -however, should you not use an angled bracket as the first character libcurl -will assume you provided a single email address and enclose that address -within brackets for you. - -(Added in 7.20.0) -.IP CURLOPT_MAIL_AUTH -Pass a pointer to a zero terminated string as parameter. This will be used -to specify the authentication address (identity) of a submitted message that -is being relayed to another server. - -This optional parameter allows co-operating agents in a trusted environment to -communicate the authentication of individual messages and should only be used -by the application program, using libcurl, if the application is itself a -mail server acting in such an environment. If the application is operating as -such and the AUTH address is not known or is invalid, then an empty string -should be used for this parameter. - -Unlike CURLOPT_MAIL_FROM and CURLOPT_MAIL_RCPT, the address should not be -specified within a pair of angled brackets (<>). However, if an empty string -is used then a pair of brackets will be sent by libcurl as required by -RFC2554. - -(Added in 7.25.0) -.SH TFTP OPTIONS -.IP CURLOPT_TFTP_BLKSIZE -Specify block size to use for TFTP data transmission. Valid range as per -RFC2348 is 8-65464 bytes. The default of 512 bytes will be used if this option -is not specified. The specified block size will only be used pending support -by the remote server. If the server does not return an option acknowledgement -or returns an option acknowledgement with no blksize, the default of 512 bytes -will be used. (added in 7.19.4) -.SH FTP OPTIONS -.IP CURLOPT_FTPPORT -Pass a pointer to a zero terminated string as parameter. It will be used to -get the IP address to use for the FTP PORT instruction. The PORT instruction -tells the remote server to connect to our specified IP address. The string may -be a plain IP address, a host name, a network interface name (under Unix) or -just a '-' symbol to let the library use your system's default IP -address. Default FTP operations are passive, and thus won't use PORT. - -The address can be followed by a ':' to specify a port, optionally followed by -a '-' to specify a port range. If the port specified is 0, the operating -system will pick a free port. If a range is provided and all ports in the -range are not available, libcurl will report CURLE_FTP_PORT_FAILED for the -handle. Invalid port/range settings are ignored. IPv6 addresses followed by -a port or portrange have to be in brackets. IPv6 addresses without port/range -specifier can be in brackets. (added in 7.19.5) - -Examples with specified ports: - -.nf - eth0:0 - 192.168.1.2:32000-33000 - curl.se:32123 - [::1]:1234-4567 -.fi - -You disable PORT again and go back to using the passive version by setting -this option to NULL. -.IP CURLOPT_QUOTE -Pass a pointer to a linked list of FTP or SFTP commands to pass to the server -prior to your FTP request. This will be done before any other commands are -issued (even before the CWD command for FTP). The linked list should be a -fully valid list of 'struct curl_slist' structs properly filled in with text -strings. Use \fIcurl_slist_append(3)\fP to append strings (commands) to the -list, and clear the entire list afterwards with -\fIcurl_slist_free_all(3)\fP. Disable this operation again by setting a NULL -to this option. When speaking to a FTP (or SFTP since 7.24.0) server, prefix -the command with an asterisk (*) to make libcurl continue even if the command -fails as by default libcurl will stop at first failure. - -The set of valid FTP commands depends on the server (see RFC959 for a list of -mandatory commands). - -The valid SFTP commands are: chgrp, chmod, chown, ln, mkdir, pwd, rename, rm, -rmdir, symlink (see -.BR curl (1)) -(SFTP support added in 7.16.3) -.IP CURLOPT_POSTQUOTE -Pass a pointer to a linked list of FTP or SFTP commands to pass to the server -after your FTP transfer request. The commands will only be run if no error -occurred. The linked list should be a fully valid list of struct curl_slist -structs properly filled in as described for \fICURLOPT_QUOTE\fP. Disable this -operation again by setting a NULL to this option. -.IP CURLOPT_PREQUOTE -Pass a pointer to a linked list of FTP commands to pass to the server after -the transfer type is set. The linked list should be a fully valid list of -struct curl_slist structs properly filled in as described for -\fICURLOPT_QUOTE\fP. Disable this operation again by setting a NULL to this -option. Before version 7.16.0, if you also set \fICURLOPT_NOBODY\fP to 1, this -option didn't work. -.IP CURLOPT_DIRLISTONLY -A parameter set to 1 tells the library to just list the names of files in a -directory, instead of doing a full directory listing that would include file -sizes, dates etc. This works for FTP and SFTP URLs. - -This causes an FTP NLST command to be sent on an FTP server. Beware that some -FTP servers list only files in their response to NLST; they might not include -subdirectories and symbolic links. - -Setting this option to 1 also implies a directory listing even if the URL -doesn't end with a slash, which otherwise is necessary. - -Do NOT use this option if you also use \fICURLOPT_WILDCARDMATCH\fP as it will -effectively break that feature then. - -(This option was known as CURLOPT_FTPLISTONLY up to 7.16.4) -.IP CURLOPT_APPEND -A parameter set to 1 tells the library to append to the remote file instead of -overwrite it. This is only useful when uploading to an FTP site. - -(This option was known as CURLOPT_FTPAPPEND up to 7.16.4) -.IP CURLOPT_FTP_USE_EPRT -Pass a long. If the value is 1, it tells curl to use the EPRT (and -LPRT) command when doing active FTP downloads (which is enabled by -\fICURLOPT_FTPPORT\fP). Using EPRT means that it will first attempt to use -EPRT and then LPRT before using PORT, but if you pass zero to this -option, it will not try using EPRT or LPRT, only plain PORT. (Added in 7.10.5) - -If the server is an IPv6 host, this option will have no effect as of 7.12.3. -.IP CURLOPT_FTP_USE_EPSV -Pass a long. If the value is 1, it tells curl to use the EPSV command -when doing passive FTP downloads (which it always does by default). Using EPSV -means that it will first attempt to use EPSV before using PASV, but if you -pass zero to this option, it will not try using EPSV, only plain PASV. - -If the server is an IPv6 host, this option will have no effect as of 7.12.3. -.IP CURLOPT_FTP_USE_PRET -Pass a long. If the value is 1, it tells curl to send a PRET command before -PASV (and EPSV). Certain FTP servers, mainly drftpd, require this non-standard -command for directory listings as well as up and downloads in PASV mode. Has -no effect when using the active FTP transfers mode. (Added in 7.20.0) -.IP CURLOPT_FTP_CREATE_MISSING_DIRS -Pass a long. If the value is 1, curl will attempt to create any remote -directory that it fails to CWD into. CWD is the command that changes working -directory. (Added in 7.10.7) - -This setting also applies to SFTP-connections. curl will attempt to create -the remote directory if it can't obtain a handle to the target-location. The -creation will fail if a file of the same name as the directory to create -already exists or lack of permissions prevents creation. (Added in 7.16.3) - -Starting with 7.19.4, you can also set this value to 2, which will make -libcurl retry the CWD command again if the subsequent MKD command fails. This -is especially useful if you're doing many simultaneous connections against the -same server and they all have this option enabled, as then CWD may first fail -but then another connection does MKD before this connection and thus MKD fails -but trying CWD works! 7.19.4 also introduced the \fICURLFTP_CREATE_DIR\fP and -\fICURLFTP_CREATE_DIR_RETRY\fP enum names for these arguments. - -Before version 7.19.4, libcurl will simply ignore arguments set to 2 and act -as if 1 was selected. -.IP CURLOPT_FTP_RESPONSE_TIMEOUT -Pass a long. Causes curl to set a timeout period (in seconds) on the amount -of time that the server is allowed to take in order to generate a response -message for a command before the session is considered hung. While curl is -waiting for a response, this value overrides \fICURLOPT_TIMEOUT\fP. It is -recommended that if used in conjunction with \fICURLOPT_TIMEOUT\fP, you set -\fICURLOPT_FTP_RESPONSE_TIMEOUT\fP to a value smaller than -\fICURLOPT_TIMEOUT\fP. (Added in 7.10.8) -.IP CURLOPT_FTP_ALTERNATIVE_TO_USER -Pass a char * as parameter, pointing to a string which will be used to -authenticate if the usual FTP "USER user" and "PASS password" negotiation -fails. This is currently only known to be required when connecting to -Tumbleweed's Secure Transport FTPS server using client certificates for -authentication. (Added in 7.15.5) -.IP CURLOPT_FTP_SKIP_PASV_IP -Pass a long. If set to 1, it instructs libcurl to not use the IP address the -server suggests in its 227-response to libcurl's PASV command when libcurl -connects the data connection. Instead libcurl will re-use the same IP address -it already uses for the control connection. But it will use the port number -from the 227-response. (Added in 7.14.2) - -This option has no effect if PORT, EPRT or EPSV is used instead of PASV. -.IP CURLOPT_FTPSSLAUTH -Pass a long using one of the values from below, to alter how libcurl issues -\&"AUTH TLS" or "AUTH SSL" when FTP over SSL is activated (see -\fICURLOPT_USE_SSL\fP). (Added in 7.12.2) -.RS -.IP CURLFTPAUTH_DEFAULT -Allow libcurl to decide. -.IP CURLFTPAUTH_SSL -Try "AUTH SSL" first, and only if that fails try "AUTH TLS". -.IP CURLFTPAUTH_TLS -Try "AUTH TLS" first, and only if that fails try "AUTH SSL". -.RE -.IP CURLOPT_FTP_SSL_CCC -If enabled, this option makes libcurl use CCC (Clear Command Channel). It -shuts down the SSL/TLS layer after authenticating. The rest of the -control channel communication will be unencrypted. This allows NAT routers -to follow the FTP transaction. Pass a long using one of the values below. -(Added in 7.16.1) -.RS -.IP CURLFTPSSL_CCC_NONE -Don't attempt to use CCC. -.IP CURLFTPSSL_CCC_PASSIVE -Do not initiate the shutdown, but wait for the server to do it. Do not send -a reply. -.IP CURLFTPSSL_CCC_ACTIVE -Initiate the shutdown and wait for a reply. -.RE -.IP CURLOPT_FTP_ACCOUNT -Pass a pointer to a zero terminated string (or NULL to disable). When an FTP -server asks for "account data" after user name and password has been provided, -this data is sent off using the ACCT command. (Added in 7.13.0) -.IP CURLOPT_FTP_FILEMETHOD -Pass a long that should have one of the following values. This option controls -what method libcurl should use to reach a file on a FTP(S) server. The -argument should be one of the following alternatives: -.RS -.IP CURLFTPMETHOD_MULTICWD -libcurl does a single CWD operation for each path part in the given URL. For -deep hierarchies this means many commands. This is how RFC1738 says it -should be done. This is the default but the slowest behavior. -.IP CURLFTPMETHOD_NOCWD -libcurl does no CWD at all. libcurl will do SIZE, RETR, STOR etc and give a -full path to the server for all these commands. This is the fastest behavior. -.IP CURLFTPMETHOD_SINGLECWD -libcurl does one CWD with the full target directory and then operates on the -file \&"normally" (like in the multicwd case). This is somewhat more standards -compliant than 'nocwd' but without the full penalty of 'multicwd'. -.RE -(Added in 7.15.1) -.SH RTSP OPTIONS -.IP CURLOPT_RTSP_REQUEST -Tell libcurl what kind of RTSP request to make. Pass one of the following RTSP -enum values. Unless noted otherwise, commands require the Session ID to be -initialized. (Added in 7.20.0) -.RS -.IP CURL_RTSPREQ_OPTIONS -Used to retrieve the available methods of the server. The application is -responsible for parsing and obeying the response. \fB(The session ID is not -needed for this method.)\fP (Added in 7.20.0) -.IP CURL_RTSPREQ_DESCRIBE -Used to get the low level description of a stream. The application should note -what formats it understands in the \fI'Accept:'\fP header. Unless set -manually, libcurl will automatically fill in \fI'Accept: -application/sdp'\fP. Time-condition headers will be added to Describe requests -if the \fICURLOPT_TIMECONDITION\fP option is active. \fB(The session ID is not -needed for this method)\fP (Added in 7.20.0) -.IP CURL_RTSPREQ_ANNOUNCE -When sent by a client, this method changes the description of the session. For -example, if a client is using the server to record a meeting, the client can -use Announce to inform the server of all the meta-information about the -session. ANNOUNCE acts like a HTTP PUT or POST just like -\fICURL_RTSPREQ_SET_PARAMETER\fP (Added in 7.20.0) -.IP CURL_RTSPREQ_SETUP -Setup is used to initialize the transport layer for the session. The -application must set the desired Transport options for a session by using the -\fICURLOPT_RTSP_TRANSPORT\fP option prior to calling setup. If no session ID -is currently set with \fICURLOPT_RTSP_SESSION_ID\fP, libcurl will extract and -use the session ID in the response to this request. \fB(The session ID is not -needed for this method).\fP (Added in 7.20.0) -.IP CURL_RTSPREQ_PLAY -Send a Play command to the server. Use the \fICURLOPT_RANGE\fP option to -modify the playback time (e.g. 'npt=10-15'). (Added in 7.20.0) -.IP CURL_RTSPREQ_PAUSE -Send a Pause command to the server. Use the \fICURLOPT_RANGE\fP option with a -single value to indicate when the stream should be halted. (e.g. npt='25') -(Added in 7.20.0) -.IP CURL_RTSPREQ_TEARDOWN -This command terminates an RTSP session. Simply closing a connection does not -terminate the RTSP session since it is valid to control an RTSP session over -different connections. (Added in 7.20.0) -.IP CURL_RTSPREQ_GET_PARAMETER -Retrieve a parameter from the server. By default, libcurl will automatically -include a \fIContent-Type: text/parameters\fP header on all non-empty requests -unless a custom one is set. GET_PARAMETER acts just like a HTTP PUT or POST -(see \fICURL_RTSPREQ_SET_PARAMETER\fP). -Applications wishing to send a heartbeat message (e.g. in the presence of a -server-specified timeout) should send use an empty GET_PARAMETER request. -(Added in 7.20.0) -.IP CURL_RTSPREQ_SET_PARAMETER -Set a parameter on the server. By default, libcurl will automatically include -a \fIContent-Type: text/parameters\fP header unless a custom one is set. The -interaction with SET_PARAMTER is much like a HTTP PUT or POST. An application -may either use \fICURLOPT_UPLOAD\fP with \fICURLOPT_READDATA\fP like a HTTP -PUT, or it may use \fICURLOPT_POSTFIELDS\fP like a HTTP POST. No chunked -transfers are allowed, so the application must set the -\fICURLOPT_INFILESIZE\fP in the former and \fICURLOPT_POSTFIELDSIZE\fP in the -latter. Also, there is no use of multi-part POSTs within RTSP. (Added in -7.20.0) -.IP CURL_RTSPREQ_RECORD -Used to tell the server to record a session. Use the \fICURLOPT_RANGE\fP -option to modify the record time. (Added in 7.20.0) -.IP CURL_RTSPREQ_RECEIVE -This is a special request because it does not send any data to the server. The -application may call this function in order to receive interleaved RTP -data. It will return after processing one read buffer of data in order to give -the application a chance to run. (Added in 7.20.0) -.RE -.IP CURLOPT_RTSP_SESSION_ID -Pass a char * as a parameter to set the value of the current RTSP Session ID -for the handle. Useful for resuming an in-progress session. Once this value is -set to any non-NULL value, libcurl will return \fICURLE_RTSP_SESSION_ERROR\fP -if ID received from the server does not match. If unset (or set to NULL), -libcurl will automatically set the ID the first time the server sets it in a -response. (Added in 7.20.0) -.IP CURLOPT_RTSP_STREAM_URI -Set the stream URI to operate on by passing a char * . For example, a single -session may be controlling \fIrtsp://foo/twister/audio\fP and -\fIrtsp://foo/twister/video\fP and the application can switch to the -appropriate stream using this option. If unset, libcurl will default to -operating on generic server options by passing '*' in the place of the RTSP -Stream URI. This option is distinct from \fICURLOPT_URL\fP. When working with -RTSP, the \fICURLOPT_STREAM_URI\fP indicates what URL to send to the server in -the request header while the \fICURLOPT_URL\fP indicates where to make the -connection to. (e.g. the \fICURLOPT_URL\fP for the above examples might be -set to \fIrtsp://foo/twister\fP (Added in 7.20.0) -.IP CURLOPT_RTSP_TRANSPORT -Pass a char * to tell libcurl what to pass for the Transport: header for this -RTSP session. This is mainly a convenience method to avoid needing to set a -custom Transport: header for every SETUP request. The application must set a -Transport: header before issuing a SETUP request. (Added in 7.20.0) -.IP CURLOPT_RTSP_HEADER -This option is simply an alias for \fICURLOPT_HTTP_HEADER\fP. Use this to -replace the standard headers that RTSP and HTTP share. It is also valid to use -the shortcuts such as \fICURLOPT_USERAGENT\fP. (Added in 7.20.0) -.IP CURLOPT_RTSP_CLIENT_CSEQ -Manually set the the CSEQ number to issue for the next RTSP request. Useful if -the application is resuming a previously broken connection. The CSEQ will -increment from this new number henceforth. (Added in 7.20.0) -.IP CURLOPT_RTSP_SERVER_CSEQ -Manually set the CSEQ number to expect for the next RTSP Server->Client -request. At the moment, this feature (listening for Server requests) is -unimplemented. (Added in 7.20.0) -.SH PROTOCOL OPTIONS -.IP CURLOPT_TRANSFERTEXT -A parameter set to 1 tells the library to use ASCII mode for FTP transfers, -instead of the default binary transfer. For win32 systems it does not set the -stdout to binary mode. This option can be usable when transferring text data -between systems with different views on certain characters, such as newlines -or similar. - -libcurl does not do a complete ASCII conversion when doing ASCII transfers -over FTP. This is a known limitation/flaw that nobody has rectified. libcurl -simply sets the mode to ASCII and performs a standard transfer. -.IP CURLOPT_PROXY_TRANSFER_MODE -Pass a long. If the value is set to 1 (one), it tells libcurl to set the -transfer mode (binary or ASCII) for FTP transfers done via a HTTP proxy, by -appending ;type=a or ;type=i to the URL. Without this setting, or it being set -to 0 (zero, the default), \fICURLOPT_TRANSFERTEXT\fP has no effect when doing -FTP via a proxy. Beware that not all proxies support this feature. (Added in -7.18.0) -.IP CURLOPT_CRLF -Pass a long. If the value is set to 1 (one), libcurl converts Unix newlines to -CRLF newlines on transfers. Disable this option again by setting the value to -0 (zero). -.IP CURLOPT_RANGE -Pass a char * as parameter, which should contain the specified range you -want. It should be in the format "X-Y", where X or Y may be left out. HTTP -transfers also support several intervals, separated with commas as in -\fI"X-Y,N-M"\fP. Using this kind of multiple intervals will cause the HTTP -server to send the response document in pieces (using standard MIME separation -techniques). For RTSP, the formatting of a range should follow RFC2326 -Section 12.29. For RTSP, byte ranges are \fBnot\fP permitted. Instead, ranges -should be given in npt, utc, or smpte formats. - -Pass a NULL to this option to disable the use of ranges. - -Ranges work on HTTP, FTP, FILE (since 7.18.0), and RTSP (since 7.20.0) -transfers only. -.IP CURLOPT_RESUME_FROM -Pass a long as parameter. It contains the offset in number of bytes that you -want the transfer to start from. Set this option to 0 to make the transfer -start from the beginning (effectively disabling resume). For FTP, set this -option to -1 to make the transfer start from the end of the target file -(useful to continue an interrupted upload). - -When doing uploads with FTP, the resume position is where in the local/source -file libcurl should try to resume the upload from and it will then append the -source file to the remote target file. -.IP CURLOPT_RESUME_FROM_LARGE -Pass a curl_off_t as parameter. It contains the offset in number of bytes that -you want the transfer to start from. (Added in 7.11.0) -.IP CURLOPT_CUSTOMREQUEST -Pass a pointer to a zero terminated string as parameter. It can be used to -specify the request instead of GET or HEAD when performing HTTP based -requests, instead of LIST and NLST when performing FTP directory listings and -instead of LIST and RETR when issuing POP3 based commands. This is -particularly useful, for example, for performing a HTTP DELETE request or a -POP3 DELE command. - -Please don't perform this at will, on HTTP based requests, by making sure -your server supports the command you are sending first. - -When you change the request method by setting \fBCURLOPT_CUSTOMREQUEST\fP to -something, you don't actually change how libcurl behaves or acts in regards -to the particular request method, it will only change the actual string sent -in the request. - -For example: - -With the HTTP protocol when you tell libcurl to do a HEAD request, but then -specify a GET though a custom request libcurl will still act as if it sent a -HEAD. To switch to a proper HEAD use \fICURLOPT_NOBODY\fP, to switch to a -proper POST use \fICURLOPT_POST\fP or \fICURLOPT_POSTFIELDS\fP and to switch -to a proper GET use CURLOPT_HTTPGET. - -With the POP3 protocol when you tell libcurl to use a custom request it will -behave like a LIST or RETR command was sent where it expects data to be -returned by the server. As such \fICURLOPT_NOBODY\fP should be used when -specifying commands such as DELE and NOOP for example. - -Restore to the internal default by setting this to NULL. - -Many people have wrongly used this option to replace the entire request with -their own, including multiple headers and POST contents. While that might -work in many cases, it will cause libcurl to send invalid requests and it -could possibly confuse the remote server badly. Use \fICURLOPT_POST\fP and -\fICURLOPT_POSTFIELDS\fP to set POST data. Use \fICURLOPT_HTTPHEADER\fP to -replace or extend the set of headers sent by libcurl. Use -\fICURLOPT_HTTP_VERSION\fP to change HTTP version. - -(Support for POP3 added in 7.26.0) -.IP CURLOPT_FILETIME -Pass a long. If it is 1, libcurl will attempt to get the modification date of -the remote document in this operation. This requires that the remote server -sends the time or replies to a time querying command. The -\fIcurl_easy_getinfo(3)\fP function with the \fICURLINFO_FILETIME\fP argument -can be used after a transfer to extract the received time (if any). -.IP CURLOPT_NOBODY -A parameter set to 1 tells the library to not include the body-part in the -output. This is only relevant for protocols that have separate header and -body parts. On HTTP(S) servers, this will make libcurl do a HEAD request. - -To change request to GET, you should use \fICURLOPT_HTTPGET\fP. Change -request to POST with \fICURLOPT_POST\fP etc. -.IP CURLOPT_INFILESIZE -When uploading a file to a remote site, this option should be used to tell -libcurl what the expected size of the infile is. This value should be passed -as a long. See also \fICURLOPT_INFILESIZE_LARGE\fP. - -For uploading using SCP, this option or \fICURLOPT_INFILESIZE_LARGE\fP is -mandatory. - -When sending emails using SMTP, this command can be used to specify the -optional SIZE parameter for the MAIL FROM command. (Added in 7.23.0) - -This option does not limit how much data libcurl will actually send, as that -is controlled entirely by what the read callback returns. -.IP CURLOPT_INFILESIZE_LARGE -When uploading a file to a remote site, this option should be used to tell -libcurl what the expected size of the infile is. This value should be passed -as a curl_off_t. (Added in 7.11.0) - -For uploading using SCP, this option or \fICURLOPT_INFILESIZE\fP is mandatory. - -This option does not limit how much data libcurl will actually send, as that -is controlled entirely by what the read callback returns. -.IP CURLOPT_UPLOAD -A parameter set to 1 tells the library to prepare for an upload. The -\fICURLOPT_READDATA\fP and \fICURLOPT_INFILESIZE\fP or -\fICURLOPT_INFILESIZE_LARGE\fP options are also interesting for uploads. If -the protocol is HTTP, uploading means using the PUT request unless you tell -libcurl otherwise. - -Using PUT with HTTP 1.1 implies the use of a "Expect: 100-continue" header. -You can disable this header with \fICURLOPT_HTTPHEADER\fP as usual. - -If you use PUT to a HTTP 1.1 server, you can upload data without knowing the -size before starting the transfer if you use chunked encoding. You enable this -by adding a header like "Transfer-Encoding: chunked" with -\fICURLOPT_HTTPHEADER\fP. With HTTP 1.0 or without chunked transfer, you must -specify the size. -.IP CURLOPT_MAXFILESIZE -Pass a long as parameter. This allows you to specify the maximum size (in -bytes) of a file to download. If the file requested is larger than this value, -the transfer will not start and CURLE_FILESIZE_EXCEEDED will be returned. - -The file size is not always known prior to download, and for such files this -option has no effect even if the file transfer ends up being larger than this -given limit. This concerns both FTP and HTTP transfers. -.IP CURLOPT_MAXFILESIZE_LARGE -Pass a curl_off_t as parameter. This allows you to specify the maximum size -(in bytes) of a file to download. If the file requested is larger than this -value, the transfer will not start and \fICURLE_FILESIZE_EXCEEDED\fP will be -returned. (Added in 7.11.0) - -The file size is not always known prior to download, and for such files this -option has no effect even if the file transfer ends up being larger than this -given limit. This concerns both FTP and HTTP transfers. -.IP CURLOPT_TIMECONDITION -Pass a long as parameter. This defines how the \fICURLOPT_TIMEVALUE\fP time -value is treated. You can set this parameter to \fICURL_TIMECOND_IFMODSINCE\fP -or \fICURL_TIMECOND_IFUNMODSINCE\fP. This feature applies to HTTP, FTP, RTSP, -and FILE. - -The last modification time of a file is not always known and in such instances -this feature will have no effect even if the given time condition would not -have been met. \fIcurl_easy_getinfo(3)\fP with the -\fICURLINFO_CONDITION_UNMET\fP option can be used after a transfer to learn if -a zero-byte successful "transfer" was due to this condition not matching. -.IP CURLOPT_TIMEVALUE -Pass a long as parameter. This should be the time in seconds since 1 Jan 1970, -and the time will be used in a condition as specified with -\fICURLOPT_TIMECONDITION\fP. -.SH CONNECTION OPTIONS -.IP CURLOPT_TIMEOUT -Pass a long as parameter containing the maximum time in seconds that you allow -the libcurl transfer operation to take. Normally, name lookups can take a -considerable time and limiting operations to less than a few minutes risk -aborting perfectly normal operations. This option will cause curl to use the -SIGALRM to enable time-outing system calls. - -In unix-like systems, this might cause signals to be used unless -\fICURLOPT_NOSIGNAL\fP is set. - -Default timeout is 0 (zero) which means it never times out. -.IP CURLOPT_TIMEOUT_MS -Like \fICURLOPT_TIMEOUT\fP but takes number of milliseconds instead. If -libcurl is built to use the standard system name resolver, that portion -of the transfer will still use full-second resolution for timeouts with -a minimum timeout allowed of one second. -(Added in 7.16.2) -.IP CURLOPT_LOW_SPEED_LIMIT -Pass a long as parameter. It contains the transfer speed in bytes per second -that the transfer should be below during \fICURLOPT_LOW_SPEED_TIME\fP seconds -for the library to consider it too slow and abort. -.IP CURLOPT_LOW_SPEED_TIME -Pass a long as parameter. It contains the time in seconds that the transfer -should be below the \fICURLOPT_LOW_SPEED_LIMIT\fP for the library to consider -it too slow and abort. -.IP CURLOPT_MAX_SEND_SPEED_LARGE -Pass a curl_off_t as parameter. If an upload exceeds this speed (counted in -bytes per second) on cumulative average during the transfer, the transfer will -pause to keep the average rate less than or equal to the parameter value. -Defaults to unlimited speed. (Added in 7.15.5) -.IP CURLOPT_MAX_RECV_SPEED_LARGE -Pass a curl_off_t as parameter. If a download exceeds this speed (counted in -bytes per second) on cumulative average during the transfer, the transfer will -pause to keep the average rate less than or equal to the parameter -value. Defaults to unlimited speed. (Added in 7.15.5) -.IP CURLOPT_MAXCONNECTS -Pass a long. The set number will be the persistent connection cache size. The -set amount will be the maximum amount of simultaneously open connections that -libcurl may cache in this easy handle. Default is 5, and there isn't much -point in changing this value unless you are perfectly aware of how this works -and changes libcurl's behaviour. This concerns connections using any of the -protocols that support persistent connections. - -When reaching the maximum limit, curl closes the oldest one in the cache to -prevent increasing the number of open connections. - -If you already have performed transfers with this curl handle, setting a -smaller MAXCONNECTS than before may cause open connections to get closed -unnecessarily. - -If you add this easy handle to a multi handle, this setting is not -acknowledged, and you must instead use \fIcurl_multi_setopt(3)\fP and the -\fICURLMOPT_MAXCONNECTS\fP option. -.IP CURLOPT_CLOSEPOLICY -(Obsolete) This option does nothing. -.IP CURLOPT_FRESH_CONNECT -Pass a long. Set to 1 to make the next transfer use a new (fresh) connection -by force. If the connection cache is full before this connection, one of the -existing connections will be closed as according to the selected or default -policy. This option should be used with caution and only if you understand -what it does. Set this to 0 to have libcurl attempt re-using an existing -connection (default behavior). -.IP CURLOPT_FORBID_REUSE -Pass a long. Set to 1 to make the next transfer explicitly close the -connection when done. Normally, libcurl keeps all connections alive when done -with one transfer in case a succeeding one follows that can re-use them. -This option should be used with caution and only if you understand what it -does. Set to 0 to have libcurl keep the connection open for possible later -re-use (default behavior). -.IP CURLOPT_CONNECTTIMEOUT -Pass a long. It should contain the maximum time in seconds that you allow the -connection to the server to take. This only limits the connection phase, once -it has connected, this option is of no more use. Set to zero to switch to the -default built-in connection timeout - 300 seconds. See also the -\fICURLOPT_TIMEOUT\fP option. - -In unix-like systems, this might cause signals to be used unless -\fICURLOPT_NOSIGNAL\fP is set. -.IP CURLOPT_CONNECTTIMEOUT_MS -Like \fICURLOPT_CONNECTTIMEOUT\fP but takes the number of milliseconds -instead. If libcurl is built to use the standard system name resolver, -that portion of the connect will still use full-second resolution for -timeouts with a minimum timeout allowed of one second. -(Added in 7.16.2) -.IP CURLOPT_IPRESOLVE -Allows an application to select what kind of IP addresses to use when -resolving host names. This is only interesting when using host names that -resolve addresses using more than one version of IP. The allowed values are: -.RS -.IP CURL_IPRESOLVE_WHATEVER -Default, resolves addresses to all IP versions that your system allows. -.IP CURL_IPRESOLVE_V4 -Resolve to IPv4 addresses. -.IP CURL_IPRESOLVE_V6 -Resolve to IPv6 addresses. -.RE -.IP CURLOPT_CONNECT_ONLY -Pass a long. If the parameter equals 1, it tells the library to perform all -the required proxy authentication and connection setup, but no data transfer. -This option is implemented for HTTP, SMTP and POP3. - -The option can be used to simply test a connection to a server, but is more -useful when used with the \fICURLINFO_LASTSOCKET\fP option to -\fIcurl_easy_getinfo(3)\fP as the library can set up the connection and then -the application can obtain the most recently used socket for special data -transfers. (Added in 7.15.2) -.IP CURLOPT_USE_SSL -Pass a long using one of the values from below, to make libcurl use your -desired level of SSL for the transfer. (Added in 7.11.0) - -This is for enabling SSL/TLS when you use FTP, SMTP, POP3, IMAP etc. - -(This option was known as CURLOPT_FTP_SSL up to 7.16.4, and the constants -were known as CURLFTPSSL_*) -.RS -.IP CURLUSESSL_NONE -Don't attempt to use SSL. -.IP CURLUSESSL_TRY -Try using SSL, proceed as normal otherwise. -.IP CURLUSESSL_CONTROL -Require SSL for the control connection or fail with \fICURLE_USE_SSL_FAILED\fP. -.IP CURLUSESSL_ALL -Require SSL for all communication or fail with \fICURLE_USE_SSL_FAILED\fP. -.RE -.IP CURLOPT_RESOLVE -Pass a pointer to a linked list of strings with host name resolve information -to use for requests with this handle. The linked list should be a fully valid -list of \fBstruct curl_slist\fP structs properly filled in. Use -\fIcurl_slist_append(3)\fP to create the list and \fIcurl_slist_free_all(3)\fP -to clean up an entire list. - -Each single name resolve string should be written using the format -HOST:PORT:ADDRESS where HOST is the name libcurl will try to resolve, PORT is -the port number of the service where libcurl wants to connect to the HOST and -ADDRESS is the numerical IP address. If libcurl is built to support IPv6, -ADDRESS can of course be either IPv4 or IPv6 style addressing. - -This option effectively pre-populates the DNS cache with entries for the -host+port pair so redirects and everything that operations against the -HOST+PORT will instead use your provided ADDRESS. - -You can remove names from the DNS cache again, to stop providing these fake -resolves, by including a string in the linked list that uses the format -\&"-HOST:PORT". The host name must be prefixed with a dash, and the host name -and port number must exactly match what was already added previously. - -(Added in 7.21.3) -.IP CURLOPT_DNS_SERVERS -Set the list of DNS servers to be used instead of the system default. -The format of the dns servers option is: - -host[:port][,host[:port]]... - -For example: - -192.168.1.100,192.168.1.101,3.4.5.6 - -This option requires that libcurl was built with a resolver backend that -supports this operation. The c-ares backend is the only such one. - -(Added in 7.24.0) -.IP CURLOPT_ACCEPTTIMEOUT_MS -Pass a long telling libcurl the maximum number of milliseconds to wait for a -server to connect back to libcurl when an active FTP connection is used. If no -timeout is set, the internal default of 60000 will be used. (Added in 7.24.0) -.SH SSL and SECURITY OPTIONS -.IP CURLOPT_SSLCERT -Pass a pointer to a zero terminated string as parameter. The string should be -the file name of your certificate. The default format is "PEM" and can be -changed with \fICURLOPT_SSLCERTTYPE\fP. - -With NSS this can also be the nickname of the certificate you wish to -authenticate with. If you want to use a file from the current directory, please -precede it with "./" prefix, in order to avoid confusion with a nickname. -.IP CURLOPT_SSLCERTTYPE -Pass a pointer to a zero terminated string as parameter. The string should be -the format of your certificate. Supported formats are "PEM" and "DER". (Added -in 7.9.3) -.IP CURLOPT_SSLKEY -Pass a pointer to a zero terminated string as parameter. The string should be -the file name of your private key. The default format is "PEM" and can be -changed with \fICURLOPT_SSLKEYTYPE\fP. -.IP CURLOPT_SSLKEYTYPE -Pass a pointer to a zero terminated string as parameter. The string should be -the format of your private key. Supported formats are "PEM", "DER" and "ENG". - -The format "ENG" enables you to load the private key from a crypto engine. In -this case \fICURLOPT_SSLKEY\fP is used as an identifier passed to the -engine. You have to set the crypto engine with \fICURLOPT_SSLENGINE\fP. -\&"DER" format key file currently does not work because of a bug in OpenSSL. -.IP CURLOPT_KEYPASSWD -Pass a pointer to a zero terminated string as parameter. It will be used as -the password required to use the \fICURLOPT_SSLKEY\fP or -\fICURLOPT_SSH_PRIVATE_KEYFILE\fP private key. -You never needed a pass phrase to load a certificate but you need one to -load your private key. - -(This option was known as CURLOPT_SSLKEYPASSWD up to 7.16.4 and -CURLOPT_SSLCERTPASSWD up to 7.9.2) -.IP CURLOPT_SSLENGINE -Pass a pointer to a zero terminated string as parameter. It will be used as -the identifier for the crypto engine you want to use for your private -key. - -If the crypto device cannot be loaded, \fICURLE_SSL_ENGINE_NOTFOUND\fP is -returned. -.IP CURLOPT_SSLENGINE_DEFAULT -Sets the actual crypto engine as the default for (asymmetric) crypto -operations. - -If the crypto device cannot be set, \fICURLE_SSL_ENGINE_SETFAILED\fP is -returned. - -Even though this option doesn't need any parameter, in some configurations -\fIcurl_easy_setopt\fP might be defined as a macro taking exactly three -arguments. Therefore, it's recommended to pass 1 as parameter to this option. -.IP CURLOPT_SSLVERSION -Pass a long as parameter to control what version of SSL/TLS to attempt to use. -The available options are: -.RS -.IP CURL_SSLVERSION_DEFAULT -The default action. This will attempt to figure out the remote SSL protocol -version, i.e. either SSLv3 or TLSv1 (but not SSLv2, which became disabled -by default with 7.18.1). -.IP CURL_SSLVERSION_TLSv1 -Force TLSv1 -.IP CURL_SSLVERSION_SSLv2 -Force SSLv2 -.IP CURL_SSLVERSION_SSLv3 -Force SSLv3 -.RE -.IP CURLOPT_SSL_VERIFYPEER -Pass a long as parameter. By default, curl assumes a value of 1. - -This option determines whether curl verifies the authenticity of the peer's -certificate. A value of 1 means curl verifies; 0 (zero) means it doesn't. - -When negotiating a SSL connection, the server sends a certificate indicating -its identity. Curl verifies whether the certificate is authentic, i.e. that -you can trust that the server is who the certificate says it is. This trust -is based on a chain of digital signatures, rooted in certification authority -(CA) certificates you supply. curl uses a default bundle of CA certificates -(the path for that is determined at build time) and you can specify alternate -certificates with the \fICURLOPT_CAINFO\fP option or the \fICURLOPT_CAPATH\fP -option. - -When \fICURLOPT_SSL_VERIFYPEER\fP is nonzero, and the verification fails to -prove that the certificate is authentic, the connection fails. When the -option is zero, the peer certificate verification succeeds regardless. - -Authenticating the certificate is not by itself very useful. You typically -want to ensure that the server, as authentically identified by its -certificate, is the server you mean to be talking to. Use -\fICURLOPT_SSL_VERIFYHOST\fP to control that. The check that the host name in -the certificate is valid for the host name you're connecting to is done -independently of the \fICURLOPT_SSL_VERIFYPEER\fP option. -.IP CURLOPT_CAINFO -Pass a char * to a zero terminated string naming a file holding one or more -certificates to verify the peer with. This makes sense only when used in -combination with the \fICURLOPT_SSL_VERIFYPEER\fP option. If -\fICURLOPT_SSL_VERIFYPEER\fP is zero, \fICURLOPT_CAINFO\fP need not -even indicate an accessible file. - -This option is by default set to the system path where libcurl's cacert bundle -is assumed to be stored, as established at build time. - -If curl is built against the NSS SSL library, the NSS PEM PKCS#11 module -(libnsspem.so) needs to be available for this option to work properly. -.IP CURLOPT_ISSUERCERT -Pass a char * to a zero terminated string naming a file holding a CA -certificate in PEM format. If the option is set, an additional check against -the peer certificate is performed to verify the issuer is indeed the one -associated with the certificate provided by the option. This additional check -is useful in multi-level PKI where one needs to enforce that the peer -certificate is from a specific branch of the tree. - -This option makes sense only when used in combination with the -\fICURLOPT_SSL_VERIFYPEER\fP option. Otherwise, the result of the check is not -considered as failure. - -A specific error code (CURLE_SSL_ISSUER_ERROR) is defined with the option, -which is returned if the setup of the SSL/TLS session has failed due to a -mismatch with the issuer of peer certificate (\fICURLOPT_SSL_VERIFYPEER\fP has -to be set too for the check to fail). (Added in 7.19.0) -.IP CURLOPT_CAPATH -Pass a char * to a zero terminated string naming a directory holding multiple -CA certificates to verify the peer with. If libcurl is built against OpenSSL, -the certificate directory must be prepared using the openssl c_rehash utility. -This makes sense only when used in combination with the -\fICURLOPT_SSL_VERIFYPEER\fP option. If \fICURLOPT_SSL_VERIFYPEER\fP is zero, -\fICURLOPT_CAPATH\fP need not even indicate an accessible path. The -\fICURLOPT_CAPATH\fP function apparently does not work in Windows due to some -limitation in openssl. This option is OpenSSL-specific and does nothing if -libcurl is built to use GnuTLS. NSS-powered libcurl provides the option only -for backward compatibility. -.IP CURLOPT_CRLFILE -Pass a char * to a zero terminated string naming a file with the concatenation -of CRL (in PEM format) to use in the certificate validation that occurs during -the SSL exchange. - -When curl is built to use NSS or GnuTLS, there is no way to influence the use -of CRL passed to help in the verification process. When libcurl is built with -OpenSSL support, X509_V_FLAG_CRL_CHECK and X509_V_FLAG_CRL_CHECK_ALL are both -set, requiring CRL check against all the elements of the certificate chain if -a CRL file is passed. - -This option makes sense only when used in combination with the -\fICURLOPT_SSL_VERIFYPEER\fP option. - -A specific error code (CURLE_SSL_CRL_BADFILE) is defined with the option. It -is returned when the SSL exchange fails because the CRL file cannot be loaded. -A failure in certificate verification due to a revocation information found in -the CRL does not trigger this specific error. (Added in 7.19.0) -.IP CURLOPT_SSL_VERIFYHOST -Pass a long as parameter. - -This option determines whether libcurl verifies that the server cert is for -the server it is known as. - -When negotiating a SSL connection, the server sends a certificate indicating -its identity. - -When \fICURLOPT_SSL_VERIFYHOST\fP is 2, that certificate must indicate that -the server is the server to which you meant to connect, or the connection -fails. - -Curl considers the server the intended one when the Common Name field or a -Subject Alternate Name field in the certificate matches the host name in the -URL to which you told Curl to connect. - -When the value is 1, libcurl will return a failure. It was previously (in -7.28.0 and earlier) a debug option of some sorts, but it is no longer -supported due to frequently leading to programmer mistakes. - -When the value is 0, the connection succeeds regardless of the names in the -certificate. - -The default value for this option is 2. - -This option controls checking the server's certificate's claimed identity. -The server could be lying. To control lying, see -\fICURLOPT_SSL_VERIFYPEER\fP. If libcurl is built against NSS and -\fICURLOPT_SSL_VERIFYPEER\fP is zero, \fICURLOPT_SSL_VERIFYHOST\fP -is ignored. - -.IP CURLOPT_CERTINFO -Pass a long set to 1 to enable libcurl's certificate chain info gatherer. With -this enabled, libcurl (if built with OpenSSL) will extract lots of information -and data about the certificates in the certificate chain used in the SSL -connection. This data is then possible to extract after a transfer using -\fIcurl_easy_getinfo(3)\fP and its option \fICURLINFO_CERTINFO\fP. (Added in -7.19.1) -.IP CURLOPT_RANDOM_FILE -Pass a char * to a zero terminated file name. The file will be used to read -from to seed the random engine for SSL. The more random the specified file is, -the more secure the SSL connection will become. -.IP CURLOPT_EGDSOCKET -Pass a char * to the zero terminated path name to the Entropy Gathering Daemon -socket. It will be used to seed the random engine for SSL. -.IP CURLOPT_SSL_CIPHER_LIST -Pass a char *, pointing to a zero terminated string holding the list of -ciphers to use for the SSL connection. The list must be syntactically correct, -it consists of one or more cipher strings separated by colons. Commas or -spaces are also acceptable separators but colons are normally used, \&!, \&- -and \&+ can be used as operators. - -For OpenSSL and GnuTLS valid examples of cipher lists include 'RC4-SHA', -\'SHA1+DES\', 'TLSv1' and 'DEFAULT'. The default list is normally set when you -compile OpenSSL. - -You'll find more details about cipher lists on this URL: -\fIhttp://www.openssl.org/docs/apps/ciphers.html\fP - -For NSS, valid examples of cipher lists include 'rsa_rc4_128_md5', -\'rsa_aes_128_sha\', etc. With NSS you don't add/remove ciphers. If one uses -this option then all known ciphers are disabled and only those passed in -are enabled. - -You'll find more details about the NSS cipher lists on this URL: -\fIhttp://git.fedorahosted.org/cgit/mod_nss.git/plain/docs/mod_nss.html#Directives\fP - -.IP CURLOPT_SSL_SESSIONID_CACHE -Pass a long set to 0 to disable libcurl's use of SSL session-ID caching. Set -this to 1 to enable it. By default all transfers are done using the -cache. While nothing ever should get hurt by attempting to reuse SSL -session-IDs, there seem to be broken SSL implementations in the wild that may -require you to disable this in order for you to succeed. (Added in 7.16.0) -.IP CURLOPT_SSL_OPTIONS -Pass a long with a bitmask to tell libcurl about specific SSL behaviors. - -CURLSSLOPT_ALLOW_BEAST is the only supported bit and by setting this the user -will tell libcurl to not attempt to use any workarounds for a security flaw -in the SSL3 and TLS1.0 protocols. If this option isn't used or this bit is -set to 0, the SSL layer libcurl uses may use a work-around for this flaw -although it might cause interoperability problems with some (older) SSL -implementations. WARNING: avoiding this work-around loosens the security, and -by setting this option to 1 you ask for exactly that. (Added in 7.25.0) -.IP CURLOPT_KRBLEVEL -Pass a char * as parameter. Set the kerberos security level for FTP; this also -enables kerberos awareness. This is a string, \&'clear', \&'safe', -\&'confidential' or \&'private'. If the string is set but doesn't match one -of these, 'private' will be used. Set the string to NULL to disable kerberos -support for FTP. - -(This option was known as CURLOPT_KRB4LEVEL up to 7.16.3) -.IP CURLOPT_GSSAPI_DELEGATION -Set the parameter to CURLGSSAPI_DELEGATION_FLAG to allow unconditional GSSAPI -credential delegation. The delegation is disabled by default since 7.21.7. -Set the parameter to CURLGSSAPI_DELEGATION_POLICY_FLAG to delegate only if -the OK-AS-DELEGATE flag is set in the service ticket in case this feature is -supported by the GSSAPI implementation and the definition of -GSS_C_DELEG_POLICY_FLAG was available at compile-time. -(Added in 7.22.0) -.SH SSH OPTIONS -.IP CURLOPT_SSH_AUTH_TYPES -Pass a long set to a bitmask consisting of one or more of -CURLSSH_AUTH_PUBLICKEY, CURLSSH_AUTH_PASSWORD, CURLSSH_AUTH_HOST, -CURLSSH_AUTH_KEYBOARD and CURLSSH_AUTH_AGENT. Set CURLSSH_AUTH_ANY to let -libcurl pick a suitable one. Currently CURLSSH_AUTH_HOST has no effect. (Added -in 7.16.1) If CURLSSH_AUTH_AGENT is used, libcurl attempts to connect to -ssh-agent or pageant and let the agent attempt the authentication. (Added in -7.28.0) -.IP CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 -Pass a char * pointing to a string containing 32 hexadecimal digits. The -string should be the 128 bit MD5 checksum of the remote host's public key, and -libcurl will reject the connection to the host unless the md5sums match. This -option is only for SCP and SFTP transfers. (Added in 7.17.1) -.IP CURLOPT_SSH_PUBLIC_KEYFILE -Pass a char * pointing to a file name for your public key. If not used, -libcurl defaults to \fB$HOME/.ssh/id_dsa.pub\fP if the HOME environment -variable is set, and just "id_dsa.pub" in the current directory if HOME is not -set. (Added in 7.16.1) -If an empty string is passed, libcurl will pass no public key to libssh2 -which then tries to compute it from the private key, this is known to work -when libssh2 1.4.0+ is linked against OpenSSL. (Added in 7.26.0) -.IP CURLOPT_SSH_PRIVATE_KEYFILE -Pass a char * pointing to a file name for your private key. If not used, -libcurl defaults to \fB$HOME/.ssh/id_dsa\fP if the HOME environment variable -is set, and just "id_dsa" in the current directory if HOME is not set. If the -file is password-protected, set the password with -\fICURLOPT_KEYPASSWD\fP. (Added in 7.16.1) -.IP CURLOPT_SSH_KNOWNHOSTS -Pass a pointer to a zero terminated string holding the file name of the -known_host file to use. The known_hosts file should use the OpenSSH file -format as supported by libssh2. If this file is specified, libcurl will only -accept connections with hosts that are known and present in that file, with a -matching public key. Use \fICURLOPT_SSH_KEYFUNCTION\fP to alter the default -behavior on host and key (mis)matching. (Added in 7.19.6) -.IP CURLOPT_SSH_KEYFUNCTION -Pass a pointer to a curl_sshkeycallback function. It gets called when the -known_host matching has been done, to allow the application to act and decide -for libcurl how to proceed. The callback will only be called if -\fICURLOPT_SSH_KNOWNHOSTS\fP is also set. - -The curl_sshkeycallback function gets passed the CURL handle, the key from the -known_hosts file, the key from the remote site, info from libcurl on the -matching status and a custom pointer (set with \fICURLOPT_SSH_KEYDATA\fP). It -MUST return one of the following return codes to tell libcurl how to act: -.RS -.IP CURLKHSTAT_FINE_ADD_TO_FILE -The host+key is accepted and libcurl will append it to the known_hosts file -before continuing with the connection. This will also add the host+key combo -to the known_host pool kept in memory if it wasn't already present there. The -adding of data to the file is done by completely replacing the file with a new -copy, so the permissions of the file must allow this. -.IP CURLKHSTAT_FINE -The host+key is accepted libcurl will continue with the connection. This will -also add the host+key combo to the known_host pool kept in memory if it wasn't -already present there. -.IP CURLKHSTAT_REJECT -The host+key is rejected. libcurl will deny the connection to continue and it -will be closed. -.IP CURLKHSTAT_DEFER -The host+key is rejected, but the SSH connection is asked to be kept alive. -This feature could be used when the app wants to somehow return back and act -on the host+key situation and then retry without needing the overhead of -setting it up from scratch again. -.RE - (Added in 7.19.6) -.IP CURLOPT_SSH_KEYDATA -Pass a void * as parameter. This pointer will be passed along verbatim to the -callback set with \fICURLOPT_SSH_KEYFUNCTION\fP. (Added in 7.19.6) -.SH OTHER OPTIONS -.IP CURLOPT_PRIVATE -Pass a void * as parameter, pointing to data that should be associated with -this curl handle. The pointer can subsequently be retrieved using -\fIcurl_easy_getinfo(3)\fP with the CURLINFO_PRIVATE option. libcurl itself -does nothing with this data. (Added in 7.10.3) -.IP CURLOPT_SHARE -Pass a share handle as a parameter. The share handle must have been created by -a previous call to \fIcurl_share_init(3)\fP. Setting this option, will make -this curl handle use the data from the shared handle instead of keeping the -data to itself. This enables several curl handles to share data. If the curl -handles are used simultaneously in multiple threads, you \fBMUST\fP use the -locking methods in the share handle. See \fIcurl_share_setopt(3)\fP for -details. - -If you add a share that is set to share cookies, your easy handle will use -that cookie cache and get the cookie engine enabled. If you unshare an object -that was using cookies (or change to another object that doesn't share -cookies), the easy handle will get its cookie engine disabled. - -Data that the share object is not set to share will be dealt with the usual -way, as if no share was used. -.IP CURLOPT_NEW_FILE_PERMS -Pass a long as a parameter, containing the value of the permissions that will -be assigned to newly created files on the remote server. The default value is -\fI0644\fP, but any valid value can be used. The only protocols that can use -this are \fIsftp://\fP, \fIscp://\fP, and \fIfile://\fP. (Added in 7.16.4) -.IP CURLOPT_NEW_DIRECTORY_PERMS -Pass a long as a parameter, containing the value of the permissions that will -be assigned to newly created directories on the remote server. The default -value is \fI0755\fP, but any valid value can be used. The only protocols that -can use this are \fIsftp://\fP, \fIscp://\fP, and \fIfile://\fP. -(Added in 7.16.4) -.SH TELNET OPTIONS -.IP CURLOPT_TELNETOPTIONS -Provide a pointer to a curl_slist with variables to pass to the telnet -negotiations. The variables should be in the format <option=value>. libcurl -supports the options 'TTYPE', 'XDISPLOC' and 'NEW_ENV'. See the TELNET -standard for details. -.SH RETURN VALUE -CURLE_OK (zero) means that the option was set properly, non-zero means an -error occurred as \fI<curl/curl.h>\fP defines. See the \fIlibcurl-errors(3)\fP -man page for the full list with descriptions. - -If you try to set an option that libcurl doesn't know about, perhaps because -the library is too old to support it or the option was removed in a recent -version, this function will return \fICURLE_FAILED_INIT\fP. -.SH "SEE ALSO" -.BR curl_easy_init "(3), " curl_easy_cleanup "(3), " curl_easy_reset "(3)" diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_setopt.html b/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_setopt.html deleted file mode 100644 index c2698a6dd3..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_setopt.html +++ /dev/null @@ -1,920 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> -<html><head> -<title>curl_easy_setopt man page</title> -<meta name="generator" content="roffit"> -<STYLE type="text/css"> -P.level0 { - padding-left: 2em; -} - -P.level1 { - padding-left: 4em; -} - -P.level2 { - padding-left: 6em; -} - -span.emphasis { - font-style: italic; -} - -span.bold { - font-weight: bold; -} - -span.manpage { - font-weight: bold; -} - -h2.nroffsh { - background-color: #e0e0e0; -} - -span.nroffip { - font-weight: bold; - font-size: 120%; - font-family: monospace; -} - -p.roffit { - text-align: center; - font-size: 80%; -} -</STYLE> -</head><body> - -<p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2> -<p class="level0">curl_easy_setopt - set options for a curl easy handle <a name="SYNOPSIS"></a><h2 class="nroffsh">SYNOPSIS</h2> -<p class="level0">#include <curl/curl.h> -<p class="level0">CURLcode curl_easy_setopt(CURL *handle, CURLoption option, parameter); <a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2> -<p class="level0">curl_easy_setopt() is used to tell libcurl how to behave. By using the appropriate options to <span Class="emphasis">curl_easy_setopt</span>, you can change libcurl's behavior. All options are set with the <span Class="emphasis">option</span> followed by a <span Class="emphasis">parameter</span>. That parameter can be a <span Class="bold">long</span>, a <span Class="bold">function pointer</span>, an <span Class="bold">object pointer</span> or a <span Class="bold">curl_off_t</span>, depending on what the specific option expects. Read this manual carefully as bad input values may cause libcurl to behave badly! You can only set one option in each function call. A typical application uses many curl_easy_setopt() calls in the setup phase. -<p class="level0">Options set with this function call are valid for all forthcoming transfers performed using this <span Class="emphasis">handle</span>. The options are not in any way reset between transfers, so if you want subsequent transfers with different options, you must change them between the transfers. You can optionally reset all options back to internal default with <a class="emphasis" href="./curl_easy_reset.html">curl_easy_reset(3)</a>. -<p class="level0">Strings passed to libcurl as 'char *' arguments, are copied by the library; thus the string storage associated to the pointer argument may be overwritten after curl_easy_setopt() returns. Exceptions to this rule are described in the option details below. -<p class="level0">Before version 7.17.0, strings were not copied. Instead the user was forced keep them available until libcurl no longer needed them. -<p class="level0">The <span Class="emphasis">handle</span> is the return code from a <a class="emphasis" href="./curl_easy_init.html">curl_easy_init(3)</a> or <a class="emphasis" href="./curl_easy_duphandle.html">curl_easy_duphandle(3)</a> call. <a name="BEHAVIOR"></a><h2 class="nroffsh">BEHAVIOR OPTIONS</h2> -<p class="level0"> -<p class="level0"><a name="CURLOPTVERBOSE"></a><span class="nroffip">CURLOPT_VERBOSE</span> -<p class="level1">Set the parameter to 1 to get the library to display a lot of verbose information about its operations. Very useful for libcurl and/or protocol debugging and understanding. The verbose information will be sent to stderr, or the stream set with <a class="emphasis" href="#CURLOPTSTDERR">CURLOPT_STDERR</a>. -<p class="level1">You hardly ever want this set in production use, you will almost always want this when you debug/report problems. Another neat option for debugging is the <a class="emphasis" href="#CURLOPTDEBUGFUNCTION">CURLOPT_DEBUGFUNCTION</a>. -<p class="level0"><a name="CURLOPTHEADER"></a><span class="nroffip">CURLOPT_HEADER</span> -<p class="level1">A parameter set to 1 tells the library to include the header in the body output. This is only relevant for protocols that actually have headers preceding the data (like HTTP). -<p class="level0"><a name="CURLOPTNOPROGRESS"></a><span class="nroffip">CURLOPT_NOPROGRESS</span> -<p class="level1">Pass a long. If set to 1, it tells the library to shut off the progress meter completely. It will also prevent the <a class="emphasis" href="#CURLOPTPROGRESSFUNCTION">CURLOPT_PROGRESSFUNCTION</a> from getting called. -<p class="level1">Future versions of libcurl are likely to not have any built-in progress meter at all. -<p class="level0"><a name="CURLOPTNOSIGNAL"></a><span class="nroffip">CURLOPT_NOSIGNAL</span> -<p class="level1">Pass a long. If it is 1, libcurl will not use any functions that install signal handlers or any functions that cause signals to be sent to the process. This option is mainly here to allow multi-threaded unix applications to still set/use all timeout options etc, without risking getting signals. (Added in 7.10) -<p class="level1">If this option is set and libcurl has been built with the standard name resolver, timeouts will not occur while the name resolve takes place. Consider building libcurl with c-ares support to enable asynchronous DNS lookups, which enables nice timeouts for name resolves without signals. -<p class="level1">Setting <a class="emphasis" href="#CURLOPTNOSIGNAL">CURLOPT_NOSIGNAL</a> to 1 makes libcurl NOT ask the system to ignore SIGPIPE signals, which otherwise are sent by the system when trying to send data to a socket which is closed in the other end. libcurl makes an effort to never cause such SIGPIPEs to trigger, but some operating systems have no way to avoid them and even on those that have there are some corner cases when they may still happen, contrary to our desire. In addition, using <a class="emphasis" href="#CURLAUTHNTLMWB">CURLAUTH_NTLM_WB</a> authentication could cause a SIGCHLD signal to be raised. -<p class="level0"><a name="CURLOPTWILDCARDMATCH"></a><span class="nroffip">CURLOPT_WILDCARDMATCH</span> -<p class="level1">Set this option to 1 if you want to transfer multiple files according to a file name pattern. The pattern can be specified as part of the <a class="emphasis" href="#CURLOPTURL">CURLOPT_URL</a> option, using an fnmatch-like pattern (Shell Pattern Matching) in the last part of URL (file name). -<p class="level1">By default, libcurl uses its internal wildcard matching implementation. You can provide your own matching function by the <a class="emphasis" href="#CURLOPTFNMATCHFUNCTION">CURLOPT_FNMATCH_FUNCTION</a> option. -<p class="level1">This feature is only supported by the FTP download for now. -<p class="level1">A brief introduction of its syntax follows: -<p class="level2"> -<p class="level1"><a name=""></a><span class="nroffip">* - ASTERISK</span> -<p class="level2"><a href="ftp://example.com/some/path/">ftp://example.com/some/path/</a><span Class="bold">*.txt</span> (for all txt's from the root directory) -<p class="level1"> -<p class="level2"> -<p class="level1"><a name=""></a><span class="nroffip">? - QUESTION MARK</span> -<p class="level2">Question mark matches any (exactly one) character. -<p class="level2"><a href="ftp://example.com/some/path/">ftp://example.com/some/path/</a><span Class="bold">photo?.jpeg</span> -<p class="level1"> -<p class="level2"> -<p class="level1"><a name=""></a><span class="nroffip">[ - BRACKET EXPRESSION</span> -<p class="level2">The left bracket opens a bracket expression. The question mark and asterisk have no special meaning in a bracket expression. Each bracket expression ends by the right bracket and matches exactly one character. Some examples follow: -<p class="level2"><span Class="bold">[a-zA-Z0-9]</span> or <span Class="bold">[f-gF-G]</span> - character interval -<p class="level2"><span Class="bold">[abc]</span> - character enumeration -<p class="level2"><span Class="bold">[^abc]</span> or <span Class="bold">[!abc]</span> - negation -<p class="level2"><a class="bold" href="#">[[:</a><span Class="emphasis">name</span><a class="bold" href="#">:]]</a> class expression. Supported classes are <span Class="bold">alnum</span>,<span Class="bold">lower</span>, <span Class="bold">space</span>, <span Class="bold">alpha</span>, <span Class="bold">digit</span>, <span Class="bold">print</span>, <span Class="bold">upper</span>, <span Class="bold">blank</span>, <span Class="bold">graph</span>, <span Class="bold">xdigit</span>. -<p class="level2"><span Class="bold">[][-!^]</span> - special case - matches only '-', ']', '[', '!' or '^'. These characters have no special purpose. -<p class="level2"><a class="bold" href="#">[\[\]\\]</a> - escape syntax. Matches '[', ']' or '´. -<p class="level2">Using the rules above, a file name pattern can be constructed: -<p class="level2"><a href="ftp://example.com/some/path/">ftp://example.com/some/path/</a><span Class="bold">[a-z[:upper:]\\].jpeg</span> -<p class="level1"> -<p class="level1">(This was added in 7.21.0) <a name="CALLBACK"></a><h2 class="nroffsh">CALLBACK OPTIONS</h2> -<p class="level0"> -<p class="level0"><a name="CURLOPTWRITEFUNCTION"></a><span class="nroffip">CURLOPT_WRITEFUNCTION</span> -<p class="level1">Pass a pointer to a function that matches the following prototype: <span Class="bold">size_t function( char *ptr, size_t size, size_t nmemb, void *userdata);</span> This function gets called by libcurl as soon as there is data received that needs to be saved. The size of the data pointed to by <span Class="emphasis">ptr</span> is <span Class="emphasis">size</span> multiplied with <span Class="emphasis">nmemb</span>, it will not be zero terminated. Return the number of bytes actually taken care of. If that amount differs from the amount passed to your function, it'll signal an error to the library. This will abort the transfer and return <span Class="emphasis">CURLE_WRITE_ERROR</span>. -<p class="level1">From 7.18.0, the function can return CURL_WRITEFUNC_PAUSE which then will cause writing to this connection to become paused. See <a class="emphasis" href="./curl_easy_pause.html">curl_easy_pause(3)</a> for further details. -<p class="level1">This function may be called with zero bytes data if the transferred file is empty. -<p class="level1">Set this option to NULL to get the internal default function. The internal default function will write the data to the FILE * given with <a class="emphasis" href="#CURLOPTWRITEDATA">CURLOPT_WRITEDATA</a>. -<p class="level1">Set the <span Class="emphasis">userdata</span> argument with the <a class="emphasis" href="#CURLOPTWRITEDATA">CURLOPT_WRITEDATA</a> option. -<p class="level1">The callback function will be passed as much data as possible in all invokes, but you cannot possibly make any assumptions. It may be one byte, it may be thousands. The maximum amount of body data that can be passed to the write callback is defined in the curl.h header file: CURL_MAX_WRITE_SIZE (the usual default is 16K). If you however have <a class="emphasis" href="#CURLOPTHEADER">CURLOPT_HEADER</a> set, which sends header data to the write callback, you can get up to <span Class="emphasis">CURL_MAX_HTTP_HEADER</span> bytes of header data passed into it. This usually means 100K. -<p class="level0"><a name="CURLOPTWRITEDATA"></a><span class="nroffip">CURLOPT_WRITEDATA</span> -<p class="level1">Data pointer to pass to the file write function. If you use the <a class="emphasis" href="#CURLOPTWRITEFUNCTION">CURLOPT_WRITEFUNCTION</a> option, this is the pointer you'll get as input. If you don't use a callback, you must pass a 'FILE *' as libcurl will pass this to fwrite() when writing data. -<p class="level1">The internal <a class="emphasis" href="#CURLOPTWRITEFUNCTION">CURLOPT_WRITEFUNCTION</a> will write the data to the FILE * given with this option, or to stdout if this option hasn't been set. -<p class="level1">If you're using libcurl as a win32 DLL, you <span Class="bold">MUST</span> use the <a class="emphasis" href="#CURLOPTWRITEFUNCTION">CURLOPT_WRITEFUNCTION</a> if you set this option or you will experience crashes. -<p class="level1">This option is also known with the older name <span Class="emphasis">CURLOPT_FILE</span>, the name <a class="emphasis" href="#CURLOPTWRITEDATA">CURLOPT_WRITEDATA</a> was introduced in 7.9.7. -<p class="level0"><a name="CURLOPTREADFUNCTION"></a><span class="nroffip">CURLOPT_READFUNCTION</span> -<p class="level1">Pass a pointer to a function that matches the following prototype: <span Class="bold">size_t function( void *ptr, size_t size, size_t nmemb, void *userdata);</span> This function gets called by libcurl as soon as it needs to read data in order to send it to the peer. The data area pointed at by the pointer <span Class="emphasis">ptr</span> may be filled with at most <span Class="emphasis">size</span> multiplied with <span Class="emphasis">nmemb</span> number of bytes. Your function must return the actual number of bytes that you stored in that memory area. Returning 0 will signal end-of-file to the library and cause it to stop the current transfer. -<p class="level1">If you stop the current transfer by returning 0 "pre-maturely" (i.e before the server expected it, like when you've said you will upload N bytes and you upload less than N bytes), you may experience that the server "hangs" waiting for the rest of the data that won't come. -<p class="level1">The read callback may return <span Class="emphasis">CURL_READFUNC_ABORT</span> to stop the current operation immediately, resulting in a <span Class="emphasis">CURLE_ABORTED_BY_CALLBACK</span> error code from the transfer (Added in 7.12.1) -<p class="level1">From 7.18.0, the function can return CURL_READFUNC_PAUSE which then will cause reading from this connection to become paused. See <a class="emphasis" href="./curl_easy_pause.html">curl_easy_pause(3)</a> for further details. -<p class="level1"><span Class="bold">Bugs</span>: when doing TFTP uploads, you must return the exact amount of data that the callback wants, or it will be considered the final packet by the server end and the transfer will end there. -<p class="level1">If you set this callback pointer to NULL, or don't set it at all, the default internal read function will be used. It is doing an fread() on the FILE * userdata set with <a class="emphasis" href="#CURLOPTREADDATA">CURLOPT_READDATA</a>. -<p class="level0"><a name="CURLOPTREADDATA"></a><span class="nroffip">CURLOPT_READDATA</span> -<p class="level1">Data pointer to pass to the file read function. If you use the <a class="emphasis" href="#CURLOPTREADFUNCTION">CURLOPT_READFUNCTION</a> option, this is the pointer you'll get as input. If you don't specify a read callback but instead rely on the default internal read function, this data must be a valid readable FILE *. -<p class="level1">If you're using libcurl as a win32 DLL, you MUST use a <a class="emphasis" href="#CURLOPTREADFUNCTION">CURLOPT_READFUNCTION</a> if you set this option. -<p class="level1">This option was also known by the older name <span Class="emphasis">CURLOPT_INFILE</span>, the name <a class="emphasis" href="#CURLOPTREADDATA">CURLOPT_READDATA</a> was introduced in 7.9.7. -<p class="level0"><a name="CURLOPTIOCTLFUNCTION"></a><span class="nroffip">CURLOPT_IOCTLFUNCTION</span> -<p class="level1">Pass a pointer to a function that matches the following prototype: <span Class="bold">curlioerr function(CURL *handle, int cmd, void *clientp);</span>. This function gets called by libcurl when something special I/O-related needs to be done that the library can't do by itself. For now, rewinding the read data stream is the only action it can request. The rewinding of the read data stream may be necessary when doing a HTTP PUT or POST with a multi-pass authentication method. (Option added in 7.12.3). -<p class="level1">Use <a class="emphasis" href="#CURLOPTSEEKFUNCTION">CURLOPT_SEEKFUNCTION</a> instead to provide seeking! -<p class="level0"><a name="CURLOPTIOCTLDATA"></a><span class="nroffip">CURLOPT_IOCTLDATA</span> -<p class="level1">Pass a pointer that will be untouched by libcurl and passed as the 3rd argument in the ioctl callback set with <a class="emphasis" href="#CURLOPTIOCTLFUNCTION">CURLOPT_IOCTLFUNCTION</a>. (Option added in 7.12.3) -<p class="level0"><a name="CURLOPTSEEKFUNCTION"></a><span class="nroffip">CURLOPT_SEEKFUNCTION</span> -<p class="level1">Pass a pointer to a function that matches the following prototype: <span class="bold">int function(void *instream, curl_off_t offset, int origin);</span> This function gets called by libcurl to seek to a certain position in the input stream and can be used to fast forward a file in a resumed upload (instead of reading all uploaded bytes with the normal read function/callback). It is also called to rewind a stream when doing a HTTP PUT or POST with a multi-pass authentication method. The function shall work like "fseek" or "lseek" and accepted SEEK_SET, SEEK_CUR and SEEK_END as argument for origin, although (in 7.18.0) libcurl only passes SEEK_SET. The callback must return 0 (CURL_SEEKFUNC_OK) on success, 1 (CURL_SEEKFUNC_FAIL) to cause the upload operation to fail or 2 (CURL_SEEKFUNC_CANTSEEK) to indicate that while the seek failed, libcurl is free to work around the problem if possible. The latter can sometimes be done by instead reading from the input or similar. -<p class="level1">If you forward the input arguments directly to "fseek" or "lseek", note that the data type for <span Class="emphasis">offset</span> is not the same as defined for curl_off_t on many systems! (Option added in 7.18.0) -<p class="level0"><a name="CURLOPTSEEKDATA"></a><span class="nroffip">CURLOPT_SEEKDATA</span> -<p class="level1">Data pointer to pass to the file seek function. If you use the <a class="emphasis" href="#CURLOPTSEEKFUNCTION">CURLOPT_SEEKFUNCTION</a> option, this is the pointer you'll get as input. If you don't specify a seek callback, NULL is passed. (Option added in 7.18.0) -<p class="level0"><a name="CURLOPTSOCKOPTFUNCTION"></a><span class="nroffip">CURLOPT_SOCKOPTFUNCTION</span> -<p class="level1">Pass a pointer to a function that matches the following prototype: <span class="bold">int function(void *clientp, curl_socket_t curlfd, curlsocktype purpose);</span>. This function gets called by libcurl after the socket() call but before the connect() call. The callback's <span Class="emphasis">purpose</span> argument identifies the exact purpose for this particular socket: -<p class="level1"><span Class="emphasis">CURLSOCKTYPE_IPCXN</span> for actively created connections or since 7.28.0 <span Class="emphasis">CURLSOCKTYPE_ACCEPT</span> for FTP when the connection was setup with PORT/EPSV (in earlier versions these sockets weren't passed to this callback). -<p class="level1">Future versions of libcurl may support more purposes. It passes the newly created socket descriptor so additional setsockopt() calls can be done at the user's discretion. Return 0 (zero) from the callback on success. Return 1 from the callback function to signal an unrecoverable error to the library and it will close the socket and return <span Class="emphasis">CURLE_COULDNT_CONNECT</span>. (Option added in 7.16.0) -<p class="level1">Added in 7.21.5, the callback function may return <span Class="emphasis">CURL_SOCKOPT_ALREADY_CONNECTED</span>, which tells libcurl that the socket is in fact already connected and then libcurl will not attempt to connect it. -<p class="level0"><a name="CURLOPTSOCKOPTDATA"></a><span class="nroffip">CURLOPT_SOCKOPTDATA</span> -<p class="level1">Pass a pointer that will be untouched by libcurl and passed as the first argument in the sockopt callback set with <a class="emphasis" href="#CURLOPTSOCKOPTFUNCTION">CURLOPT_SOCKOPTFUNCTION</a>. (Option added in 7.16.0) -<p class="level0"><a name="CURLOPTOPENSOCKETFUNCTION"></a><span class="nroffip">CURLOPT_OPENSOCKETFUNCTION</span> -<p class="level1">Pass a pointer to a function that matches the following prototype: <span class="bold">curl_socket_t function(void *clientp, curlsocktype purpose, struct curl_sockaddr *address);</span>. This function gets called by libcurl instead of the <span Class="emphasis">socket(2)</span> call. The callback's <span Class="emphasis">purpose</span> argument identifies the exact purpose for this particular socket: <span Class="emphasis">CURLSOCKTYPE_IPCXN</span> is for IP based connections. Future versions of libcurl may support more purposes. It passes the resolved peer address as a <span Class="emphasis">address</span> argument so the callback can modify the address or refuse to connect at all. The callback function should return the socket or <span Class="emphasis">CURL_SOCKET_BAD</span> in case no connection could be established or another error was detected. Any additional <span Class="emphasis">setsockopt(2)</span> calls can be done on the socket at the user's discretion. <span Class="emphasis">CURL_SOCKET_BAD</span> return value from the callback function will signal an unrecoverable error to the library and it will return <span Class="emphasis">CURLE_COULDNT_CONNECT</span>. This return code can be used for IP address blacklisting. The default behavior is: -<p class="level1"> return socket(addr->family, addr->socktype, addr->protocol); -<p class="level1">(Option added in 7.17.1.) -<p class="level0"><a name="CURLOPTOPENSOCKETDATA"></a><span class="nroffip">CURLOPT_OPENSOCKETDATA</span> -<p class="level1">Pass a pointer that will be untouched by libcurl and passed as the first argument in the opensocket callback set with <a class="emphasis" href="#CURLOPTOPENSOCKETFUNCTION">CURLOPT_OPENSOCKETFUNCTION</a>. (Option added in 7.17.1.) -<p class="level0"><a name="CURLOPTCLOSESOCKETFUNCTION"></a><span class="nroffip">CURLOPT_CLOSESOCKETFUNCTION</span> -<p class="level1">Pass a pointer to a function that matches the following prototype: <span class="bold">int function(void *clientp, curl_socket_t item);</span>. This function gets called by libcurl instead of the <span Class="emphasis">close(3)</span> or <span Class="emphasis">closesocket(3)</span> call when sockets are closed (not for any other file descriptors). This is pretty much the reverse to the <a class="emphasis" href="#CURLOPTOPENSOCKETFUNCTION">CURLOPT_OPENSOCKETFUNCTION</a> option. Return 0 to signal success and 1 if there was an error. (Option added in 7.21.7) -<p class="level0"><a name="CURLOPTCLOSESOCKETDATA"></a><span class="nroffip">CURLOPT_CLOSESOCKETDATA</span> -<p class="level1">Pass a pointer that will be untouched by libcurl and passed as the first argument in the closesocket callback set with <a class="emphasis" href="#CURLOPTCLOSESOCKETFUNCTION">CURLOPT_CLOSESOCKETFUNCTION</a>. (Option added in 7.21.7) -<p class="level0"><a name="CURLOPTPROGRESSFUNCTION"></a><span class="nroffip">CURLOPT_PROGRESSFUNCTION</span> -<p class="level1">Pass a pointer to a function that matches the following prototype: <span class="bold">int function(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow); </span>. This function gets called by libcurl instead of its internal equivalent with a frequent interval during operation (roughly once per second or sooner) no matter if data is being transferred or not. Unknown/unused argument values passed to the callback will be set to zero (like if you only download data, the upload size will remain 0). Returning a non-zero value from this callback will cause libcurl to abort the transfer and return <span Class="emphasis">CURLE_ABORTED_BY_CALLBACK</span>. -<p class="level1">If you transfer data with the multi interface, this function will not be called during periods of idleness unless you call the appropriate libcurl function that performs transfers. -<p class="level1"><a class="emphasis" href="#CURLOPTNOPROGRESS">CURLOPT_NOPROGRESS</a> must be set to 0 to make this function actually get called. -<p class="level0"><a name="CURLOPTPROGRESSDATA"></a><span class="nroffip">CURLOPT_PROGRESSDATA</span> -<p class="level1">Pass a pointer that will be untouched by libcurl and passed as the first argument in the progress callback set with <a class="emphasis" href="#CURLOPTPROGRESSFUNCTION">CURLOPT_PROGRESSFUNCTION</a>. -<p class="level0"><a name="CURLOPTHEADERFUNCTION"></a><span class="nroffip">CURLOPT_HEADERFUNCTION</span> -<p class="level1">Pass a pointer to a function that matches the following prototype: <span class="bold">size_t function( void *ptr, size_t size, size_t nmemb, void *userdata);</span>. This function gets called by libcurl as soon as it has received header data. The header callback will be called once for each header and only complete header lines are passed on to the callback. Parsing headers is very easy using this. The size of the data pointed to by <span Class="emphasis">ptr</span> is <span Class="emphasis">size</span> multiplied with <span Class="emphasis">nmemb</span>. Do not assume that the header line is zero terminated! The pointer named <span Class="emphasis">userdata</span> is the one you set with the <a class="emphasis" href="#CURLOPTWRITEHEADER">CURLOPT_WRITEHEADER</a> option. The callback function must return the number of bytes actually taken care of. If that amount differs from the amount passed to your function, it'll signal an error to the library. This will abort the transfer and return <span Class="emphasis">CURL_WRITE_ERROR</span>. -<p class="level1">A complete HTTP header that is passed to this function can be up to <span Class="emphasis">CURL_MAX_HTTP_HEADER</span> (100K) bytes. -<p class="level1">If this option is not set, or if it is set to NULL, but <span Class="emphasis">CURLOPT_HEADERDATA</span> (<a class="emphasis" href="#CURLOPTWRITEHEADER">CURLOPT_WRITEHEADER</a>) is set to anything but NULL, the function used to accept response data will be used instead. That is, it will be the function specified with <a class="emphasis" href="#CURLOPTWRITEFUNCTION">CURLOPT_WRITEFUNCTION</a>, or if it is not specified or NULL - the default, stream-writing function. -<p class="level1">It's important to note that the callback will be invoked for the headers of all responses received after initiating a request and not just the final response. This includes all responses which occur during authentication negotiation. If you need to operate on only the headers from the final response, you will need to collect headers in the callback yourself and use HTTP status lines, for example, to delimit response boundaries. -<p class="level1">When a server sends a chunked encoded transfer, it may contain a trailer. That trailer is identical to a HTTP header and if such a trailer is received it is passed to the application using this callback as well. There are several ways to detect it being a trailer and not an ordinary header: 1) it comes after the response-body. 2) it comes after the final header line (CR LF) 3) a Trailer: header among the regular response-headers mention what header(s) to expect in the trailer. -<p class="level1">For non-HTTP protocols like FTP, POP3, IMAP and SMTP this function will get called with the server responses to the commands that libcurl sends. -<p class="level0"><a name="CURLOPTWRITEHEADER"></a><span class="nroffip">CURLOPT_WRITEHEADER</span> -<p class="level1">(This option is also known as <span Class="bold">CURLOPT_HEADERDATA</span>) Pass a pointer to be used to write the header part of the received data to. If you don't use <a class="emphasis" href="#CURLOPTWRITEFUNCTION">CURLOPT_WRITEFUNCTION</a> or <a class="emphasis" href="#CURLOPTHEADERFUNCTION">CURLOPT_HEADERFUNCTION</a> to take care of the writing, this must be a valid FILE * as the internal default will then be a plain fwrite(). See also the <a class="emphasis" href="#CURLOPTHEADERFUNCTION">CURLOPT_HEADERFUNCTION</a> option above on how to set a custom get-all-headers callback. -<p class="level0"><a name="CURLOPTDEBUGFUNCTION"></a><span class="nroffip">CURLOPT_DEBUGFUNCTION</span> -<p class="level1">Pass a pointer to a function that matches the following prototype: <span class="bold">int curl_debug_callback (CURL *, curl_infotype, char *, size_t, void *);</span> <a class="emphasis" href="#CURLOPTDEBUGFUNCTION">CURLOPT_DEBUGFUNCTION</a> replaces the standard debug function used when <a class="emphasis" href="#CURLOPTVERBOSE">CURLOPT_VERBOSE </a> is in effect. This callback receives debug information, as specified with the <span Class="bold">curl_infotype</span> argument. This function must return 0. The data pointed to by the char * passed to this function WILL NOT be zero terminated, but will be exactly of the size as told by the size_t argument. -<p class="level1">Available curl_infotype values: -<p class="level2"> -<p class="level1"><a name="CURLINFOTEXT"></a><span class="nroffip">CURLINFO_TEXT</span> -<p class="level2">The data is informational text. -<p class="level1"><a name="CURLINFOHEADERIN"></a><span class="nroffip">CURLINFO_HEADER_IN</span> -<p class="level2">The data is header (or header-like) data received from the peer. -<p class="level1"><a name="CURLINFOHEADEROUT"></a><span class="nroffip">CURLINFO_HEADER_OUT</span> -<p class="level2">The data is header (or header-like) data sent to the peer. -<p class="level1"><a name="CURLINFODATAIN"></a><span class="nroffip">CURLINFO_DATA_IN</span> -<p class="level2">The data is protocol data received from the peer. -<p class="level1"><a name="CURLINFODATAOUT"></a><span class="nroffip">CURLINFO_DATA_OUT</span> -<p class="level2">The data is protocol data sent to the peer. -<p class="level1"> -<p class="level0"><a name="CURLOPTDEBUGDATA"></a><span class="nroffip">CURLOPT_DEBUGDATA</span> -<p class="level1">Pass a pointer to whatever you want passed in to your <a class="emphasis" href="#CURLOPTDEBUGFUNCTION">CURLOPT_DEBUGFUNCTION</a> in the last void * argument. This pointer is not used by libcurl, it is only passed to the callback. -<p class="level0"><a name="CURLOPTSSLCTXFUNCTION"></a><span class="nroffip">CURLOPT_SSL_CTX_FUNCTION</span> -<p class="level1">This option does only function for libcurl powered by OpenSSL. If libcurl was built against another SSL library, this functionality is absent. -<p class="level1">Pass a pointer to a function that matches the following prototype: <span Class="bold">CURLcode sslctxfun(CURL *curl, void *sslctx, void *parm);</span> This function gets called by libcurl just before the initialization of a SSL connection after having processed all other SSL related options to give a last chance to an application to modify the behaviour of openssl's ssl initialization. The <span Class="emphasis">sslctx</span> parameter is actually a pointer to an openssl <span Class="emphasis">SSL_CTX</span>. If an error is returned no attempt to establish a connection is made and the perform operation will return the error code from this callback function. Set the <span Class="emphasis">parm</span> argument with the <a class="emphasis" href="#CURLOPTSSLCTXDATA">CURLOPT_SSL_CTX_DATA</a> option. This option was introduced in 7.11.0. -<p class="level1">This function will get called on all new connections made to a server, during the SSL negotiation. The SSL_CTX pointer will be a new one every time. -<p class="level1">To use this properly, a non-trivial amount of knowledge of the openssl libraries is necessary. For example, using this function allows you to use openssl callbacks to add additional validation code for certificates, and even to change the actual URI of a HTTPS request (example used in the lib509 test case). See also the example section for a replacement of the key, certificate and trust file settings. -<p class="level0"><a name="CURLOPTSSLCTXDATA"></a><span class="nroffip">CURLOPT_SSL_CTX_DATA</span> -<p class="level1">Data pointer to pass to the ssl context callback set by the option <a class="emphasis" href="#CURLOPTSSLCTXFUNCTION">CURLOPT_SSL_CTX_FUNCTION</a>, this is the pointer you'll get as third parameter, otherwise <span Class="bold">NULL</span>. (Added in 7.11.0) -<p class="level0"><a name="CURLOPTCONVTONETWORKFUNCTION"></a><span class="nroffip">CURLOPT_CONV_TO_NETWORK_FUNCTION</span> -<p class="level1"> -<p class="level0"><a name="CURLOPTCONVFROMNETWORKFUNCTION"></a><span class="nroffip">CURLOPT_CONV_FROM_NETWORK_FUNCTION</span> -<p class="level1"> -<p class="level0"><a name="CURLOPTCONVFROMUTF8FUNCTION"></a><span class="nroffip">CURLOPT_CONV_FROM_UTF8_FUNCTION</span> -<p class="level1">Pass a pointer to a function that matches the following prototype: <span Class="bold">CURLcode function(char *ptr, size_t length);</span> -<p class="level1">These three options apply to non-ASCII platforms only. They are available only if <span Class="bold">CURL_DOES_CONVERSIONS</span> was defined when libcurl was built. When this is the case, <a class="emphasis" href="./curl_version_info.html">curl_version_info(3)</a> will return the CURL_VERSION_CONV feature bit set. -<p class="level1">The data to be converted is in a buffer pointed to by the ptr parameter. The amount of data to convert is indicated by the length parameter. The converted data overlays the input data in the buffer pointed to by the ptr parameter. CURLE_OK should be returned upon successful conversion. A CURLcode return value defined by curl.h, such as CURLE_CONV_FAILED, should be returned if an error was encountered. -<p class="level1"><a class="bold" href="#CURLOPTCONVTONETWORKFUNCTION">CURLOPT_CONV_TO_NETWORK_FUNCTION</a> and <a class="bold" href="#CURLOPTCONVFROMNETWORKFUNCTION">CURLOPT_CONV_FROM_NETWORK_FUNCTION</a> convert between the host encoding and the network encoding. They are used when commands or ASCII data are sent/received over the network. -<p class="level1"><a class="bold" href="#CURLOPTCONVFROMUTF8FUNCTION">CURLOPT_CONV_FROM_UTF8_FUNCTION</a> is called to convert from UTF8 into the host encoding. It is required only for SSL processing. -<p class="level1">If you set a callback pointer to NULL, or don't set it at all, the built-in libcurl iconv functions will be used. If HAVE_ICONV was not defined when libcurl was built, and no callback has been established, conversion will return the CURLE_CONV_REQD error code. -<p class="level1">If HAVE_ICONV is defined, CURL_ICONV_CODESET_OF_HOST must also be defined. For example: -<p class="level1"> #define CURL_ICONV_CODESET_OF_HOST "IBM-1047" -<p class="level1">The iconv code in libcurl will default the network and UTF8 codeset names as follows: -<p class="level1"> #define CURL_ICONV_CODESET_OF_NETWORK "ISO8859-1" -<p class="level1"> #define CURL_ICONV_CODESET_FOR_UTF8 "UTF-8" -<p class="level1">You will need to override these definitions if they are different on your system. -<p class="level0"><a name="CURLOPTINTERLEAVEFUNCTION"></a><span class="nroffip">CURLOPT_INTERLEAVEFUNCTION</span> -<p class="level1">Pass a pointer to a function that matches the following prototype: <span class="bold">size_t function( void *ptr, size_t size, size_t nmemb, void *userdata)</span>. This function gets called by libcurl as soon as it has received interleaved RTP data. This function gets called for each $ block and therefore contains exactly one upper-layer protocol unit (e.g. one RTP packet). Curl writes the interleaved header as well as the included data for each call. The first byte is always an ASCII dollar sign. The dollar sign is followed by a one byte channel identifier and then a 2 byte integer length in network byte order. See <span Class="emphasis"><a href="http://www.ietf.org/rfc/rfc2326.txt">RFC 2326</a> Section 10.12</span> for more information on how RTP interleaving behaves. If unset or set to NULL, curl will use the default write function. -<p class="level1">Interleaved RTP poses some challenges for the client application. Since the stream data is sharing the RTSP control connection, it is critical to service the RTP in a timely fashion. If the RTP data is not handled quickly, subsequent response processing may become unreasonably delayed and the connection may close. The application may use <a class="emphasis" href="#CURLRTSPREQRECEIVE">CURL_RTSPREQ_RECEIVE</a> to service RTP data when no requests are desired. If the application makes a request, (e.g. <a class="emphasis" href="#CURLRTSPREQPAUSE">CURL_RTSPREQ_PAUSE</a>) then the response handler will process any pending RTP data before marking the request as finished. (Added in 7.20.0) -<p class="level0"><a name="CURLOPTINTERLEAVEDATA"></a><span class="nroffip">CURLOPT_INTERLEAVEDATA</span> -<p class="level1">This is the userdata pointer that will be passed to <a class="emphasis" href="#CURLOPTINTERLEAVEFUNCTION">CURLOPT_INTERLEAVEFUNCTION</a> when interleaved RTP data is received. (Added in 7.20.0) -<p class="level0"><a name="CURLOPTCHUNKBGNFUNCTION"></a><span class="nroffip">CURLOPT_CHUNK_BGN_FUNCTION</span> -<p class="level1">Pass a pointer to a function that matches the following prototype: <span Class="bold">long function (const void *transfer_info, void *ptr, int remains)</span>. This function gets called by libcurl before a part of the stream is going to be transferred (if the transfer supports chunks). -<p class="level1">This callback makes sense only when using the <a class="emphasis" href="#CURLOPTWILDCARDMATCH">CURLOPT_WILDCARDMATCH</a> option for now. -<p class="level1">The target of transfer_info parameter is a "feature depended" structure. For the FTP wildcard download, the target is curl_fileinfo structure (see <span Class="emphasis">curl/curl.h</span>). The parameter ptr is a pointer given by <a class="emphasis" href="#CURLOPTCHUNKDATA">CURLOPT_CHUNK_DATA</a>. The parameter remains contains number of chunks remaining per the transfer. If the feature is not available, the parameter has zero value. -<p class="level1">Return <span Class="emphasis">CURL_CHUNK_BGN_FUNC_OK</span> if everything is fine, <span Class="emphasis">CURL_CHUNK_BGN_FUNC_SKIP</span> if you want to skip the concrete chunk or <span Class="emphasis">CURL_CHUNK_BGN_FUNC_FAIL</span> to tell libcurl to stop if some error occurred. (This was added in 7.21.0) -<p class="level0"><a name="CURLOPTCHUNKENDFUNCTION"></a><span class="nroffip">CURLOPT_CHUNK_END_FUNCTION</span> -<p class="level1">Pass a pointer to a function that matches the following prototype: <span Class="bold">long function(void *ptr)</span>. This function gets called by libcurl as soon as a part of the stream has been transferred (or skipped). -<p class="level1">Return <span Class="emphasis">CURL_CHUNK_END_FUNC_OK</span> if everything is fine or <span Class="bold">CURL_CHUNK_END_FUNC_FAIL</span> to tell the lib to stop if some error occurred. (This was added in 7.21.0) -<p class="level0"><a name="CURLOPTCHUNKDATA"></a><span class="nroffip">CURLOPT_CHUNK_DATA</span> -<p class="level1">Pass a pointer that will be untouched by libcurl and passed as the ptr argument to the <span Class="emphasis">CURL_CHUNK_BGN_FUNTION</span> and <span Class="emphasis">CURL_CHUNK_END_FUNTION</span>. (This was added in 7.21.0) -<p class="level0"><a name="CURLOPTFNMATCHFUNCTION"></a><span class="nroffip">CURLOPT_FNMATCH_FUNCTION</span> -<p class="level1">Pass a pointer to a function that matches the following prototype: <span class="bold">int function(void *ptr, const char *pattern, const char *string)</span> prototype (see <span Class="emphasis">curl/curl.h</span>). It is used internally for the wildcard matching feature. -<p class="level1">Return <span Class="emphasis">CURL_FNMATCHFUNC_MATCH</span> if pattern matches the string, <span Class="emphasis">CURL_FNMATCHFUNC_NOMATCH</span> if not or <span Class="emphasis">CURL_FNMATCHFUNC_FAIL</span> if an error occurred. (This was added in 7.21.0) -<p class="level0"><a name="CURLOPTFNMATCHDATA"></a><span class="nroffip">CURLOPT_FNMATCH_DATA</span> -<p class="level1">Pass a pointer that will be untouched by libcurl and passed as the ptr argument to the <span Class="emphasis">CURL_FNMATCH_FUNCTION</span>. (This was added in 7.21.0) <a name="ERROR"></a><h2 class="nroffsh">ERROR OPTIONS</h2> -<p class="level0"> -<p class="level0"><a name="CURLOPTERRORBUFFER"></a><span class="nroffip">CURLOPT_ERRORBUFFER</span> -<p class="level1">Pass a char * to a buffer that the libcurl may store human readable error messages in. This may be more helpful than just the return code from <span Class="emphasis">curl_easy_perform</span>. The buffer must be at least CURL_ERROR_SIZE big. Although this argument is a 'char *', it does not describe an input string. Therefore the (probably undefined) contents of the buffer is NOT copied by the library. You must keep the associated storage available until libcurl no longer needs it. Failing to do so will cause very odd behavior or even crashes. libcurl will need it until you call <a class="emphasis" href="./curl_easy_cleanup.html">curl_easy_cleanup(3)</a> or you set the same option again to use a different pointer. -<p class="level1">Use <a class="emphasis" href="#CURLOPTVERBOSE">CURLOPT_VERBOSE</a> and <a class="emphasis" href="#CURLOPTDEBUGFUNCTION">CURLOPT_DEBUGFUNCTION</a> to better debug/trace why errors happen. -<p class="level1">If the library does not return an error, the buffer may not have been touched. Do not rely on the contents in those cases. -<p class="level1"> -<p class="level0"><a name="CURLOPTSTDERR"></a><span class="nroffip">CURLOPT_STDERR</span> -<p class="level1">Pass a FILE * as parameter. Tell libcurl to use this stream instead of stderr when showing the progress meter and displaying <a class="emphasis" href="#CURLOPTVERBOSE">CURLOPT_VERBOSE</a> data. -<p class="level0"><a name="CURLOPTFAILONERROR"></a><span class="nroffip">CURLOPT_FAILONERROR</span> -<p class="level1">A parameter set to 1 tells the library to fail silently if the HTTP code returned is equal to or larger than 400. The default action would be to return the page normally, ignoring that code. -<p class="level1">This method is not fail-safe and there are occasions where non-successful response codes will slip through, especially when authentication is involved (response codes 401 and 407). -<p class="level1">You might get some amounts of headers transferred before this situation is detected, like when a "100-continue" is received as a response to a POST/PUT and a 401 or 407 is received immediately afterwards. <a name="NETWORK"></a><h2 class="nroffsh">NETWORK OPTIONS</h2> -<p class="level0"> -<p class="level0"><a name="CURLOPTURL"></a><span class="nroffip">CURLOPT_URL</span> -<p class="level1">Pass in a pointer to the actual URL to deal with. The parameter should be a char * to a zero terminated string which must be URL-encoded in the following format: -<p class="level1">scheme://host:port/path -<p class="level1">For a greater explanation of the format please see <a href="http://www.ietf.org/rfc/rfc3986.txt">RFC 3986</a>. -<p class="level1">If the given URL lacks the scheme, or protocol, part ("http://" or "ftp://" etc), libcurl will attempt to resolve which protocol to use based on the given host mame. If the protocol is not supported, libcurl will return (<span Class="emphasis">CURLE_UNSUPPORTED_PROTOCOL</span>) when you call <a class="emphasis" href="./curl_easy_perform.html">curl_easy_perform(3)</a> or <a class="emphasis" href="./curl_multi_perform.html">curl_multi_perform(3)</a>. Use <a class="emphasis" href="./curl_version_info.html">curl_version_info(3)</a> for detailed information on which protocols are supported. -<p class="level1">The host part of the URL contains the address of the server that you want to connect to. This can be the fully qualified domain name of the server, the local network name of the machine on your network or the IP address of the server or machine represented by either an IPv4 or IPv6 address. For example: -<p class="level1"><a href="http://www.example.com/">http://www.example.com/</a> -<p class="level1"><a href="http://hostname/">http://hostname/</a> -<p class="level1"><a href="http://192.168.0.1/">http://192.168.0.1/</a> -<p class="level1">http://[2001:1890:1112:1::20]/ -<p class="level1">It is also possible to specify the user name and password as part of the host, for some protocols, when connecting to servers that require authentication. -<p class="level1">For example the following types of authentication support this: -<p class="level1"><a href="http://user">http://user</a>:password@www.example.com -<p class="level1"><a href="ftp://user">ftp://user</a>:password@ftp.example.com -<p class="level1">pop3://user:password@mail.example.com -<p class="level1">The port is optional and when not specified libcurl will use the default port based on the determined or specified protocol: 80 for HTTP, 21 for FTP and 25 for SMTP, etc. The following examples show how to specify the port: -<p class="level1"><a href="http://www.example.com">http://www.example.com</a>:8080/ - This will connect to a web server using port 8080 rather than 80. -<p class="level1">smtp://mail.example.com:587/ - This will connect to a SMTP server on the alternative mail port. -<p class="level1">The path part of the URL is protocol specific and whilst some examples are given below this list is not conclusive: -<p class="level1"><a class="bold" href="#HTTP">HTTP</a> -<p class="level1">The path part of a HTTP request specifies the file to retrieve and from what directory. If the directory is not specified then the web server's root directory is used. If the file is omitted then the default document will be retrieved for either the directory specified or the root directory. The exact resource returned for each URL is entirely dependent on the server's configuration. -<p class="level1"><a href="http://www.example.com">http://www.example.com</a> - This gets the main page from the web server. -<p class="level1"><a href="http://www.example.com/index.html">http://www.example.com/index.html</a> - This returns the main page by explicitly requesting it. -<p class="level1"><a href="http://www.example.com/contactus/">http://www.example.com/contactus/</a> - This returns the default document from the contactus directory. -<p class="level1"><a class="bold" href="#FTP">FTP</a> -<p class="level1">The path part of an FTP request specifies the file to retrieve and from what directory. If the file part is omitted then libcurl downloads the directory listing for the directory specified. If the directory is omitted then the directory listing for the root / home directory will be returned. -<p class="level1"><a href="ftp://ftp.example.com">ftp://ftp.example.com</a> - This retrieves the directory listing for the root directory. -<p class="level1"><a href="ftp://ftp.example.com/readme.txt">ftp://ftp.example.com/readme.txt</a> - This downloads the file readme.txt from the root directory. -<p class="level1"><a href="ftp://ftp.example.com/libcurl/readme.txt">ftp://ftp.example.com/libcurl/readme.txt</a> - This downloads readme.txt from the libcurl directory. -<p class="level1"><a href="ftp://user">ftp://user</a>:password@ftp.example.com/readme.txt - This retrieves the readme.txt file from the user's home directory. When a username and password is specified, everything that is specified in the path part is relative to the user's home directory. To retrieve files from the root directory or a directory underneath the root directory then the absolute path must be specified by prepending an additional forward slash to the beginning of the path. -<p class="level1"><a href="ftp://user">ftp://user</a>:password@ftp.example.com//readme.txt - This retrieves the readme.txt from the root directory when logging in as a specified user. -<p class="level1"><a class="bold" href="#SMTP">SMTP</a> -<p class="level1">The path part of a SMTP request specifies the host name to present during communication with the mail server. If the path is omitted then libcurl will attempt to resolve the local computer's host name. However, this may not return the fully qualified domain name that is required by some mail servers and specifying this path allows you to set an alternative name, such as your machine's fully qualified domain name, which you might have obtained from an external function such as gethostname or getaddrinfo. -<p class="level1">smtp://mail.example.com - This connects to the mail server at example.com and sends your local computer's host name in the HELO / EHLO command. -<p class="level1">smtp://mail.example.com/client.example.com - This will send client.example.com in the HELO / EHLO command to the mail server at example.com. -<p class="level1"><span Class="bold">POP3</span> -<p class="level1">The path part of a POP3 request specifies the mailbox (message) to retrieve. If the mailbox is not specified then a list of waiting messages is returned instead. -<p class="level1">pop3://user:password@mail.example.com - This lists the available messages pop3://user:password@mail.example.com/1 - This retrieves the first message -<p class="level1"><span Class="bold">SCP</span> -<p class="level1">The path part of a SCP request specifies the file to retrieve and from what directory. The file part may not be omitted. The file is taken as an absolute path from the root directory on the server. To specify a path relative to the user's home directory on the server, prepend ~/ to the path portion. If the user name is not embedded in the URL, it can be set with the <a class="emphasis" href="#CURLOPTUSERPWD">CURLOPT_USERPWD</a> or <a class="bold" href="#CURLOPTUSERNAME">CURLOPT_USERNAME</a> option. -<p class="level1">scp://user@example.com/etc/issue - This specifies the file /etc/issue -<p class="level1">scp://example.com/~/my-file - This specifies the file my-file in the user's home directory on the server -<p class="level1"><span Class="bold">SFTP</span> -<p class="level1">The path part of a SFTP request specifies the file to retrieve and from what directory. If the file part is omitted then libcurl downloads the directory listing for the directory specified. If the path ends in a / then a directory listing is returned instead of a file. If the path is omitted entirely then the directory listing for the root / home directory will be returned. If the user name is not embedded in the URL, it can be set with the <a class="emphasis" href="#CURLOPTUSERPWD">CURLOPT_USERPWD</a> or <a class="bold" href="#CURLOPTUSERNAME">CURLOPT_USERNAME</a> option. -<p class="level1">s<a href="ftp://user">ftp://user</a>:password@example.com/etc/issue - This specifies the file /etc/issue -<p class="level1">s<a href="ftp://user">ftp://user</a>@example.com/~/my-file - This specifies the file my-file in the user's home directory -<p class="level1">s<a href="ftp://ssh.example.com/">ftp://ssh.example.com/</a>~/Documents/ - This requests a directory listing of the Documents directory under the user's home directory -<p class="level1"><span Class="bold">LDAP</span> -<p class="level1">The path part of a LDAP request can be used to specify the: Distinguished Name, Attributes, Scope, Filter and Extension for a LDAP search. Each field is separated by a question mark and when that field is not required an empty string with the question mark separator should be included. -<p class="level1">ldap://ldap.example.com/o=My%20Organisation - This will perform a LDAP search with the DN as My Organisation. -<p class="level1">ldap://ldap.example.com/o=My%20Organisation?postalAddress - This will perform the same search but will only return postalAddress attributes. -<p class="level1">ldap://ldap.example.com/?rootDomainNamingContext - This specifies an empty DN and requests information about the rootDomainNamingContext attribute for an Active Directory server. -<p class="level1">For more information about the individual components of a LDAP URL please see <a href="http://www.ietf.org/rfc/rfc4516.txt">RFC 4516</a>. -<p class="level1"><span Class="bold">NOTES</span> -<p class="level1">Starting with version 7.20.0, the fragment part of the URI will not be sent as part of the path, which was previously the case. -<p class="level1"><a class="emphasis" href="#CURLOPTURL">CURLOPT_URL</a> is the only option that <span Class="bold">must</span> be set before <a class="emphasis" href="./curl_easy_perform.html">curl_easy_perform(3)</a> is called. -<p class="level1"><a class="emphasis" href="#CURLOPTPROTOCOLS">CURLOPT_PROTOCOLS</a> can be used to limit what protocols libcurl will use for this transfer, independent of what libcurl has been compiled to support. That may be useful if you accept the URL from an external source and want to limit the accessibility. -<p class="level0"><a name="CURLOPTPROTOCOLS"></a><span class="nroffip">CURLOPT_PROTOCOLS</span> -<p class="level1">Pass a long that holds a bitmask of CURLPROTO_* defines. If used, this bitmask limits what protocols libcurl may use in the transfer. This allows you to have a libcurl built to support a wide range of protocols but still limit specific transfers to only be allowed to use a subset of them. By default libcurl will accept all protocols it supports. See also <a class="emphasis" href="#CURLOPTREDIRPROTOCOLS">CURLOPT_REDIR_PROTOCOLS</a>. (Added in 7.19.4) -<p class="level0"><a name="CURLOPTREDIRPROTOCOLS"></a><span class="nroffip">CURLOPT_REDIR_PROTOCOLS</span> -<p class="level1">Pass a long that holds a bitmask of CURLPROTO_* defines. If used, this bitmask limits what protocols libcurl may use in a transfer that it follows to in a redirect when <a class="emphasis" href="#CURLOPTFOLLOWLOCATION">CURLOPT_FOLLOWLOCATION</a> is enabled. This allows you to limit specific transfers to only be allowed to use a subset of protocols in redirections. By default libcurl will allow all protocols except for FILE and SCP. This is a difference compared to pre-7.19.4 versions which unconditionally would follow to all protocols supported. (Added in 7.19.4) -<p class="level0"><a name="CURLOPTPROXY"></a><span class="nroffip">CURLOPT_PROXY</span> -<p class="level1">Set HTTP proxy to use. The parameter should be a char * to a zero terminated string holding the host name or dotted IP address. To specify port number in this string, append :[port] to the end of the host name. The proxy string may be prefixed with [protocol]:// since any such prefix will be ignored. The proxy's port number may optionally be specified with the separate option. If not specified, libcurl will default to using port 1080 for proxies. <a class="emphasis" href="#CURLOPTPROXYPORT">CURLOPT_PROXYPORT</a>. -<p class="level1">When you tell the library to use a HTTP proxy, libcurl will transparently convert operations to HTTP even if you specify an FTP URL etc. This may have an impact on what other features of the library you can use, such as <a class="emphasis" href="#CURLOPTQUOTE">CURLOPT_QUOTE</a> and similar FTP specifics that don't work unless you tunnel through the HTTP proxy. Such tunneling is activated with <a class="emphasis" href="#CURLOPTHTTPPROXYTUNNEL">CURLOPT_HTTPPROXYTUNNEL</a>. -<p class="level1">libcurl respects the environment variables <span Class="bold">http_proxy</span>, <span Class="bold">ftp_proxy</span>, <span Class="bold">all_proxy</span> etc, if any of those are set. The <a class="emphasis" href="#CURLOPTPROXY">CURLOPT_PROXY</a> option does however override any possibly set environment variables. -<p class="level1">Setting the proxy string to "" (an empty string) will explicitly disable the use of a proxy, even if there is an environment variable set for it. -<p class="level1">Since 7.14.1, the proxy host string given in environment variables can be specified the exact same way as the proxy can be set with <a class="emphasis" href="#CURLOPTPROXY">CURLOPT_PROXY</a>, include protocol prefix (http://) and embedded user + password. -<p class="level1">Since 7.21.7, the proxy string may be specified with a protocol:// prefix to specify alternative proxy protocols. Use socks4://, socks4a://, socks5:// or socks5h:// (the last one to enable socks5 and asking the proxy to do the resolving, also known as CURLPROXY_SOCKS5_HOSTNAME type) to request the specific SOCKS version to be used. No protocol specified, http:// and all others will be treated as HTTP proxies. -<p class="level0"><a name="CURLOPTPROXYPORT"></a><span class="nroffip">CURLOPT_PROXYPORT</span> -<p class="level1">Pass a long with this option to set the proxy port to connect to unless it is specified in the proxy string <a class="emphasis" href="#CURLOPTPROXY">CURLOPT_PROXY</a>. -<p class="level0"><a name="CURLOPTPROXYTYPE"></a><span class="nroffip">CURLOPT_PROXYTYPE</span> -<p class="level1">Pass a long with this option to set type of the proxy. Available options for this are <span Class="emphasis">CURLPROXY_HTTP</span>, <span Class="emphasis">CURLPROXY_HTTP_1_0</span> (added in 7.19.4), <span Class="emphasis">CURLPROXY_SOCKS4</span> (added in 7.10), <span Class="emphasis">CURLPROXY_SOCKS5</span>, <span Class="emphasis">CURLPROXY_SOCKS4A</span> (added in 7.18.0) and <span Class="emphasis">CURLPROXY_SOCKS5_HOSTNAME</span> (added in 7.18.0). The HTTP type is default. (Added in 7.10) -<p class="level1">If you set <a class="bold" href="#CURLOPTPROXYTYPE">CURLOPT_PROXYTYPE</a> to <span Class="emphasis">CURLPROXY_HTTP_1_0</span>, it will only affect how libcurl speaks to a proxy when CONNECT is used. The HTTP version used for "regular" HTTP requests is instead controlled with <a class="emphasis" href="#CURLOPTHTTPVERSION">CURLOPT_HTTP_VERSION</a>. -<p class="level0"><a name="CURLOPTNOPROXY"></a><span class="nroffip">CURLOPT_NOPROXY</span> -<p class="level1">Pass a pointer to a zero terminated string. The string consists of a comma separated list of host names that do not require a proxy to get reached, even if one is specified. The only wildcard available is a single * character, which matches all hosts, and effectively disables the proxy. Each name in this list is matched as either a domain which contains the hostname, or the hostname itself. For example, example.com would match example.com, example.com:80, and www.example.com, but not www.notanexample.com. (Added in 7.19.4) -<p class="level0"><a name="CURLOPTHTTPPROXYTUNNEL"></a><span class="nroffip">CURLOPT_HTTPPROXYTUNNEL</span> -<p class="level1">Set the parameter to 1 to make the library tunnel all operations through a given HTTP proxy. There is a big difference between using a proxy and to tunnel through it. If you don't know what this means, you probably don't want this tunneling option. -<p class="level0"><a name="CURLOPTSOCKS5GSSAPISERVICE"></a><span class="nroffip">CURLOPT_SOCKS5_GSSAPI_SERVICE</span> -<p class="level1">Pass a char * as parameter to a string holding the name of the service. The default service name for a SOCKS5 server is rcmd/server-fqdn. This option allows you to change it. (Added in 7.19.4) -<p class="level0"><a name="CURLOPTSOCKS5GSSAPINEC"></a><span class="nroffip">CURLOPT_SOCKS5_GSSAPI_NEC</span> -<p class="level1">Pass a long set to 1 to enable or 0 to disable. As part of the gssapi negotiation a protection mode is negotiated. The <a href="http://www.ietf.org/rfc/rfc1961.txt">RFC 1961</a> says in section 4.3/4.4 it should be protected, but the NEC reference implementation does not. If enabled, this option allows the unprotected exchange of the protection mode negotiation. (Added in 7.19.4). -<p class="level0"><a name="CURLOPTINTERFACE"></a><span class="nroffip">CURLOPT_INTERFACE</span> -<p class="level1">Pass a char * as parameter. This sets the interface name to use as outgoing network interface. The name can be an interface name, an IP address, or a host name. -<p class="level1">Starting with 7.24.0: If the parameter starts with "if!" then it is treated as only as interface name and no attempt will ever be named to do treat it as an IP address or to do name resolution on it. If the parameter starts with "host!" it is treated as either an IP address or a hostname. Hostnames are resolved synchronously. Using the if! format is highly recommended when using the multi interfaces to avoid allowing the code to block. If "if!" is specified but the parameter does not match an existing interface, CURLE_INTERFACE_FAILED is returned. -<p class="level0"><a name="CURLOPTLOCALPORT"></a><span class="nroffip">CURLOPT_LOCALPORT</span> -<p class="level1">Pass a long. This sets the local port number of the socket used for connection. This can be used in combination with <a class="emphasis" href="#CURLOPTINTERFACE">CURLOPT_INTERFACE</a> and you are recommended to use <a class="emphasis" href="#CURLOPTLOCALPORTRANGE">CURLOPT_LOCALPORTRANGE</a> as well when this is set. Valid port numbers are 1 - 65535. (Added in 7.15.2) -<p class="level0"><a name="CURLOPTLOCALPORTRANGE"></a><span class="nroffip">CURLOPT_LOCALPORTRANGE</span> -<p class="level1">Pass a long. This is the number of attempts libcurl will make to find a working local port number. It starts with the given <a class="emphasis" href="#CURLOPTLOCALPORT">CURLOPT_LOCALPORT</a> and adds one to the number for each retry. Setting this to 1 or below will make libcurl do only one try for the exact port number. Port numbers by nature are scarce resources that will be busy at times so setting this value to something too low might cause unnecessary connection setup failures. (Added in 7.15.2) -<p class="level0"><a name="CURLOPTDNSCACHETIMEOUT"></a><span class="nroffip">CURLOPT_DNS_CACHE_TIMEOUT</span> -<p class="level1">Pass a long, this sets the timeout in seconds. Name resolves will be kept in memory for this number of seconds. Set to zero to completely disable caching, or set to -1 to make the cached entries remain forever. By default, libcurl caches this info for 60 seconds. -<p class="level1">The name resolve functions of various libc implementations don't re-read name server information unless explicitly told so (for example, by calling <span Class="emphasis">res_init(3)</span>). This may cause libcurl to keep using the older server even if DHCP has updated the server info, and this may look like a DNS cache issue to the casual libcurl-app user. -<p class="level0"><a name="CURLOPTDNSUSEGLOBALCACHE"></a><span class="nroffip">CURLOPT_DNS_USE_GLOBAL_CACHE</span> -<p class="level1">Pass a long. If the value is 1, it tells curl to use a global DNS cache that will survive between easy handle creations and deletions. This is not thread-safe and this will use a global variable. -<p class="level1"><span Class="bold">WARNING:</span> this option is considered obsolete. Stop using it. Switch over to using the share interface instead! See <a class="emphasis" href="#CURLOPTSHARE">CURLOPT_SHARE</a> and <a class="emphasis" href="./curl_share_init.html">curl_share_init(3)</a>. -<p class="level0"><a name="CURLOPTBUFFERSIZE"></a><span class="nroffip">CURLOPT_BUFFERSIZE</span> -<p class="level1">Pass a long specifying your preferred size (in bytes) for the receive buffer in libcurl. The main point of this would be that the write callback gets called more often and with smaller chunks. This is just treated as a request, not an order. You cannot be guaranteed to actually get the given size. (Added in 7.10) -<p class="level1">This size is by default set as big as possible (CURL_MAX_WRITE_SIZE), so it only makes sense to use this option if you want it smaller. -<p class="level0"><a name="CURLOPTPORT"></a><span class="nroffip">CURLOPT_PORT</span> -<p class="level1">Pass a long specifying what remote port number to connect to, instead of the one specified in the URL or the default port for the used protocol. -<p class="level0"><a name="CURLOPTTCPNODELAY"></a><span class="nroffip">CURLOPT_TCP_NODELAY</span> -<p class="level1">Pass a long specifying whether the TCP_NODELAY option is to be set or cleared (1 = set, 0 = clear). The option is cleared by default. This will have no effect after the connection has been established. -<p class="level1">Setting this option will disable TCP's Nagle algorithm. The purpose of this algorithm is to try to minimize the number of small packets on the network (where "small packets" means TCP segments less than the Maximum Segment Size (MSS) for the network). -<p class="level1">Maximizing the amount of data sent per TCP segment is good because it amortizes the overhead of the send. However, in some cases (most notably telnet or rlogin) small segments may need to be sent without delay. This is less efficient than sending larger amounts of data at a time, and can contribute to congestion on the network if overdone. -<p class="level0"><a name="CURLOPTADDRESSSCOPE"></a><span class="nroffip">CURLOPT_ADDRESS_SCOPE</span> -<p class="level1">Pass a long specifying the scope_id value to use when connecting to IPv6 link-local or site-local addresses. (Added in 7.19.0) -<p class="level0"><a name="CURLOPTTCPKEEPALIVE"></a><span class="nroffip">CURLOPT_TCP_KEEPALIVE</span> -<p class="level1">Pass a long. If set to 1, TCP keepalive probes will be sent. The delay and frequency of these probes can be controlled by the <a class="emphasis" href="#CURLOPTTCPKEEPIDLE">CURLOPT_TCP_KEEPIDLE</a> and <a class="emphasis" href="#CURLOPTTCPKEEPINTVL">CURLOPT_TCP_KEEPINTVL</a> options, provided the operating system supports them. Set to 0 (default behavior) to disable keepalive probes (Added in 7.25.0). -<p class="level0"><a name="CURLOPTTCPKEEPIDLE"></a><span class="nroffip">CURLOPT_TCP_KEEPIDLE</span> -<p class="level1">Pass a long. Sets the delay, in seconds, that the operating system will wait while the connection is idle before sending keepalive probes. Not all operating systems support this option. (Added in 7.25.0) -<p class="level0"><a name="CURLOPTTCPKEEPINTVL"></a><span class="nroffip">CURLOPT_TCP_KEEPINTVL</span> -<p class="level1">Pass a long. Sets the interval, in seconds, that the operating system will wait between sending keepalive probes. Not all operating systems support this option. (Added in 7.25.0) <a name="NAMES"></a><h2 class="nroffsh">NAMES and PASSWORDS OPTIONS (Authentication)</h2> -<p class="level0"> -<p class="level0"><a name="CURLOPTNETRC"></a><span class="nroffip">CURLOPT_NETRC</span> -<p class="level1">This parameter controls the preference of libcurl between using user names and passwords from your <span Class="emphasis">~/.netrc</span> file, relative to user names and passwords in the URL supplied with <a class="emphasis" href="#CURLOPTURL">CURLOPT_URL</a>. -<p class="level1">libcurl uses a user name (and supplied or prompted password) supplied with <a class="emphasis" href="#CURLOPTUSERPWD">CURLOPT_USERPWD</a> in preference to any of the options controlled by this parameter. -<p class="level1">Pass a long, set to one of the values described below. -<p class="level2"> -<p class="level1"><a name="CURLNETRCOPTIONAL"></a><span class="nroffip">CURL_NETRC_OPTIONAL</span> -<p class="level2">The use of your <span Class="emphasis">~/.netrc</span> file is optional, and information in the URL is to be preferred. The file will be scanned for the host and user name (to find the password only) or for the host only, to find the first user name and password after that <span Class="emphasis">machine</span>, which ever information is not specified in the URL. -<p class="level2">Undefined values of the option will have this effect. -<p class="level1"><a name="CURLNETRCIGNORED"></a><span class="nroffip">CURL_NETRC_IGNORED</span> -<p class="level2">The library will ignore the file and use only the information in the URL. -<p class="level2">This is the default. -<p class="level1"><a name="CURLNETRCREQUIRED"></a><span class="nroffip">CURL_NETRC_REQUIRED</span> -<p class="level2">This value tells the library that use of the file is required, to ignore the information in the URL, and to search the file for the host only. -<p class="level1">Only machine name, user name and password are taken into account (init macros and similar things aren't supported). -<p class="level1">libcurl does not verify that the file has the correct properties set (as the standard Unix ftp client does). It should only be readable by user. -<p class="level0"><a name="CURLOPTNETRCFILE"></a><span class="nroffip">CURLOPT_NETRC_FILE</span> -<p class="level1">Pass a char * as parameter, pointing to a zero terminated string containing the full path name to the file you want libcurl to use as .netrc file. If this option is omitted, and <a class="emphasis" href="#CURLOPTNETRC">CURLOPT_NETRC</a> is set, libcurl will attempt to find a .netrc file in the current user's home directory. (Added in 7.10.9) -<p class="level0"><a name="CURLOPTUSERPWD"></a><span class="nroffip">CURLOPT_USERPWD</span> -<p class="level1">Pass a char * as parameter, which should be [user name]:[password] to use for the connection. Use <a class="emphasis" href="#CURLOPTHTTPAUTH">CURLOPT_HTTPAUTH</a> to decide the authentication method. -<p class="level1">When using NTLM, you can set the domain by prepending it to the user name and separating the domain and name with a forward (/) or backward slash (\). Like this: "domain/user:password" or "domain\user:password". Some HTTP servers (on Windows) support this style even for Basic authentication. -<p class="level1">When using HTTP and <a class="emphasis" href="#CURLOPTFOLLOWLOCATION">CURLOPT_FOLLOWLOCATION</a>, libcurl might perform several requests to possibly different hosts. libcurl will only send this user and password information to hosts using the initial host name (unless <a class="emphasis" href="#CURLOPTUNRESTRICTEDAUTH">CURLOPT_UNRESTRICTED_AUTH</a> is set), so if libcurl follows locations to other hosts it will not send the user and password to those. This is enforced to prevent accidental information leakage. -<p class="level0"><a name="CURLOPTPROXYUSERPWD"></a><span class="nroffip">CURLOPT_PROXYUSERPWD</span> -<p class="level1">Pass a char * as parameter, which should be [user name]:[password] to use for the connection to the HTTP proxy. Use <a class="emphasis" href="#CURLOPTPROXYAUTH">CURLOPT_PROXYAUTH</a> to decide the authentication method. -<p class="level0"><a name="CURLOPTUSERNAME"></a><span class="nroffip">CURLOPT_USERNAME</span> -<p class="level1">Pass a char * as parameter, which should be pointing to the zero terminated user name to use for the transfer. -<p class="level1"><a class="bold" href="#CURLOPTUSERNAME">CURLOPT_USERNAME</a> sets the user name to be used in protocol authentication. You should not use this option together with the (older) CURLOPT_USERPWD option. -<p class="level1">In order to specify the password to be used in conjunction with the user name use the <a class="emphasis" href="#CURLOPTPASSWORD">CURLOPT_PASSWORD</a> option. (Added in 7.19.1) -<p class="level0"><a name="CURLOPTPASSWORD"></a><span class="nroffip">CURLOPT_PASSWORD</span> -<p class="level1">Pass a char * as parameter, which should be pointing to the zero terminated password to use for the transfer. -<p class="level1">The CURLOPT_PASSWORD option should be used in conjunction with the <a class="emphasis" href="#CURLOPTUSERNAME">CURLOPT_USERNAME</a> option. (Added in 7.19.1) -<p class="level0"><a name="CURLOPTPROXYUSERNAME"></a><span class="nroffip">CURLOPT_PROXYUSERNAME</span> -<p class="level1">Pass a char * as parameter, which should be pointing to the zero terminated user name to use for the transfer while connecting to Proxy. -<p class="level1">The CURLOPT_PROXYUSERNAME option should be used in same way as the <a class="emphasis" href="#CURLOPTPROXYUSERPWD">CURLOPT_PROXYUSERPWD</a> is used. In comparison to <a class="emphasis" href="#CURLOPTPROXYUSERPWD">CURLOPT_PROXYUSERPWD</a> the CURLOPT_PROXYUSERNAME allows the username to contain a colon, like in the following example: "sip:user@example.com". The CURLOPT_PROXYUSERNAME option is an alternative way to set the user name while connecting to Proxy. There is no meaning to use it together with the <a class="emphasis" href="#CURLOPTPROXYUSERPWD">CURLOPT_PROXYUSERPWD</a> option. -<p class="level1">In order to specify the password to be used in conjunction with the user name use the <a class="emphasis" href="#CURLOPTPROXYPASSWORD">CURLOPT_PROXYPASSWORD</a> option. (Added in 7.19.1) -<p class="level0"><a name="CURLOPTPROXYPASSWORD"></a><span class="nroffip">CURLOPT_PROXYPASSWORD</span> -<p class="level1">Pass a char * as parameter, which should be pointing to the zero terminated password to use for the transfer while connecting to Proxy. -<p class="level1">The CURLOPT_PROXYPASSWORD option should be used in conjunction with the <a class="emphasis" href="#CURLOPTPROXYUSERNAME">CURLOPT_PROXYUSERNAME</a> option. (Added in 7.19.1) -<p class="level0"><a name="CURLOPTHTTPAUTH"></a><span class="nroffip">CURLOPT_HTTPAUTH</span> -<p class="level1">Pass a long as parameter, which is set to a bitmask, to tell libcurl which authentication method(s) you want it to use. The available bits are listed below. If more than one bit is set, libcurl will first query the site to see which authentication methods it supports and then pick the best one you allow it to use. For some methods, this will induce an extra network round-trip. Set the actual name and password with the <a class="emphasis" href="#CURLOPTUSERPWD">CURLOPT_USERPWD</a> option or with the <a class="emphasis" href="#CURLOPTUSERNAME">CURLOPT_USERNAME</a> and the <a class="emphasis" href="#CURLOPTPASSWORD">CURLOPT_PASSWORD</a> options. (Added in 7.10.6) -<p class="level2"> -<p class="level1"><a name="CURLAUTHBASIC"></a><span class="nroffip">CURLAUTH_BASIC</span> -<p class="level2">HTTP Basic authentication. This is the default choice, and the only method that is in wide-spread use and supported virtually everywhere. This sends the user name and password over the network in plain text, easily captured by others. -<p class="level1"><a name="CURLAUTHDIGEST"></a><span class="nroffip">CURLAUTH_DIGEST</span> -<p class="level2">HTTP Digest authentication. Digest authentication is defined in <a href="http://www.ietf.org/rfc/rfc2617.txt">RFC 2617</a> and is a more secure way to do authentication over public networks than the regular old-fashioned Basic method. -<p class="level1"><a name="CURLAUTHDIGESTIE"></a><span class="nroffip">CURLAUTH_DIGEST_IE</span> -<p class="level2">HTTP Digest authentication with an IE flavor. Digest authentication is defined in <a href="http://www.ietf.org/rfc/rfc2617.txt">RFC 2617</a> and is a more secure way to do authentication over public networks than the regular old-fashioned Basic method. The IE flavor is simply that libcurl will use a special "quirk" that IE is known to have used before version 7 and that some servers require the client to use. (This define was added in 7.19.3) -<p class="level1"><a name="CURLAUTHGSSNEGOTIATE"></a><span class="nroffip">CURLAUTH_GSSNEGOTIATE</span> -<p class="level2">HTTP GSS-Negotiate authentication. The GSS-Negotiate (also known as plain "Negotiate") method was designed by Microsoft and is used in their web applications. It is primarily meant as a support for Kerberos5 authentication but may also be used along with other authentication methods. For more information see IETF draft draft-brezak-spnego-http-04.txt. -<p class="level2">You need to build libcurl with a suitable GSS-API library for this to work. -<p class="level1"><a name="CURLAUTHNTLM"></a><span class="nroffip">CURLAUTH_NTLM</span> -<p class="level2">HTTP NTLM authentication. A proprietary protocol invented and used by Microsoft. It uses a challenge-response and hash concept similar to Digest, to prevent the password from being eavesdropped. -<p class="level2">You need to build libcurl with either OpenSSL, GnuTLS or NSS support for this option to work, or build libcurl on Windows. -<p class="level1"><a name="CURLAUTHNTLMWB"></a><span class="nroffip">CURLAUTH_NTLM_WB</span> -<p class="level2">NTLM delegating to winbind helper. Authentication is performed by a separate binary application that is executed when needed. The name of the application is specified at compile time but is typically /usr/bin/ntlm_auth (Added in 7.22.0) -<p class="level2">Note that libcurl will fork when necessary to run the winbind application and kill it when complete, calling waitpid() to await its exit when done. On POSIX operating systems, killing the process will cause a SIGCHLD signal to be raised (regardless of whether <a class="emphasis" href="#CURLOPTNOSIGNAL">CURLOPT_NOSIGNAL</a> is set), which must be handled intelligently by the application. In particular, the application must not unconditionally call wait() in its SIGCHLD signal handler to avoid being subject to a race condition. This behavior is subject to change in future versions of libcurl. -<p class="level1"><a name="CURLAUTHANY"></a><span class="nroffip">CURLAUTH_ANY</span> -<p class="level2">This is a convenience macro that sets all bits and thus makes libcurl pick any it finds suitable. libcurl will automatically select the one it finds most secure. -<p class="level1"><a name="CURLAUTHANYSAFE"></a><span class="nroffip">CURLAUTH_ANYSAFE</span> -<p class="level2">This is a convenience macro that sets all bits except Basic and thus makes libcurl pick any it finds suitable. libcurl will automatically select the one it finds most secure. -<p class="level1"><a name="CURLAUTHONLY"></a><span class="nroffip">CURLAUTH_ONLY</span> -<p class="level2">This is a meta symbol. Or this value together with a single specific auth value to force libcurl to probe for un-restricted auth and if not, only that single auth algorithm is acceptable. (Added in 7.21.3) -<p class="level1"> -<p class="level0"><a name="CURLOPTTLSAUTHTYPE"></a><span class="nroffip">CURLOPT_TLSAUTH_TYPE</span> -<p class="level1">Pass a long as parameter, which is set to a bitmask, to tell libcurl which authentication method(s) you want it to use for TLS authentication. -<p class="level2"> -<p class="level1"><a name="CURLOPTTLSAUTHSRP"></a><span class="nroffip">CURLOPT_TLSAUTH_SRP</span> -<p class="level2">TLS-SRP authentication. Secure Remote Password authentication for TLS is defined in <a href="http://www.ietf.org/rfc/rfc5054.txt">RFC 5054</a> and provides mutual authentication if both sides have a shared secret. To use TLS-SRP, you must also set the <a class="emphasis" href="#CURLOPTTLSAUTHUSERNAME">CURLOPT_TLSAUTH_USERNAME</a> and <a class="emphasis" href="#CURLOPTTLSAUTHPASSWORD">CURLOPT_TLSAUTH_PASSWORD</a> options. -<p class="level2">You need to build libcurl with GnuTLS or OpenSSL with TLS-SRP support for this to work. (Added in 7.21.4) -<p class="level1"> -<p class="level0"><a name="CURLOPTTLSAUTHUSERNAME"></a><span class="nroffip">CURLOPT_TLSAUTH_USERNAME</span> -<p class="level1">Pass a char * as parameter, which should point to the zero terminated username to use for the TLS authentication method specified with the <a class="emphasis" href="#CURLOPTTLSAUTHTYPE">CURLOPT_TLSAUTH_TYPE</a> option. Requires that the <span Class="emphasis">CURLOPT_TLS_PASSWORD</span> option also be set. (Added in 7.21.4) -<p class="level0"><a name="CURLOPTTLSAUTHPASSWORD"></a><span class="nroffip">CURLOPT_TLSAUTH_PASSWORD</span> -<p class="level1">Pass a char * as parameter, which should point to the zero terminated password to use for the TLS authentication method specified with the <a class="emphasis" href="#CURLOPTTLSAUTHTYPE">CURLOPT_TLSAUTH_TYPE</a> option. Requires that the <span Class="emphasis">CURLOPT_TLS_USERNAME</span> option also be set. (Added in 7.21.4) -<p class="level0"><a name="CURLOPTPROXYAUTH"></a><span class="nroffip">CURLOPT_PROXYAUTH</span> -<p class="level1">Pass a long as parameter, which is set to a bitmask, to tell libcurl which authentication method(s) you want it to use for your proxy authentication. If more than one bit is set, libcurl will first query the site to see what authentication methods it supports and then pick the best one you allow it to use. For some methods, this will induce an extra network round-trip. Set the actual name and password with the <a class="emphasis" href="#CURLOPTPROXYUSERPWD">CURLOPT_PROXYUSERPWD</a> option. The bitmask can be constructed by or'ing together the bits listed above for the <a class="emphasis" href="#CURLOPTHTTPAUTH">CURLOPT_HTTPAUTH</a> option. As of this writing, only Basic, Digest and NTLM work. (Added in 7.10.7) <a name="HTTP"></a><h2 class="nroffsh">HTTP OPTIONS</h2> -<p class="level0"> -<p class="level0"><a name="CURLOPTAUTOREFERER"></a><span class="nroffip">CURLOPT_AUTOREFERER</span> -<p class="level1">Pass a parameter set to 1 to enable this. When enabled, libcurl will automatically set the Referer: field in requests where it follows a Location: redirect. -<p class="level0"><a name="CURLOPTACCEPTENCODING"></a><span class="nroffip">CURLOPT_ACCEPT_ENCODING</span> -<p class="level1">Sets the contents of the Accept-Encoding: header sent in a HTTP request, and enables decoding of a response when a Content-Encoding: header is received. Three encodings are supported: <span Class="emphasis">identity</span>, which does nothing, <span Class="emphasis">deflate</span> which requests the server to compress its response using the zlib algorithm, and <span Class="emphasis">gzip</span> which requests the gzip algorithm. If a zero-length string is set, then an Accept-Encoding: header containing all supported encodings is sent. -<p class="level1">This is a request, not an order; the server may or may not do it. This option must be set (to any non-NULL value) or else any unsolicited encoding done by the server is ignored. See the special file lib/README.encoding for details. -<p class="level1">(This option was called CURLOPT_ENCODING before 7.21.6) -<p class="level0"><a name="CURLOPTTRANSFERENCODING"></a><span class="nroffip">CURLOPT_TRANSFER_ENCODING</span> -<p class="level1">Adds a request for compressed Transfer Encoding in the outgoing HTTP request. If the server supports this and so desires, it can respond with the HTTP response sent using a compressed Transfer-Encoding that will be automatically uncompressed by libcurl on reception. -<p class="level1">Transfer-Encoding differs slightly from the Content-Encoding you ask for with <a class="bold" href="#CURLOPTACCEPTENCODING">CURLOPT_ACCEPT_ENCODING</a> in that a Transfer-Encoding is strictly meant to be for the transfer and thus MUST be decoded before the data arrives in the client. Traditionally, Transfer-Encoding has been much less used and supported by both HTTP clients and HTTP servers. -<p class="level1">(Added in 7.21.6) -<p class="level0"><a name="CURLOPTFOLLOWLOCATION"></a><span class="nroffip">CURLOPT_FOLLOWLOCATION</span> -<p class="level1">A parameter set to 1 tells the library to follow any Location: header that the server sends as part of a HTTP header. -<p class="level1">This means that the library will re-send the same request on the new location and follow new Location: headers all the way until no more such headers are returned. <a class="emphasis" href="#CURLOPTMAXREDIRS">CURLOPT_MAXREDIRS</a> can be used to limit the number of redirects libcurl will follow. -<p class="level1">Since 7.19.4, libcurl can limit what protocols it will automatically follow. The accepted protocols are set with <a class="emphasis" href="#CURLOPTREDIRPROTOCOLS">CURLOPT_REDIR_PROTOCOLS</a> and it excludes the FILE protocol by default. -<p class="level0"><a name="CURLOPTUNRESTRICTEDAUTH"></a><span class="nroffip">CURLOPT_UNRESTRICTED_AUTH</span> -<p class="level1">A parameter set to 1 tells the library it can continue to send authentication (user+password) when following locations, even when hostname changed. This option is meaningful only when setting <a class="emphasis" href="#CURLOPTFOLLOWLOCATION">CURLOPT_FOLLOWLOCATION</a>. -<p class="level0"><a name="CURLOPTMAXREDIRS"></a><span class="nroffip">CURLOPT_MAXREDIRS</span> -<p class="level1">Pass a long. The set number will be the redirection limit. If that many redirections have been followed, the next redirect will cause an error (<span Class="emphasis">CURLE_TOO_MANY_REDIRECTS</span>). This option only makes sense if the <a class="emphasis" href="#CURLOPTFOLLOWLOCATION">CURLOPT_FOLLOWLOCATION</a> is used at the same time. Added in 7.15.1: Setting the limit to 0 will make libcurl refuse any redirect. Set it to -1 for an infinite number of redirects (which is the default) -<p class="level0"><a name="CURLOPTPOSTREDIR"></a><span class="nroffip">CURLOPT_POSTREDIR</span> -<p class="level1">Pass a bitmask to control how libcurl acts on redirects after POSTs that get a 301, 302 or 303 response back. A parameter with bit 0 set (value <span Class="bold">CURL_REDIR_POST_301</span>) tells the library to respect <a href="http://www.ietf.org/rfc/rfc2616.txt">RFC 2616</a>/10.3.2 and not convert POST requests into GET requests when following a 301 redirection. Setting bit 1 (value <span Class="bold">CURL_REDIR_POST_302</span>) makes libcurl maintain the request method after a 302 redirect whilst setting bit 2 (value <span Class="bold">CURL_REDIR_POST_303</span>) makes libcurl maintain the request method after a 303 redirect. The value <span Class="bold">CURL_REDIR_POST_ALL</span> is a convenience define that sets all three bits. -<p class="level1">The non-RFC behaviour is ubiquitous in web browsers, so the library does the conversion by default to maintain consistency. However, a server may require a POST to remain a POST after such a redirection. This option is meaningful only when setting <a class="emphasis" href="#CURLOPTFOLLOWLOCATION">CURLOPT_FOLLOWLOCATION</a>. (Added in 7.17.1) (This option was known as CURLOPT_POST301 up to 7.19.0 as it only supported the 301 then) -<p class="level0"><a name="CURLOPTPUT"></a><span class="nroffip">CURLOPT_PUT</span> -<p class="level1">A parameter set to 1 tells the library to use HTTP PUT to transfer data. The data should be set with <a class="emphasis" href="#CURLOPTREADDATA">CURLOPT_READDATA</a> and <a class="emphasis" href="#CURLOPTINFILESIZE">CURLOPT_INFILESIZE</a>. -<p class="level1">This option is deprecated and starting with version 7.12.1 you should instead use <a class="emphasis" href="#CURLOPTUPLOAD">CURLOPT_UPLOAD</a>. -<p class="level0"><a name="CURLOPTPOST"></a><span class="nroffip">CURLOPT_POST</span> -<p class="level1">A parameter set to 1 tells the library to do a regular HTTP post. This will also make the library use a "Content-Type: application/x-www-form-urlencoded" header. (This is by far the most commonly used POST method). -<p class="level1">Use one of <a class="emphasis" href="#CURLOPTPOSTFIELDS">CURLOPT_POSTFIELDS</a> or <a class="emphasis" href="#CURLOPTCOPYPOSTFIELDS">CURLOPT_COPYPOSTFIELDS</a> options to specify what data to post and <a class="emphasis" href="#CURLOPTPOSTFIELDSIZE">CURLOPT_POSTFIELDSIZE</a> or <a class="emphasis" href="#CURLOPTPOSTFIELDSIZELARGE">CURLOPT_POSTFIELDSIZE_LARGE</a> to set the data size. -<p class="level1">Optionally, you can provide data to POST using the <a class="emphasis" href="#CURLOPTREADFUNCTION">CURLOPT_READFUNCTION</a> and <a class="emphasis" href="#CURLOPTREADDATA">CURLOPT_READDATA</a> options but then you must make sure to not set <a class="emphasis" href="#CURLOPTPOSTFIELDS">CURLOPT_POSTFIELDS</a> to anything but NULL. When providing data with a callback, you must transmit it using chunked transfer-encoding or you must set the size of the data with the <a class="emphasis" href="#CURLOPTPOSTFIELDSIZE">CURLOPT_POSTFIELDSIZE</a> or <a class="emphasis" href="#CURLOPTPOSTFIELDSIZELARGE">CURLOPT_POSTFIELDSIZE_LARGE</a> option. To enable chunked encoding, you simply pass in the appropriate Transfer-Encoding header, see the post-callback.c example. -<p class="level1">You can override the default POST Content-Type: header by setting your own with <a class="emphasis" href="#CURLOPTHTTPHEADER">CURLOPT_HTTPHEADER</a>. -<p class="level1">Using POST with HTTP 1.1 implies the use of a "Expect: 100-continue" header. You can disable this header with <a class="emphasis" href="#CURLOPTHTTPHEADER">CURLOPT_HTTPHEADER</a> as usual. -<p class="level1">If you use POST to a HTTP 1.1 server, you can send data without knowing the size before starting the POST if you use chunked encoding. You enable this by adding a header like "Transfer-Encoding: chunked" with <a class="emphasis" href="#CURLOPTHTTPHEADER">CURLOPT_HTTPHEADER</a>. With HTTP 1.0 or without chunked transfer, you must specify the size in the request. -<p class="level1">When setting <a class="emphasis" href="#CURLOPTPOST">CURLOPT_POST</a> to 1, it will automatically set <a class="emphasis" href="#CURLOPTNOBODY">CURLOPT_NOBODY</a> to 0 (since 7.14.1). -<p class="level1">If you issue a POST request and then want to make a HEAD or GET using the same re-used handle, you must explicitly set the new request type using <a class="emphasis" href="#CURLOPTNOBODY">CURLOPT_NOBODY</a> or <a class="emphasis" href="#CURLOPTHTTPGET">CURLOPT_HTTPGET</a> or similar. -<p class="level0"><a name="CURLOPTPOSTFIELDS"></a><span class="nroffip">CURLOPT_POSTFIELDS</span> -<p class="level1">Pass a void * as parameter, which should be the full data to post in a HTTP POST operation. You must make sure that the data is formatted the way you want the server to receive it. libcurl will not convert or encode it for you. Most web servers will assume this data to be url-encoded. -<p class="level1">The pointed data are NOT copied by the library: as a consequence, they must be preserved by the calling application until the transfer finishes. -<p class="level1">This POST is a normal application/x-www-form-urlencoded kind (and libcurl will set that Content-Type by default when this option is used), which is the most commonly used one by HTML forms. See also the <a class="emphasis" href="#CURLOPTPOST">CURLOPT_POST</a>. Using <a class="emphasis" href="#CURLOPTPOSTFIELDS">CURLOPT_POSTFIELDS</a> implies <a class="emphasis" href="#CURLOPTPOST">CURLOPT_POST</a>. -<p class="level1">If you want to do a zero-byte POST, you need to set <a class="emphasis" href="#CURLOPTPOSTFIELDSIZE">CURLOPT_POSTFIELDSIZE</a> explicitly to zero, as simply setting <a class="emphasis" href="#CURLOPTPOSTFIELDS">CURLOPT_POSTFIELDS</a> to NULL or "" just effectively disables the sending of the specified string. libcurl will instead assume that you'll send the POST data using the read callback! -<p class="level1">Using POST with HTTP 1.1 implies the use of a "Expect: 100-continue" header. You can disable this header with <a class="emphasis" href="#CURLOPTHTTPHEADER">CURLOPT_HTTPHEADER</a> as usual. -<p class="level1">To make multipart/formdata posts (aka <a href="http://www.ietf.org/rfc/rfc2388.txt">RFC 2388</a>-posts), check out the <a class="emphasis" href="#CURLOPTHTTPPOST">CURLOPT_HTTPPOST</a> option. -<p class="level0"><a name="CURLOPTPOSTFIELDSIZE"></a><span class="nroffip">CURLOPT_POSTFIELDSIZE</span> -<p class="level1">If you want to post data to the server without letting libcurl do a strlen() to measure the data size, this option must be used. When this option is used you can post fully binary data, which otherwise is likely to fail. If this size is set to -1, the library will use strlen() to get the size. -<p class="level0"><a name="CURLOPTPOSTFIELDSIZELARGE"></a><span class="nroffip">CURLOPT_POSTFIELDSIZE_LARGE</span> -<p class="level1">Pass a curl_off_t as parameter. Use this to set the size of the <a class="emphasis" href="#CURLOPTPOSTFIELDS">CURLOPT_POSTFIELDS</a> data to prevent libcurl from doing strlen() on the data to figure out the size. This is the large file version of the <a class="emphasis" href="#CURLOPTPOSTFIELDSIZE">CURLOPT_POSTFIELDSIZE</a> option. (Added in 7.11.1) -<p class="level0"><a name="CURLOPTCOPYPOSTFIELDS"></a><span class="nroffip">CURLOPT_COPYPOSTFIELDS</span> -<p class="level1">Pass a char * as parameter, which should be the full data to post in a HTTP POST operation. It behaves as the <a class="emphasis" href="#CURLOPTPOSTFIELDS">CURLOPT_POSTFIELDS</a> option, but the original data are copied by the library, allowing the application to overwrite the original data after setting this option. -<p class="level1">Because data are copied, care must be taken when using this option in conjunction with <a class="emphasis" href="#CURLOPTPOSTFIELDSIZE">CURLOPT_POSTFIELDSIZE</a> or <a class="emphasis" href="#CURLOPTPOSTFIELDSIZELARGE">CURLOPT_POSTFIELDSIZE_LARGE</a>: If the size has not been set prior to <a class="emphasis" href="#CURLOPTCOPYPOSTFIELDS">CURLOPT_COPYPOSTFIELDS</a>, the data are assumed to be a NUL-terminated string; else the stored size informs the library about the data byte count to copy. In any case, the size must not be changed after <a class="emphasis" href="#CURLOPTCOPYPOSTFIELDS">CURLOPT_COPYPOSTFIELDS</a>, unless another <a class="emphasis" href="#CURLOPTPOSTFIELDS">CURLOPT_POSTFIELDS</a> or <a class="emphasis" href="#CURLOPTCOPYPOSTFIELDS">CURLOPT_COPYPOSTFIELDS</a> option is issued. (Added in 7.17.1) -<p class="level0"><a name="CURLOPTHTTPPOST"></a><span class="nroffip">CURLOPT_HTTPPOST</span> -<p class="level1">Tells libcurl you want a multipart/formdata HTTP POST to be made and you instruct what data to pass on to the server. Pass a pointer to a linked list of curl_httppost structs as parameter. The easiest way to create such a list, is to use <a class="emphasis" href="./curl_formadd.html">curl_formadd(3)</a> as documented. The data in this list must remain intact until you close this curl handle again with <a class="emphasis" href="./curl_easy_cleanup.html">curl_easy_cleanup(3)</a>. -<p class="level1">Using POST with HTTP 1.1 implies the use of a "Expect: 100-continue" header. You can disable this header with <a class="emphasis" href="#CURLOPTHTTPHEADER">CURLOPT_HTTPHEADER</a> as usual. -<p class="level1">When setting <a class="emphasis" href="#CURLOPTHTTPPOST">CURLOPT_HTTPPOST</a>, it will automatically set <a class="emphasis" href="#CURLOPTNOBODY">CURLOPT_NOBODY</a> to 0 (since 7.14.1). -<p class="level0"><a name="CURLOPTREFERER"></a><span class="nroffip">CURLOPT_REFERER</span> -<p class="level1">Pass a pointer to a zero terminated string as parameter. It will be used to set the Referer: header in the http request sent to the remote server. This can be used to fool servers or scripts. You can also set any custom header with <a class="emphasis" href="#CURLOPTHTTPHEADER">CURLOPT_HTTPHEADER</a>. -<p class="level0"><a name="CURLOPTUSERAGENT"></a><span class="nroffip">CURLOPT_USERAGENT</span> -<p class="level1">Pass a pointer to a zero terminated string as parameter. It will be used to set the User-Agent: header in the http request sent to the remote server. This can be used to fool servers or scripts. You can also set any custom header with <a class="emphasis" href="#CURLOPTHTTPHEADER">CURLOPT_HTTPHEADER</a>. -<p class="level0"><a name="CURLOPTHTTPHEADER"></a><span class="nroffip">CURLOPT_HTTPHEADER</span> -<p class="level1">Pass a pointer to a linked list of HTTP headers to pass to the server in your HTTP request. The linked list should be a fully valid list of <span class="bold">struct curl_slist</span> structs properly filled in. Use <a class="emphasis" href="./curl_slist_append.html">curl_slist_append(3)</a> to create the list and <a class="emphasis" href="./curl_slist_free_all.html">curl_slist_free_all(3)</a> to clean up an entire list. If you add a header that is otherwise generated and used by libcurl internally, your added one will be used instead. If you add a header with no content as in 'Accept:' (no data on the right side of the colon), the internally used header will get disabled. Thus, using this option you can add new headers, replace internal headers and remove internal headers. To add a header with no content, make the content be two quotes: "". The headers included in the linked list must not be CRLF-terminated, because curl adds CRLF after each header item. Failure to comply with this will result in strange bugs because the server will most likely ignore part of the headers you specified. -<p class="level1">The first line in a request (containing the method, usually a GET or POST) is not a header and cannot be replaced using this option. Only the lines following the request-line are headers. Adding this method line in this list of headers will only cause your request to send an invalid header. -<p class="level1">Pass a NULL to this to reset back to no custom headers. -<p class="level1">The most commonly replaced headers have "shortcuts" in the options <a class="emphasis" href="#CURLOPTCOOKIE">CURLOPT_COOKIE</a>, <a class="emphasis" href="#CURLOPTUSERAGENT">CURLOPT_USERAGENT</a> and <a class="emphasis" href="#CURLOPTREFERER">CURLOPT_REFERER</a>. -<p class="level0"><a name="CURLOPTHTTP200ALIASES"></a><span class="nroffip">CURLOPT_HTTP200ALIASES</span> -<p class="level1">Pass a pointer to a linked list of aliases to be treated as valid HTTP 200 responses. Some servers respond with a custom header response line. For example, IceCast servers respond with "ICY 200 OK". By including this string in your list of aliases, the response will be treated as a valid HTTP header line such as "HTTP/1.0 200 OK". (Added in 7.10.3) -<p class="level1">The linked list should be a fully valid list of struct curl_slist structs, and be properly filled in. Use <a class="emphasis" href="./curl_slist_append.html">curl_slist_append(3)</a> to create the list and <a class="emphasis" href="./curl_slist_free_all.html">curl_slist_free_all(3)</a> to clean up an entire list. -<p class="level1">The alias itself is not parsed for any version strings. Before libcurl 7.16.3, Libcurl used the value set by option <a class="emphasis" href="#CURLOPTHTTPVERSION">CURLOPT_HTTP_VERSION</a>, but starting with 7.16.3 the protocol is assumed to match HTTP 1.0 when an alias matched. -<p class="level0"><a name="CURLOPTCOOKIE"></a><span class="nroffip">CURLOPT_COOKIE</span> -<p class="level1">Pass a pointer to a zero terminated string as parameter. It will be used to set a cookie in the http request. The format of the string should be NAME=CONTENTS, where NAME is the cookie name and CONTENTS is what the cookie should contain. -<p class="level1">If you need to set multiple cookies, you need to set them all using a single option and thus you need to concatenate them all in one single string. Set multiple cookies in one string like this: "name1=content1; name2=content2;" etc. -<p class="level1">This option sets the cookie header explicitly in the outgoing request(s). If multiple requests are done due to authentication, followed redirections or similar, they will all get this cookie passed on. -<p class="level1">Using this option multiple times will only make the latest string override the previous ones. -<p class="level0"><a name="CURLOPTCOOKIEFILE"></a><span class="nroffip">CURLOPT_COOKIEFILE</span> -<p class="level1">Pass a pointer to a zero terminated string as parameter. It should contain the name of your file holding cookie data to read. The cookie data may be in Netscape / Mozilla cookie data format or just regular HTTP-style headers dumped to a file. -<p class="level1">Given an empty or non-existing file or by passing the empty string (""), this option will enable cookies for this curl handle, making it understand and parse received cookies and then use matching cookies in future requests. -<p class="level1">If you use this option multiple times, you just add more files to read. Subsequent files will add more cookies. -<p class="level0"><a name="CURLOPTCOOKIEJAR"></a><span class="nroffip">CURLOPT_COOKIEJAR</span> -<p class="level1">Pass a file name as char *, zero terminated. This will make libcurl write all internally known cookies to the specified file when <a class="emphasis" href="./curl_easy_cleanup.html">curl_easy_cleanup(3)</a> is called. If no cookies are known, no file will be created. Specify "-" to instead have the cookies written to stdout. Using this option also enables cookies for this session, so if you for example follow a location it will make matching cookies get sent accordingly. -<p class="level1">If the cookie jar file can't be created or written to (when the <a class="emphasis" href="./curl_easy_cleanup.html">curl_easy_cleanup(3)</a> is called), libcurl will not and cannot report an error for this. Using <a class="emphasis" href="#CURLOPTVERBOSE">CURLOPT_VERBOSE</a> or <a class="emphasis" href="#CURLOPTDEBUGFUNCTION">CURLOPT_DEBUGFUNCTION</a> will get a warning to display, but that is the only visible feedback you get about this possibly lethal situation. -<p class="level0"><a name="CURLOPTCOOKIESESSION"></a><span class="nroffip">CURLOPT_COOKIESESSION</span> -<p class="level1">Pass a long set to 1 to mark this as a new cookie "session". It will force libcurl to ignore all cookies it is about to load that are "session cookies" from the previous session. By default, libcurl always stores and loads all cookies, independent if they are session cookies or not. Session cookies are cookies without expiry date and they are meant to be alive and existing for this "session" only. -<p class="level0"><a name="CURLOPTCOOKIELIST"></a><span class="nroffip">CURLOPT_COOKIELIST</span> -<p class="level1">Pass a char * to a cookie string. Cookie can be either in Netscape / Mozilla format or just regular HTTP-style header (Set-Cookie: ...) format. If cURL cookie engine was not enabled it will enable its cookie engine. Passing a magic string "ALL" will erase all cookies known by cURL. (Added in 7.14.1) Passing the special string "SESS" will only erase all session cookies known by cURL. (Added in 7.15.4) Passing the special string "FLUSH" will write all cookies known by cURL to the file specified by <a class="emphasis" href="#CURLOPTCOOKIEJAR">CURLOPT_COOKIEJAR</a>. (Added in 7.17.1) -<p class="level0"><a name="CURLOPTHTTPGET"></a><span class="nroffip">CURLOPT_HTTPGET</span> -<p class="level1">Pass a long. If the long is 1, this forces the HTTP request to get back to GET. Usable if a POST, HEAD, PUT, or a custom request has been used previously using the same curl handle. -<p class="level1">When setting <a class="emphasis" href="#CURLOPTHTTPGET">CURLOPT_HTTPGET</a> to 1, it will automatically set <a class="emphasis" href="#CURLOPTNOBODY">CURLOPT_NOBODY</a> to 0 (since 7.14.1). -<p class="level0"><a name="CURLOPTHTTPVERSION"></a><span class="nroffip">CURLOPT_HTTP_VERSION</span> -<p class="level1">Pass a long, set to one of the values described below. They force libcurl to use the specific HTTP versions. This is not sensible to do unless you have a good reason. -<p class="level2"> -<p class="level1"><a name="CURLHTTPVERSIONNONE"></a><span class="nroffip">CURL_HTTP_VERSION_NONE</span> -<p class="level2">We don't care about what version the library uses. libcurl will use whatever it thinks fit. -<p class="level1"><a name="CURLHTTPVERSION10"></a><span class="nroffip">CURL_HTTP_VERSION_1_0</span> -<p class="level2">Enforce HTTP 1.0 requests. -<p class="level1"><a name="CURLHTTPVERSION11"></a><span class="nroffip">CURL_HTTP_VERSION_1_1</span> -<p class="level2">Enforce HTTP 1.1 requests. -<p class="level1"> -<p class="level0"><a name="CURLOPTIGNORECONTENTLENGTH"></a><span class="nroffip">CURLOPT_IGNORE_CONTENT_LENGTH</span> -<p class="level1">Ignore the Content-Length header. This is useful for Apache 1.x (and similar servers) which will report incorrect content length for files over 2 gigabytes. If this option is used, curl will not be able to accurately report progress, and will simply stop the download when the server ends the connection. (added in 7.14.1) -<p class="level0"><a name="CURLOPTHTTPCONTENTDECODING"></a><span class="nroffip">CURLOPT_HTTP_CONTENT_DECODING</span> -<p class="level1">Pass a long to tell libcurl how to act on content decoding. If set to zero, content decoding will be disabled. If set to 1 it is enabled. Libcurl has no default content decoding but requires you to use <span Class="emphasis">CURLOPT_ENCODING</span> for that. (added in 7.16.2) -<p class="level0"><a name="CURLOPTHTTPTRANSFERDECODING"></a><span class="nroffip">CURLOPT_HTTP_TRANSFER_DECODING</span> -<p class="level1">Pass a long to tell libcurl how to act on transfer decoding. If set to zero, transfer decoding will be disabled, if set to 1 it is enabled (default). libcurl does chunked transfer decoding by default unless this option is set to zero. (added in 7.16.2) <a name="SMTP"></a><h2 class="nroffsh">SMTP OPTIONS</h2> -<p class="level0"> -<p class="level0"><a name="CURLOPTMAILFROM"></a><span class="nroffip">CURLOPT_MAIL_FROM</span> -<p class="level1">Pass a pointer to a zero terminated string as parameter. This should be used to specify the sender's email address when sending SMTP mail with libcurl. -<p class="level1">An originator email address should be specified with angled brackets (<>) around it, which if not specified, will be added by libcurl from version 7.21.4 onwards. Failing to provide such brackets may cause the server to reject the email. -<p class="level1">If this parameter is not specified then an empty address will be sent to the mail server which may or may not cause the email to be rejected. -<p class="level1">(Added in 7.20.0) -<p class="level0"><a name="CURLOPTMAILRCPT"></a><span class="nroffip">CURLOPT_MAIL_RCPT</span> -<p class="level1">Pass a pointer to a linked list of recipients to pass to the server in your SMTP mail request. The linked list should be a fully valid list of <span class="bold">struct curl_slist</span> structs properly filled in. Use <a class="emphasis" href="./curl_slist_append.html">curl_slist_append(3)</a> to create the list and <a class="emphasis" href="./curl_slist_free_all.html">curl_slist_free_all(3)</a> to clean up an entire list. -<p class="level1">Each recipient should be specified within a pair of angled brackets (<>), however, should you not use an angled bracket as the first character libcurl will assume you provided a single email address and enclose that address within brackets for you. -<p class="level1">(Added in 7.20.0) -<p class="level0"><a name="CURLOPTMAILAUTH"></a><span class="nroffip">CURLOPT_MAIL_AUTH</span> -<p class="level1">Pass a pointer to a zero terminated string as parameter. This will be used to specify the authentication address (identity) of a submitted message that is being relayed to another server. -<p class="level1">This optional parameter allows co-operating agents in a trusted environment to communicate the authentication of individual messages and should only be used by the application program, using libcurl, if the application is itself a mail server acting in such an environment. If the application is operating as such and the AUTH address is not known or is invalid, then an empty string should be used for this parameter. -<p class="level1">Unlike CURLOPT_MAIL_FROM and CURLOPT_MAIL_RCPT, the address should not be specified within a pair of angled brackets (<>). However, if an empty string is used then a pair of brackets will be sent by libcurl as required by <a href="http://www.ietf.org/rfc/rfc2554.txt">RFC 2554</a>. -<p class="level1">(Added in 7.25.0) <a name="TFTP"></a><h2 class="nroffsh">TFTP OPTIONS</h2> -<p class="level0"> -<p class="level0"><a name="CURLOPTTFTPBLKSIZE"></a><span class="nroffip">CURLOPT_TFTP_BLKSIZE</span> -<p class="level1">Specify block size to use for TFTP data transmission. Valid range as per <a href="http://www.ietf.org/rfc/rfc2348.txt">RFC 2348</a> is 8-65464 bytes. The default of 512 bytes will be used if this option is not specified. The specified block size will only be used pending support by the remote server. If the server does not return an option acknowledgement or returns an option acknowledgement with no blksize, the default of 512 bytes will be used. (added in 7.19.4) <a name="FTP"></a><h2 class="nroffsh">FTP OPTIONS</h2> -<p class="level0"> -<p class="level0"><a name="CURLOPTFTPPORT"></a><span class="nroffip">CURLOPT_FTPPORT</span> -<p class="level1">Pass a pointer to a zero terminated string as parameter. It will be used to get the IP address to use for the FTP PORT instruction. The PORT instruction tells the remote server to connect to our specified IP address. The string may be a plain IP address, a host name, a network interface name (under Unix) or just a '-' symbol to let the library use your system's default IP address. Default FTP operations are passive, and thus won't use PORT. -<p class="level1">The address can be followed by a ':' to specify a port, optionally followed by a '-' to specify a port range. If the port specified is 0, the operating system will pick a free port. If a range is provided and all ports in the range are not available, libcurl will report CURLE_FTP_PORT_FAILED for the handle. Invalid port/range settings are ignored. IPv6 addresses followed by a port or portrange have to be in brackets. IPv6 addresses without port/range specifier can be in brackets. (added in 7.19.5) -<p class="level1">Examples with specified ports: -<p class="level1"> -<p class="level1"> eth0:0 192.168.1.2:32000-33000 curl.se:32123 [::1]:1234-4567 -<p class="level1"> -<p class="level1">You disable PORT again and go back to using the passive version by setting this option to NULL. -<p class="level0"><a name="CURLOPTQUOTE"></a><span class="nroffip">CURLOPT_QUOTE</span> -<p class="level1">Pass a pointer to a linked list of FTP or SFTP commands to pass to the server prior to your FTP request. This will be done before any other commands are issued (even before the CWD command for FTP). The linked list should be a fully valid list of 'struct curl_slist' structs properly filled in with text strings. Use <a class="emphasis" href="./curl_slist_append.html">curl_slist_append(3)</a> to append strings (commands) to the list, and clear the entire list afterwards with <a class="emphasis" href="./curl_slist_free_all.html">curl_slist_free_all(3)</a>. Disable this operation again by setting a NULL to this option. When speaking to a FTP (or SFTP since 7.24.0) server, prefix the command with an asterisk (*) to make libcurl continue even if the command fails as by default libcurl will stop at first failure. -<p class="level1">The set of valid FTP commands depends on the server (see <a href="http://www.ietf.org/rfc/rfc959.txt">RFC 959</a> for a list of mandatory commands). -<p class="level1">The valid SFTP commands are: chgrp, chmod, chown, ln, mkdir, pwd, rename, rm, rmdir, symlink (see <span Class="manpage">curl (1))</span> (SFTP support added in 7.16.3) -<p class="level0"><a name="CURLOPTPOSTQUOTE"></a><span class="nroffip">CURLOPT_POSTQUOTE</span> -<p class="level1">Pass a pointer to a linked list of FTP or SFTP commands to pass to the server after your FTP transfer request. The commands will only be run if no error occurred. The linked list should be a fully valid list of struct curl_slist structs properly filled in as described for <a class="emphasis" href="#CURLOPTQUOTE">CURLOPT_QUOTE</a>. Disable this operation again by setting a NULL to this option. -<p class="level0"><a name="CURLOPTPREQUOTE"></a><span class="nroffip">CURLOPT_PREQUOTE</span> -<p class="level1">Pass a pointer to a linked list of FTP commands to pass to the server after the transfer type is set. The linked list should be a fully valid list of struct curl_slist structs properly filled in as described for <a class="emphasis" href="#CURLOPTQUOTE">CURLOPT_QUOTE</a>. Disable this operation again by setting a NULL to this option. Before version 7.16.0, if you also set <a class="emphasis" href="#CURLOPTNOBODY">CURLOPT_NOBODY</a> to 1, this option didn't work. -<p class="level0"><a name="CURLOPTDIRLISTONLY"></a><span class="nroffip">CURLOPT_DIRLISTONLY</span> -<p class="level1">A parameter set to 1 tells the library to just list the names of files in a directory, instead of doing a full directory listing that would include file sizes, dates etc. This works for FTP and SFTP URLs. -<p class="level1">This causes an FTP NLST command to be sent on an FTP server. Beware that some FTP servers list only files in their response to NLST; they might not include subdirectories and symbolic links. -<p class="level1">Setting this option to 1 also implies a directory listing even if the URL doesn't end with a slash, which otherwise is necessary. -<p class="level1">Do NOT use this option if you also use <a class="emphasis" href="#CURLOPTWILDCARDMATCH">CURLOPT_WILDCARDMATCH</a> as it will effectively break that feature then. -<p class="level1">(This option was known as CURLOPT_FTPLISTONLY up to 7.16.4) -<p class="level0"><a name="CURLOPTAPPEND"></a><span class="nroffip">CURLOPT_APPEND</span> -<p class="level1">A parameter set to 1 tells the library to append to the remote file instead of overwrite it. This is only useful when uploading to an FTP site. -<p class="level1">(This option was known as CURLOPT_FTPAPPEND up to 7.16.4) -<p class="level0"><a name="CURLOPTFTPUSEEPRT"></a><span class="nroffip">CURLOPT_FTP_USE_EPRT</span> -<p class="level1">Pass a long. If the value is 1, it tells curl to use the EPRT (and LPRT) command when doing active FTP downloads (which is enabled by <a class="emphasis" href="#CURLOPTFTPPORT">CURLOPT_FTPPORT</a>). Using EPRT means that it will first attempt to use EPRT and then LPRT before using PORT, but if you pass zero to this option, it will not try using EPRT or LPRT, only plain PORT. (Added in 7.10.5) -<p class="level1">If the server is an IPv6 host, this option will have no effect as of 7.12.3. -<p class="level0"><a name="CURLOPTFTPUSEEPSV"></a><span class="nroffip">CURLOPT_FTP_USE_EPSV</span> -<p class="level1">Pass a long. If the value is 1, it tells curl to use the EPSV command when doing passive FTP downloads (which it always does by default). Using EPSV means that it will first attempt to use EPSV before using PASV, but if you pass zero to this option, it will not try using EPSV, only plain PASV. -<p class="level1">If the server is an IPv6 host, this option will have no effect as of 7.12.3. -<p class="level0"><a name="CURLOPTFTPUSEPRET"></a><span class="nroffip">CURLOPT_FTP_USE_PRET</span> -<p class="level1">Pass a long. If the value is 1, it tells curl to send a PRET command before PASV (and EPSV). Certain FTP servers, mainly drftpd, require this non-standard command for directory listings as well as up and downloads in PASV mode. Has no effect when using the active FTP transfers mode. (Added in 7.20.0) -<p class="level0"><a name="CURLOPTFTPCREATEMISSINGDIRS"></a><span class="nroffip">CURLOPT_FTP_CREATE_MISSING_DIRS</span> -<p class="level1">Pass a long. If the value is 1, curl will attempt to create any remote directory that it fails to CWD into. CWD is the command that changes working directory. (Added in 7.10.7) -<p class="level1">This setting also applies to SFTP-connections. curl will attempt to create the remote directory if it can't obtain a handle to the target-location. The creation will fail if a file of the same name as the directory to create already exists or lack of permissions prevents creation. (Added in 7.16.3) -<p class="level1">Starting with 7.19.4, you can also set this value to 2, which will make libcurl retry the CWD command again if the subsequent MKD command fails. This is especially useful if you're doing many simultaneous connections against the same server and they all have this option enabled, as then CWD may first fail but then another connection does MKD before this connection and thus MKD fails but trying CWD works! 7.19.4 also introduced the <span Class="emphasis">CURLFTP_CREATE_DIR</span> and <span Class="emphasis">CURLFTP_CREATE_DIR_RETRY</span> enum names for these arguments. -<p class="level1">Before version 7.19.4, libcurl will simply ignore arguments set to 2 and act as if 1 was selected. -<p class="level0"><a name="CURLOPTFTPRESPONSETIMEOUT"></a><span class="nroffip">CURLOPT_FTP_RESPONSE_TIMEOUT</span> -<p class="level1">Pass a long. Causes curl to set a timeout period (in seconds) on the amount of time that the server is allowed to take in order to generate a response message for a command before the session is considered hung. While curl is waiting for a response, this value overrides <a class="emphasis" href="#CURLOPTTIMEOUT">CURLOPT_TIMEOUT</a>. It is recommended that if used in conjunction with <a class="emphasis" href="#CURLOPTTIMEOUT">CURLOPT_TIMEOUT</a>, you set <a class="emphasis" href="#CURLOPTFTPRESPONSETIMEOUT">CURLOPT_FTP_RESPONSE_TIMEOUT</a> to a value smaller than <a class="emphasis" href="#CURLOPTTIMEOUT">CURLOPT_TIMEOUT</a>. (Added in 7.10.8) -<p class="level0"><a name="CURLOPTFTPALTERNATIVETOUSER"></a><span class="nroffip">CURLOPT_FTP_ALTERNATIVE_TO_USER</span> -<p class="level1">Pass a char * as parameter, pointing to a string which will be used to authenticate if the usual FTP "USER user" and "PASS password" negotiation fails. This is currently only known to be required when connecting to Tumbleweed's Secure Transport FTPS server using client certificates for authentication. (Added in 7.15.5) -<p class="level0"><a name="CURLOPTFTPSKIPPASVIP"></a><span class="nroffip">CURLOPT_FTP_SKIP_PASV_IP</span> -<p class="level1">Pass a long. If set to 1, it instructs libcurl to not use the IP address the server suggests in its 227-response to libcurl's PASV command when libcurl connects the data connection. Instead libcurl will re-use the same IP address it already uses for the control connection. But it will use the port number from the 227-response. (Added in 7.14.2) -<p class="level1">This option has no effect if PORT, EPRT or EPSV is used instead of PASV. -<p class="level0"><a name="CURLOPTFTPSSLAUTH"></a><span class="nroffip">CURLOPT_FTPSSLAUTH</span> -<p class="level1">Pass a long using one of the values from below, to alter how libcurl issues "AUTH TLS" or "AUTH SSL" when FTP over SSL is activated (see <a class="emphasis" href="#CURLOPTUSESSL">CURLOPT_USE_SSL</a>). (Added in 7.12.2) -<p class="level2"> -<p class="level1"><a name="CURLFTPAUTHDEFAULT"></a><span class="nroffip">CURLFTPAUTH_DEFAULT</span> -<p class="level2">Allow libcurl to decide. -<p class="level1"><a name="CURLFTPAUTHSSL"></a><span class="nroffip">CURLFTPAUTH_SSL</span> -<p class="level2">Try "AUTH SSL" first, and only if that fails try "AUTH TLS". -<p class="level1"><a name="CURLFTPAUTHTLS"></a><span class="nroffip">CURLFTPAUTH_TLS</span> -<p class="level2">Try "AUTH TLS" first, and only if that fails try "AUTH SSL". -<p class="level1"> -<p class="level0"><a name="CURLOPTFTPSSLCCC"></a><span class="nroffip">CURLOPT_FTP_SSL_CCC</span> -<p class="level1">If enabled, this option makes libcurl use CCC (Clear Command Channel). It shuts down the SSL/TLS layer after authenticating. The rest of the control channel communication will be unencrypted. This allows NAT routers to follow the FTP transaction. Pass a long using one of the values below. (Added in 7.16.1) -<p class="level2"> -<p class="level1"><a name="CURLFTPSSLCCCNONE"></a><span class="nroffip">CURLFTPSSL_CCC_NONE</span> -<p class="level2">Don't attempt to use CCC. -<p class="level1"><a name="CURLFTPSSLCCCPASSIVE"></a><span class="nroffip">CURLFTPSSL_CCC_PASSIVE</span> -<p class="level2">Do not initiate the shutdown, but wait for the server to do it. Do not send a reply. -<p class="level1"><a name="CURLFTPSSLCCCACTIVE"></a><span class="nroffip">CURLFTPSSL_CCC_ACTIVE</span> -<p class="level2">Initiate the shutdown and wait for a reply. -<p class="level1"> -<p class="level0"><a name="CURLOPTFTPACCOUNT"></a><span class="nroffip">CURLOPT_FTP_ACCOUNT</span> -<p class="level1">Pass a pointer to a zero terminated string (or NULL to disable). When an FTP server asks for "account data" after user name and password has been provided, this data is sent off using the ACCT command. (Added in 7.13.0) -<p class="level0"><a name="CURLOPTFTPFILEMETHOD"></a><span class="nroffip">CURLOPT_FTP_FILEMETHOD</span> -<p class="level1">Pass a long that should have one of the following values. This option controls what method libcurl should use to reach a file on a FTP(S) server. The argument should be one of the following alternatives: -<p class="level2"> -<p class="level1"><a name="CURLFTPMETHODMULTICWD"></a><span class="nroffip">CURLFTPMETHOD_MULTICWD</span> -<p class="level2">libcurl does a single CWD operation for each path part in the given URL. For deep hierarchies this means many commands. This is how <a href="http://www.ietf.org/rfc/rfc1738.txt">RFC 1738</a> says it should be done. This is the default but the slowest behavior. -<p class="level1"><a name="CURLFTPMETHODNOCWD"></a><span class="nroffip">CURLFTPMETHOD_NOCWD</span> -<p class="level2">libcurl does no CWD at all. libcurl will do SIZE, RETR, STOR etc and give a full path to the server for all these commands. This is the fastest behavior. -<p class="level1"><a name="CURLFTPMETHODSINGLECWD"></a><span class="nroffip">CURLFTPMETHOD_SINGLECWD</span> -<p class="level2">libcurl does one CWD with the full target directory and then operates on the file "normally" (like in the multicwd case). This is somewhat more standards compliant than 'nocwd' but without the full penalty of 'multicwd'. -<p class="level1">(Added in 7.15.1) <a name="RTSP"></a><h2 class="nroffsh">RTSP OPTIONS</h2> -<p class="level0"> -<p class="level0"><a name="CURLOPTRTSPREQUEST"></a><span class="nroffip">CURLOPT_RTSP_REQUEST</span> -<p class="level1">Tell libcurl what kind of RTSP request to make. Pass one of the following RTSP enum values. Unless noted otherwise, commands require the Session ID to be initialized. (Added in 7.20.0) -<p class="level2"> -<p class="level1"><a name="CURLRTSPREQOPTIONS"></a><span class="nroffip">CURL_RTSPREQ_OPTIONS</span> -<p class="level2">Used to retrieve the available methods of the server. The application is responsible for parsing and obeying the response. <span class="bold">(The session ID is not needed for this method.)</span> (Added in 7.20.0) -<p class="level1"><a name="CURLRTSPREQDESCRIBE"></a><span class="nroffip">CURL_RTSPREQ_DESCRIBE</span> -<p class="level2">Used to get the low level description of a stream. The application should note what formats it understands in the <span Class="emphasis">'Accept:'</span> header. Unless set manually, libcurl will automatically fill in <span class="emphasis">'Accept: application/sdp'</span>. Time-condition headers will be added to Describe requests if the <a class="emphasis" href="#CURLOPTTIMECONDITION">CURLOPT_TIMECONDITION</a> option is active. <span class="bold">(The session ID is not needed for this method)</span> (Added in 7.20.0) -<p class="level1"><a name="CURLRTSPREQANNOUNCE"></a><span class="nroffip">CURL_RTSPREQ_ANNOUNCE</span> -<p class="level2">When sent by a client, this method changes the description of the session. For example, if a client is using the server to record a meeting, the client can use Announce to inform the server of all the meta-information about the session. ANNOUNCE acts like a HTTP PUT or POST just like <a class="emphasis" href="#CURLRTSPREQSETPARAMETER">CURL_RTSPREQ_SET_PARAMETER</a> (Added in 7.20.0) -<p class="level1"><a name="CURLRTSPREQSETUP"></a><span class="nroffip">CURL_RTSPREQ_SETUP</span> -<p class="level2">Setup is used to initialize the transport layer for the session. The application must set the desired Transport options for a session by using the <a class="emphasis" href="#CURLOPTRTSPTRANSPORT">CURLOPT_RTSP_TRANSPORT</a> option prior to calling setup. If no session ID is currently set with <a class="emphasis" href="#CURLOPTRTSPSESSIONID">CURLOPT_RTSP_SESSION_ID</a>, libcurl will extract and use the session ID in the response to this request. <span class="bold">(The session ID is not needed for this method).</span> (Added in 7.20.0) -<p class="level1"><a name="CURLRTSPREQPLAY"></a><span class="nroffip">CURL_RTSPREQ_PLAY</span> -<p class="level2">Send a Play command to the server. Use the <a class="emphasis" href="#CURLOPTRANGE">CURLOPT_RANGE</a> option to modify the playback time (e.g. 'npt=10-15'). (Added in 7.20.0) -<p class="level1"><a name="CURLRTSPREQPAUSE"></a><span class="nroffip">CURL_RTSPREQ_PAUSE</span> -<p class="level2">Send a Pause command to the server. Use the <a class="emphasis" href="#CURLOPTRANGE">CURLOPT_RANGE</a> option with a single value to indicate when the stream should be halted. (e.g. npt='25') (Added in 7.20.0) -<p class="level1"><a name="CURLRTSPREQTEARDOWN"></a><span class="nroffip">CURL_RTSPREQ_TEARDOWN</span> -<p class="level2">This command terminates an RTSP session. Simply closing a connection does not terminate the RTSP session since it is valid to control an RTSP session over different connections. (Added in 7.20.0) -<p class="level1"><a name="CURLRTSPREQGETPARAMETER"></a><span class="nroffip">CURL_RTSPREQ_GET_PARAMETER</span> -<p class="level2">Retrieve a parameter from the server. By default, libcurl will automatically include a <span Class="emphasis">Content-Type: text/parameters</span> header on all non-empty requests unless a custom one is set. GET_PARAMETER acts just like a HTTP PUT or POST (see <a class="emphasis" href="#CURLRTSPREQSETPARAMETER">CURL_RTSPREQ_SET_PARAMETER</a>). Applications wishing to send a heartbeat message (e.g. in the presence of a server-specified timeout) should send use an empty GET_PARAMETER request. (Added in 7.20.0) -<p class="level1"><a name="CURLRTSPREQSETPARAMETER"></a><span class="nroffip">CURL_RTSPREQ_SET_PARAMETER</span> -<p class="level2">Set a parameter on the server. By default, libcurl will automatically include a <span Class="emphasis">Content-Type: text/parameters</span> header unless a custom one is set. The interaction with SET_PARAMTER is much like a HTTP PUT or POST. An application may either use <a class="emphasis" href="#CURLOPTUPLOAD">CURLOPT_UPLOAD</a> with <a class="emphasis" href="#CURLOPTREADDATA">CURLOPT_READDATA</a> like a HTTP PUT, or it may use <a class="emphasis" href="#CURLOPTPOSTFIELDS">CURLOPT_POSTFIELDS</a> like a HTTP POST. No chunked transfers are allowed, so the application must set the <a class="emphasis" href="#CURLOPTINFILESIZE">CURLOPT_INFILESIZE</a> in the former and <a class="emphasis" href="#CURLOPTPOSTFIELDSIZE">CURLOPT_POSTFIELDSIZE</a> in the latter. Also, there is no use of multi-part POSTs within RTSP. (Added in 7.20.0) -<p class="level1"><a name="CURLRTSPREQRECORD"></a><span class="nroffip">CURL_RTSPREQ_RECORD</span> -<p class="level2">Used to tell the server to record a session. Use the <a class="emphasis" href="#CURLOPTRANGE">CURLOPT_RANGE</a> option to modify the record time. (Added in 7.20.0) -<p class="level1"><a name="CURLRTSPREQRECEIVE"></a><span class="nroffip">CURL_RTSPREQ_RECEIVE</span> -<p class="level2">This is a special request because it does not send any data to the server. The application may call this function in order to receive interleaved RTP data. It will return after processing one read buffer of data in order to give the application a chance to run. (Added in 7.20.0) -<p class="level1"> -<p class="level0"><a name="CURLOPTRTSPSESSIONID"></a><span class="nroffip">CURLOPT_RTSP_SESSION_ID</span> -<p class="level1">Pass a char * as a parameter to set the value of the current RTSP Session ID for the handle. Useful for resuming an in-progress session. Once this value is set to any non-NULL value, libcurl will return <span Class="emphasis">CURLE_RTSP_SESSION_ERROR</span> if ID received from the server does not match. If unset (or set to NULL), libcurl will automatically set the ID the first time the server sets it in a response. (Added in 7.20.0) -<p class="level0"><a name="CURLOPTRTSPSTREAMURI"></a><span class="nroffip">CURLOPT_RTSP_STREAM_URI</span> -<p class="level1">Set the stream URI to operate on by passing a char * . For example, a single session may be controlling <span Class="emphasis">rtsp://foo/twister/audio</span> and <span Class="emphasis">rtsp://foo/twister/video</span> and the application can switch to the appropriate stream using this option. If unset, libcurl will default to operating on generic server options by passing '*' in the place of the RTSP Stream URI. This option is distinct from <a class="emphasis" href="#CURLOPTURL">CURLOPT_URL</a>. When working with RTSP, the <span Class="emphasis">CURLOPT_STREAM_URI</span> indicates what URL to send to the server in the request header while the <a class="emphasis" href="#CURLOPTURL">CURLOPT_URL</a> indicates where to make the connection to. (e.g. the <a class="emphasis" href="#CURLOPTURL">CURLOPT_URL</a> for the above examples might be set to <span Class="emphasis">rtsp://foo/twister</span> (Added in 7.20.0) -<p class="level0"><a name="CURLOPTRTSPTRANSPORT"></a><span class="nroffip">CURLOPT_RTSP_TRANSPORT</span> -<p class="level1">Pass a char * to tell libcurl what to pass for the Transport: header for this RTSP session. This is mainly a convenience method to avoid needing to set a custom Transport: header for every SETUP request. The application must set a Transport: header before issuing a SETUP request. (Added in 7.20.0) -<p class="level0"><a name="CURLOPTRTSPHEADER"></a><span class="nroffip">CURLOPT_RTSP_HEADER</span> -<p class="level1">This option is simply an alias for <a class="emphasis" href="#CURLOPTHTTPHEADER">CURLOPT_HTTP_HEADER</a>. Use this to replace the standard headers that RTSP and HTTP share. It is also valid to use the shortcuts such as <a class="emphasis" href="#CURLOPTUSERAGENT">CURLOPT_USERAGENT</a>. (Added in 7.20.0) -<p class="level0"><a name="CURLOPTRTSPCLIENTCSEQ"></a><span class="nroffip">CURLOPT_RTSP_CLIENT_CSEQ</span> -<p class="level1">Manually set the the CSEQ number to issue for the next RTSP request. Useful if the application is resuming a previously broken connection. The CSEQ will increment from this new number henceforth. (Added in 7.20.0) -<p class="level0"><a name="CURLOPTRTSPSERVERCSEQ"></a><span class="nroffip">CURLOPT_RTSP_SERVER_CSEQ</span> -<p class="level1">Manually set the CSEQ number to expect for the next RTSP Server->Client request. At the moment, this feature (listening for Server requests) is unimplemented. (Added in 7.20.0) <a name="PROTOCOL"></a><h2 class="nroffsh">PROTOCOL OPTIONS</h2> -<p class="level0"> -<p class="level0"><a name="CURLOPTTRANSFERTEXT"></a><span class="nroffip">CURLOPT_TRANSFERTEXT</span> -<p class="level1">A parameter set to 1 tells the library to use ASCII mode for FTP transfers, instead of the default binary transfer. For win32 systems it does not set the stdout to binary mode. This option can be usable when transferring text data between systems with different views on certain characters, such as newlines or similar. -<p class="level1">libcurl does not do a complete ASCII conversion when doing ASCII transfers over FTP. This is a known limitation/flaw that nobody has rectified. libcurl simply sets the mode to ASCII and performs a standard transfer. -<p class="level0"><a name="CURLOPTPROXYTRANSFERMODE"></a><span class="nroffip">CURLOPT_PROXY_TRANSFER_MODE</span> -<p class="level1">Pass a long. If the value is set to 1 (one), it tells libcurl to set the transfer mode (binary or ASCII) for FTP transfers done via a HTTP proxy, by appending ;type=a or ;type=i to the URL. Without this setting, or it being set to 0 (zero, the default), <a class="emphasis" href="#CURLOPTTRANSFERTEXT">CURLOPT_TRANSFERTEXT</a> has no effect when doing FTP via a proxy. Beware that not all proxies support this feature. (Added in 7.18.0) -<p class="level0"><a name="CURLOPTCRLF"></a><span class="nroffip">CURLOPT_CRLF</span> -<p class="level1">Pass a long. If the value is set to 1 (one), libcurl converts Unix newlines to CRLF newlines on transfers. Disable this option again by setting the value to 0 (zero). -<p class="level0"><a name="CURLOPTRANGE"></a><span class="nroffip">CURLOPT_RANGE</span> -<p class="level1">Pass a char * as parameter, which should contain the specified range you want. It should be in the format "X-Y", where X or Y may be left out. HTTP transfers also support several intervals, separated with commas as in <span Class="emphasis">"X-Y,N-M"</span>. Using this kind of multiple intervals will cause the HTTP server to send the response document in pieces (using standard MIME separation techniques). For RTSP, the formatting of a range should follow <a href="http://www.ietf.org/rfc/rfc2326.txt">RFC 2326</a> Section 12.29. For RTSP, byte ranges are <span Class="bold">not</span> permitted. Instead, ranges should be given in npt, utc, or smpte formats. -<p class="level1">Pass a NULL to this option to disable the use of ranges. -<p class="level1">Ranges work on HTTP, FTP, FILE (since 7.18.0), and RTSP (since 7.20.0) transfers only. -<p class="level0"><a name="CURLOPTRESUMEFROM"></a><span class="nroffip">CURLOPT_RESUME_FROM</span> -<p class="level1">Pass a long as parameter. It contains the offset in number of bytes that you want the transfer to start from. Set this option to 0 to make the transfer start from the beginning (effectively disabling resume). For FTP, set this option to -1 to make the transfer start from the end of the target file (useful to continue an interrupted upload). -<p class="level1">When doing uploads with FTP, the resume position is where in the local/source file libcurl should try to resume the upload from and it will then append the source file to the remote target file. -<p class="level0"><a name="CURLOPTRESUMEFROMLARGE"></a><span class="nroffip">CURLOPT_RESUME_FROM_LARGE</span> -<p class="level1">Pass a curl_off_t as parameter. It contains the offset in number of bytes that you want the transfer to start from. (Added in 7.11.0) -<p class="level0"><a name="CURLOPTCUSTOMREQUEST"></a><span class="nroffip">CURLOPT_CUSTOMREQUEST</span> -<p class="level1">Pass a pointer to a zero terminated string as parameter. It can be used to specify the request instead of GET or HEAD when performing HTTP based requests, instead of LIST and NLST when performing FTP directory listings and instead of LIST and RETR when issuing POP3 based commands. This is particularly useful, for example, for performing a HTTP DELETE request or a POP3 DELE command. -<p class="level1">Please don't perform this at will, on HTTP based requests, by making sure your server supports the command you are sending first. -<p class="level1">When you change the request method by setting <a class="bold" href="#CURLOPTCUSTOMREQUEST">CURLOPT_CUSTOMREQUEST</a> to something, you don't actually change how libcurl behaves or acts in regards to the particular request method, it will only change the actual string sent in the request. -<p class="level1">For example: -<p class="level1">With the HTTP protocol when you tell libcurl to do a HEAD request, but then specify a GET though a custom request libcurl will still act as if it sent a HEAD. To switch to a proper HEAD use <a class="emphasis" href="#CURLOPTNOBODY">CURLOPT_NOBODY</a>, to switch to a proper POST use <a class="emphasis" href="#CURLOPTPOST">CURLOPT_POST</a> or <a class="emphasis" href="#CURLOPTPOSTFIELDS">CURLOPT_POSTFIELDS</a> and to switch to a proper GET use CURLOPT_HTTPGET. -<p class="level1">With the POP3 protocol when you tell libcurl to use a custom request it will behave like a LIST or RETR command was sent where it expects data to be returned by the server. As such <a class="emphasis" href="#CURLOPTNOBODY">CURLOPT_NOBODY</a> should be used when specifying commands such as DELE and NOOP for example. -<p class="level1">Restore to the internal default by setting this to NULL. -<p class="level1">Many people have wrongly used this option to replace the entire request with their own, including multiple headers and POST contents. While that might work in many cases, it will cause libcurl to send invalid requests and it could possibly confuse the remote server badly. Use <a class="emphasis" href="#CURLOPTPOST">CURLOPT_POST</a> and <a class="emphasis" href="#CURLOPTPOSTFIELDS">CURLOPT_POSTFIELDS</a> to set POST data. Use <a class="emphasis" href="#CURLOPTHTTPHEADER">CURLOPT_HTTPHEADER</a> to replace or extend the set of headers sent by libcurl. Use <a class="emphasis" href="#CURLOPTHTTPVERSION">CURLOPT_HTTP_VERSION</a> to change HTTP version. -<p class="level1">(Support for POP3 added in 7.26.0) -<p class="level0"><a name="CURLOPTFILETIME"></a><span class="nroffip">CURLOPT_FILETIME</span> -<p class="level1">Pass a long. If it is 1, libcurl will attempt to get the modification date of the remote document in this operation. This requires that the remote server sends the time or replies to a time querying command. The <a class="emphasis" href="./curl_easy_getinfo.html">curl_easy_getinfo(3)</a> function with the <span Class="emphasis">CURLINFO_FILETIME</span> argument can be used after a transfer to extract the received time (if any). -<p class="level0"><a name="CURLOPTNOBODY"></a><span class="nroffip">CURLOPT_NOBODY</span> -<p class="level1">A parameter set to 1 tells the library to not include the body-part in the output. This is only relevant for protocols that have separate header and body parts. On HTTP(S) servers, this will make libcurl do a HEAD request. -<p class="level1">To change request to GET, you should use <a class="emphasis" href="#CURLOPTHTTPGET">CURLOPT_HTTPGET</a>. Change request to POST with <a class="emphasis" href="#CURLOPTPOST">CURLOPT_POST</a> etc. -<p class="level0"><a name="CURLOPTINFILESIZE"></a><span class="nroffip">CURLOPT_INFILESIZE</span> -<p class="level1">When uploading a file to a remote site, this option should be used to tell libcurl what the expected size of the infile is. This value should be passed as a long. See also <a class="emphasis" href="#CURLOPTINFILESIZELARGE">CURLOPT_INFILESIZE_LARGE</a>. -<p class="level1">For uploading using SCP, this option or <a class="emphasis" href="#CURLOPTINFILESIZELARGE">CURLOPT_INFILESIZE_LARGE</a> is mandatory. -<p class="level1">When sending emails using SMTP, this command can be used to specify the optional SIZE parameter for the MAIL FROM command. (Added in 7.23.0) -<p class="level1">This option does not limit how much data libcurl will actually send, as that is controlled entirely by what the read callback returns. -<p class="level0"><a name="CURLOPTINFILESIZELARGE"></a><span class="nroffip">CURLOPT_INFILESIZE_LARGE</span> -<p class="level1">When uploading a file to a remote site, this option should be used to tell libcurl what the expected size of the infile is. This value should be passed as a curl_off_t. (Added in 7.11.0) -<p class="level1">For uploading using SCP, this option or <a class="emphasis" href="#CURLOPTINFILESIZE">CURLOPT_INFILESIZE</a> is mandatory. -<p class="level1">This option does not limit how much data libcurl will actually send, as that is controlled entirely by what the read callback returns. -<p class="level0"><a name="CURLOPTUPLOAD"></a><span class="nroffip">CURLOPT_UPLOAD</span> -<p class="level1">A parameter set to 1 tells the library to prepare for an upload. The <a class="emphasis" href="#CURLOPTREADDATA">CURLOPT_READDATA</a> and <a class="emphasis" href="#CURLOPTINFILESIZE">CURLOPT_INFILESIZE</a> or <a class="emphasis" href="#CURLOPTINFILESIZELARGE">CURLOPT_INFILESIZE_LARGE</a> options are also interesting for uploads. If the protocol is HTTP, uploading means using the PUT request unless you tell libcurl otherwise. -<p class="level1">Using PUT with HTTP 1.1 implies the use of a "Expect: 100-continue" header. You can disable this header with <a class="emphasis" href="#CURLOPTHTTPHEADER">CURLOPT_HTTPHEADER</a> as usual. -<p class="level1">If you use PUT to a HTTP 1.1 server, you can upload data without knowing the size before starting the transfer if you use chunked encoding. You enable this by adding a header like "Transfer-Encoding: chunked" with <a class="emphasis" href="#CURLOPTHTTPHEADER">CURLOPT_HTTPHEADER</a>. With HTTP 1.0 or without chunked transfer, you must specify the size. -<p class="level0"><a name="CURLOPTMAXFILESIZE"></a><span class="nroffip">CURLOPT_MAXFILESIZE</span> -<p class="level1">Pass a long as parameter. This allows you to specify the maximum size (in bytes) of a file to download. If the file requested is larger than this value, the transfer will not start and CURLE_FILESIZE_EXCEEDED will be returned. -<p class="level1">The file size is not always known prior to download, and for such files this option has no effect even if the file transfer ends up being larger than this given limit. This concerns both FTP and HTTP transfers. -<p class="level0"><a name="CURLOPTMAXFILESIZELARGE"></a><span class="nroffip">CURLOPT_MAXFILESIZE_LARGE</span> -<p class="level1">Pass a curl_off_t as parameter. This allows you to specify the maximum size (in bytes) of a file to download. If the file requested is larger than this value, the transfer will not start and <span Class="emphasis">CURLE_FILESIZE_EXCEEDED</span> will be returned. (Added in 7.11.0) -<p class="level1">The file size is not always known prior to download, and for such files this option has no effect even if the file transfer ends up being larger than this given limit. This concerns both FTP and HTTP transfers. -<p class="level0"><a name="CURLOPTTIMECONDITION"></a><span class="nroffip">CURLOPT_TIMECONDITION</span> -<p class="level1">Pass a long as parameter. This defines how the <a class="emphasis" href="#CURLOPTTIMEVALUE">CURLOPT_TIMEVALUE</a> time value is treated. You can set this parameter to <span Class="emphasis">CURL_TIMECOND_IFMODSINCE</span> or <span Class="emphasis">CURL_TIMECOND_IFUNMODSINCE</span>. This feature applies to HTTP, FTP, RTSP, and FILE. -<p class="level1">The last modification time of a file is not always known and in such instances this feature will have no effect even if the given time condition would not have been met. <a class="emphasis" href="./curl_easy_getinfo.html">curl_easy_getinfo(3)</a> with the <span Class="emphasis">CURLINFO_CONDITION_UNMET</span> option can be used after a transfer to learn if a zero-byte successful "transfer" was due to this condition not matching. -<p class="level0"><a name="CURLOPTTIMEVALUE"></a><span class="nroffip">CURLOPT_TIMEVALUE</span> -<p class="level1">Pass a long as parameter. This should be the time in seconds since 1 Jan 1970, and the time will be used in a condition as specified with <a class="emphasis" href="#CURLOPTTIMECONDITION">CURLOPT_TIMECONDITION</a>. <a name="CONNECTION"></a><h2 class="nroffsh">CONNECTION OPTIONS</h2> -<p class="level0"> -<p class="level0"><a name="CURLOPTTIMEOUT"></a><span class="nroffip">CURLOPT_TIMEOUT</span> -<p class="level1">Pass a long as parameter containing the maximum time in seconds that you allow the libcurl transfer operation to take. Normally, name lookups can take a considerable time and limiting operations to less than a few minutes risk aborting perfectly normal operations. This option will cause curl to use the SIGALRM to enable time-outing system calls. -<p class="level1">In unix-like systems, this might cause signals to be used unless <a class="emphasis" href="#CURLOPTNOSIGNAL">CURLOPT_NOSIGNAL</a> is set. -<p class="level1">Default timeout is 0 (zero) which means it never times out. -<p class="level0"><a name="CURLOPTTIMEOUTMS"></a><span class="nroffip">CURLOPT_TIMEOUT_MS</span> -<p class="level1">Like <a class="emphasis" href="#CURLOPTTIMEOUT">CURLOPT_TIMEOUT</a> but takes number of milliseconds instead. If libcurl is built to use the standard system name resolver, that portion of the transfer will still use full-second resolution for timeouts with a minimum timeout allowed of one second. (Added in 7.16.2) -<p class="level0"><a name="CURLOPTLOWSPEEDLIMIT"></a><span class="nroffip">CURLOPT_LOW_SPEED_LIMIT</span> -<p class="level1">Pass a long as parameter. It contains the transfer speed in bytes per second that the transfer should be below during <a class="emphasis" href="#CURLOPTLOWSPEEDTIME">CURLOPT_LOW_SPEED_TIME</a> seconds for the library to consider it too slow and abort. -<p class="level0"><a name="CURLOPTLOWSPEEDTIME"></a><span class="nroffip">CURLOPT_LOW_SPEED_TIME</span> -<p class="level1">Pass a long as parameter. It contains the time in seconds that the transfer should be below the <a class="emphasis" href="#CURLOPTLOWSPEEDLIMIT">CURLOPT_LOW_SPEED_LIMIT</a> for the library to consider it too slow and abort. -<p class="level0"><a name="CURLOPTMAXSENDSPEEDLARGE"></a><span class="nroffip">CURLOPT_MAX_SEND_SPEED_LARGE</span> -<p class="level1">Pass a curl_off_t as parameter. If an upload exceeds this speed (counted in bytes per second) on cumulative average during the transfer, the transfer will pause to keep the average rate less than or equal to the parameter value. Defaults to unlimited speed. (Added in 7.15.5) -<p class="level0"><a name="CURLOPTMAXRECVSPEEDLARGE"></a><span class="nroffip">CURLOPT_MAX_RECV_SPEED_LARGE</span> -<p class="level1">Pass a curl_off_t as parameter. If a download exceeds this speed (counted in bytes per second) on cumulative average during the transfer, the transfer will pause to keep the average rate less than or equal to the parameter value. Defaults to unlimited speed. (Added in 7.15.5) -<p class="level0"><a name="CURLOPTMAXCONNECTS"></a><span class="nroffip">CURLOPT_MAXCONNECTS</span> -<p class="level1">Pass a long. The set number will be the persistent connection cache size. The set amount will be the maximum amount of simultaneously open connections that libcurl may cache in this easy handle. Default is 5, and there isn't much point in changing this value unless you are perfectly aware of how this works and changes libcurl's behaviour. This concerns connections using any of the protocols that support persistent connections. -<p class="level1">When reaching the maximum limit, curl closes the oldest one in the cache to prevent increasing the number of open connections. -<p class="level1">If you already have performed transfers with this curl handle, setting a smaller MAXCONNECTS than before may cause open connections to get closed unnecessarily. -<p class="level1">If you add this easy handle to a multi handle, this setting is not acknowledged, and you must instead use <a class="emphasis" href="./curl_multi_setopt.html">curl_multi_setopt(3)</a> and the <span Class="emphasis">CURLMOPT_MAXCONNECTS</span> option. -<p class="level0"><a name="CURLOPTCLOSEPOLICY"></a><span class="nroffip">CURLOPT_CLOSEPOLICY</span> -<p class="level1">(Obsolete) This option does nothing. -<p class="level0"><a name="CURLOPTFRESHCONNECT"></a><span class="nroffip">CURLOPT_FRESH_CONNECT</span> -<p class="level1">Pass a long. Set to 1 to make the next transfer use a new (fresh) connection by force. If the connection cache is full before this connection, one of the existing connections will be closed as according to the selected or default policy. This option should be used with caution and only if you understand what it does. Set this to 0 to have libcurl attempt re-using an existing connection (default behavior). -<p class="level0"><a name="CURLOPTFORBIDREUSE"></a><span class="nroffip">CURLOPT_FORBID_REUSE</span> -<p class="level1">Pass a long. Set to 1 to make the next transfer explicitly close the connection when done. Normally, libcurl keeps all connections alive when done with one transfer in case a succeeding one follows that can re-use them. This option should be used with caution and only if you understand what it does. Set to 0 to have libcurl keep the connection open for possible later re-use (default behavior). -<p class="level0"><a name="CURLOPTCONNECTTIMEOUT"></a><span class="nroffip">CURLOPT_CONNECTTIMEOUT</span> -<p class="level1">Pass a long. It should contain the maximum time in seconds that you allow the connection to the server to take. This only limits the connection phase, once it has connected, this option is of no more use. Set to zero to switch to the default built-in connection timeout - 300 seconds. See also the <a class="emphasis" href="#CURLOPTTIMEOUT">CURLOPT_TIMEOUT</a> option. -<p class="level1">In unix-like systems, this might cause signals to be used unless <a class="emphasis" href="#CURLOPTNOSIGNAL">CURLOPT_NOSIGNAL</a> is set. -<p class="level0"><a name="CURLOPTCONNECTTIMEOUTMS"></a><span class="nroffip">CURLOPT_CONNECTTIMEOUT_MS</span> -<p class="level1">Like <a class="emphasis" href="#CURLOPTCONNECTTIMEOUT">CURLOPT_CONNECTTIMEOUT</a> but takes the number of milliseconds instead. If libcurl is built to use the standard system name resolver, that portion of the connect will still use full-second resolution for timeouts with a minimum timeout allowed of one second. (Added in 7.16.2) -<p class="level0"><a name="CURLOPTIPRESOLVE"></a><span class="nroffip">CURLOPT_IPRESOLVE</span> -<p class="level1">Allows an application to select what kind of IP addresses to use when resolving host names. This is only interesting when using host names that resolve addresses using more than one version of IP. The allowed values are: -<p class="level2"> -<p class="level1"><a name="CURLIPRESOLVEWHATEVER"></a><span class="nroffip">CURL_IPRESOLVE_WHATEVER</span> -<p class="level2">Default, resolves addresses to all IP versions that your system allows. -<p class="level1"><a name="CURLIPRESOLVEV4"></a><span class="nroffip">CURL_IPRESOLVE_V4</span> -<p class="level2">Resolve to IPv4 addresses. -<p class="level1"><a name="CURLIPRESOLVEV6"></a><span class="nroffip">CURL_IPRESOLVE_V6</span> -<p class="level2">Resolve to IPv6 addresses. -<p class="level1"> -<p class="level0"><a name="CURLOPTCONNECTONLY"></a><span class="nroffip">CURLOPT_CONNECT_ONLY</span> -<p class="level1">Pass a long. If the parameter equals 1, it tells the library to perform all the required proxy authentication and connection setup, but no data transfer. This option is implemented for HTTP, SMTP and POP3. -<p class="level1">The option can be used to simply test a connection to a server, but is more useful when used with the <span Class="emphasis">CURLINFO_LASTSOCKET</span> option to <a class="emphasis" href="./curl_easy_getinfo.html">curl_easy_getinfo(3)</a> as the library can set up the connection and then the application can obtain the most recently used socket for special data transfers. (Added in 7.15.2) -<p class="level0"><a name="CURLOPTUSESSL"></a><span class="nroffip">CURLOPT_USE_SSL</span> -<p class="level1">Pass a long using one of the values from below, to make libcurl use your desired level of SSL for the transfer. (Added in 7.11.0) -<p class="level1">This is for enabling SSL/TLS when you use FTP, SMTP, POP3, IMAP etc. -<p class="level1">(This option was known as CURLOPT_FTP_SSL up to 7.16.4, and the constants were known as CURLFTPSSL_*) -<p class="level2"> -<p class="level1"><a name="CURLUSESSLNONE"></a><span class="nroffip">CURLUSESSL_NONE</span> -<p class="level2">Don't attempt to use SSL. -<p class="level1"><a name="CURLUSESSLTRY"></a><span class="nroffip">CURLUSESSL_TRY</span> -<p class="level2">Try using SSL, proceed as normal otherwise. -<p class="level1"><a name="CURLUSESSLCONTROL"></a><span class="nroffip">CURLUSESSL_CONTROL</span> -<p class="level2">Require SSL for the control connection or fail with <span Class="emphasis">CURLE_USE_SSL_FAILED</span>. -<p class="level1"><a name="CURLUSESSLALL"></a><span class="nroffip">CURLUSESSL_ALL</span> -<p class="level2">Require SSL for all communication or fail with <span Class="emphasis">CURLE_USE_SSL_FAILED</span>. -<p class="level1"> -<p class="level0"><a name="CURLOPTRESOLVE"></a><span class="nroffip">CURLOPT_RESOLVE</span> -<p class="level1">Pass a pointer to a linked list of strings with host name resolve information to use for requests with this handle. The linked list should be a fully valid list of <span Class="bold">struct curl_slist</span> structs properly filled in. Use <a class="emphasis" href="./curl_slist_append.html">curl_slist_append(3)</a> to create the list and <a class="emphasis" href="./curl_slist_free_all.html">curl_slist_free_all(3)</a> to clean up an entire list. -<p class="level1">Each single name resolve string should be written using the format HOST:PORT:ADDRESS where HOST is the name libcurl will try to resolve, PORT is the port number of the service where libcurl wants to connect to the HOST and ADDRESS is the numerical IP address. If libcurl is built to support IPv6, ADDRESS can of course be either IPv4 or IPv6 style addressing. -<p class="level1">This option effectively pre-populates the DNS cache with entries for the host+port pair so redirects and everything that operations against the HOST+PORT will instead use your provided ADDRESS. -<p class="level1">You can remove names from the DNS cache again, to stop providing these fake resolves, by including a string in the linked list that uses the format "-HOST:PORT". The host name must be prefixed with a dash, and the host name and port number must exactly match what was already added previously. -<p class="level1">(Added in 7.21.3) -<p class="level0"><a name="CURLOPTDNSSERVERS"></a><span class="nroffip">CURLOPT_DNS_SERVERS</span> -<p class="level1">Set the list of DNS servers to be used instead of the system default. The format of the dns servers option is: -<p class="level1">host[:port][,host[:port]]... -<p class="level1">For example: -<p class="level1">192.168.1.100,192.168.1.101,3.4.5.6 -<p class="level1">This option requires that libcurl was built with a resolver backend that supports this operation. The c-ares backend is the only such one. -<p class="level1">(Added in 7.24.0) -<p class="level0"><a name="CURLOPTACCEPTTIMEOUTMS"></a><span class="nroffip">CURLOPT_ACCEPTTIMEOUT_MS</span> -<p class="level1">Pass a long telling libcurl the maximum number of milliseconds to wait for a server to connect back to libcurl when an active FTP connection is used. If no timeout is set, the internal default of 60000 will be used. (Added in 7.24.0) <a name="SSL"></a><h2 class="nroffsh">SSL and SECURITY OPTIONS</h2> -<p class="level0"> -<p class="level0"><a name="CURLOPTSSLCERT"></a><span class="nroffip">CURLOPT_SSLCERT</span> -<p class="level1">Pass a pointer to a zero terminated string as parameter. The string should be the file name of your certificate. The default format is "PEM" and can be changed with <a class="emphasis" href="#CURLOPTSSLCERTTYPE">CURLOPT_SSLCERTTYPE</a>. -<p class="level1">With NSS this can also be the nickname of the certificate you wish to authenticate with. If you want to use a file from the current directory, please precede it with "./" prefix, in order to avoid confusion with a nickname. -<p class="level0"><a name="CURLOPTSSLCERTTYPE"></a><span class="nroffip">CURLOPT_SSLCERTTYPE</span> -<p class="level1">Pass a pointer to a zero terminated string as parameter. The string should be the format of your certificate. Supported formats are "PEM" and "DER". (Added in 7.9.3) -<p class="level0"><a name="CURLOPTSSLKEY"></a><span class="nroffip">CURLOPT_SSLKEY</span> -<p class="level1">Pass a pointer to a zero terminated string as parameter. The string should be the file name of your private key. The default format is "PEM" and can be changed with <a class="emphasis" href="#CURLOPTSSLKEYTYPE">CURLOPT_SSLKEYTYPE</a>. -<p class="level0"><a name="CURLOPTSSLKEYTYPE"></a><span class="nroffip">CURLOPT_SSLKEYTYPE</span> -<p class="level1">Pass a pointer to a zero terminated string as parameter. The string should be the format of your private key. Supported formats are "PEM", "DER" and "ENG". -<p class="level1">The format "ENG" enables you to load the private key from a crypto engine. In this case <a class="emphasis" href="#CURLOPTSSLKEY">CURLOPT_SSLKEY</a> is used as an identifier passed to the engine. You have to set the crypto engine with <a class="emphasis" href="#CURLOPTSSLENGINE">CURLOPT_SSLENGINE</a>. "DER" format key file currently does not work because of a bug in OpenSSL. -<p class="level0"><a name="CURLOPTKEYPASSWD"></a><span class="nroffip">CURLOPT_KEYPASSWD</span> -<p class="level1">Pass a pointer to a zero terminated string as parameter. It will be used as the password required to use the <a class="emphasis" href="#CURLOPTSSLKEY">CURLOPT_SSLKEY</a> or <a class="emphasis" href="#CURLOPTSSHPRIVATEKEYFILE">CURLOPT_SSH_PRIVATE_KEYFILE</a> private key. You never needed a pass phrase to load a certificate but you need one to load your private key. -<p class="level1">(This option was known as CURLOPT_SSLKEYPASSWD up to 7.16.4 and CURLOPT_SSLCERTPASSWD up to 7.9.2) -<p class="level0"><a name="CURLOPTSSLENGINE"></a><span class="nroffip">CURLOPT_SSLENGINE</span> -<p class="level1">Pass a pointer to a zero terminated string as parameter. It will be used as the identifier for the crypto engine you want to use for your private key. -<p class="level1">If the crypto device cannot be loaded, <span Class="emphasis">CURLE_SSL_ENGINE_NOTFOUND</span> is returned. -<p class="level0"><a name="CURLOPTSSLENGINEDEFAULT"></a><span class="nroffip">CURLOPT_SSLENGINE_DEFAULT</span> -<p class="level1">Sets the actual crypto engine as the default for (asymmetric) crypto operations. -<p class="level1">If the crypto device cannot be set, <span Class="emphasis">CURLE_SSL_ENGINE_SETFAILED</span> is returned. -<p class="level1">Even though this option doesn't need any parameter, in some configurations <span Class="emphasis">curl_easy_setopt</span> might be defined as a macro taking exactly three arguments. Therefore, it's recommended to pass 1 as parameter to this option. -<p class="level0"><a name="CURLOPTSSLVERSION"></a><span class="nroffip">CURLOPT_SSLVERSION</span> -<p class="level1">Pass a long as parameter to control what version of SSL/TLS to attempt to use. The available options are: -<p class="level2"> -<p class="level1"><a name="CURLSSLVERSIONDEFAULT"></a><span class="nroffip">CURL_SSLVERSION_DEFAULT</span> -<p class="level2">The default action. This will attempt to figure out the remote SSL protocol version, i.e. either SSLv3 or TLSv1 (but not SSLv2, which became disabled by default with 7.18.1). -<p class="level1"><a name="CURLSSLVERSIONTLSv1"></a><span class="nroffip">CURL_SSLVERSION_TLSv1</span> -<p class="level2">Force TLSv1 -<p class="level1"><a name="CURLSSLVERSIONSSLv2"></a><span class="nroffip">CURL_SSLVERSION_SSLv2</span> -<p class="level2">Force SSLv2 -<p class="level1"><a name="CURLSSLVERSIONSSLv3"></a><span class="nroffip">CURL_SSLVERSION_SSLv3</span> -<p class="level2">Force SSLv3 -<p class="level1"> -<p class="level0"><a name="CURLOPTSSLVERIFYPEER"></a><span class="nroffip">CURLOPT_SSL_VERIFYPEER</span> -<p class="level1">Pass a long as parameter. By default, curl assumes a value of 1. -<p class="level1">This option determines whether curl verifies the authenticity of the peer's certificate. A value of 1 means curl verifies; 0 (zero) means it doesn't. -<p class="level1">When negotiating a SSL connection, the server sends a certificate indicating its identity. Curl verifies whether the certificate is authentic, i.e. that you can trust that the server is who the certificate says it is. This trust is based on a chain of digital signatures, rooted in certification authority (CA) certificates you supply. curl uses a default bundle of CA certificates (the path for that is determined at build time) and you can specify alternate certificates with the <a class="emphasis" href="#CURLOPTCAINFO">CURLOPT_CAINFO</a> option or the <a class="emphasis" href="#CURLOPTCAPATH">CURLOPT_CAPATH</a> option. -<p class="level1">When <a class="emphasis" href="#CURLOPTSSLVERIFYPEER">CURLOPT_SSL_VERIFYPEER</a> is nonzero, and the verification fails to prove that the certificate is authentic, the connection fails. When the option is zero, the peer certificate verification succeeds regardless. -<p class="level1">Authenticating the certificate is not by itself very useful. You typically want to ensure that the server, as authentically identified by its certificate, is the server you mean to be talking to. Use <a class="emphasis" href="#CURLOPTSSLVERIFYHOST">CURLOPT_SSL_VERIFYHOST</a> to control that. The check that the host name in the certificate is valid for the host name you're connecting to is done independently of the <a class="emphasis" href="#CURLOPTSSLVERIFYPEER">CURLOPT_SSL_VERIFYPEER</a> option. -<p class="level0"><a name="CURLOPTCAINFO"></a><span class="nroffip">CURLOPT_CAINFO</span> -<p class="level1">Pass a char * to a zero terminated string naming a file holding one or more certificates to verify the peer with. This makes sense only when used in combination with the <a class="emphasis" href="#CURLOPTSSLVERIFYPEER">CURLOPT_SSL_VERIFYPEER</a> option. If <a class="emphasis" href="#CURLOPTSSLVERIFYPEER">CURLOPT_SSL_VERIFYPEER</a> is zero, <a class="emphasis" href="#CURLOPTCAINFO">CURLOPT_CAINFO</a> need not even indicate an accessible file. -<p class="level1">This option is by default set to the system path where libcurl's cacert bundle is assumed to be stored, as established at build time. -<p class="level1">If curl is built against the NSS SSL library, the NSS PEM PKCS#11 module (libnsspem.so) needs to be available for this option to work properly. -<p class="level0"><a name="CURLOPTISSUERCERT"></a><span class="nroffip">CURLOPT_ISSUERCERT</span> -<p class="level1">Pass a char * to a zero terminated string naming a file holding a CA certificate in PEM format. If the option is set, an additional check against the peer certificate is performed to verify the issuer is indeed the one associated with the certificate provided by the option. This additional check is useful in multi-level PKI where one needs to enforce that the peer certificate is from a specific branch of the tree. -<p class="level1">This option makes sense only when used in combination with the <a class="emphasis" href="#CURLOPTSSLVERIFYPEER">CURLOPT_SSL_VERIFYPEER</a> option. Otherwise, the result of the check is not considered as failure. -<p class="level1">A specific error code (CURLE_SSL_ISSUER_ERROR) is defined with the option, which is returned if the setup of the SSL/TLS session has failed due to a mismatch with the issuer of peer certificate (<a class="emphasis" href="#CURLOPTSSLVERIFYPEER">CURLOPT_SSL_VERIFYPEER</a> has to be set too for the check to fail). (Added in 7.19.0) -<p class="level0"><a name="CURLOPTCAPATH"></a><span class="nroffip">CURLOPT_CAPATH</span> -<p class="level1">Pass a char * to a zero terminated string naming a directory holding multiple CA certificates to verify the peer with. If libcurl is built against OpenSSL, the certificate directory must be prepared using the openssl c_rehash utility. This makes sense only when used in combination with the <a class="emphasis" href="#CURLOPTSSLVERIFYPEER">CURLOPT_SSL_VERIFYPEER</a> option. If <a class="emphasis" href="#CURLOPTSSLVERIFYPEER">CURLOPT_SSL_VERIFYPEER</a> is zero, <a class="emphasis" href="#CURLOPTCAPATH">CURLOPT_CAPATH</a> need not even indicate an accessible path. The <a class="emphasis" href="#CURLOPTCAPATH">CURLOPT_CAPATH</a> function apparently does not work in Windows due to some limitation in openssl. This option is OpenSSL-specific and does nothing if libcurl is built to use GnuTLS. NSS-powered libcurl provides the option only for backward compatibility. -<p class="level0"><a name="CURLOPTCRLFILE"></a><span class="nroffip">CURLOPT_CRLFILE</span> -<p class="level1">Pass a char * to a zero terminated string naming a file with the concatenation of CRL (in PEM format) to use in the certificate validation that occurs during the SSL exchange. -<p class="level1">When curl is built to use NSS or GnuTLS, there is no way to influence the use of CRL passed to help in the verification process. When libcurl is built with OpenSSL support, X509_V_FLAG_CRL_CHECK and X509_V_FLAG_CRL_CHECK_ALL are both set, requiring CRL check against all the elements of the certificate chain if a CRL file is passed. -<p class="level1">This option makes sense only when used in combination with the <a class="emphasis" href="#CURLOPTSSLVERIFYPEER">CURLOPT_SSL_VERIFYPEER</a> option. -<p class="level1">A specific error code (CURLE_SSL_CRL_BADFILE) is defined with the option. It is returned when the SSL exchange fails because the CRL file cannot be loaded. A failure in certificate verification due to a revocation information found in the CRL does not trigger this specific error. (Added in 7.19.0) -<p class="level0"><a name="CURLOPTSSLVERIFYHOST"></a><span class="nroffip">CURLOPT_SSL_VERIFYHOST</span> -<p class="level1">Pass a long as parameter. -<p class="level1">This option determines whether libcurl verifies that the server cert is for the server it is known as. -<p class="level1">When negotiating a SSL connection, the server sends a certificate indicating its identity. -<p class="level1">When <a class="emphasis" href="#CURLOPTSSLVERIFYHOST">CURLOPT_SSL_VERIFYHOST</a> is 2, that certificate must indicate that the server is the server to which you meant to connect, or the connection fails. -<p class="level1">Curl considers the server the intended one when the Common Name field or a Subject Alternate Name field in the certificate matches the host name in the URL to which you told Curl to connect. -<p class="level1">When the value is 1, libcurl will return a failure. It was previously (in 7.28.0 and earlier) a debug option of some sorts, but it is no longer supported due to frequently leading to programmer mistakes. -<p class="level1">When the value is 0, the connection succeeds regardless of the names in the certificate. -<p class="level1">The default value for this option is 2. -<p class="level1">This option controls checking the server's certificate's claimed identity. The server could be lying. To control lying, see <a class="emphasis" href="#CURLOPTSSLVERIFYPEER">CURLOPT_SSL_VERIFYPEER</a>. If libcurl is built against NSS and <a class="emphasis" href="#CURLOPTSSLVERIFYPEER">CURLOPT_SSL_VERIFYPEER</a> is zero, <a class="emphasis" href="#CURLOPTSSLVERIFYHOST">CURLOPT_SSL_VERIFYHOST</a> is ignored. -<p class="level1"> -<p class="level0"><a name="CURLOPTCERTINFO"></a><span class="nroffip">CURLOPT_CERTINFO</span> -<p class="level1">Pass a long set to 1 to enable libcurl's certificate chain info gatherer. With this enabled, libcurl (if built with OpenSSL) will extract lots of information and data about the certificates in the certificate chain used in the SSL connection. This data is then possible to extract after a transfer using <a class="emphasis" href="./curl_easy_getinfo.html">curl_easy_getinfo(3)</a> and its option <span Class="emphasis">CURLINFO_CERTINFO</span>. (Added in 7.19.1) -<p class="level0"><a name="CURLOPTRANDOMFILE"></a><span class="nroffip">CURLOPT_RANDOM_FILE</span> -<p class="level1">Pass a char * to a zero terminated file name. The file will be used to read from to seed the random engine for SSL. The more random the specified file is, the more secure the SSL connection will become. -<p class="level0"><a name="CURLOPTEGDSOCKET"></a><span class="nroffip">CURLOPT_EGDSOCKET</span> -<p class="level1">Pass a char * to the zero terminated path name to the Entropy Gathering Daemon socket. It will be used to seed the random engine for SSL. -<p class="level0"><a name="CURLOPTSSLCIPHERLIST"></a><span class="nroffip">CURLOPT_SSL_CIPHER_LIST</span> -<p class="level1">Pass a char *, pointing to a zero terminated string holding the list of ciphers to use for the SSL connection. The list must be syntactically correct, it consists of one or more cipher strings separated by colons. Commas or spaces are also acceptable separators but colons are normally used, !, - and + can be used as operators. -<p class="level1">For OpenSSL and GnuTLS valid examples of cipher lists include 'RC4-SHA', ´SHA1+DES´, 'TLSv1' and 'DEFAULT'. The default list is normally set when you compile OpenSSL. -<p class="level1">You'll find more details about cipher lists on this URL: <span Class="emphasis"><a href="http://www.openssl.org/docs/apps/ciphers.html">http://www.openssl.org/docs/apps/ciphers.html</a></span> -<p class="level1">For NSS, valid examples of cipher lists include 'rsa_rc4_128_md5', ´rsa_aes_128_sha´, etc. With NSS you don't add/remove ciphers. If one uses this option then all known ciphers are disabled and only those passed in are enabled. -<p class="level1">You'll find more details about the NSS cipher lists on this URL: <span Class="emphasis"><a href="http://git.fedorahosted.org/cgit/mod_nss.git/plain/docs/mod_nss.html">http://git.fedorahosted.org/cgit/mod_nss.git/plain/docs/mod_nss.html</a>#Directives</span> -<p class="level1"> -<p class="level0"><a name="CURLOPTSSLSESSIONIDCACHE"></a><span class="nroffip">CURLOPT_SSL_SESSIONID_CACHE</span> -<p class="level1">Pass a long set to 0 to disable libcurl's use of SSL session-ID caching. Set this to 1 to enable it. By default all transfers are done using the cache. While nothing ever should get hurt by attempting to reuse SSL session-IDs, there seem to be broken SSL implementations in the wild that may require you to disable this in order for you to succeed. (Added in 7.16.0) -<p class="level0"><a name="CURLOPTSSLOPTIONS"></a><span class="nroffip">CURLOPT_SSL_OPTIONS</span> -<p class="level1">Pass a long with a bitmask to tell libcurl about specific SSL behaviors. -<p class="level1">CURLSSLOPT_ALLOW_BEAST is the only supported bit and by setting this the user will tell libcurl to not attempt to use any workarounds for a security flaw in the SSL3 and TLS1.0 protocols. If this option isn't used or this bit is set to 0, the SSL layer libcurl uses may use a work-around for this flaw although it might cause interoperability problems with some (older) SSL implementations. WARNING: avoiding this work-around loosens the security, and by setting this option to 1 you ask for exactly that. (Added in 7.25.0) -<p class="level0"><a name="CURLOPTKRBLEVEL"></a><span class="nroffip">CURLOPT_KRBLEVEL</span> -<p class="level1">Pass a char * as parameter. Set the kerberos security level for FTP; this also enables kerberos awareness. This is a string, 'clear', 'safe', 'confidential' or 'private'. If the string is set but doesn't match one of these, 'private' will be used. Set the string to NULL to disable kerberos support for FTP. -<p class="level1">(This option was known as CURLOPT_KRB4LEVEL up to 7.16.3) -<p class="level0"><a name="CURLOPTGSSAPIDELEGATION"></a><span class="nroffip">CURLOPT_GSSAPI_DELEGATION</span> -<p class="level1">Set the parameter to CURLGSSAPI_DELEGATION_FLAG to allow unconditional GSSAPI credential delegation. The delegation is disabled by default since 7.21.7. Set the parameter to CURLGSSAPI_DELEGATION_POLICY_FLAG to delegate only if the OK-AS-DELEGATE flag is set in the service ticket in case this feature is supported by the GSSAPI implementation and the definition of GSS_C_DELEG_POLICY_FLAG was available at compile-time. (Added in 7.22.0) <a name="SSH"></a><h2 class="nroffsh">SSH OPTIONS</h2> -<p class="level0"> -<p class="level0"><a name="CURLOPTSSHAUTHTYPES"></a><span class="nroffip">CURLOPT_SSH_AUTH_TYPES</span> -<p class="level1">Pass a long set to a bitmask consisting of one or more of CURLSSH_AUTH_PUBLICKEY, CURLSSH_AUTH_PASSWORD, CURLSSH_AUTH_HOST, CURLSSH_AUTH_KEYBOARD and CURLSSH_AUTH_AGENT. Set CURLSSH_AUTH_ANY to let libcurl pick a suitable one. Currently CURLSSH_AUTH_HOST has no effect. (Added in 7.16.1) If CURLSSH_AUTH_AGENT is used, libcurl attempts to connect to ssh-agent or pageant and let the agent attempt the authentication. (Added in 7.28.0) -<p class="level0"><a name="CURLOPTSSHHOSTPUBLICKEYMD5"></a><span class="nroffip">CURLOPT_SSH_HOST_PUBLIC_KEY_MD5</span> -<p class="level1">Pass a char * pointing to a string containing 32 hexadecimal digits. The string should be the 128 bit MD5 checksum of the remote host's public key, and libcurl will reject the connection to the host unless the md5sums match. This option is only for SCP and SFTP transfers. (Added in 7.17.1) -<p class="level0"><a name="CURLOPTSSHPUBLICKEYFILE"></a><span class="nroffip">CURLOPT_SSH_PUBLIC_KEYFILE</span> -<p class="level1">Pass a char * pointing to a file name for your public key. If not used, libcurl defaults to <span Class="bold">$HOME/.ssh/id_dsa.pub</span> if the HOME environment variable is set, and just "id_dsa.pub" in the current directory if HOME is not set. (Added in 7.16.1) If an empty string is passed, libcurl will pass no public key to libssh2 which then tries to compute it from the private key, this is known to work when libssh2 1.4.0+ is linked against OpenSSL. (Added in 7.26.0) -<p class="level0"><a name="CURLOPTSSHPRIVATEKEYFILE"></a><span class="nroffip">CURLOPT_SSH_PRIVATE_KEYFILE</span> -<p class="level1">Pass a char * pointing to a file name for your private key. If not used, libcurl defaults to <span Class="bold">$HOME/.ssh/id_dsa</span> if the HOME environment variable is set, and just "id_dsa" in the current directory if HOME is not set. If the file is password-protected, set the password with <a class="emphasis" href="#CURLOPTKEYPASSWD">CURLOPT_KEYPASSWD</a>. (Added in 7.16.1) -<p class="level0"><a name="CURLOPTSSHKNOWNHOSTS"></a><span class="nroffip">CURLOPT_SSH_KNOWNHOSTS</span> -<p class="level1">Pass a pointer to a zero terminated string holding the file name of the known_host file to use. The known_hosts file should use the OpenSSH file format as supported by libssh2. If this file is specified, libcurl will only accept connections with hosts that are known and present in that file, with a matching public key. Use <a class="emphasis" href="#CURLOPTSSHKEYFUNCTION">CURLOPT_SSH_KEYFUNCTION</a> to alter the default behavior on host and key (mis)matching. (Added in 7.19.6) -<p class="level0"><a name="CURLOPTSSHKEYFUNCTION"></a><span class="nroffip">CURLOPT_SSH_KEYFUNCTION</span> -<p class="level1">Pass a pointer to a curl_sshkeycallback function. It gets called when the known_host matching has been done, to allow the application to act and decide for libcurl how to proceed. The callback will only be called if <a class="emphasis" href="#CURLOPTSSHKNOWNHOSTS">CURLOPT_SSH_KNOWNHOSTS</a> is also set. -<p class="level1">The curl_sshkeycallback function gets passed the CURL handle, the key from the known_hosts file, the key from the remote site, info from libcurl on the matching status and a custom pointer (set with <a class="emphasis" href="#CURLOPTSSHKEYDATA">CURLOPT_SSH_KEYDATA</a>). It MUST return one of the following return codes to tell libcurl how to act: -<p class="level2"> -<p class="level1"><a name="CURLKHSTATFINEADDTOFILE"></a><span class="nroffip">CURLKHSTAT_FINE_ADD_TO_FILE</span> -<p class="level2">The host+key is accepted and libcurl will append it to the known_hosts file before continuing with the connection. This will also add the host+key combo to the known_host pool kept in memory if it wasn't already present there. The adding of data to the file is done by completely replacing the file with a new copy, so the permissions of the file must allow this. -<p class="level1"><a name="CURLKHSTATFINE"></a><span class="nroffip">CURLKHSTAT_FINE</span> -<p class="level2">The host+key is accepted libcurl will continue with the connection. This will also add the host+key combo to the known_host pool kept in memory if it wasn't already present there. -<p class="level1"><a name="CURLKHSTATREJECT"></a><span class="nroffip">CURLKHSTAT_REJECT</span> -<p class="level2">The host+key is rejected. libcurl will deny the connection to continue and it will be closed. -<p class="level1"><a name="CURLKHSTATDEFER"></a><span class="nroffip">CURLKHSTAT_DEFER</span> -<p class="level2">The host+key is rejected, but the SSH connection is asked to be kept alive. This feature could be used when the app wants to somehow return back and act on the host+key situation and then retry without needing the overhead of setting it up from scratch again. -<p class="level1"> (Added in 7.19.6) -<p class="level0"><a name="CURLOPTSSHKEYDATA"></a><span class="nroffip">CURLOPT_SSH_KEYDATA</span> -<p class="level1">Pass a void * as parameter. This pointer will be passed along verbatim to the callback set with <a class="emphasis" href="#CURLOPTSSHKEYFUNCTION">CURLOPT_SSH_KEYFUNCTION</a>. (Added in 7.19.6) <a name="OTHER"></a><h2 class="nroffsh">OTHER OPTIONS</h2> -<p class="level0"> -<p class="level0"><a name="CURLOPTPRIVATE"></a><span class="nroffip">CURLOPT_PRIVATE</span> -<p class="level1">Pass a void * as parameter, pointing to data that should be associated with this curl handle. The pointer can subsequently be retrieved using <a class="emphasis" href="./curl_easy_getinfo.html">curl_easy_getinfo(3)</a> with the CURLINFO_PRIVATE option. libcurl itself does nothing with this data. (Added in 7.10.3) -<p class="level0"><a name="CURLOPTSHARE"></a><span class="nroffip">CURLOPT_SHARE</span> -<p class="level1">Pass a share handle as a parameter. The share handle must have been created by a previous call to <a class="emphasis" href="./curl_share_init.html">curl_share_init(3)</a>. Setting this option, will make this curl handle use the data from the shared handle instead of keeping the data to itself. This enables several curl handles to share data. If the curl handles are used simultaneously in multiple threads, you <span Class="bold">MUST</span> use the locking methods in the share handle. See <a class="emphasis" href="./curl_share_setopt.html">curl_share_setopt(3)</a> for details. -<p class="level1">If you add a share that is set to share cookies, your easy handle will use that cookie cache and get the cookie engine enabled. If you unshare an object that was using cookies (or change to another object that doesn't share cookies), the easy handle will get its cookie engine disabled. -<p class="level1">Data that the share object is not set to share will be dealt with the usual way, as if no share was used. -<p class="level0"><a name="CURLOPTNEWFILEPERMS"></a><span class="nroffip">CURLOPT_NEW_FILE_PERMS</span> -<p class="level1">Pass a long as a parameter, containing the value of the permissions that will be assigned to newly created files on the remote server. The default value is <span Class="emphasis">0644</span>, but any valid value can be used. The only protocols that can use this are <span Class="emphasis">sftp://</span>, <span Class="emphasis">scp://</span>, and <span Class="emphasis">file://</span>. (Added in 7.16.4) -<p class="level0"><a name="CURLOPTNEWDIRECTORYPERMS"></a><span class="nroffip">CURLOPT_NEW_DIRECTORY_PERMS</span> -<p class="level1">Pass a long as a parameter, containing the value of the permissions that will be assigned to newly created directories on the remote server. The default value is <span Class="emphasis">0755</span>, but any valid value can be used. The only protocols that can use this are <span Class="emphasis">sftp://</span>, <span Class="emphasis">scp://</span>, and <span Class="emphasis">file://</span>. (Added in 7.16.4) <a name="TELNET"></a><h2 class="nroffsh">TELNET OPTIONS</h2> -<p class="level0"> -<p class="level0"><a name="CURLOPTTELNETOPTIONS"></a><span class="nroffip">CURLOPT_TELNETOPTIONS</span> -<p class="level1">Provide a pointer to a curl_slist with variables to pass to the telnet negotiations. The variables should be in the format <option=value>. libcurl supports the options 'TTYPE', 'XDISPLOC' and 'NEW_ENV'. See the TELNET standard for details. <a name="RETURN"></a><h2 class="nroffsh">RETURN VALUE</h2> -<p class="level0">CURLE_OK (zero) means that the option was set properly, non-zero means an error occurred as <span Class="emphasis"><curl/curl.h></span> defines. See the <span Class="emphasis">libcurl-errors(3)</span> man page for the full list with descriptions. -<p class="level0">If you try to set an option that libcurl doesn't know about, perhaps because the library is too old to support it or the option was removed in a recent version, this function will return <span Class="emphasis">CURLE_FAILED_INIT</span>. <a name="SEE"></a><h2 class="nroffsh">SEE ALSO</h2> -<p class="level0"><a class="manpage" href="./curl_easy_init.html">curl_easy_init (3)</a> <a class="manpage" href="./curl_easy_cleanup.html"> curl_easy_cleanup (3)</a> <a class="manpage" href="./curl_easy_reset.html"> curl_easy_reset (3)</a> <p class="roffit"> - This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>. -</body></html> diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_setopt.pdf b/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_setopt.pdf Binary files differdeleted file mode 100644 index 344916c108..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_setopt.pdf +++ /dev/null diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_strerror.3 b/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_strerror.3 deleted file mode 100644 index a26c9c5db6..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_strerror.3 +++ /dev/null @@ -1,37 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at http://curl.haxx.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" ************************************************************************** -.TH curl_easy_strerror 3 "26 Apr 2004" "libcurl 7.12" "libcurl Manual" -.SH NAME -curl_easy_strerror - return string describing error code -.SH SYNOPSIS -#include <curl/curl.h> - -const char *curl_easy_strerror(CURLcode errornum); -.SH DESCRIPTION -The curl_easy_strerror() function returns a string describing the CURLcode -error code passed in the argument \fIerrornum\fP. -.SH AVAILABILITY -This function was added in libcurl 7.12.0 -.SH RETURN VALUE -A pointer to a zero terminated string. -.SH "SEE ALSO" -.BR libcurl-errors "(3), " curl_multi_strerror "(3), " curl_share_strerror "(3)" diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_strerror.html b/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_strerror.html deleted file mode 100644 index d8cb379dc3..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_strerror.html +++ /dev/null @@ -1,57 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> -<html><head> -<title>curl_easy_strerror man page</title> -<meta name="generator" content="roffit"> -<STYLE type="text/css"> -P.level0 { - padding-left: 2em; -} - -P.level1 { - padding-left: 4em; -} - -P.level2 { - padding-left: 6em; -} - -span.emphasis { - font-style: italic; -} - -span.bold { - font-weight: bold; -} - -span.manpage { - font-weight: bold; -} - -h2.nroffsh { - background-color: #e0e0e0; -} - -span.nroffip { - font-weight: bold; - font-size: 120%; - font-family: monospace; -} - -p.roffit { - text-align: center; - font-size: 80%; -} -</STYLE> -</head><body> - -<p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2> -<p class="level0">curl_easy_strerror - return string describing error code <a name="SYNOPSIS"></a><h2 class="nroffsh">SYNOPSIS</h2> -<p class="level0">#include <curl/curl.h> -<p class="level0">const char *curl_easy_strerror(CURLcode errornum); <a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2> -<p class="level0">The curl_easy_strerror() function returns a string describing the CURLcode error code passed in the argument <span Class="emphasis">errornum</span>. <a name="AVAILABILITY"></a><h2 class="nroffsh">AVAILABILITY</h2> -<p class="level0">This function was added in libcurl 7.12.0 <a name="RETURN"></a><h2 class="nroffsh">RETURN VALUE</h2> -<p class="level0">A pointer to a zero terminated string. <a name="SEE"></a><h2 class="nroffsh">SEE ALSO</h2> -<p class="level0"><span Class="manpage">libcurl-errors (3)</span> <a class="manpage" href="./curl_multi_strerror.html"> curl_multi_strerror (3)</a> <a class="manpage" href="./curl_share_strerror.html"> curl_share_strerror (3)</a> <p class="roffit"> - This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>. -</body></html> diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_strerror.pdf b/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_strerror.pdf Binary files differdeleted file mode 100644 index 97b9b1c796..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_strerror.pdf +++ /dev/null diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_unescape.3 b/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_unescape.3 deleted file mode 100644 index 9b03fd0f95..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_unescape.3 +++ /dev/null @@ -1,51 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at http://curl.haxx.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" ************************************************************************** -.\" -.TH curl_easy_unescape 3 "7 April 2006" "libcurl 7.15.4" "libcurl Manual" -.SH NAME -curl_easy_unescape - URL decodes the given string -.SH SYNOPSIS -.B #include <curl/curl.h> -.sp -.BI "char *curl_easy_unescape( CURL *" curl ", char *" url ", int "inlength -.BI ", int *" outlength " );" -.ad -.SH DESCRIPTION -This function converts the given URL encoded input string to a "plain string" -and returns that in an allocated memory area. All input characters that are -URL encoded (%XX where XX is a two-digit hexadecimal number) are converted to -their binary versions. - -If the \fBlength\fP argument is set to 0 (zero), \fIcurl_easy_unescape(3)\fP -will use strlen() on the input \fIurl\fP string to find out the size. - -If \fBoutlength\fP is non-NULL, the function will write the length of the -returned string in the integer it points to. This allows an escaped string -containing %00 to still get used properly after unescaping. - -You must \fIcurl_free(3)\fP the returned string when you're done with it. -.SH AVAILABILITY -Added in 7.15.4 and replaces the old \fIcurl_unescape(3)\fP function. -.SH RETURN VALUE -A pointer to a zero terminated string or NULL if it failed. -.SH "SEE ALSO" -.I curl_easy_escape(3), curl_free(3), RFC 2396 diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_unescape.html b/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_unescape.html deleted file mode 100644 index 5d1f01819e..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_unescape.html +++ /dev/null @@ -1,61 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> -<html><head> -<title>curl_easy_unescape man page</title> -<meta name="generator" content="roffit"> -<STYLE type="text/css"> -P.level0 { - padding-left: 2em; -} - -P.level1 { - padding-left: 4em; -} - -P.level2 { - padding-left: 6em; -} - -span.emphasis { - font-style: italic; -} - -span.bold { - font-weight: bold; -} - -span.manpage { - font-weight: bold; -} - -h2.nroffsh { - background-color: #e0e0e0; -} - -span.nroffip { - font-weight: bold; - font-size: 120%; - font-family: monospace; -} - -p.roffit { - text-align: center; - font-size: 80%; -} -</STYLE> -</head><body> - -<p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2> -<p class="level0">curl_easy_unescape - URL decodes the given string <a name="SYNOPSIS"></a><h2 class="nroffsh">SYNOPSIS</h2> -<p class="level0"><span Class="bold">#include <curl/curl.h></span> -<p class="level0"><span Class="bold">char *curl_easy_unescape( CURL * curl , char * url , int inlength</span> <span Class="bold">, int * outlength );</span> -<p class="level0"><a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2> -<p class="level0">This function converts the given URL encoded input string to a "plain string" and returns that in an allocated memory area. All input characters that are URL encoded (%XX where XX is a two-digit hexadecimal number) are converted to their binary versions. -<p class="level0">If the <span Class="bold">length</span> argument is set to 0 (zero), <a class="emphasis" href="./curl_easy_unescape.html">curl_easy_unescape(3)</a> will use strlen() on the input <span Class="emphasis">url</span> string to find out the size. -<p class="level0">If <span Class="bold">outlength</span> is non-NULL, the function will write the length of the returned string in the integer it points to. This allows an escaped string containing %00 to still get used properly after unescaping. -<p class="level0">You must <a class="emphasis" href="./curl_free.html">curl_free(3)</a> the returned string when you're done with it. <a name="AVAILABILITY"></a><h2 class="nroffsh">AVAILABILITY</h2> -<p class="level0">Added in 7.15.4 and replaces the old <a class="emphasis" href="./curl_unescape.html">curl_unescape(3)</a> function. <a name="RETURN"></a><h2 class="nroffsh">RETURN VALUE</h2> -<p class="level0">A pointer to a zero terminated string or NULL if it failed. <a name="SEE"></a><h2 class="nroffsh">SEE ALSO</h2> -<p class="level0"><span Class="emphasis">curl_easy_escape(3), curl_free(3), <a href="http://www.ietf.org/rfc/rfc2396.txt">RFC 2396</a></span> <p class="roffit"> - This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>. -</body></html> diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_unescape.pdf b/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_unescape.pdf Binary files differdeleted file mode 100644 index 63821a61ea..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_easy_unescape.pdf +++ /dev/null diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_escape.3 b/plugins/FTPFileYM/curl/docs/libcurl/curl_escape.3 deleted file mode 100644 index 75fd51f2d0..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_escape.3 +++ /dev/null @@ -1,48 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at http://curl.haxx.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" ************************************************************************** -.TH curl_escape 3 "6 March 2002" "libcurl 7.9" "libcurl Manual" -.SH NAME -curl_escape - URL encodes the given string -.SH SYNOPSIS -.B #include <curl/curl.h> -.sp -.BI "char *curl_escape( char *" url ", int "length " );" -.ad -.SH DESCRIPTION -Obsolete function. Use \fIcurl_easy_escape(3)\fP instead! - -This function will convert the given input string to an URL encoded string and -return that as a new allocated string. All input characters that are not a-z, -A-Z or 0-9 will be converted to their "URL escaped" version (%NN where NN is a -two-digit hexadecimal number). - -If the 'length' argument is set to 0, curl_escape() will use strlen() on the -input 'url' string to find out the size. - -You must curl_free() the returned string when you're done with it. -.SH AVAILABILITY -Since 7.15.4, \fIcurl_easy_escape(3)\fP should be used. This function will -be removed in a future release. -.SH RETURN VALUE -A pointer to a zero terminated string or NULL if it failed. -.SH "SEE ALSO" -.BR curl_unescape "(3), " curl_free "(3), " RFC 2396 diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_escape.html b/plugins/FTPFileYM/curl/docs/libcurl/curl_escape.html deleted file mode 100644 index 6212096fb5..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_escape.html +++ /dev/null @@ -1,61 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> -<html><head> -<title>curl_escape man page</title> -<meta name="generator" content="roffit"> -<STYLE type="text/css"> -P.level0 { - padding-left: 2em; -} - -P.level1 { - padding-left: 4em; -} - -P.level2 { - padding-left: 6em; -} - -span.emphasis { - font-style: italic; -} - -span.bold { - font-weight: bold; -} - -span.manpage { - font-weight: bold; -} - -h2.nroffsh { - background-color: #e0e0e0; -} - -span.nroffip { - font-weight: bold; - font-size: 120%; - font-family: monospace; -} - -p.roffit { - text-align: center; - font-size: 80%; -} -</STYLE> -</head><body> - -<p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2> -<p class="level0">curl_escape - URL encodes the given string <a name="SYNOPSIS"></a><h2 class="nroffsh">SYNOPSIS</h2> -<p class="level0"><span Class="bold">#include <curl/curl.h></span> -<p class="level0"><span Class="bold">char *curl_escape( char * url , int length );</span> -<p class="level0"><a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2> -<p class="level0">Obsolete function. Use <a class="emphasis" href="./curl_easy_escape.html">curl_easy_escape(3)</a> instead! -<p class="level0">This function will convert the given input string to an URL encoded string and return that as a new allocated string. All input characters that are not a-z, A-Z or 0-9 will be converted to their "URL escaped" version (%NN where NN is a two-digit hexadecimal number). -<p class="level0">If the 'length' argument is set to 0, curl_escape() will use strlen() on the input 'url' string to find out the size. -<p class="level0">You must curl_free() the returned string when you're done with it. <a name="AVAILABILITY"></a><h2 class="nroffsh">AVAILABILITY</h2> -<p class="level0">Since 7.15.4, <a class="emphasis" href="./curl_easy_escape.html">curl_easy_escape(3)</a> should be used. This function will be removed in a future release. <a name="RETURN"></a><h2 class="nroffsh">RETURN VALUE</h2> -<p class="level0">A pointer to a zero terminated string or NULL if it failed. <a name="SEE"></a><h2 class="nroffsh">SEE ALSO</h2> -<p class="level0"><a class="manpage" href="./curl_unescape.html">curl_unescape (3)</a> <a class="manpage" href="./curl_free.html"> curl_free (3)</a> <span Class="manpage"> <a href="http://www.ietf.org/rfc/rfc2396.txt">RFC 2396</a></span> <p class="roffit"> - This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>. -</body></html> diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_escape.pdf b/plugins/FTPFileYM/curl/docs/libcurl/curl_escape.pdf Binary files differdeleted file mode 100644 index 72083b49c6..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_escape.pdf +++ /dev/null diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_formadd.3 b/plugins/FTPFileYM/curl/docs/libcurl/curl_formadd.3 deleted file mode 100644 index ce4df1e4bd..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_formadd.3 +++ /dev/null @@ -1,235 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at http://curl.haxx.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" ************************************************************************** -.TH curl_formadd 3 "24 June 2002" "libcurl 7.9.8" "libcurl Manual" -.SH NAME -curl_formadd - add a section to a multipart/formdata HTTP POST -.SH SYNOPSIS -.B #include <curl/curl.h> -.sp -.BI "CURLFORMcode curl_formadd(struct curl_httppost ** " firstitem, -.BI "struct curl_httppost ** " lastitem, " ...);" -.ad -.SH DESCRIPTION -curl_formadd() is used to append sections when building a multipart/formdata -HTTP POST (sometimes referred to as RFC2388-style posts). Append one section -at a time until you've added all the sections you want included and then you -pass the \fIfirstitem\fP pointer as parameter to \fBCURLOPT_HTTPPOST\fP. -\fIlastitem\fP is set after each \fIcurl_formadd(3)\fP call and on repeated -invokes it should be left as set to allow repeated invokes to find the end of -the list faster. - -After the \fIlastitem\fP pointer follow the real arguments. - -The pointers \fIfirstitem\fP and \fIlastitem\fP should both be pointing to -NULL in the first call to this function. All list-data will be allocated by -the function itself. You must call \fIcurl_formfree(3)\fP on the -\fIfirstitem\P after the form post has been done to free the resources. - -Using POST with HTTP 1.1 implies the use of a "Expect: 100-continue" header. -You can disable this header with \fICURLOPT_HTTPHEADER\fP as usual. - -First, there are some basics you need to understand about multipart/formdata -posts. Each part consists of at least a NAME and a CONTENTS part. If the part -is made for file upload, there are also a stored CONTENT-TYPE and a FILENAME. -Below, we'll discuss what options you use to set these properties in the -parts you want to add to your post. - -The options listed first are for making normal parts. The options from -\fICURLFORM_FILE\fP through \fICURLFORM_BUFFERLENGTH\fP are for file upload -parts. -.SH OPTIONS -.IP CURLFORM_COPYNAME -followed by a string which provides the \fIname\fP of this part. libcurl -copies the string so your application doesn't need to keep it around after -this function call. If the name isn't NUL-terminated, or if you'd -like it to contain zero bytes, you must set its length with -\fBCURLFORM_NAMELENGTH\fP. The copied data will be freed by -\fIcurl_formfree(3)\fP. -.IP CURLFORM_PTRNAME -followed by a string which provides the \fIname\fP of this part. libcurl -will use the pointer and refer to the data in your application, so you -must make sure it remains until curl no longer needs it. If the name -isn't NUL-terminated, or if you'd like it to contain zero -bytes, you must set its length with \fBCURLFORM_NAMELENGTH\fP. -.IP CURLFORM_COPYCONTENTS -followed by a pointer to the contents of this part, the actual data -to send away. libcurl copies the provided data, so your application doesn't -need to keep it around after this function call. If the data isn't null -terminated, or if you'd like it to contain zero bytes, you must -set the length of the name with \fBCURLFORM_CONTENTSLENGTH\fP. The copied -data will be freed by \fIcurl_formfree(3)\fP. -.IP CURLFORM_PTRCONTENTS -followed by a pointer to the contents of this part, the actual data -to send away. libcurl will use the pointer and refer to the data in your -application, so you must make sure it remains until curl no longer needs it. -If the data isn't NUL-terminated, or if you'd like it to contain zero bytes, -you must set its length with \fBCURLFORM_CONTENTSLENGTH\fP. -.IP CURLFORM_CONTENTSLENGTH -followed by a long giving the length of the contents. Note that for -\fICURLFORM_STREAM\fP contents, this option is mandatory. -.IP CURLFORM_FILECONTENT -followed by a filename, causes that file to be read and its contents used -as data in this part. This part does \fInot\fP automatically become a file -upload part simply because its data was read from a file. -.IP CURLFORM_FILE -followed by a filename, makes this part a file upload part. It sets the -\fIfilename\fP field to the basename of the provided filename, it reads the -contents of the file and passes them as data and sets the content-type if the -given file match one of the internally known file extensions. For -\fBCURLFORM_FILE\fP the user may send one or more files in one part by -providing multiple \fBCURLFORM_FILE\fP arguments each followed by the filename -(and each \fICURLFORM_FILE\fP is allowed to have a -\fICURLFORM_CONTENTTYPE\fP). -.IP CURLFORM_CONTENTTYPE -is used in combination with \fICURLFORM_FILE\fP. Followed by a pointer to a -string which provides the content-type for this part, possibly instead of an -internally chosen one. -.IP CURLFORM_FILENAME -is used in combination with \fICURLFORM_FILE\fP. Followed by a pointer to a -string, it tells libcurl to use the given string as the \fIfilename\fP in the -file upload part instead of the actual file name. -.IP CURLFORM_BUFFER -is used for custom file upload parts without use of \fICURLFORM_FILE\fP. It -tells libcurl that the file contents are already present in a buffer. The -parameter is a string which provides the \fIfilename\fP field in the content -header. -.IP CURLFORM_BUFFERPTR -is used in combination with \fICURLFORM_BUFFER\fP. The parameter is a pointer -to the buffer to be uploaded. This buffer must not be freed until after -\fIcurl_easy_cleanup(3)\fP is called. You must also use -\fICURLFORM_BUFFERLENGTH\fP to set the number of bytes in the buffer. -.IP CURLFORM_BUFFERLENGTH -is used in combination with \fICURLFORM_BUFFER\fP. The parameter is a -long which gives the length of the buffer. -.IP CURLFORM_STREAM -Tells libcurl to use the \fICURLOPT_READFUNCTION\fP callback to get data. The -parameter you pass to \fICURLFORM_STREAM\fP is the pointer passed on to the -read callback's fourth argument. If you want the part to look like a file -upload one, set the \fICURLFORM_FILENAME\fP parameter as well. Note that when -using \fICURLFORM_STREAM\fP, \fICURLFORM_CONTENTSLENGTH\fP must also be set -with the total expected length of the part. (Option added in libcurl 7.18.2) -.IP CURLFORM_ARRAY -Another possibility to send options to curl_formadd() is the -\fBCURLFORM_ARRAY\fP option, that passes a struct curl_forms array pointer as -its value. Each curl_forms structure element has a CURLformoption and a char -pointer. The final element in the array must be a CURLFORM_END. All available -options can be used in an array, except the CURLFORM_ARRAY option itself! The -last argument in such an array must always be \fBCURLFORM_END\fP. -.IP CURLFORM_CONTENTHEADER -specifies extra headers for the form POST section. This takes a curl_slist -prepared in the usual way using \fBcurl_slist_append\fP and appends the list -of headers to those libcurl automatically generates. The list must exist while -the POST occurs, if you free it before the post completes you may experience -problems. - -When you've passed the HttpPost pointer to \fIcurl_easy_setopt(3)\fP (using -the \fICURLOPT_HTTPPOST\fP option), you must not free the list until after -you've called \fIcurl_easy_cleanup(3)\fP for the curl handle. - -See example below. -.SH RETURN VALUE -0 means everything was ok, non-zero means an error occurred corresponding -to a CURL_FORMADD_* constant defined in -.I <curl/curl.h> -.SH EXAMPLE -.nf - - struct curl_httppost* post = NULL; - struct curl_httppost* last = NULL; - char namebuffer[] = "name buffer"; - long namelength = strlen(namebuffer); - char buffer[] = "test buffer"; - char htmlbuffer[] = "<HTML>test buffer</HTML>"; - long htmlbufferlength = strlen(htmlbuffer); - struct curl_forms forms[3]; - char file1[] = "my-face.jpg"; - char file2[] = "your-face.jpg"; - /* add null character into htmlbuffer, to demonstrate that - transfers of buffers containing null characters actually work - */ - htmlbuffer[8] = '\\0'; - - /* Add simple name/content section */ - curl_formadd(&post, &last, CURLFORM_COPYNAME, "name", - CURLFORM_COPYCONTENTS, "content", CURLFORM_END); - - /* Add simple name/content/contenttype section */ - curl_formadd(&post, &last, CURLFORM_COPYNAME, "htmlcode", - CURLFORM_COPYCONTENTS, "<HTML></HTML>", - CURLFORM_CONTENTTYPE, "text/html", CURLFORM_END); - - /* Add name/ptrcontent section */ - curl_formadd(&post, &last, CURLFORM_COPYNAME, "name_for_ptrcontent", - CURLFORM_PTRCONTENTS, buffer, CURLFORM_END); - - /* Add ptrname/ptrcontent section */ - curl_formadd(&post, &last, CURLFORM_PTRNAME, namebuffer, - CURLFORM_PTRCONTENTS, buffer, CURLFORM_NAMELENGTH, - namelength, CURLFORM_END); - - /* Add name/ptrcontent/contenttype section */ - curl_formadd(&post, &last, CURLFORM_COPYNAME, "html_code_with_hole", - CURLFORM_PTRCONTENTS, htmlbuffer, - CURLFORM_CONTENTSLENGTH, htmlbufferlength, - CURLFORM_CONTENTTYPE, "text/html", CURLFORM_END); - - /* Add simple file section */ - curl_formadd(&post, &last, CURLFORM_COPYNAME, "picture", - CURLFORM_FILE, "my-face.jpg", CURLFORM_END); - - /* Add file/contenttype section */ - curl_formadd(&post, &last, CURLFORM_COPYNAME, "picture", - CURLFORM_FILE, "my-face.jpg", - CURLFORM_CONTENTTYPE, "image/jpeg", CURLFORM_END); - - /* Add two file section */ - curl_formadd(&post, &last, CURLFORM_COPYNAME, "pictures", - CURLFORM_FILE, "my-face.jpg", - CURLFORM_FILE, "your-face.jpg", CURLFORM_END); - - /* Add two file section using CURLFORM_ARRAY */ - forms[0].option = CURLFORM_FILE; - forms[0].value = file1; - forms[1].option = CURLFORM_FILE; - forms[1].value = file2; - forms[2].option = CURLFORM_END; - - /* Add a buffer to upload */ - curl_formadd(&post, &last, - CURLFORM_COPYNAME, "name", - CURLFORM_BUFFER, "data", - CURLFORM_BUFFERPTR, record, - CURLFORM_BUFFERLENGTH, record_length, - CURLFORM_END); - - /* no option needed for the end marker */ - curl_formadd(&post, &last, CURLFORM_COPYNAME, "pictures", - CURLFORM_ARRAY, forms, CURLFORM_END); - /* Add the content of a file as a normal post text value */ - curl_formadd(&post, &last, CURLFORM_COPYNAME, "filecontent", - CURLFORM_FILECONTENT, ".bashrc", CURLFORM_END); - /* Set the form info */ - curl_easy_setopt(curl, CURLOPT_HTTPPOST, post); - -.SH "SEE ALSO" -.BR curl_easy_setopt "(3), " -.BR curl_formfree "(3)" diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_formadd.html b/plugins/FTPFileYM/curl/docs/libcurl/curl_formadd.html deleted file mode 100644 index 64b9a8e7ba..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_formadd.html +++ /dev/null @@ -1,110 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> -<html><head> -<title>curl_formadd man page</title> -<meta name="generator" content="roffit"> -<STYLE type="text/css"> -P.level0 { - padding-left: 2em; -} - -P.level1 { - padding-left: 4em; -} - -P.level2 { - padding-left: 6em; -} - -span.emphasis { - font-style: italic; -} - -span.bold { - font-weight: bold; -} - -span.manpage { - font-weight: bold; -} - -h2.nroffsh { - background-color: #e0e0e0; -} - -span.nroffip { - font-weight: bold; - font-size: 120%; - font-family: monospace; -} - -p.roffit { - text-align: center; - font-size: 80%; -} -</STYLE> -</head><body> - -<p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2> -<p class="level0">curl_formadd - add a section to a multipart/formdata HTTP POST <a name="SYNOPSIS"></a><h2 class="nroffsh">SYNOPSIS</h2> -<p class="level0"><span Class="bold">#include <curl/curl.h></span> -<p class="level0"><span Class="bold">CURLFORMcode curl_formadd(struct curl_httppost ** firstitem,</span> <span Class="bold">struct curl_httppost ** lastitem, ...);</span> -<p class="level0"><a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2> -<p class="level0">curl_formadd() is used to append sections when building a multipart/formdata HTTP POST (sometimes referred to as <a href="http://www.ietf.org/rfc/rfc2388.txt">RFC 2388</a>-style posts). Append one section at a time until you've added all the sections you want included and then you pass the <span Class="emphasis">firstitem</span> pointer as parameter to <span Class="bold">CURLOPT_HTTPPOST</span>. <span Class="emphasis">lastitem</span> is set after each <a class="emphasis" href="./curl_formadd.html">curl_formadd(3)</a> call and on repeated invokes it should be left as set to allow repeated invokes to find the end of the list faster. -<p class="level0">After the <span Class="emphasis">lastitem</span> pointer follow the real arguments. -<p class="level0">The pointers <span Class="emphasis">firstitem</span> and <span Class="emphasis">lastitem</span> should both be pointing to NULL in the first call to this function. All list-data will be allocated by the function itself. You must call <a class="emphasis" href="./curl_formfree.html">curl_formfree(3)</a> on the <span class="emphasis">firstitemP after the form post has been done to free the resources. -<p class="level0">Using POST with HTTP 1.1 implies the use of a "Expect: 100-continue" header. You can disable this header with <span Class="emphasis">CURLOPT_HTTPHEADER</span> as usual. -<p class="level0">First, there are some basics you need to understand about multipart/formdata posts. Each part consists of at least a NAME and a CONTENTS part. If the part is made for file upload, there are also a stored CONTENT-TYPE and a FILENAME. Below, we'll discuss what options you use to set these properties in the parts you want to add to your post. -<p class="level0">The options listed first are for making normal parts. The options from <a class="emphasis" href="#CURLFORMFILE">CURLFORM_FILE</a> through <a class="emphasis" href="#CURLFORMBUFFERLENGTH">CURLFORM_BUFFERLENGTH</a> are for file upload parts. <a name="OPTIONS"></a><h2 class="nroffsh">OPTIONS</h2> -<p class="level0"> -<p class="level0"><a name="CURLFORMCOPYNAME"></a><span class="nroffip">CURLFORM_COPYNAME</span> -<p class="level1">followed by a string which provides the <span Class="emphasis">name</span> of this part. libcurl copies the string so your application doesn't need to keep it around after this function call. If the name isn't NUL-terminated, or if you'd like it to contain zero bytes, you must set its length with <span Class="bold">CURLFORM_NAMELENGTH</span>. The copied data will be freed by <a class="emphasis" href="./curl_formfree.html">curl_formfree(3)</a>. -<p class="level0"><a name="CURLFORMPTRNAME"></a><span class="nroffip">CURLFORM_PTRNAME</span> -<p class="level1">followed by a string which provides the <span Class="emphasis">name</span> of this part. libcurl will use the pointer and refer to the data in your application, so you must make sure it remains until curl no longer needs it. If the name isn't NUL-terminated, or if you'd like it to contain zero bytes, you must set its length with <span Class="bold">CURLFORM_NAMELENGTH</span>. -<p class="level0"><a name="CURLFORMCOPYCONTENTS"></a><span class="nroffip">CURLFORM_COPYCONTENTS</span> -<p class="level1">followed by a pointer to the contents of this part, the actual data to send away. libcurl copies the provided data, so your application doesn't need to keep it around after this function call. If the data isn't null terminated, or if you'd like it to contain zero bytes, you must set the length of the name with <a class="bold" href="#CURLFORMCONTENTSLENGTH">CURLFORM_CONTENTSLENGTH</a>. The copied data will be freed by <a class="emphasis" href="./curl_formfree.html">curl_formfree(3)</a>. -<p class="level0"><a name="CURLFORMPTRCONTENTS"></a><span class="nroffip">CURLFORM_PTRCONTENTS</span> -<p class="level1">followed by a pointer to the contents of this part, the actual data to send away. libcurl will use the pointer and refer to the data in your application, so you must make sure it remains until curl no longer needs it. If the data isn't NUL-terminated, or if you'd like it to contain zero bytes, you must set its length with <a class="bold" href="#CURLFORMCONTENTSLENGTH">CURLFORM_CONTENTSLENGTH</a>. -<p class="level0"><a name="CURLFORMCONTENTSLENGTH"></a><span class="nroffip">CURLFORM_CONTENTSLENGTH</span> -<p class="level1">followed by a long giving the length of the contents. Note that for <a class="emphasis" href="#CURLFORMSTREAM">CURLFORM_STREAM</a> contents, this option is mandatory. -<p class="level0"><a name="CURLFORMFILECONTENT"></a><span class="nroffip">CURLFORM_FILECONTENT</span> -<p class="level1">followed by a filename, causes that file to be read and its contents used as data in this part. This part does <span Class="emphasis">not</span> automatically become a file upload part simply because its data was read from a file. -<p class="level0"><a name="CURLFORMFILE"></a><span class="nroffip">CURLFORM_FILE</span> -<p class="level1">followed by a filename, makes this part a file upload part. It sets the <span Class="emphasis">filename</span> field to the basename of the provided filename, it reads the contents of the file and passes them as data and sets the content-type if the given file match one of the internally known file extensions. For <a class="bold" href="#CURLFORMFILE">CURLFORM_FILE</a> the user may send one or more files in one part by providing multiple <a class="bold" href="#CURLFORMFILE">CURLFORM_FILE</a> arguments each followed by the filename (and each <a class="emphasis" href="#CURLFORMFILE">CURLFORM_FILE</a> is allowed to have a <a class="emphasis" href="#CURLFORMCONTENTTYPE">CURLFORM_CONTENTTYPE</a>). -<p class="level0"><a name="CURLFORMCONTENTTYPE"></a><span class="nroffip">CURLFORM_CONTENTTYPE</span> -<p class="level1">is used in combination with <a class="emphasis" href="#CURLFORMFILE">CURLFORM_FILE</a>. Followed by a pointer to a string which provides the content-type for this part, possibly instead of an internally chosen one. -<p class="level0"><a name="CURLFORMFILENAME"></a><span class="nroffip">CURLFORM_FILENAME</span> -<p class="level1">is used in combination with <a class="emphasis" href="#CURLFORMFILE">CURLFORM_FILE</a>. Followed by a pointer to a string, it tells libcurl to use the given string as the <span Class="emphasis">filename</span> in the file upload part instead of the actual file name. -<p class="level0"><a name="CURLFORMBUFFER"></a><span class="nroffip">CURLFORM_BUFFER</span> -<p class="level1">is used for custom file upload parts without use of <a class="emphasis" href="#CURLFORMFILE">CURLFORM_FILE</a>. It tells libcurl that the file contents are already present in a buffer. The parameter is a string which provides the <span Class="emphasis">filename</span> field in the content header. -<p class="level0"><a name="CURLFORMBUFFERPTR"></a><span class="nroffip">CURLFORM_BUFFERPTR</span> -<p class="level1">is used in combination with <a class="emphasis" href="#CURLFORMBUFFER">CURLFORM_BUFFER</a>. The parameter is a pointer to the buffer to be uploaded. This buffer must not be freed until after <a class="emphasis" href="./curl_easy_cleanup.html">curl_easy_cleanup(3)</a> is called. You must also use <a class="emphasis" href="#CURLFORMBUFFERLENGTH">CURLFORM_BUFFERLENGTH</a> to set the number of bytes in the buffer. -<p class="level0"><a name="CURLFORMBUFFERLENGTH"></a><span class="nroffip">CURLFORM_BUFFERLENGTH</span> -<p class="level1">is used in combination with <a class="emphasis" href="#CURLFORMBUFFER">CURLFORM_BUFFER</a>. The parameter is a long which gives the length of the buffer. -<p class="level0"><a name="CURLFORMSTREAM"></a><span class="nroffip">CURLFORM_STREAM</span> -<p class="level1">Tells libcurl to use the <span Class="emphasis">CURLOPT_READFUNCTION</span> callback to get data. The parameter you pass to <a class="emphasis" href="#CURLFORMSTREAM">CURLFORM_STREAM</a> is the pointer passed on to the read callback's fourth argument. If you want the part to look like a file upload one, set the <a class="emphasis" href="#CURLFORMFILENAME">CURLFORM_FILENAME</a> parameter as well. Note that when using <a class="emphasis" href="#CURLFORMSTREAM">CURLFORM_STREAM</a>, <a class="emphasis" href="#CURLFORMCONTENTSLENGTH">CURLFORM_CONTENTSLENGTH</a> must also be set with the total expected length of the part. (Option added in libcurl 7.18.2) -<p class="level0"><a name="CURLFORMARRAY"></a><span class="nroffip">CURLFORM_ARRAY</span> -<p class="level1">Another possibility to send options to curl_formadd() is the <a class="bold" href="#CURLFORMARRAY">CURLFORM_ARRAY</a> option, that passes a struct curl_forms array pointer as its value. Each curl_forms structure element has a CURLformoption and a char pointer. The final element in the array must be a CURLFORM_END. All available options can be used in an array, except the CURLFORM_ARRAY option itself! The last argument in such an array must always be <span Class="bold">CURLFORM_END</span>. -<p class="level0"><a name="CURLFORMCONTENTHEADER"></a><span class="nroffip">CURLFORM_CONTENTHEADER</span> -<p class="level1">specifies extra headers for the form POST section. This takes a curl_slist prepared in the usual way using <span Class="bold">curl_slist_append</span> and appends the list of headers to those libcurl automatically generates. The list must exist while the POST occurs, if you free it before the post completes you may experience problems. -<p class="level1">When you've passed the HttpPost pointer to <a class="emphasis" href="./curl_easy_setopt.html">curl_easy_setopt(3)</a> (using the <span Class="emphasis">CURLOPT_HTTPPOST</span> option), you must not free the list until after you've called <a class="emphasis" href="./curl_easy_cleanup.html">curl_easy_cleanup(3)</a> for the curl handle. -<p class="level1">See example below. <a name="RETURN"></a><h2 class="nroffsh">RETURN VALUE</h2> -<p class="level0">0 means everything was ok, non-zero means an error occurred corresponding to a CURL_FORMADD_* constant defined in <span Class="emphasis"><curl/curl.h></span> <a name="EXAMPLE"></a><h2 class="nroffsh">EXAMPLE</h2> -<p class="level0"> -<p class="level0"> -<p class="level0"> struct curl_httppost* post = NULL; struct curl_httppost* last = NULL; char namebuffer[] = "name buffer"; long namelength = strlen(namebuffer); char buffer[] = "test buffer"; char htmlbuffer[] = "<HTML>test buffer</HTML>"; long htmlbufferlength = strlen(htmlbuffer); struct curl_forms forms[3]; char file1[] = "my-face.jpg"; char file2[] = "your-face.jpg"; /* add null character into htmlbuffer, to demonstrate that transfers of buffers containing null characters actually work */ htmlbuffer[8] = '\0'; -<p class="level0"> /* Add simple name/content section */ curl_formadd(&post, &last, CURLFORM_COPYNAME, "name", CURLFORM_COPYCONTENTS, "content", CURLFORM_END); -<p class="level0"> /* Add simple name/content/contenttype section */ curl_formadd(&post, &last, CURLFORM_COPYNAME, "htmlcode", CURLFORM_COPYCONTENTS, "<HTML></HTML>", CURLFORM_CONTENTTYPE, "text/html", CURLFORM_END); -<p class="level0"> /* Add name/ptrcontent section */ curl_formadd(&post, &last, CURLFORM_COPYNAME, "name_for_ptrcontent", CURLFORM_PTRCONTENTS, buffer, CURLFORM_END); -<p class="level0"> /* Add ptrname/ptrcontent section */ curl_formadd(&post, &last, CURLFORM_PTRNAME, namebuffer, CURLFORM_PTRCONTENTS, buffer, CURLFORM_NAMELENGTH, namelength, CURLFORM_END); -<p class="level0"> /* Add name/ptrcontent/contenttype section */ curl_formadd(&post, &last, CURLFORM_COPYNAME, "html_code_with_hole", CURLFORM_PTRCONTENTS, htmlbuffer, CURLFORM_CONTENTSLENGTH, htmlbufferlength, CURLFORM_CONTENTTYPE, "text/html", CURLFORM_END); -<p class="level0"> /* Add simple file section */ curl_formadd(&post, &last, CURLFORM_COPYNAME, "picture", CURLFORM_FILE, "my-face.jpg", CURLFORM_END); -<p class="level0"> /* Add file/contenttype section */ curl_formadd(&post, &last, CURLFORM_COPYNAME, "picture", CURLFORM_FILE, "my-face.jpg", CURLFORM_CONTENTTYPE, "image/jpeg", CURLFORM_END); -<p class="level0"> /* Add two file section */ curl_formadd(&post, &last, CURLFORM_COPYNAME, "pictures", CURLFORM_FILE, "my-face.jpg", CURLFORM_FILE, "your-face.jpg", CURLFORM_END); -<p class="level0"> /* Add two file section using CURLFORM_ARRAY */ forms[0].option = CURLFORM_FILE; forms[0].value = file1; forms[1].option = CURLFORM_FILE; forms[1].value = file2; forms[2].option = CURLFORM_END; -<p class="level0"> /* Add a buffer to upload */ curl_formadd(&post, &last, CURLFORM_COPYNAME, "name", CURLFORM_BUFFER, "data", CURLFORM_BUFFERPTR, record, CURLFORM_BUFFERLENGTH, record_length, CURLFORM_END); -<p class="level0"> /* no option needed for the end marker */ curl_formadd(&post, &last, CURLFORM_COPYNAME, "pictures", CURLFORM_ARRAY, forms, CURLFORM_END); /* Add the content of a file as a normal post text value */ curl_formadd(&post, &last, CURLFORM_COPYNAME, "filecontent", CURLFORM_FILECONTENT, ".bashrc", CURLFORM_END); /* Set the form info */ curl_easy_setopt(curl, CURLOPT_HTTPPOST, post); -<p class="level0"><a name="SEE"></a><h2 class="nroffsh">SEE ALSO</h2> -<p class="level0"><a class="manpage" href="./curl_easy_setopt.html">curl_easy_setopt (3)</a> <span Class="manpage"> </span> <a class="manpage" href="./curl_formfree.html">curl_formfree (3)</a> <p class="roffit"> - This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>. -</body></html> diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_formadd.pdf b/plugins/FTPFileYM/curl/docs/libcurl/curl_formadd.pdf Binary files differdeleted file mode 100644 index 9b543c84f8..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_formadd.pdf +++ /dev/null diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_formfree.3 b/plugins/FTPFileYM/curl/docs/libcurl/curl_formfree.3 deleted file mode 100644 index 7438a16401..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_formfree.3 +++ /dev/null @@ -1,44 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at http://curl.haxx.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" ************************************************************************** -.TH curl_formfree 3 "6 April 2001" "libcurl 7.7.1" "libcurl Manual" -.SH NAME -curl_formfree - free a previously build multipart/formdata HTTP POST chain -.SH SYNOPSIS -.B #include <curl/curl.h> -.sp -.BI "void curl_formfree(struct curl_httppost *" form); -.ad -.SH DESCRIPTION -curl_formfree() is used to clean up data previously built/appended with -\fIcurl_formadd(3)\fP. This must be called when the data has been used, which -typically means after \fIcurl_easy_perform(3)\fP has been called. - -The pointer to free is the same pointer you passed to the -\fBCURLOPT_HTTPPOST\fP option, which is the \fIfirstitem\fP pointer from the -\fIcurl_formadd(3)\fP invoke(s). - -\fBform\fP is the pointer as returned from a previous call to -\fIcurl_formadd(3)\fP and may be NULL. -.SH RETURN VALUE -None -.SH "SEE ALSO" -.BR curl_formadd "(3) " diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_formfree.html b/plugins/FTPFileYM/curl/docs/libcurl/curl_formfree.html deleted file mode 100644 index 9ea2c743f7..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_formfree.html +++ /dev/null @@ -1,59 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> -<html><head> -<title>curl_formfree man page</title> -<meta name="generator" content="roffit"> -<STYLE type="text/css"> -P.level0 { - padding-left: 2em; -} - -P.level1 { - padding-left: 4em; -} - -P.level2 { - padding-left: 6em; -} - -span.emphasis { - font-style: italic; -} - -span.bold { - font-weight: bold; -} - -span.manpage { - font-weight: bold; -} - -h2.nroffsh { - background-color: #e0e0e0; -} - -span.nroffip { - font-weight: bold; - font-size: 120%; - font-family: monospace; -} - -p.roffit { - text-align: center; - font-size: 80%; -} -</STYLE> -</head><body> - -<p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2> -<p class="level0">curl_formfree - free a previously build multipart/formdata HTTP POST chain <a name="SYNOPSIS"></a><h2 class="nroffsh">SYNOPSIS</h2> -<p class="level0"><span Class="bold">#include <curl/curl.h></span> -<p class="level0"><span Class="bold">void curl_formfree(struct curl_httppost * form);</span> -<p class="level0"><a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2> -<p class="level0">curl_formfree() is used to clean up data previously built/appended with <a class="emphasis" href="./curl_formadd.html">curl_formadd(3)</a>. This must be called when the data has been used, which typically means after <a class="emphasis" href="./curl_easy_perform.html">curl_easy_perform(3)</a> has been called. -<p class="level0">The pointer to free is the same pointer you passed to the <span Class="bold">CURLOPT_HTTPPOST</span> option, which is the <span Class="emphasis">firstitem</span> pointer from the <a class="emphasis" href="./curl_formadd.html">curl_formadd(3)</a> invoke(s). -<p class="level0"><span Class="bold">form</span> is the pointer as returned from a previous call to <a class="emphasis" href="./curl_formadd.html">curl_formadd(3)</a> and may be NULL. <a name="RETURN"></a><h2 class="nroffsh">RETURN VALUE</h2> -<p class="level0">None <a name="SEE"></a><h2 class="nroffsh">SEE ALSO</h2> -<p class="level0"><a class="manpage" href="./curl_formadd.html">curl_formadd (3) </a> <p class="roffit"> - This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>. -</body></html> diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_formfree.pdf b/plugins/FTPFileYM/curl/docs/libcurl/curl_formfree.pdf Binary files differdeleted file mode 100644 index b22ac75968..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_formfree.pdf +++ /dev/null diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_formget.3 b/plugins/FTPFileYM/curl/docs/libcurl/curl_formget.3 deleted file mode 100644 index b526221367..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_formget.3 +++ /dev/null @@ -1,70 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at http://curl.haxx.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" ************************************************************************** -.TH curl_formget 3 "20 June 2006" "libcurl 7.15.5" "libcurl Manual" -.SH NAME -curl_formget - serialize a previously built multipart/formdata HTTP POST chain -.SH SYNOPSIS -.nf -.B #include <curl/curl.h> - -void curl_formget(struct curl_httppost * form, void *userp, - curl_formget_callback append ); -.SH DESCRIPTION -curl_formget() is used to serialize data previously built/appended with -\fIcurl_formadd(3)\fP. Accepts a void pointer as second argument named -\fIuserp\fP which will be passed as the first argument to the -curl_formget_callback function. - -.BI "typedef size_t (*curl_formget_callback)(void *" userp, " const char *" buf, -.BI " size_t " len ");" - -The curl_formget_callback will be executed for each part of the HTTP POST -chain. The character buffer passed to the callback must not be freed. The -callback should return the buffer length passed to it on success. - -If the \fBCURLFORM_STREAM\fP option is used in the formpost, it will prevent -\fIcurl_formget(3)\fP from working until you've performed the actual HTTP -request as only then will libcurl get the actual read callback to use! -.SH RETURN VALUE -0 means everything was ok, non-zero means an error occurred -.SH EXAMPLE -.nf - - size_t print_httppost_callback(void *arg, const char *buf, size_t len) - { - fwrite(buf, len, 1, stdout); - (*(size_t *) arg) += len; - return len; - } - - size_t print_httppost(struct curl_httppost *post) - { - size_t total_size = 0; - if(curl_formget(post, &total_size, print_httppost_callback)) { - return (size_t) -1; - } - return total_size; - } -.SH AVAILABILITY -This function was added in libcurl 7.15.5 -.SH "SEE ALSO" -.BR curl_formadd "(3) " diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_formget.html b/plugins/FTPFileYM/curl/docs/libcurl/curl_formget.html deleted file mode 100644 index 28745d0423..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_formget.html +++ /dev/null @@ -1,65 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> -<html><head> -<title>curl_formget man page</title> -<meta name="generator" content="roffit"> -<STYLE type="text/css"> -P.level0 { - padding-left: 2em; -} - -P.level1 { - padding-left: 4em; -} - -P.level2 { - padding-left: 6em; -} - -span.emphasis { - font-style: italic; -} - -span.bold { - font-weight: bold; -} - -span.manpage { - font-weight: bold; -} - -h2.nroffsh { - background-color: #e0e0e0; -} - -span.nroffip { - font-weight: bold; - font-size: 120%; - font-family: monospace; -} - -p.roffit { - text-align: center; - font-size: 80%; -} -</STYLE> -</head><body> - -<p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2> -<p class="level0">curl_formget - serialize a previously built multipart/formdata HTTP POST chain <a name="SYNOPSIS"></a><h2 class="nroffsh">SYNOPSIS</h2> -<p class="level0"> -<p class="level0"><span Class="bold">#include <curl/curl.h></span> -<p class="level0">void curl_formget(struct curl_httppost * form, void *userp, curl_formget_callback append ); <a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2> -<p class="level0">curl_formget() is used to serialize data previously built/appended with <a class="emphasis" href="./curl_formadd.html">curl_formadd(3)</a>. Accepts a void pointer as second argument named <span Class="emphasis">userp</span> which will be passed as the first argument to the curl_formget_callback function. -<p class="level0"><span Class="bold">typedef size_t (*curl_formget_callback)(void * userp, const char * buf,</span> <span Class="bold"> size_t len );</span> -<p class="level0">The curl_formget_callback will be executed for each part of the HTTP POST chain. The character buffer passed to the callback must not be freed. The callback should return the buffer length passed to it on success. -<p class="level0">If the <span Class="bold">CURLFORM_STREAM</span> option is used in the formpost, it will prevent <a class="emphasis" href="./curl_formget.html">curl_formget(3)</a> from working until you've performed the actual HTTP request as only then will libcurl get the actual read callback to use! <a name="RETURN"></a><h2 class="nroffsh">RETURN VALUE</h2> -<p class="level0">0 means everything was ok, non-zero means an error occurred <a name="EXAMPLE"></a><h2 class="nroffsh">EXAMPLE</h2> -<p class="level0"> -<p class="level0"> -<p class="level0"> size_t print_httppost_callback(void *arg, const char *buf, size_t len) { fwrite(buf, len, 1, stdout); (*(size_t *) arg) += len; return len; } -<p class="level0"> size_t print_httppost(struct curl_httppost *post) { size_t total_size = 0; if(curl_formget(post, &total_size, print_httppost_callback)) { return (size_t) -1; } return total_size; } <a name="AVAILABILITY"></a><h2 class="nroffsh">AVAILABILITY</h2> -<p class="level0">This function was added in libcurl 7.15.5 <a name="SEE"></a><h2 class="nroffsh">SEE ALSO</h2> -<p class="level0"><a class="manpage" href="./curl_formadd.html">curl_formadd (3) </a> <p class="roffit"> - This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>. -</body></html> diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_formget.pdf b/plugins/FTPFileYM/curl/docs/libcurl/curl_formget.pdf Binary files differdeleted file mode 100644 index 5a01f0e209..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_formget.pdf +++ /dev/null diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_free.3 b/plugins/FTPFileYM/curl/docs/libcurl/curl_free.3 deleted file mode 100644 index 08ec9b6b3d..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_free.3 +++ /dev/null @@ -1,35 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at http://curl.haxx.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" ************************************************************************** -.TH curl_free 3 "12 Aug 2003" "libcurl 7.10" "libcurl Manual" -.SH NAME -curl_free - reclaim memory that has been obtained through a libcurl call -.SH SYNOPSIS -.B #include <curl/curl.h> -.sp -.BI "void curl_free( char *" ptr " );" -.ad -.SH DESCRIPTION -curl_free reclaims memory that has been obtained through a libcurl call. Use -curl_free() instead of free() to avoid anomalies that can result from -differences in memory management between your application and libcurl. -.SH "SEE ALSO" -.I curl_unescape(3) diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_free.html b/plugins/FTPFileYM/curl/docs/libcurl/curl_free.html deleted file mode 100644 index 7d75c24858..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_free.html +++ /dev/null @@ -1,56 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> -<html><head> -<title>curl_free man page</title> -<meta name="generator" content="roffit"> -<STYLE type="text/css"> -P.level0 { - padding-left: 2em; -} - -P.level1 { - padding-left: 4em; -} - -P.level2 { - padding-left: 6em; -} - -span.emphasis { - font-style: italic; -} - -span.bold { - font-weight: bold; -} - -span.manpage { - font-weight: bold; -} - -h2.nroffsh { - background-color: #e0e0e0; -} - -span.nroffip { - font-weight: bold; - font-size: 120%; - font-family: monospace; -} - -p.roffit { - text-align: center; - font-size: 80%; -} -</STYLE> -</head><body> - -<p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2> -<p class="level0">curl_free - reclaim memory that has been obtained through a libcurl call <a name="SYNOPSIS"></a><h2 class="nroffsh">SYNOPSIS</h2> -<p class="level0"><span Class="bold">#include <curl/curl.h></span> -<p class="level0"><span Class="bold">void curl_free( char * ptr );</span> -<p class="level0"><a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2> -<p class="level0">curl_free reclaims memory that has been obtained through a libcurl call. Use curl_free() instead of free() to avoid anomalies that can result from differences in memory management between your application and libcurl. <a name="SEE"></a><h2 class="nroffsh">SEE ALSO</h2> -<p class="level0"><a class="emphasis" href="./curl_unescape.html">curl_unescape(3)</a> <p class="roffit"> - This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>. -</body></html> diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_free.pdf b/plugins/FTPFileYM/curl/docs/libcurl/curl_free.pdf deleted file mode 100644 index 5822c630e7..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_free.pdf +++ /dev/null @@ -1,106 +0,0 @@ -%PDF-1.4 -%Çì¢ -5 0 obj -<</Length 6 0 R/Filter /FlateDecode>> -stream -xœ“ÛŽÓ0†ïó#qƒ×Î9!èEÑn»4ámr·
Jœn¬öíçÐH\ K±dOf¾ÿŸñ0Êé5îiiÌ6ƒÁÁx2x ã––ð!Á€P${cø‡C`C94Œ )
î¹”<$íêâǾ–rKœ E¾Ó'¦e{Œ2{¡:QÀm˜ù=ùlXŒÚó¥X.Âr4òtELJäÎ «¹ù ñ–{Ô‹¤H2ƒÜ/ÌäçŸÍ¨Ë°¸¯™fº µL‘—Pʲª_ =ŠŽ¢” -ª]+r%3<®«îp1ñC*Šb¨t…f!›Å}ö(ñ·Õú!^Æ—°„!¯r•]&áN9Óz|¯Ã-Ý”f»½Ö_Õ¤5¢Ñ ô‘äÙdšÉC¢ƒô(jxÓ›7Ûp6Vêy£=§¶¾ÅálÍ·+â®KïJÕ§Eüq³|H–ëÕÓaØXßù£û“ÑÍ9MMËc>µ#Ÿ|mäõ°àHåªi¥È ÚÃù¬Î#ÔˆÝû(.F¢næDá S»0º*TUŠ"—ÍÀ˜ -…ðMW´˜¾*!Ë÷¦®Ev@ö²–*ÅÈ\MºJ¡ÄA–Rµ¨¬}Öâ^ª®q:y*Ú¼RX!ð&Ši"FÍôß“5Lq¼XÀü.^±çn;hÓ9_oT§d“ŠÓø²nzf
ÑžP˜ªÉõ€rfbE„“ͻ،9=¶ëO¯ët‹Äø‚ë7ÿ&;endstream -endobj -6 0 obj -565 -endobj -4 0 obj -<</Type/Page/MediaBox [0 0 595 842] -/Rotate 0/Parent 3 0 R -/Resources<</ProcSet[/PDF /Text] -/ExtGState 11 0 R -/Font 12 0 R ->> -/Contents 5 0 R ->> -endobj -3 0 obj -<< /Type /Pages /Kids [ -4 0 R -] /Count 1 ->> -endobj -1 0 obj -<</Type /Catalog /Pages 3 0 R -/Metadata 13 0 R ->> -endobj -7 0 obj -<</Type/ExtGState -/OPM 1>>endobj -11 0 obj -<</R7 -7 0 R>> -endobj -12 0 obj -<</R10 -10 0 R/R9 -9 0 R/R8 -8 0 R>> -endobj -10 0 obj -<</BaseFont/Times-Italic/Type/Font -/Subtype/Type1>> -endobj -9 0 obj -<</BaseFont/Times-Bold/Type/Font -/Subtype/Type1>> -endobj -8 0 obj -<</BaseFont/Times-Roman/Type/Font -/Subtype/Type1>> -endobj -13 0 obj -<</Type/Metadata -/Subtype/XML/Length 1346>>stream -<?xpacket begin='' id='W5M0MpCehiHzreSzNTczkc9d'?> -<?adobe-xap-filters esc="CRLF"?> -<x:xmpmeta xmlns:x='adobe:ns:meta/' x:xmptk='XMP toolkit 2.9.1-13, framework 1.6'> -<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' xmlns:iX='http://ns.adobe.com/iX/1.0/'> -<rdf:Description rdf:about='uuid:b8c58b2d-a861-11ed-0000-156c038b2dc2' xmlns:pdf='http://ns.adobe.com/pdf/1.3/' pdf:Producer='GPL Ghostscript 9.05'/> -<rdf:Description rdf:about='uuid:b8c58b2d-a861-11ed-0000-156c038b2dc2' xmlns:xmp='http://ns.adobe.com/xap/1.0/'><xmp:ModifyDate>2013-02-06T11:08:37+01:00</xmp:ModifyDate> -<xmp:CreateDate>2013-02-06T11:08:37+01:00</xmp:CreateDate> -<xmp:CreatorTool>groff version 1.22.1</xmp:CreatorTool></rdf:Description> -<rdf:Description rdf:about='uuid:b8c58b2d-a861-11ed-0000-156c038b2dc2' xmlns:xapMM='http://ns.adobe.com/xap/1.0/mm/' xapMM:DocumentID='uuid:b8c58b2d-a861-11ed-0000-156c038b2dc2'/> -<rdf:Description rdf:about='uuid:b8c58b2d-a861-11ed-0000-156c038b2dc2' xmlns:dc='http://purl.org/dc/elements/1.1/' dc:format='application/pdf'><dc:title><rdf:Alt><rdf:li xml:lang='x-default'>Untitled</rdf:li></rdf:Alt></dc:title></rdf:Description> -</rdf:RDF> -</x:xmpmeta> - - -<?xpacket end='w'?> -endstream -endobj -2 0 obj -<</Producer(GPL Ghostscript 9.05) -/CreationDate(D:20130206110837+01'00') -/ModDate(D:20130206110837+01'00') -/Creator(groff version 1.22.1)>>endobj -xref -0 14 -0000000000 65535 f -0000000888 00000 n -0000002696 00000 n -0000000829 00000 n -0000000669 00000 n -0000000015 00000 n -0000000650 00000 n -0000000953 00000 n -0000001207 00000 n -0000001142 00000 n -0000001074 00000 n -0000000994 00000 n -0000001024 00000 n -0000001273 00000 n -trailer -<< /Size 14 /Root 1 0 R /Info 2 0 R -/ID [<0EA3D41182AFB1081715DDEBB3BB91E1><0EA3D41182AFB1081715DDEBB3BB91E1>] ->> -startxref -2850 -%%EOF diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_getdate.3 b/plugins/FTPFileYM/curl/docs/libcurl/curl_getdate.3 deleted file mode 100644 index 65eed9c578..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_getdate.3 +++ /dev/null @@ -1,117 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at http://curl.haxx.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" ************************************************************************** -.TH curl_getdate 3 "12 Aug 2005" "libcurl 7.0" "libcurl Manual" -.SH NAME -curl_getdate - Convert a date string to number of seconds since January 1, -1970 -.SH SYNOPSIS -.B #include <curl/curl.h> -.sp -.BI "time_t curl_getdate(char *" datestring ", time_t *"now " );" -.ad -.SH DESCRIPTION -This function returns the number of seconds since January 1st 1970 in the UTC -time zone, for the date and time that the \fIdatestring\fP parameter -specifies. The \fInow\fP parameter is not used, pass a NULL there. - -\fBNOTE:\fP This function was rewritten for the 7.12.2 release and this -documentation covers the functionality of the new one. The new one is not -feature-complete with the old one, but most of the formats supported by the -new one was supported by the old too. -.SH PARSING DATES AND TIMES -A "date" is a string containing several items separated by whitespace. The -order of the items is immaterial. A date string may contain many flavors of -items: -.TP 0.8i -.B calendar date items -Can be specified several ways. Month names can only be three-letter english -abbreviations, numbers can be zero-prefixed and the year may use 2 or 4 digits. -Examples: 06 Nov 1994, 06-Nov-94 and Nov-94 6. -.TP -.B time of the day items -This string specifies the time on a given day. You must specify it with 6 -digits with two colons: HH:MM:SS. To not include the time in a date string, -will make the function assume 00:00:00. Example: 18:19:21. -.TP -.B time zone items -Specifies international time zone. There are a few acronyms supported, but in -general you should instead use the specific relative time compared to -UTC. Supported formats include: -1200, MST, +0100. -.TP -.B day of the week items -Specifies a day of the week. Days of the week may be spelled out in full -(using english): `Sunday', `Monday', etc or they may be abbreviated to their -first three letters. This is usually not info that adds anything. -.TP -.B pure numbers -If a decimal number of the form YYYYMMDD appears, then YYYY is read as the -year, MM as the month number and DD as the day of the month, for the specified -calendar date. -.PP -.SH EXAMPLES -.nf -Sun, 06 Nov 1994 08:49:37 GMT -Sunday, 06-Nov-94 08:49:37 GMT -Sun Nov 6 08:49:37 1994 -06 Nov 1994 08:49:37 GMT -06-Nov-94 08:49:37 GMT -Nov 6 08:49:37 1994 -06 Nov 1994 08:49:37 -06-Nov-94 08:49:37 -1994 Nov 6 08:49:37 -GMT 08:49:37 06-Nov-94 Sunday -94 6 Nov 08:49:37 -1994 Nov 6 -06-Nov-94 -Sun Nov 6 94 -1994.Nov.6 -Sun/Nov/6/94/GMT -Sun, 06 Nov 1994 08:49:37 CET -06 Nov 1994 08:49:37 EST -Sun, 12 Sep 2004 15:05:58 -0700 -Sat, 11 Sep 2004 21:32:11 +0200 -20040912 15:05:58 -0700 -20040911 +0200 -.fi -.SH STANDARDS -This parser was written to handle date formats specified in RFC 822 (including -the update in RFC 1123) using time zone name or time zone delta and RFC 850 -(obsoleted by RFC 1036) and ANSI C's asctime() format. These formats are the -only ones RFC2616 says HTTP applications may use. -.SH RETURN VALUE -This function returns -1 when it fails to parse the date string. Otherwise it -returns the number of seconds as described. - -If the year is larger than 2037 on systems with 32 bit time_t, this function -will return 0x7fffffff (since that is the largest possible signed 32 bit -number). - -Having a 64 bit time_t is not a guarantee that dates beyond 03:14:07 UTC, -January 19, 2038 will work fine. On systems with a 64 bit time_t but with a -crippled mktime(), \fIcurl_getdate\fP will return -1 in this case. -.SH REWRITE -The former version of this function was built with yacc and was not only very -large, it was also never quite understood and it wasn't possible to build with -non-GNU tools since only GNU Bison could make it thread-safe! - -The rewrite was done for 7.12.2. The new one is much smaller and uses simpler -code. diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_getdate.html b/plugins/FTPFileYM/curl/docs/libcurl/curl_getdate.html deleted file mode 100644 index b989702dbc..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_getdate.html +++ /dev/null @@ -1,72 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> -<html><head> -<title>curl_getdate man page</title> -<meta name="generator" content="roffit"> -<STYLE type="text/css"> -P.level0 { - padding-left: 2em; -} - -P.level1 { - padding-left: 4em; -} - -P.level2 { - padding-left: 6em; -} - -span.emphasis { - font-style: italic; -} - -span.bold { - font-weight: bold; -} - -span.manpage { - font-weight: bold; -} - -h2.nroffsh { - background-color: #e0e0e0; -} - -span.nroffip { - font-weight: bold; - font-size: 120%; - font-family: monospace; -} - -p.roffit { - text-align: center; - font-size: 80%; -} -</STYLE> -</head><body> - -<p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2> -<p class="level0">curl_getdate - Convert a date string to number of seconds since January 1, 1970 <a name="SYNOPSIS"></a><h2 class="nroffsh">SYNOPSIS</h2> -<p class="level0"><span Class="bold">#include <curl/curl.h></span> -<p class="level0"><span Class="bold">time_t curl_getdate(char * datestring , time_t *now );</span> -<p class="level0"><a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2> -<p class="level0">This function returns the number of seconds since January 1st 1970 in the UTC time zone, for the date and time that the <span Class="emphasis">datestring</span> parameter specifies. The <span Class="emphasis">now</span> parameter is not used, pass a NULL there. -<p class="level0"><span Class="bold">NOTE:</span> This function was rewritten for the 7.12.2 release and this documentation covers the functionality of the new one. The new one is not feature-complete with the old one, but most of the formats supported by the new one was supported by the old too. <a name="PARSING"></a><h2 class="nroffsh">PARSING DATES AND TIMES</h2> -<p class="level0">A "date" is a string containing several items separated by whitespace. The order of the items is immaterial. A date string may contain many flavors of items: -<p class="level0"><span Class="bold">calendar date items</span> Can be specified several ways. Month names can only be three-letter english abbreviations, numbers can be zero-prefixed and the year may use 2 or 4 digits. Examples: 06 Nov 1994, 06-Nov-94 and Nov-94 6. -<p class="level0"><span Class="bold">time of the day items</span> This string specifies the time on a given day. You must specify it with 6 digits with two colons: HH:MM:SS. To not include the time in a date string, will make the function assume 00:00:00. Example: 18:19:21. -<p class="level0"><span Class="bold">time zone items</span> Specifies international time zone. There are a few acronyms supported, but in general you should instead use the specific relative time compared to UTC. Supported formats include: -1200, MST, +0100. -<p class="level0"><span Class="bold">day of the week items</span> Specifies a day of the week. Days of the week may be spelled out in full (using english): `Sunday', `Monday', etc or they may be abbreviated to their first three letters. This is usually not info that adds anything. -<p class="level0"><span Class="bold">pure numbers</span> If a decimal number of the form YYYYMMDD appears, then YYYY is read as the year, MM as the month number and DD as the day of the month, for the specified calendar date. -<p class="level0"><a name="EXAMPLES"></a><h2 class="nroffsh">EXAMPLES</h2> -<p class="level0"> -<p class="level0">Sun, 06 Nov 1994 08:49:37 GMT Sunday, 06-Nov-94 08:49:37 GMT Sun Nov 6 08:49:37 1994 06 Nov 1994 08:49:37 GMT 06-Nov-94 08:49:37 GMT Nov 6 08:49:37 1994 06 Nov 1994 08:49:37 06-Nov-94 08:49:37 1994 Nov 6 08:49:37 GMT 08:49:37 06-Nov-94 Sunday 94 6 Nov 08:49:37 1994 Nov 6 06-Nov-94 Sun Nov 6 94 1994.Nov.6 Sun/Nov/6/94/GMT Sun, 06 Nov 1994 08:49:37 CET 06 Nov 1994 08:49:37 EST Sun, 12 Sep 2004 15:05:58 -0700 Sat, 11 Sep 2004 21:32:11 +0200 20040912 15:05:58 -0700 20040911 +0200 -<p class="level0"><a name="STANDARDS"></a><h2 class="nroffsh">STANDARDS</h2> -<p class="level0">This parser was written to handle date formats specified in <a href="http://www.ietf.org/rfc/rfc822.txt">RFC 822</a> (including the update in <a href="http://www.ietf.org/rfc/rfc1123.txt">RFC 1123</a>) using time zone name or time zone delta and RFC 850 (obsoleted by <a href="http://www.ietf.org/rfc/rfc1036.txt">RFC 1036</a>) and ANSI C's asctime() format. These formats are the only ones <a href="http://www.ietf.org/rfc/rfc2616.txt">RFC 2616</a> says HTTP applications may use. <a name="RETURN"></a><h2 class="nroffsh">RETURN VALUE</h2> -<p class="level0">This function returns -1 when it fails to parse the date string. Otherwise it returns the number of seconds as described. -<p class="level0">If the year is larger than 2037 on systems with 32 bit time_t, this function will return 0x7fffffff (since that is the largest possible signed 32 bit number). -<p class="level0">Having a 64 bit time_t is not a guarantee that dates beyond 03:14:07 UTC, January 19, 2038 will work fine. On systems with a 64 bit time_t but with a crippled mktime(), <span Class="emphasis">curl_getdate</span> will return -1 in this case. <a name="REWRITE"></a><h2 class="nroffsh">REWRITE</h2> -<p class="level0">The former version of this function was built with yacc and was not only very large, it was also never quite understood and it wasn't possible to build with non-GNU tools since only GNU Bison could make it thread-safe! -<p class="level0">The rewrite was done for 7.12.2. The new one is much smaller and uses simpler code. <p class="roffit"> - This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>. -</body></html> diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_getdate.pdf b/plugins/FTPFileYM/curl/docs/libcurl/curl_getdate.pdf Binary files differdeleted file mode 100644 index 19344b0be2..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_getdate.pdf +++ /dev/null diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_getenv.3 b/plugins/FTPFileYM/curl/docs/libcurl/curl_getenv.3 deleted file mode 100644 index 33554476a1..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_getenv.3 +++ /dev/null @@ -1,49 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at http://curl.haxx.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" ************************************************************************** -.TH curl_getenv 3 "30 April 2004" "libcurl 7.12" "libcurl Manual" -.SH NAME -curl_getenv - return value for environment name -.SH SYNOPSIS -.B #include <curl/curl.h> -.sp -.BI "char *curl_getenv(const char *" name ");" -.ad -.SH DESCRIPTION -curl_getenv() is a portable wrapper for the getenv() function, meant to -emulate its behaviour and provide an identical interface for all operating -systems libcurl builds on (including win32). -.SH AVAILABILITY -This function will be removed from the public libcurl API in a near future. It -will instead be made "available" by source code access only, and then as -curlx_getenv(). -.SH RETURN VALUE -If successful, curl_getenv() returns a pointer to the value of the specified -environment. The memory it refers to is malloc()ed so the application must -free() this when the data is no longer needed. When \fIcurl_getenv(3)\fP fails -to find the specified name, it returns a null pointer. -.SH NOTE -Under unix operating systems, there isn't any point in returning an allocated -memory, although other systems won't work properly if this isn't done. The -unix implementation thus has to suffer slightly from the drawbacks of other -systems. -.SH "SEE ALSO" -.BR getenv "(3C), " diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_getenv.html b/plugins/FTPFileYM/curl/docs/libcurl/curl_getenv.html deleted file mode 100644 index fcab4e093d..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_getenv.html +++ /dev/null @@ -1,59 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> -<html><head> -<title>curl_getenv man page</title> -<meta name="generator" content="roffit"> -<STYLE type="text/css"> -P.level0 { - padding-left: 2em; -} - -P.level1 { - padding-left: 4em; -} - -P.level2 { - padding-left: 6em; -} - -span.emphasis { - font-style: italic; -} - -span.bold { - font-weight: bold; -} - -span.manpage { - font-weight: bold; -} - -h2.nroffsh { - background-color: #e0e0e0; -} - -span.nroffip { - font-weight: bold; - font-size: 120%; - font-family: monospace; -} - -p.roffit { - text-align: center; - font-size: 80%; -} -</STYLE> -</head><body> - -<p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2> -<p class="level0">curl_getenv - return value for environment name <a name="SYNOPSIS"></a><h2 class="nroffsh">SYNOPSIS</h2> -<p class="level0"><span Class="bold">#include <curl/curl.h></span> -<p class="level0"><span Class="bold">char *curl_getenv(const char * name );</span> -<p class="level0"><a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2> -<p class="level0">curl_getenv() is a portable wrapper for the getenv() function, meant to emulate its behaviour and provide an identical interface for all operating systems libcurl builds on (including win32). <a name="AVAILABILITY"></a><h2 class="nroffsh">AVAILABILITY</h2> -<p class="level0">This function will be removed from the public libcurl API in a near future. It will instead be made "available" by source code access only, and then as curlx_getenv(). <a name="RETURN"></a><h2 class="nroffsh">RETURN VALUE</h2> -<p class="level0">If successful, curl_getenv() returns a pointer to the value of the specified environment. The memory it refers to is malloc()ed so the application must free() this when the data is no longer needed. When <a class="emphasis" href="./curl_getenv.html">curl_getenv(3)</a> fails to find the specified name, it returns a null pointer. <a name="NOTE"></a><h2 class="nroffsh">NOTE</h2> -<p class="level0">Under unix operating systems, there isn't any point in returning an allocated memory, although other systems won't work properly if this isn't done. The unix implementation thus has to suffer slightly from the drawbacks of other systems. <a name="SEE"></a><h2 class="nroffsh">SEE ALSO</h2> -<p class="level0"><span Class="manpage">getenv (3C)</span> <span Class="manpage"> </span> <p class="roffit"> - This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>. -</body></html> diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_getenv.pdf b/plugins/FTPFileYM/curl/docs/libcurl/curl_getenv.pdf Binary files differdeleted file mode 100644 index 048e0a146b..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_getenv.pdf +++ /dev/null diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_global_cleanup.3 b/plugins/FTPFileYM/curl/docs/libcurl/curl_global_cleanup.3 deleted file mode 100644 index 83a54e467c..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_global_cleanup.3 +++ /dev/null @@ -1,49 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at http://curl.haxx.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" ************************************************************************** -.TH curl_global_cleanup 3 "17 Feb 2006" "libcurl 7.8" "libcurl Manual" -.SH NAME -curl_global_cleanup - global libcurl cleanup -.SH SYNOPSIS -.B #include <curl/curl.h> -.sp -.BI "void curl_global_cleanup(void);" -.ad -.SH DESCRIPTION -This function releases resources acquired by \fBcurl_global_init(3)\fP. - -You should call \fIcurl_global_cleanup(3)\fP once for each call you make to -\fIcurl_global_init(3)\fP, after you are done using libcurl. - -\fBThis function is not thread safe.\fP You must not call it when any other -thread in the program (i.e. a thread sharing the same memory) is running. -This doesn't just mean no other thread that is using libcurl. Because -\fBcurl_global_cleanup(3)\fP calls functions of other libraries that are -similarly thread unsafe, it could conflict with any other thread that uses -these other libraries. - -See the description in \fBlibcurl(3)\fP of global environment requirements for -details of how to use this function. - -.SH "SEE ALSO" -.BR curl_global_init "(3), " -.BR libcurl "(3), " - diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_global_cleanup.html b/plugins/FTPFileYM/curl/docs/libcurl/curl_global_cleanup.html deleted file mode 100644 index afee7bcf39..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_global_cleanup.html +++ /dev/null @@ -1,61 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> -<html><head> -<title>curl_global_cleanup man page</title> -<meta name="generator" content="roffit"> -<STYLE type="text/css"> -P.level0 { - padding-left: 2em; -} - -P.level1 { - padding-left: 4em; -} - -P.level2 { - padding-left: 6em; -} - -span.emphasis { - font-style: italic; -} - -span.bold { - font-weight: bold; -} - -span.manpage { - font-weight: bold; -} - -h2.nroffsh { - background-color: #e0e0e0; -} - -span.nroffip { - font-weight: bold; - font-size: 120%; - font-family: monospace; -} - -p.roffit { - text-align: center; - font-size: 80%; -} -</STYLE> -</head><body> - -<p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2> -<p class="level0">curl_global_cleanup - global libcurl cleanup <a name="SYNOPSIS"></a><h2 class="nroffsh">SYNOPSIS</h2> -<p class="level0"><span Class="bold">#include <curl/curl.h></span> -<p class="level0"><span Class="bold">void curl_global_cleanup(void);</span> -<p class="level0"><a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2> -<p class="level0">This function releases resources acquired by <a class="bold" href="./curl_global_init.html">curl_global_init(3)</a>. -<p class="level0">You should call <a class="emphasis" href="./curl_global_cleanup.html">curl_global_cleanup(3)</a> once for each call you make to <a class="emphasis" href="./curl_global_init.html">curl_global_init(3)</a>, after you are done using libcurl. -<p class="level0"><span Class="bold">This function is not thread safe.</span> You must not call it when any other thread in the program (i.e. a thread sharing the same memory) is running. This doesn't just mean no other thread that is using libcurl. Because <a class="bold" href="./curl_global_cleanup.html">curl_global_cleanup(3)</a> calls functions of other libraries that are similarly thread unsafe, it could conflict with any other thread that uses these other libraries. -<p class="level0">See the description in <a class="bold" href="./libcurl.html">libcurl(3)</a> of global environment requirements for details of how to use this function. -<p class="level0"><a name="SEE"></a><h2 class="nroffsh">SEE ALSO</h2> -<p class="level0"><a class="manpage" href="./curl_global_init.html">curl_global_init (3)</a> <span Class="manpage"> </span> <a class="manpage" href="./libcurl.html">libcurl (3)</a> <span Class="manpage"> </span> -<p class="level0"><p class="roffit"> - This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>. -</body></html> diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_global_cleanup.pdf b/plugins/FTPFileYM/curl/docs/libcurl/curl_global_cleanup.pdf Binary files differdeleted file mode 100644 index 7935b4f316..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_global_cleanup.pdf +++ /dev/null diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_global_init.3 b/plugins/FTPFileYM/curl/docs/libcurl/curl_global_init.3 deleted file mode 100644 index d91e1bdb7c..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_global_init.3 +++ /dev/null @@ -1,80 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at http://curl.haxx.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" ************************************************************************** -.TH curl_global_init 3 "11 May 2004" "libcurl 7.12" "libcurl Manual" -.SH NAME -curl_global_init - Global libcurl initialisation -.SH SYNOPSIS -.B #include <curl/curl.h> -.sp -.BI "CURLcode curl_global_init(long " flags ");" -.ad -.SH DESCRIPTION -This function sets up the program environment that libcurl needs. Think of it -as an extension of the library loader. - -This function must be called at least once within a program (a program is all -the code that shares a memory space) before the program calls any other -function in libcurl. The environment it sets up is constant for the life of -the program and is the same for every program, so multiple calls have the same -effect as one call. - -The flags option is a bit pattern that tells libcurl exactly what features to -init, as described below. Set the desired bits by ORing the values together. -In normal operation, you must specify CURL_GLOBAL_ALL. Don't use any other -value unless you are familiar with it and mean to control internal operations of -libcurl. - -\fBThis function is not thread safe.\fP You must not call it when any other -thread in the program (i.e. a thread sharing the same memory) is running. -This doesn't just mean no other thread that is using libcurl. Because -\fIcurl_global_init()\fP calls functions of other libraries that are similarly -thread unsafe, it could conflict with any other thread that uses these other -libraries. - -See the description in \fBlibcurl\fP(3) of global environment requirements for -details of how to use this function. - -.SH FLAGS -.TP 5 -.B CURL_GLOBAL_ALL -Initialize everything possible. This sets all known bits. -.TP -.B CURL_GLOBAL_SSL -Initialize SSL -.TP -.B CURL_GLOBAL_WIN32 -Initialize the Win32 socket libraries. -.TP -.B CURL_GLOBAL_NOTHING -Initialise nothing extra. This sets no bit. -.TP -.B CURL_GLOBAL_DEFAULT -A sensible default. It will init both SSL and Win32. Right now, this equals -the functionality of the \fBCURL_GLOBAL_ALL\fP mask. -.SH RETURN VALUE -If this function returns non-zero, something went wrong and you cannot use the -other curl functions. -.SH "SEE ALSO" -.BR curl_global_init_mem "(3), " -.BR curl_global_cleanup "(3), " -.BR curl_easy_init "(3) " -.BR libcurl "(3) " diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_global_init.html b/plugins/FTPFileYM/curl/docs/libcurl/curl_global_init.html deleted file mode 100644 index 295616ab04..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_global_init.html +++ /dev/null @@ -1,68 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> -<html><head> -<title>curl_global_init man page</title> -<meta name="generator" content="roffit"> -<STYLE type="text/css"> -P.level0 { - padding-left: 2em; -} - -P.level1 { - padding-left: 4em; -} - -P.level2 { - padding-left: 6em; -} - -span.emphasis { - font-style: italic; -} - -span.bold { - font-weight: bold; -} - -span.manpage { - font-weight: bold; -} - -h2.nroffsh { - background-color: #e0e0e0; -} - -span.nroffip { - font-weight: bold; - font-size: 120%; - font-family: monospace; -} - -p.roffit { - text-align: center; - font-size: 80%; -} -</STYLE> -</head><body> - -<p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2> -<p class="level0">curl_global_init - Global libcurl initialisation <a name="SYNOPSIS"></a><h2 class="nroffsh">SYNOPSIS</h2> -<p class="level0"><span Class="bold">#include <curl/curl.h></span> -<p class="level0"><span Class="bold">CURLcode curl_global_init(long flags );</span> -<p class="level0"><a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2> -<p class="level0">This function sets up the program environment that libcurl needs. Think of it as an extension of the library loader. -<p class="level0">This function must be called at least once within a program (a program is all the code that shares a memory space) before the program calls any other function in libcurl. The environment it sets up is constant for the life of the program and is the same for every program, so multiple calls have the same effect as one call. -<p class="level0">The flags option is a bit pattern that tells libcurl exactly what features to init, as described below. Set the desired bits by ORing the values together. In normal operation, you must specify CURL_GLOBAL_ALL. Don't use any other value unless you are familiar with it and mean to control internal operations of libcurl. -<p class="level0"><span Class="bold">This function is not thread safe.</span> You must not call it when any other thread in the program (i.e. a thread sharing the same memory) is running. This doesn't just mean no other thread that is using libcurl. Because <span Class="emphasis">curl_global_init()</span> calls functions of other libraries that are similarly thread unsafe, it could conflict with any other thread that uses these other libraries. -<p class="level0">See the description in <span Class="bold">libcurl</span>(3) of global environment requirements for details of how to use this function. -<p class="level0"><a name="FLAGS"></a><h2 class="nroffsh">FLAGS</h2> -<p class="level0"> -<p class="level0"><span Class="bold">CURL_GLOBAL_ALL</span> Initialize everything possible. This sets all known bits. -<p class="level0"><span Class="bold">CURL_GLOBAL_SSL</span> Initialize SSL -<p class="level0"><span Class="bold">CURL_GLOBAL_WIN32</span> Initialize the Win32 socket libraries. -<p class="level0"><span Class="bold">CURL_GLOBAL_NOTHING</span> Initialise nothing extra. This sets no bit. -<p class="level0"><span Class="bold">CURL_GLOBAL_DEFAULT</span> A sensible default. It will init both SSL and Win32. Right now, this equals the functionality of the <span Class="bold">CURL_GLOBAL_ALL</span> mask. <a name="RETURN"></a><h2 class="nroffsh">RETURN VALUE</h2> -<p class="level0">If this function returns non-zero, something went wrong and you cannot use the other curl functions. <a name="SEE"></a><h2 class="nroffsh">SEE ALSO</h2> -<p class="level0"><a class="manpage" href="./curl_global_init_mem.html">curl_global_init_mem (3)</a> <span Class="manpage"> </span> <a class="manpage" href="./curl_global_cleanup.html">curl_global_cleanup (3)</a> <span Class="manpage"> </span> <a class="manpage" href="./curl_easy_init.html">curl_easy_init (3) </a> <a class="manpage" href="./libcurl.html">libcurl (3) </a> <p class="roffit"> - This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>. -</body></html> diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_global_init.pdf b/plugins/FTPFileYM/curl/docs/libcurl/curl_global_init.pdf Binary files differdeleted file mode 100644 index a95eeea908..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_global_init.pdf +++ /dev/null diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_global_init_mem.3 b/plugins/FTPFileYM/curl/docs/libcurl/curl_global_init_mem.3 deleted file mode 100644 index 9cddef7c3c..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_global_init_mem.3 +++ /dev/null @@ -1,60 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at http://curl.haxx.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" ************************************************************************** -.TH curl_global_init_mem 3 "10 May 2004" "libcurl 7.12.0" "libcurl Manual" -.SH NAME -curl_global_init_mem - Global libcurl initialisation with memory callbacks -.SH SYNOPSIS -.B #include <curl/curl.h> -.nf -.B "CURLcode curl_global_init_mem(long " flags, -.B " curl_malloc_callback "m, -.B " curl_free_callback "f, -.B " curl_realloc_callback "r, -.B " curl_strdup_callback "s, -.B " curl_calloc_callback "c ");" -.SH DESCRIPTION -This function works exactly as \fIcurl_global_init(3)\fP with one addition: it -allows the application to set callbacks to replace the otherwise used internal -memory functions. - -This man page only adds documentation for the callbacks, see the -\fIcurl_global_init(3)\fP man page for all the rest. When you use this -function, all callback arguments must be set to valid function pointers. - -The prototypes for the given callbacks should match these: -.IP "void *malloc_callback(size_t size);" -To replace malloc() -.IP "void free_callback(void *ptr);" -To replace free() -.IP "void *realloc_callback(void *ptr, size_t size);" -To replace realloc() -.IP "char *strdup_callback(const char *str);" -To replace strdup() -.IP "void *calloc_callback(size_t nmemb, size_t size);" -To replace calloc() -.SH "CAUTION" -Manipulating these gives considerable powers to the application to severely -screw things up for libcurl. Take care! -.SH "SEE ALSO" -.BR curl_global_init "(3), " -.BR curl_global_cleanup "(3), " - diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_global_init_mem.html b/plugins/FTPFileYM/curl/docs/libcurl/curl_global_init_mem.html deleted file mode 100644 index 04252c8e5e..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_global_init_mem.html +++ /dev/null @@ -1,69 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> -<html><head> -<title>curl_global_init_mem man page</title> -<meta name="generator" content="roffit"> -<STYLE type="text/css"> -P.level0 { - padding-left: 2em; -} - -P.level1 { - padding-left: 4em; -} - -P.level2 { - padding-left: 6em; -} - -span.emphasis { - font-style: italic; -} - -span.bold { - font-weight: bold; -} - -span.manpage { - font-weight: bold; -} - -h2.nroffsh { - background-color: #e0e0e0; -} - -span.nroffip { - font-weight: bold; - font-size: 120%; - font-family: monospace; -} - -p.roffit { - text-align: center; - font-size: 80%; -} -</STYLE> -</head><body> - -<p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2> -<p class="level0">curl_global_init_mem - Global libcurl initialisation with memory callbacks <a name="SYNOPSIS"></a><h2 class="nroffsh">SYNOPSIS</h2> -<p class="level0"><span Class="bold">#include <curl/curl.h></span> -<p class="level0"><span Class="bold">CURLcode curl_global_init_mem(long flags,</span> <span Class="bold"> curl_malloc_callback m,</span> <span Class="bold"> curl_free_callback f,</span> <span Class="bold"> curl_realloc_callback r,</span> <span Class="bold"> curl_strdup_callback s,</span> <span Class="bold"> curl_calloc_callback c );</span> <a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2> -<p class="level0">This function works exactly as <a class="emphasis" href="./curl_global_init.html">curl_global_init(3)</a> with one addition: it allows the application to set callbacks to replace the otherwise used internal memory functions. -<p class="level0">This man page only adds documentation for the callbacks, see the <a class="emphasis" href="./curl_global_init.html">curl_global_init(3)</a> man page for all the rest. When you use this function, all callback arguments must be set to valid function pointers. -<p class="level0">The prototypes for the given callbacks should match these: -<p class="level0"><a name="void"></a><span class="nroffip">void *malloc_callback(size_t size);</span> -<p class="level1">To replace malloc() -<p class="level0"><a name="void"></a><span class="nroffip">void free_callback(void *ptr);</span> -<p class="level1">To replace free() -<p class="level0"><a name="void"></a><span class="nroffip">void *realloc_callback(void *ptr, size_t size);</span> -<p class="level1">To replace realloc() -<p class="level0"><a name="char"></a><span class="nroffip">char *strdup_callback(const char *str);</span> -<p class="level1">To replace strdup() -<p class="level0"><a name="void"></a><span class="nroffip">void *calloc_callback(size_t nmemb, size_t size);</span> -<p class="level1">To replace calloc() <a name="CAUTION"></a><h2 class="nroffsh">CAUTION</h2> -<p class="level0">Manipulating these gives considerable powers to the application to severely screw things up for libcurl. Take care! <a name="SEE"></a><h2 class="nroffsh">SEE ALSO</h2> -<p class="level0"><a class="manpage" href="./curl_global_init.html">curl_global_init (3)</a> <span Class="manpage"> </span> <a class="manpage" href="./curl_global_cleanup.html">curl_global_cleanup (3)</a> <span Class="manpage"> </span> -<p class="level0"><p class="roffit"> - This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>. -</body></html> diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_global_init_mem.pdf b/plugins/FTPFileYM/curl/docs/libcurl/curl_global_init_mem.pdf Binary files differdeleted file mode 100644 index 0d371487cd..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_global_init_mem.pdf +++ /dev/null diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_mprintf.3 b/plugins/FTPFileYM/curl/docs/libcurl/curl_mprintf.3 deleted file mode 100644 index cbf10e1ab0..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_mprintf.3 +++ /dev/null @@ -1,109 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at http://curl.haxx.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" ************************************************************************** -.TH curl_printf 3 "30 April 2004" "libcurl 7.12" "libcurl Manual" -.SH NAME -curl_maprintf, curl_mfprintf, curl_mprintf, curl_msnprintf, curl_msprintf -curl_mvaprintf, curl_mvfprintf, curl_mvprintf, curl_mvsnprintf, -curl_mvsprintf - formatted output conversion -.SH SYNOPSIS -.B #include <curl/mprintf.h> -.sp -.BI "int curl_mprintf(const char *" format ", ...);" -.br -.BI "int curl_mfprintf(FILE *" fd ", const char *" format ", ...);" -.br -.BI "int curl_msprintf(char *" buffer ", const char *" format ", ...);" -.br -.BI "int curl_msnprintf(char *" buffer ", size_t " maxlength ", const char *" format ", ...);" -.br -.BI "int curl_mvprintf(const char *" format ", va_list " args ");" -.br -.BI "int curl_mvfprintf(FILE *" fd ", const char *" format ", va_list " args ");" -.br -.BI "int curl_mvsprintf(char *" buffer ", const char *" format ", va_list " args ");" -.br -.BI "int curl_mvsnprintf(char *" buffer ", size_t " maxlength ", const char *" format ", va_list " args ");" -.br -.BI "char *curl_maprintf(const char *" format ", ...);" -.br -.BI "char *curl_mvaprintf(const char *" format ", va_list " args ");" -.SH DESCRIPTION -These are all functions that produce output according to a format string and -given arguments. These are mostly clones of the well-known C-style functions -and there will be no detailed explanation of all available formatting rules -and usage here. - -See this table for notable exceptions. -.RS -.TP -.B curl_mprintf() -Normal printf() clone. -.TP -.B curl_mfprintf() -Normal fprintf() clone. -.TP -.B curl_msprintf() -Normal sprintf() clone. -.TP -.B curl_msnprintf() -snprintf() clone. Many systems don't have this. It is just like \fBsprintf\fP -but with an extra argument after the buffer that specifies the length of the -target buffer. -.TP -.B curl_mvprintf() -Normal vprintf() clone. -.TP -.B curl_mvfprintf() -Normal vfprintf() clone. -.TP -.B curl_mvsprintf() -Normal vsprintf() clone. -.TP -.B curl_mvsnprintf() -vsnprintf() clone. Many systems don't have this. It is just like -\fBvsprintf\fP but with an extra argument after the buffer that specifies the -length of the target buffer. -.TP -.B curl_maprintf() -Like printf() but returns the output string as a malloc()ed string. The -returned string must be free()ed by the receiver. -.TP -.B curl_mvaprintf() -Like curl_maprintf() but takes a va_list pointer argument instead of a -variable amount of arguments. -.RE - -To easily use all these cloned functions instead of the normal ones, #define -_MPRINTF_REPLACE before you include the <curl/mprintf.h> file. Then all the -normal names like printf, fprintf, sprintf etc will use the curl-functions -instead. -.SH AVAILABILITY -These function will be removed from the public libcurl API in a near -future. They will instead be made "available" by source code access only, and -then as curlx_-prefixed functions. See lib/README.curlx for further details. -.SH RETURN VALUE -The \fBcurl_maprintf\fP and \fBcurl_mvaprintf\fP functions return a pointer to -a newly allocated string, or NULL if it failed. - -All other functions return the number of characters they actually outputted. -.SH "SEE ALSO" -.BR printf "(3), " sprintf "(3), " fprintf "(3), " vprintf "(3) " diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_mprintf.html b/plugins/FTPFileYM/curl/docs/libcurl/curl_mprintf.html deleted file mode 100644 index 3d5228737c..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_mprintf.html +++ /dev/null @@ -1,81 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> -<html><head> -<title>curl_printf man page</title> -<meta name="generator" content="roffit"> -<STYLE type="text/css"> -P.level0 { - padding-left: 2em; -} - -P.level1 { - padding-left: 4em; -} - -P.level2 { - padding-left: 6em; -} - -span.emphasis { - font-style: italic; -} - -span.bold { - font-weight: bold; -} - -span.manpage { - font-weight: bold; -} - -h2.nroffsh { - background-color: #e0e0e0; -} - -span.nroffip { - font-weight: bold; - font-size: 120%; - font-family: monospace; -} - -p.roffit { - text-align: center; - font-size: 80%; -} -</STYLE> -</head><body> - -<p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2> -<p class="level0">curl_maprintf, curl_mfprintf, curl_mprintf, curl_msnprintf, curl_msprintf curl_mvaprintf, curl_mvfprintf, curl_mvprintf, curl_mvsnprintf, curl_mvsprintf - formatted output conversion <a name="SYNOPSIS"></a><h2 class="nroffsh">SYNOPSIS</h2> -<p class="level0"><span Class="bold">#include <curl/mprintf.h></span> -<p class="level0"><span Class="bold">int curl_mprintf(const char * format , ...);</span> -<p class="level0"><span Class="bold">int curl_mfprintf(FILE * fd , const char * format , ...);</span> -<p class="level0"><span Class="bold">int curl_msprintf(char * buffer , const char * format , ...);</span> -<p class="level0"><span Class="bold">int curl_msnprintf(char * buffer , size_t maxlength , const char * format , ...);</span> -<p class="level0"><span Class="bold">int curl_mvprintf(const char * format , va_list args );</span> -<p class="level0"><span Class="bold">int curl_mvfprintf(FILE * fd , const char * format , va_list args );</span> -<p class="level0"><span Class="bold">int curl_mvsprintf(char * buffer , const char * format , va_list args );</span> -<p class="level0"><span Class="bold">int curl_mvsnprintf(char * buffer , size_t maxlength , const char * format , va_list args );</span> -<p class="level0"><span Class="bold">char *curl_maprintf(const char * format , ...);</span> -<p class="level0"><span Class="bold">char *curl_mvaprintf(const char * format , va_list args );</span> <a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2> -<p class="level0">These are all functions that produce output according to a format string and given arguments. These are mostly clones of the well-known C-style functions and there will be no detailed explanation of all available formatting rules and usage here. -<p class="level0">See this table for notable exceptions. -<p class="level1"> -<p class="level1"><span Class="bold">curl_mprintf()</span> Normal printf() clone. -<p class="level1"><span Class="bold">curl_mfprintf()</span> Normal fprintf() clone. -<p class="level1"><span Class="bold">curl_msprintf()</span> Normal sprintf() clone. -<p class="level1"><span Class="bold">curl_msnprintf()</span> snprintf() clone. Many systems don't have this. It is just like <span Class="bold">sprintf</span> but with an extra argument after the buffer that specifies the length of the target buffer. -<p class="level1"><span Class="bold">curl_mvprintf()</span> Normal vprintf() clone. -<p class="level1"><span Class="bold">curl_mvfprintf()</span> Normal vfprintf() clone. -<p class="level1"><span Class="bold">curl_mvsprintf()</span> Normal vsprintf() clone. -<p class="level1"><span Class="bold">curl_mvsnprintf()</span> vsnprintf() clone. Many systems don't have this. It is just like <span Class="bold">vsprintf</span> but with an extra argument after the buffer that specifies the length of the target buffer. -<p class="level1"><span Class="bold">curl_maprintf()</span> Like printf() but returns the output string as a malloc()ed string. The returned string must be free()ed by the receiver. -<p class="level1"><span Class="bold">curl_mvaprintf()</span> Like curl_maprintf() but takes a va_list pointer argument instead of a variable amount of arguments. -<p class="level0"> -<p class="level0">To easily use all these cloned functions instead of the normal ones, #define _MPRINTF_REPLACE before you include the <curl/mprintf.h> file. Then all the normal names like printf, fprintf, sprintf etc will use the curl-functions instead. <a name="AVAILABILITY"></a><h2 class="nroffsh">AVAILABILITY</h2> -<p class="level0">These function will be removed from the public libcurl API in a near future. They will instead be made "available" by source code access only, and then as curlx_-prefixed functions. See lib/README.curlx for further details. <a name="RETURN"></a><h2 class="nroffsh">RETURN VALUE</h2> -<p class="level0">The <span Class="bold">curl_maprintf</span> and <span Class="bold">curl_mvaprintf</span> functions return a pointer to a newly allocated string, or NULL if it failed. -<p class="level0">All other functions return the number of characters they actually outputted. <a name="SEE"></a><h2 class="nroffsh">SEE ALSO</h2> -<p class="level0"><span Class="manpage">printf (3)</span> <span Class="manpage"> sprintf (3)</span> <span Class="manpage"> fprintf (3)</span> <span Class="manpage"> vprintf (3) </span> <p class="roffit"> - This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>. -</body></html> diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_mprintf.pdf b/plugins/FTPFileYM/curl/docs/libcurl/curl_mprintf.pdf Binary files differdeleted file mode 100644 index 631ffcb8a2..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_mprintf.pdf +++ /dev/null diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_add_handle.3 b/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_add_handle.3 deleted file mode 100644 index bae2c90fe0..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_add_handle.3 +++ /dev/null @@ -1,57 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at http://curl.haxx.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" ************************************************************************** -.TH curl_multi_add_handle 3 "4 March 2002" "libcurl 7.9.5" "libcurl Manual" -.SH NAME -curl_multi_add_handle - add an easy handle to a multi session -.SH SYNOPSIS -#include <curl/curl.h> - -CURLMcode curl_multi_add_handle(CURLM *multi_handle, CURL *easy_handle); -.ad -.SH DESCRIPTION -Adds a standard easy handle to the multi stack. This function call will make -this \fImulti_handle\fP control the specified \fIeasy_handle\fP. -Furthermore, libcurl now initiates the connection associated with the -specified \fIeasy_handle\fP. - -When an easy handle has been added to a multi stack, you can not and you must -not use \fIcurl_easy_perform(3)\fP on that handle! - -If the easy handle is not set to use a shared (CURLOPT_SHARE) or global DNS -cache (CURLOPT_DNS_USE_GLOBAL_CACHE), it will be made to use the DNS cache -that is shared between all easy handles within the multi handle when -\fIcurl_multi_add_handle(3)\fP is called. - -The easy handle will remain added until you remove it again with -\fIcurl_multi_remove_handle(3)\fP. You should remove the easy handle from the -multi stack before you terminate first the easy handle and then the multi -handle: - -1 - \fIcurl_multi_remove_handle(3)\fP - -2 - \fIcurl_easy_cleanup(3)\fP - -3 - \fIcurl_multi_cleanup(3)\fP -.SH RETURN VALUE -CURLMcode type, general libcurl multi interface error code. -.SH "SEE ALSO" -.BR curl_multi_cleanup "(3)," curl_multi_init "(3)" diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_add_handle.html b/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_add_handle.html deleted file mode 100644 index 2941352498..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_add_handle.html +++ /dev/null @@ -1,63 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> -<html><head> -<title>curl_multi_add_handle man page</title> -<meta name="generator" content="roffit"> -<STYLE type="text/css"> -P.level0 { - padding-left: 2em; -} - -P.level1 { - padding-left: 4em; -} - -P.level2 { - padding-left: 6em; -} - -span.emphasis { - font-style: italic; -} - -span.bold { - font-weight: bold; -} - -span.manpage { - font-weight: bold; -} - -h2.nroffsh { - background-color: #e0e0e0; -} - -span.nroffip { - font-weight: bold; - font-size: 120%; - font-family: monospace; -} - -p.roffit { - text-align: center; - font-size: 80%; -} -</STYLE> -</head><body> - -<p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2> -<p class="level0">curl_multi_add_handle - add an easy handle to a multi session <a name="SYNOPSIS"></a><h2 class="nroffsh">SYNOPSIS</h2> -<p class="level0">#include <curl/curl.h> -<p class="level0">CURLMcode curl_multi_add_handle(CURLM *multi_handle, CURL *easy_handle); -<p class="level0"><a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2> -<p class="level0">Adds a standard easy handle to the multi stack. This function call will make this <span Class="emphasis">multi_handle</span> control the specified <span Class="emphasis">easy_handle</span>. Furthermore, libcurl now initiates the connection associated with the specified <span Class="emphasis">easy_handle</span>. -<p class="level0">When an easy handle has been added to a multi stack, you can not and you must not use <a class="emphasis" href="./curl_easy_perform.html">curl_easy_perform(3)</a> on that handle! -<p class="level0">If the easy handle is not set to use a shared (CURLOPT_SHARE) or global DNS cache (CURLOPT_DNS_USE_GLOBAL_CACHE), it will be made to use the DNS cache that is shared between all easy handles within the multi handle when <a class="emphasis" href="./curl_multi_add_handle.html">curl_multi_add_handle(3)</a> is called. -<p class="level0">The easy handle will remain added until you remove it again with <a class="emphasis" href="./curl_multi_remove_handle.html">curl_multi_remove_handle(3)</a>. You should remove the easy handle from the multi stack before you terminate first the easy handle and then the multi handle: -<p class="level0">1 - <a class="emphasis" href="./curl_multi_remove_handle.html">curl_multi_remove_handle(3)</a> -<p class="level0">2 - <a class="emphasis" href="./curl_easy_cleanup.html">curl_easy_cleanup(3)</a> -<p class="level0">3 - <a class="emphasis" href="./curl_multi_cleanup.html">curl_multi_cleanup(3)</a> <a name="RETURN"></a><h2 class="nroffsh">RETURN VALUE</h2> -<p class="level0">CURLMcode type, general libcurl multi interface error code. <a name="SEE"></a><h2 class="nroffsh">SEE ALSO</h2> -<p class="level0"><a class="manpage" href="./curl_multi_cleanup.html">curl_multi_cleanup (3)</a> <a class="manpage" href="./curl_multi_init.html"> curl_multi_init (3)</a> <p class="roffit"> - This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>. -</body></html> diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_add_handle.pdf b/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_add_handle.pdf Binary files differdeleted file mode 100644 index 0674c02941..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_add_handle.pdf +++ /dev/null diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_assign.3 b/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_assign.3 deleted file mode 100644 index 0b580fe27b..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_assign.3 +++ /dev/null @@ -1,63 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at http://curl.haxx.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" ************************************************************************** -.TH curl_multi_assign 3 "9 Jul 2006" "libcurl 7.16.0" "libcurl Manual" -.SH NAME -curl_multi_assign \- set data to association with an internal socket -.SH SYNOPSIS -#include <curl/curl.h> - -CURLMcode curl_multi_assign(CURLM *multi_handle, curl_socket_t sockfd, - void *sockptr); -.SH DESCRIPTION -This function assigns an association in the multi handle between the given -socket and a private pointer of the application. This is (only) useful for -\fIcurl_multi_socket(3)\fP uses. - -When set, the \fIsockptr\fP pointer will be passed to all future socket -callbacks for the specific \fIsockfd\fP socket. - -If the given \fIsockfd\fP isn't already in use by libcurl, this function will -return an error. - -libcurl only keeps one single pointer associated with a socket, so calling -this function several times for the same socket will make the last set pointer -get used. - -The idea here being that this association (socket to private pointer) is -something that just about every application that uses this API will need and -then libcurl can just as well do it since it already has an internal hash -table lookup for this. -.SH "RETURN VALUE" -The standard CURLMcode for multi interface error codes. -.SH "TYPICAL USAGE" -In a typical application you allocate a struct or at least use some kind of -semi-dynamic data for each socket that we must wait for action on when using -the \fIcurl_multi_socket(3)\fP approach. - -When our socket-callback gets called by libcurl and we get to know about yet -another socket to wait for, we can use \fIcurl_multi_assign(3)\fP to point out -the particular data so that when we get updates about this same socket again, -we don't have to find the struct associated with this socket by ourselves. -.SH AVAILABILITY -This function was added in libcurl 7.15.5, although not deemed stable yet. -.SH "SEE ALSO" -.BR curl_multi_setopt "(3), " curl_multi_socket "(3) " diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_assign.html b/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_assign.html deleted file mode 100644 index fc468076fd..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_assign.html +++ /dev/null @@ -1,63 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> -<html><head> -<title>curl_multi_assign man page</title> -<meta name="generator" content="roffit"> -<STYLE type="text/css"> -P.level0 { - padding-left: 2em; -} - -P.level1 { - padding-left: 4em; -} - -P.level2 { - padding-left: 6em; -} - -span.emphasis { - font-style: italic; -} - -span.bold { - font-weight: bold; -} - -span.manpage { - font-weight: bold; -} - -h2.nroffsh { - background-color: #e0e0e0; -} - -span.nroffip { - font-weight: bold; - font-size: 120%; - font-family: monospace; -} - -p.roffit { - text-align: center; - font-size: 80%; -} -</STYLE> -</head><body> - -<p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2> -<p class="level0">curl_multi_assign - set data to association with an internal socket <a name="SYNOPSIS"></a><h2 class="nroffsh">SYNOPSIS</h2> -<p class="level0">#include <curl/curl.h> -<p class="level0">CURLMcode curl_multi_assign(CURLM *multi_handle, curl_socket_t sockfd, void *sockptr); <a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2> -<p class="level0">This function assigns an association in the multi handle between the given socket and a private pointer of the application. This is (only) useful for <a class="emphasis" href="./curl_multi_socket.html">curl_multi_socket(3)</a> uses. -<p class="level0">When set, the <span Class="emphasis">sockptr</span> pointer will be passed to all future socket callbacks for the specific <span Class="emphasis">sockfd</span> socket. -<p class="level0">If the given <span Class="emphasis">sockfd</span> isn't already in use by libcurl, this function will return an error. -<p class="level0">libcurl only keeps one single pointer associated with a socket, so calling this function several times for the same socket will make the last set pointer get used. -<p class="level0">The idea here being that this association (socket to private pointer) is something that just about every application that uses this API will need and then libcurl can just as well do it since it already has an internal hash table lookup for this. <a name="RETURN"></a><h2 class="nroffsh">RETURN VALUE</h2> -<p class="level0">The standard CURLMcode for multi interface error codes. <a name="TYPICAL"></a><h2 class="nroffsh">TYPICAL USAGE</h2> -<p class="level0">In a typical application you allocate a struct or at least use some kind of semi-dynamic data for each socket that we must wait for action on when using the <a class="emphasis" href="./curl_multi_socket.html">curl_multi_socket(3)</a> approach. -<p class="level0">When our socket-callback gets called by libcurl and we get to know about yet another socket to wait for, we can use <a class="emphasis" href="./curl_multi_assign.html">curl_multi_assign(3)</a> to point out the particular data so that when we get updates about this same socket again, we don't have to find the struct associated with this socket by ourselves. <a name="AVAILABILITY"></a><h2 class="nroffsh">AVAILABILITY</h2> -<p class="level0">This function was added in libcurl 7.15.5, although not deemed stable yet. <a name="SEE"></a><h2 class="nroffsh">SEE ALSO</h2> -<p class="level0"><a class="manpage" href="./curl_multi_setopt.html">curl_multi_setopt (3)</a> <a class="manpage" href="./curl_multi_socket.html"> curl_multi_socket (3) </a> <p class="roffit"> - This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>. -</body></html> diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_assign.pdf b/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_assign.pdf Binary files differdeleted file mode 100644 index 352d1b8181..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_assign.pdf +++ /dev/null diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_cleanup.3 b/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_cleanup.3 deleted file mode 100644 index e83c9f01b0..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_cleanup.3 +++ /dev/null @@ -1,46 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at http://curl.haxx.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" ************************************************************************** -.TH curl_multi_cleanup 3 "1 March 2002" "libcurl 7.9.5" "libcurl Manual" -.SH NAME -curl_multi_cleanup - close down a multi session -.SH SYNOPSIS -.B #include <curl/curl.h> -.sp -.BI "CURLMcode curl_multi_cleanup( CURLM *multi_handle );" -.ad -.SH DESCRIPTION -Cleans up and removes a whole multi stack. It does not free or touch any -individual easy handles in any way - they still need to be closed -individually, using the usual \fIcurl_easy_cleanup(3)\fP way. The order of -cleaning up should be: - -1 - \fIcurl_multi_remove_handle(3)\fP before any easy handles are cleaned up - -2 - \fIcurl_easy_cleanup(3)\fP can now be called independently since the easy -handle is no longer connected to the multi handle - -3 - \fIcurl_multi_cleanup(3)\fP should be called when all easy handles are -removed -.SH RETURN VALUE -CURLMcode type, general libcurl multi interface error code. -.SH "SEE ALSO" -.BR curl_multi_init "(3)," curl_easy_cleanup "(3)," curl_easy_init "(3)" diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_cleanup.html b/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_cleanup.html deleted file mode 100644 index ba1ccbb934..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_cleanup.html +++ /dev/null @@ -1,60 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> -<html><head> -<title>curl_multi_cleanup man page</title> -<meta name="generator" content="roffit"> -<STYLE type="text/css"> -P.level0 { - padding-left: 2em; -} - -P.level1 { - padding-left: 4em; -} - -P.level2 { - padding-left: 6em; -} - -span.emphasis { - font-style: italic; -} - -span.bold { - font-weight: bold; -} - -span.manpage { - font-weight: bold; -} - -h2.nroffsh { - background-color: #e0e0e0; -} - -span.nroffip { - font-weight: bold; - font-size: 120%; - font-family: monospace; -} - -p.roffit { - text-align: center; - font-size: 80%; -} -</STYLE> -</head><body> - -<p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2> -<p class="level0">curl_multi_cleanup - close down a multi session <a name="SYNOPSIS"></a><h2 class="nroffsh">SYNOPSIS</h2> -<p class="level0"><span Class="bold">#include <curl/curl.h></span> -<p class="level0"><span Class="bold">CURLMcode curl_multi_cleanup( CURLM *multi_handle );</span> -<p class="level0"><a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2> -<p class="level0">Cleans up and removes a whole multi stack. It does not free or touch any individual easy handles in any way - they still need to be closed individually, using the usual <a class="emphasis" href="./curl_easy_cleanup.html">curl_easy_cleanup(3)</a> way. The order of cleaning up should be: -<p class="level0">1 - <a class="emphasis" href="./curl_multi_remove_handle.html">curl_multi_remove_handle(3)</a> before any easy handles are cleaned up -<p class="level0">2 - <a class="emphasis" href="./curl_easy_cleanup.html">curl_easy_cleanup(3)</a> can now be called independently since the easy handle is no longer connected to the multi handle -<p class="level0">3 - <a class="emphasis" href="./curl_multi_cleanup.html">curl_multi_cleanup(3)</a> should be called when all easy handles are removed <a name="RETURN"></a><h2 class="nroffsh">RETURN VALUE</h2> -<p class="level0">CURLMcode type, general libcurl multi interface error code. <a name="SEE"></a><h2 class="nroffsh">SEE ALSO</h2> -<p class="level0"><a class="manpage" href="./curl_multi_init.html">curl_multi_init (3)</a> <a class="manpage" href="./curl_easy_cleanup.html"> curl_easy_cleanup (3)</a> <a class="manpage" href="./curl_easy_init.html"> curl_easy_init (3)</a> <p class="roffit"> - This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>. -</body></html> diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_cleanup.pdf b/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_cleanup.pdf Binary files differdeleted file mode 100644 index 586f5ca292..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_cleanup.pdf +++ /dev/null diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_fdset.3 b/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_fdset.3 deleted file mode 100644 index 3dbdc45044..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_fdset.3 +++ /dev/null @@ -1,70 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at http://curl.haxx.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" ************************************************************************** -.TH curl_multi_fdset 3 "2 Jan 2006" "libcurl 7.16.0" "libcurl Manual" -.SH NAME -curl_multi_fdset - extracts file descriptor information from a multi handle -.SH SYNOPSIS -.nf -#include <curl/curl.h> - -CURLMcode curl_multi_fdset(CURLM *multi_handle, - fd_set *read_fd_set, - fd_set *write_fd_set, - fd_set *exc_fd_set, - int *max_fd); -.ad -.SH DESCRIPTION -This function extracts file descriptor information from a given multi_handle. -libcurl returns its fd_set sets. The application can use these to select() on, -but be sure to FD_ZERO them before calling this function as -\fIcurl_multi_fdset(3)\fP only adds its own descriptors, it doesn't zero or -otherwise remove any others. The \fIcurl_multi_perform(3)\fP function should be -called as soon as one of them is ready to be read from or written to. - -If no file descriptors are set by libcurl, \fImax_fd\fP will contain -1 when -this function returns. Otherwise it will contain the higher descriptor number -libcurl set. When libcurl returns -1 in \fImax_fd\fP, it is because libcurl -currently does something that isn't possible for your application to monitor -with a socket and unfortunately you can then not know exactly when the current -action is completed using select(). When max_fd returns with -1, you need to -wait a while and then proceed and call \fIcurl_multi_perform\fP anyway. How -long to wait? I would suggest 100 milliseconds at least, but you may want to -test it out in your own particular conditions to find a suitable value. - -When doing select(), you should use \fBcurl_multi_timeout\fP to figure out how -long to wait for action. Call \fIcurl_multi_perform\fP even if no activity has -been seen on the fd_sets after the timeout expires as otherwise internal -retries and timeouts may not work as you'd think and want. - -If one of the sockets used by libcurl happens to be larger than what can be -set in an fd_set, which on POSIX systems means that the file descriptor is -larger than FD_SETSIZE, then libcurl will try to not set it. Setting a too -large file descriptor in an fd_set implies an out of bounds write which can -cause crashes, or worse. The effect of NOT storing it will possibly save you -from the crash, but will make your program NOT wait for sockets it should wait -for... -.SH RETURN VALUE -CURLMcode type, general libcurl multi interface error code. See -\fIlibcurl-errors(3)\fP -.SH "SEE ALSO" -.BR curl_multi_cleanup "(3), " curl_multi_init "(3), " -.BR curl_multi_timeout "(3), " curl_multi_perform "(3) " diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_fdset.html b/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_fdset.html deleted file mode 100644 index a7121e2ec4..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_fdset.html +++ /dev/null @@ -1,61 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> -<html><head> -<title>curl_multi_fdset man page</title> -<meta name="generator" content="roffit"> -<STYLE type="text/css"> -P.level0 { - padding-left: 2em; -} - -P.level1 { - padding-left: 4em; -} - -P.level2 { - padding-left: 6em; -} - -span.emphasis { - font-style: italic; -} - -span.bold { - font-weight: bold; -} - -span.manpage { - font-weight: bold; -} - -h2.nroffsh { - background-color: #e0e0e0; -} - -span.nroffip { - font-weight: bold; - font-size: 120%; - font-family: monospace; -} - -p.roffit { - text-align: center; - font-size: 80%; -} -</STYLE> -</head><body> - -<p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2> -<p class="level0">curl_multi_fdset - extracts file descriptor information from a multi handle <a name="SYNOPSIS"></a><h2 class="nroffsh">SYNOPSIS</h2> -<p class="level0"> -<p class="level0">#include <curl/curl.h> -<p class="level0">CURLMcode curl_multi_fdset(CURLM *multi_handle, fd_set *read_fd_set, fd_set *write_fd_set, fd_set *exc_fd_set, int *max_fd); -<p class="level0"><a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2> -<p class="level0">This function extracts file descriptor information from a given multi_handle. libcurl returns its fd_set sets. The application can use these to select() on, but be sure to FD_ZERO them before calling this function as <a class="emphasis" href="./curl_multi_fdset.html">curl_multi_fdset(3)</a> only adds its own descriptors, it doesn't zero or otherwise remove any others. The <a class="emphasis" href="./curl_multi_perform.html">curl_multi_perform(3)</a> function should be called as soon as one of them is ready to be read from or written to. -<p class="level0">If no file descriptors are set by libcurl, <span Class="emphasis">max_fd</span> will contain -1 when this function returns. Otherwise it will contain the higher descriptor number libcurl set. When libcurl returns -1 in <span Class="emphasis">max_fd</span>, it is because libcurl currently does something that isn't possible for your application to monitor with a socket and unfortunately you can then not know exactly when the current action is completed using select(). When max_fd returns with -1, you need to wait a while and then proceed and call <span Class="emphasis">curl_multi_perform</span> anyway. How long to wait? I would suggest 100 milliseconds at least, but you may want to test it out in your own particular conditions to find a suitable value. -<p class="level0">When doing select(), you should use <span Class="bold">curl_multi_timeout</span> to figure out how long to wait for action. Call <span Class="emphasis">curl_multi_perform</span> even if no activity has been seen on the fd_sets after the timeout expires as otherwise internal retries and timeouts may not work as you'd think and want. -<p class="level0">If one of the sockets used by libcurl happens to be larger than what can be set in an fd_set, which on POSIX systems means that the file descriptor is larger than FD_SETSIZE, then libcurl will try to not set it. Setting a too large file descriptor in an fd_set implies an out of bounds write which can cause crashes, or worse. The effect of NOT storing it will possibly save you from the crash, but will make your program NOT wait for sockets it should wait for... <a name="RETURN"></a><h2 class="nroffsh">RETURN VALUE</h2> -<p class="level0">CURLMcode type, general libcurl multi interface error code. See <span Class="emphasis">libcurl-errors(3)</span> <a name="SEE"></a><h2 class="nroffsh">SEE ALSO</h2> -<p class="level0"><a class="manpage" href="./curl_multi_cleanup.html">curl_multi_cleanup (3)</a> <a class="manpage" href="./curl_multi_init.html"> curl_multi_init (3)</a> <span Class="manpage"> </span> <a class="manpage" href="./curl_multi_timeout.html">curl_multi_timeout (3)</a> <a class="manpage" href="./curl_multi_perform.html"> curl_multi_perform (3) </a> <p class="roffit"> - This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>. -</body></html> diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_fdset.pdf b/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_fdset.pdf Binary files differdeleted file mode 100644 index 92c13eca06..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_fdset.pdf +++ /dev/null diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_info_read.3 b/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_info_read.3 deleted file mode 100644 index 875176486d..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_info_read.3 +++ /dev/null @@ -1,76 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at http://curl.haxx.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" ************************************************************************** -.TH curl_multi_info_read 3 "18 Dec 2004" "libcurl 7.10.3" "libcurl Manual" -.SH NAME -curl_multi_info_read - read multi stack informationals -.SH SYNOPSIS -#include <curl/curl.h> - -CURLMsg *curl_multi_info_read( CURLM *multi_handle, - int *msgs_in_queue); -.ad -.SH DESCRIPTION -Ask the multi handle if there are any messages/informationals from the -individual transfers. Messages may include informationals such as an error -code from the transfer or just the fact that a transfer is completed. More -details on these should be written down as well. - -Repeated calls to this function will return a new struct each time, until a -NULL is returned as a signal that there is no more to get at this point. The -integer pointed to with \fImsgs_in_queue\fP will contain the number of -remaining messages after this function was called. - -When you fetch a message using this function, it is removed from the internal -queue so calling this function again will not return the same message -again. It will instead return new messages at each new invoke until the queue -is emptied. - -\fBWARNING:\fP The data the returned pointer points to will not survive -calling \fIcurl_multi_cleanup(3)\fP, \fIcurl_multi_remove_handle(3)\fP or -\fIcurl_easy_cleanup(3)\fP. - -The 'CURLMsg' struct is very simple and only contains very basic information. -If more involved information is wanted, the particular "easy handle" in -present in that struct and can thus be used in subsequent regular -\fIcurl_easy_getinfo(3)\fP calls (or similar): - -.nf - struct CURLMsg { - CURLMSG msg; /* what this message means */ - CURL *easy_handle; /* the handle it concerns */ - union { - void *whatever; /* message-specific data */ - CURLcode result; /* return code for transfer */ - } data; - }; -.fi -When \fBmsg\fP is \fICURLMSG_DONE\fP, the message identifies a transfer that -is done, and then \fBresult\fP contains the return code for the easy handle -that just completed. - -At this point, there are no other \fBmsg\fP types defined. -.SH "RETURN VALUE" -A pointer to a filled-in struct, or NULL if it failed or ran out of -structs. It also writes the number of messages left in the queue (after this -read) in the integer the second argument points to. -.SH "SEE ALSO" -.BR curl_multi_cleanup "(3), " curl_multi_init "(3), " curl_multi_perform "(3)" diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_info_read.html b/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_info_read.html deleted file mode 100644 index e40ec426a6..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_info_read.html +++ /dev/null @@ -1,65 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> -<html><head> -<title>curl_multi_info_read man page</title> -<meta name="generator" content="roffit"> -<STYLE type="text/css"> -P.level0 { - padding-left: 2em; -} - -P.level1 { - padding-left: 4em; -} - -P.level2 { - padding-left: 6em; -} - -span.emphasis { - font-style: italic; -} - -span.bold { - font-weight: bold; -} - -span.manpage { - font-weight: bold; -} - -h2.nroffsh { - background-color: #e0e0e0; -} - -span.nroffip { - font-weight: bold; - font-size: 120%; - font-family: monospace; -} - -p.roffit { - text-align: center; - font-size: 80%; -} -</STYLE> -</head><body> - -<p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2> -<p class="level0">curl_multi_info_read - read multi stack informationals <a name="SYNOPSIS"></a><h2 class="nroffsh">SYNOPSIS</h2> -<p class="level0">#include <curl/curl.h> -<p class="level0">CURLMsg *curl_multi_info_read( CURLM *multi_handle, int *msgs_in_queue); -<p class="level0"><a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2> -<p class="level0">Ask the multi handle if there are any messages/informationals from the individual transfers. Messages may include informationals such as an error code from the transfer or just the fact that a transfer is completed. More details on these should be written down as well. -<p class="level0">Repeated calls to this function will return a new struct each time, until a NULL is returned as a signal that there is no more to get at this point. The integer pointed to with <span Class="emphasis">msgs_in_queue</span> will contain the number of remaining messages after this function was called. -<p class="level0">When you fetch a message using this function, it is removed from the internal queue so calling this function again will not return the same message again. It will instead return new messages at each new invoke until the queue is emptied. -<p class="level0"><span Class="bold">WARNING:</span> The data the returned pointer points to will not survive calling <a class="emphasis" href="./curl_multi_cleanup.html">curl_multi_cleanup(3)</a>, <a class="emphasis" href="./curl_multi_remove_handle.html">curl_multi_remove_handle(3)</a> or <a class="emphasis" href="./curl_easy_cleanup.html">curl_easy_cleanup(3)</a>. -<p class="level0">The 'CURLMsg' struct is very simple and only contains very basic information. If more involved information is wanted, the particular "easy handle" in present in that struct and can thus be used in subsequent regular <a class="emphasis" href="./curl_easy_getinfo.html">curl_easy_getinfo(3)</a> calls (or similar): -<p class="level0"> -<p class="level0"> struct CURLMsg { CURLMSG msg; /* what this message means */ CURL *easy_handle; /* the handle it concerns */ union { void *whatever; /* message-specific data */ CURLcode result; /* return code for transfer */ } data; }; -<p class="level0">When <span Class="bold">msg</span> is <span Class="emphasis">CURLMSG_DONE</span>, the message identifies a transfer that is done, and then <span Class="bold">result</span> contains the return code for the easy handle that just completed. -<p class="level0">At this point, there are no other <span Class="bold">msg</span> types defined. <a name="RETURN"></a><h2 class="nroffsh">RETURN VALUE</h2> -<p class="level0">A pointer to a filled-in struct, or NULL if it failed or ran out of structs. It also writes the number of messages left in the queue (after this read) in the integer the second argument points to. <a name="SEE"></a><h2 class="nroffsh">SEE ALSO</h2> -<p class="level0"><a class="manpage" href="./curl_multi_cleanup.html">curl_multi_cleanup (3)</a> <a class="manpage" href="./curl_multi_init.html"> curl_multi_init (3)</a> <a class="manpage" href="./curl_multi_perform.html"> curl_multi_perform (3)</a> <p class="roffit"> - This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>. -</body></html> diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_info_read.pdf b/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_info_read.pdf Binary files differdeleted file mode 100644 index 7bd8d10ad6..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_info_read.pdf +++ /dev/null diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_init.3 b/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_init.3 deleted file mode 100644 index ca9374e151..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_init.3 +++ /dev/null @@ -1,40 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at http://curl.haxx.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" ************************************************************************** -.TH curl_multi_init 3 "1 March 2002" "libcurl 7.9.5" "libcurl Manual" -.SH NAME -curl_multi_init - create a multi handle -.SH SYNOPSIS -.B #include <curl/curl.h> -.sp -.BI "CURLM *curl_multi_init( );" -.ad -.SH DESCRIPTION -This function returns a CURLM handle to be used as input to all the other -multi-functions, sometimes referred to as a multi handle in some places in the -documentation. This init call MUST have a corresponding call to -\fIcurl_multi_cleanup(3)\fP when the operation is complete. -.SH RETURN VALUE -If this function returns NULL, something went wrong and you cannot use the -other curl functions. -.SH "SEE ALSO" -.BR curl_multi_cleanup "(3)," curl_global_init "(3)," curl_easy_init "(3)" - diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_init.html b/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_init.html deleted file mode 100644 index f1c7086619..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_init.html +++ /dev/null @@ -1,58 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> -<html><head> -<title>curl_multi_init man page</title> -<meta name="generator" content="roffit"> -<STYLE type="text/css"> -P.level0 { - padding-left: 2em; -} - -P.level1 { - padding-left: 4em; -} - -P.level2 { - padding-left: 6em; -} - -span.emphasis { - font-style: italic; -} - -span.bold { - font-weight: bold; -} - -span.manpage { - font-weight: bold; -} - -h2.nroffsh { - background-color: #e0e0e0; -} - -span.nroffip { - font-weight: bold; - font-size: 120%; - font-family: monospace; -} - -p.roffit { - text-align: center; - font-size: 80%; -} -</STYLE> -</head><body> - -<p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2> -<p class="level0">curl_multi_init - create a multi handle <a name="SYNOPSIS"></a><h2 class="nroffsh">SYNOPSIS</h2> -<p class="level0"><span Class="bold">#include <curl/curl.h></span> -<p class="level0"><span Class="bold">CURLM *curl_multi_init( );</span> -<p class="level0"><a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2> -<p class="level0">This function returns a CURLM handle to be used as input to all the other multi-functions, sometimes referred to as a multi handle in some places in the documentation. This init call MUST have a corresponding call to <a class="emphasis" href="./curl_multi_cleanup.html">curl_multi_cleanup(3)</a> when the operation is complete. <a name="RETURN"></a><h2 class="nroffsh">RETURN VALUE</h2> -<p class="level0">If this function returns NULL, something went wrong and you cannot use the other curl functions. <a name="SEE"></a><h2 class="nroffsh">SEE ALSO</h2> -<p class="level0"><a class="manpage" href="./curl_multi_cleanup.html">curl_multi_cleanup (3)</a> <a class="manpage" href="./curl_global_init.html"> curl_global_init (3)</a> <a class="manpage" href="./curl_easy_init.html"> curl_easy_init (3)</a> -<p class="level0"><p class="roffit"> - This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>. -</body></html> diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_init.pdf b/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_init.pdf Binary files differdeleted file mode 100644 index 00d058c57b..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_init.pdf +++ /dev/null diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_perform.3 b/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_perform.3 deleted file mode 100644 index 304197b1a4..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_perform.3 +++ /dev/null @@ -1,78 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at http://curl.haxx.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" ************************************************************************** -.TH curl_multi_perform 3 "1 March 2002" "libcurl 7.9.5" "libcurl Manual" -.SH NAME -curl_multi_perform - reads/writes available data from each easy handle -.SH SYNOPSIS -#include <curl/curl.h> - -CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles); -.ad -.SH DESCRIPTION -This function handles transfers on all the added handles that need attention -in an non-blocking fashion. - -When an application has found out there's data available for the multi_handle -or a timeout has elapsed, the application should call this function to -read/write whatever there is to read or write right now etc. -curl_multi_perform() returns as soon as the reads/writes are done. This -function does not require that there actually is any data available for -reading or that data can be written, it can be called just in case. It will -write the number of handles that still transfer data in the second argument's -integer-pointer. - -If the amount of \fIrunning_handles\fP is changed from the previous call (or -is less than the amount of easy handles you've added to the multi handle), you -know that there is one or more transfers less "running". You can then call -\fIcurl_multi_info_read(3)\fP to get information about each individual -completed transfer, and that returned info includes CURLcode and more. If an -added handle fails very quickly, it may never be counted as a running_handle. - -When \fIrunning_handles\fP is set to zero (0) on the return of this function, -there is no longer any transfers in progress. -.SH "RETURN VALUE" -CURLMcode type, general libcurl multi interface error code. - -Before version 7.20.0: If you receive \fICURLM_CALL_MULTI_PERFORM\fP, this -basically means that you should call \fIcurl_multi_perform\fP again, before -you select() on more actions. You don't have to do it immediately, but the -return code means that libcurl may have more data available to return or that -there may be more data to send off before it is "satisfied". Do note that -\fIcurl_multi_perform(3)\fP will return \fICURLM_CALL_MULTI_PERFORM\fP only -when it wants to be called again \fBimmediately\fP. When things are fine and -there is nothing immediate it wants done, it'll return \fICURLM_OK\fP and you -need to wait for \&"action" and then call this function again. - -This function only returns errors etc regarding the whole multi stack. -Problems still might have occurred on individual transfers even when this -function returns \fICURLM_OK\fP. Use \fIcurl_multi_info_read(3)\fP to figure -out how individual transfers did. -.SH "TYPICAL USAGE" -Most applications will use \fIcurl_multi_fdset(3)\fP to get the multi_handle's -file descriptors, and \fIcurl_multi_timeout(3)\fP to get a suitable timeout -period, then it'll wait for action on the file descriptors using -\fBselect(3)\fP. As soon as one or more file descriptor is ready, -\fIcurl_multi_perform(3)\fP gets called. -.SH "SEE ALSO" -.BR curl_multi_cleanup "(3), " curl_multi_init "(3), " -.BR curl_multi_fdset "(3), " curl_multi_info_read "(3), " -.BR libcurl-errors "(3)" diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_perform.html b/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_perform.html deleted file mode 100644 index 832d928a6e..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_perform.html +++ /dev/null @@ -1,63 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> -<html><head> -<title>curl_multi_perform man page</title> -<meta name="generator" content="roffit"> -<STYLE type="text/css"> -P.level0 { - padding-left: 2em; -} - -P.level1 { - padding-left: 4em; -} - -P.level2 { - padding-left: 6em; -} - -span.emphasis { - font-style: italic; -} - -span.bold { - font-weight: bold; -} - -span.manpage { - font-weight: bold; -} - -h2.nroffsh { - background-color: #e0e0e0; -} - -span.nroffip { - font-weight: bold; - font-size: 120%; - font-family: monospace; -} - -p.roffit { - text-align: center; - font-size: 80%; -} -</STYLE> -</head><body> - -<p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2> -<p class="level0">curl_multi_perform - reads/writes available data from each easy handle <a name="SYNOPSIS"></a><h2 class="nroffsh">SYNOPSIS</h2> -<p class="level0">#include <curl/curl.h> -<p class="level0">CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles); -<p class="level0"><a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2> -<p class="level0">This function handles transfers on all the added handles that need attention in an non-blocking fashion. -<p class="level0">When an application has found out there's data available for the multi_handle or a timeout has elapsed, the application should call this function to read/write whatever there is to read or write right now etc. curl_multi_perform() returns as soon as the reads/writes are done. This function does not require that there actually is any data available for reading or that data can be written, it can be called just in case. It will write the number of handles that still transfer data in the second argument's integer-pointer. -<p class="level0">If the amount of <span Class="emphasis">running_handles</span> is changed from the previous call (or is less than the amount of easy handles you've added to the multi handle), you know that there is one or more transfers less "running". You can then call <a class="emphasis" href="./curl_multi_info_read.html">curl_multi_info_read(3)</a> to get information about each individual completed transfer, and that returned info includes CURLcode and more. If an added handle fails very quickly, it may never be counted as a running_handle. -<p class="level0">When <span Class="emphasis">running_handles</span> is set to zero (0) on the return of this function, there is no longer any transfers in progress. <a name="RETURN"></a><h2 class="nroffsh">RETURN VALUE</h2> -<p class="level0">CURLMcode type, general libcurl multi interface error code. -<p class="level0">Before version 7.20.0: If you receive <span Class="emphasis">CURLM_CALL_MULTI_PERFORM</span>, this basically means that you should call <span Class="emphasis">curl_multi_perform</span> again, before you select() on more actions. You don't have to do it immediately, but the return code means that libcurl may have more data available to return or that there may be more data to send off before it is "satisfied". Do note that <a class="emphasis" href="./curl_multi_perform.html">curl_multi_perform(3)</a> will return <span Class="emphasis">CURLM_CALL_MULTI_PERFORM</span> only when it wants to be called again <span Class="bold">immediately</span>. When things are fine and there is nothing immediate it wants done, it'll return <span Class="emphasis">CURLM_OK</span> and you need to wait for "action" and then call this function again. -<p class="level0">This function only returns errors etc regarding the whole multi stack. Problems still might have occurred on individual transfers even when this function returns <span Class="emphasis">CURLM_OK</span>. Use <a class="emphasis" href="./curl_multi_info_read.html">curl_multi_info_read(3)</a> to figure out how individual transfers did. <a name="TYPICAL"></a><h2 class="nroffsh">TYPICAL USAGE</h2> -<p class="level0">Most applications will use <a class="emphasis" href="./curl_multi_fdset.html">curl_multi_fdset(3)</a> to get the multi_handle's file descriptors, and <a class="emphasis" href="./curl_multi_timeout.html">curl_multi_timeout(3)</a> to get a suitable timeout period, then it'll wait for action on the file descriptors using <span Class="bold">select(3)</span>. As soon as one or more file descriptor is ready, <a class="emphasis" href="./curl_multi_perform.html">curl_multi_perform(3)</a> gets called. <a name="SEE"></a><h2 class="nroffsh">SEE ALSO</h2> -<p class="level0"><a class="manpage" href="./curl_multi_cleanup.html">curl_multi_cleanup (3)</a> <a class="manpage" href="./curl_multi_init.html"> curl_multi_init (3)</a> <span Class="manpage"> </span> <a class="manpage" href="./curl_multi_fdset.html">curl_multi_fdset (3)</a> <a class="manpage" href="./curl_multi_info_read.html"> curl_multi_info_read (3)</a> <span Class="manpage"> </span> <span Class="manpage">libcurl-errors (3)</span> <p class="roffit"> - This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>. -</body></html> diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_perform.pdf b/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_perform.pdf Binary files differdeleted file mode 100644 index 6006ad1c8b..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_perform.pdf +++ /dev/null diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_remove_handle.3 b/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_remove_handle.3 deleted file mode 100644 index ad6d2bac8d..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_remove_handle.3 +++ /dev/null @@ -1,43 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at http://curl.haxx.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" ************************************************************************** -.TH curl_multi_remove_handle 3 "6 March 2002" "libcurl 7.9.5" "libcurl Manual" -.SH NAME -curl_multi_remove_handle - remove an easy handle from a multi session -.SH SYNOPSIS -#include <curl/curl.h> - -CURLMcode curl_multi_remove_handle(CURLM *multi_handle, CURL *easy_handle); -.ad -.SH DESCRIPTION -Removes a given easy_handle from the multi_handle. This will make the -specified easy handle be removed from this multi handle's control. - -When the easy handle has been removed from a multi stack, it is again -perfectly legal to invoke \fIcurl_easy_perform()\fP on this easy handle. - -Removing an easy handle while being used, will effectively halt the transfer -in progress involving that easy handle. All other easy handles and transfers -will remain unaffected. -.SH RETURN VALUE -CURLMcode type, general libcurl multi interface error code. -.SH "SEE ALSO" -.BR curl_multi_cleanup "(3)," curl_multi_init "(3)" diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_remove_handle.html b/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_remove_handle.html deleted file mode 100644 index fb4c499eef..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_remove_handle.html +++ /dev/null @@ -1,59 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> -<html><head> -<title>curl_multi_remove_handle man page</title> -<meta name="generator" content="roffit"> -<STYLE type="text/css"> -P.level0 { - padding-left: 2em; -} - -P.level1 { - padding-left: 4em; -} - -P.level2 { - padding-left: 6em; -} - -span.emphasis { - font-style: italic; -} - -span.bold { - font-weight: bold; -} - -span.manpage { - font-weight: bold; -} - -h2.nroffsh { - background-color: #e0e0e0; -} - -span.nroffip { - font-weight: bold; - font-size: 120%; - font-family: monospace; -} - -p.roffit { - text-align: center; - font-size: 80%; -} -</STYLE> -</head><body> - -<p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2> -<p class="level0">curl_multi_remove_handle - remove an easy handle from a multi session <a name="SYNOPSIS"></a><h2 class="nroffsh">SYNOPSIS</h2> -<p class="level0">#include <curl/curl.h> -<p class="level0">CURLMcode curl_multi_remove_handle(CURLM *multi_handle, CURL *easy_handle); -<p class="level0"><a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2> -<p class="level0">Removes a given easy_handle from the multi_handle. This will make the specified easy handle be removed from this multi handle's control. -<p class="level0">When the easy handle has been removed from a multi stack, it is again perfectly legal to invoke <span Class="emphasis">curl_easy_perform()</span> on this easy handle. -<p class="level0">Removing an easy handle while being used, will effectively halt the transfer in progress involving that easy handle. All other easy handles and transfers will remain unaffected. <a name="RETURN"></a><h2 class="nroffsh">RETURN VALUE</h2> -<p class="level0">CURLMcode type, general libcurl multi interface error code. <a name="SEE"></a><h2 class="nroffsh">SEE ALSO</h2> -<p class="level0"><a class="manpage" href="./curl_multi_cleanup.html">curl_multi_cleanup (3)</a> <a class="manpage" href="./curl_multi_init.html"> curl_multi_init (3)</a> <p class="roffit"> - This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>. -</body></html> diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_remove_handle.pdf b/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_remove_handle.pdf Binary files differdeleted file mode 100644 index 4ee218a81c..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_remove_handle.pdf +++ /dev/null diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_setopt.3 b/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_setopt.3 deleted file mode 100644 index baaaaeac09..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_setopt.3 +++ /dev/null @@ -1,103 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at http://curl.haxx.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" ************************************************************************** -.TH curl_multi_setopt 3 "10 Oct 2006" "libcurl 7.16.0" "libcurl Manual" -.SH NAME -curl_multi_setopt \- set options for a curl multi handle -.SH SYNOPSIS -#include <curl/curl.h> - -CURLMcode curl_multi_setopt(CURLM * multi_handle, CURLMoption option, param); -.SH DESCRIPTION -curl_multi_setopt() is used to tell a libcurl multi handle how to behave. By -using the appropriate options to \fIcurl_multi_setopt(3)\fP, you can change -libcurl's behaviour when using that multi handle. All options are set with -the \fIoption\fP followed by the parameter \fIparam\fP. That parameter can be -a \fBlong\fP, a \fBfunction pointer\fP, an \fBobject pointer\fP or a -\fBcurl_off_t\fP type, depending on what the specific option expects. Read -this manual carefully as bad input values may cause libcurl to behave badly! -You can only set one option in each function call. - -.SH OPTIONS -.IP CURLMOPT_SOCKETFUNCTION -Pass a pointer to a function matching the \fBcurl_socket_callback\fP -prototype. The \fIcurl_multi_socket_action(3)\fP function informs the -application about updates in the socket (file descriptor) status by doing -none, one, or multiple calls to the curl_socket_callback given in the -\fBparam\fP argument. They update the status with changes since the previous -time a \fIcurl_multi_socket(3)\fP function was called. If the given callback -pointer is NULL, no callback will be called. Set the callback's \fBuserp\fP -argument with \fICURLMOPT_SOCKETDATA\fP. See \fIcurl_multi_socket(3)\fP for -more callback details. -.IP CURLMOPT_SOCKETDATA -Pass a pointer to whatever you want passed to the \fBcurl_socket_callback\fP's -forth argument, the userp pointer. This is not used by libcurl but only -passed-thru as-is. Set the callback pointer with -\fICURLMOPT_SOCKETFUNCTION\fP. -.IP CURLMOPT_PIPELINING -Pass a long set to 1 to enable or 0 to disable. Enabling pipelining on a multi -handle will make it attempt to perform HTTP Pipelining as far as possible for -transfers using this handle. This means that if you add a second request that -can use an already existing connection, the second request will be \&"piped" -on the same connection rather than being executed in parallel. (Added in -7.16.0) -.IP CURLMOPT_TIMERFUNCTION -Pass a pointer to a function matching the \fBcurl_multi_timer_callback\fP -prototype. This function will then be called when the timeout value -changes. The timeout value is at what latest time the application should call -one of the \&"performing" functions of the multi interface -(\fIcurl_multi_socket_action(3)\fP and \fIcurl_multi_perform(3)\fP) - to allow -libcurl to keep timeouts and retries etc to work. A timeout value of -1 means -that there is no timeout at all, and 0 means that the timeout is already -reached. Libcurl attempts to limit calling this only when the fixed future -timeout time actually changes. See also \fICURLMOPT_TIMERDATA\fP. This -callback can be used instead of, or in addition to, -\fIcurl_multi_timeout(3)\fP. (Added in 7.16.0) -.IP CURLMOPT_TIMERDATA -Pass a pointer to whatever you want passed to the -\fBcurl_multi_timer_callback\fP's third argument, the userp pointer. This is -not used by libcurl but only passed-thru as-is. Set the callback pointer with -\fICURLMOPT_TIMERFUNCTION\fP. (Added in 7.16.0) -.IP CURLMOPT_MAXCONNECTS -Pass a long. The set number will be used as the maximum amount of -simultaneously open connections that libcurl may cache. Default is 10, and -libcurl will enlarge the size for each added easy handle to make it fit 4 -times the number of added easy handles. - -By setting this option, you can prevent the cache size from growing beyond the -limit set by you. - -When the cache is full, curl closes the oldest one in the cache to prevent the -number of open connections from increasing. - -This option is for the multi handle's use only, when using the easy interface -you should instead use the \fICURLOPT_MAXCONNECTS\fP option. - -(Added in 7.16.3) -.SH RETURNS -The standard CURLMcode for multi interface error codes. Note that it returns a -CURLM_UNKNOWN_OPTION if you try setting an option that this version of libcurl -doesn't know of. -.SH AVAILABILITY -This function was added in libcurl 7.15.4. -.SH "SEE ALSO" -.BR curl_multi_cleanup "(3), " curl_multi_init "(3), " -.BR curl_multi_socket "(3), " curl_multi_info_read "(3)" diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_setopt.html b/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_setopt.html deleted file mode 100644 index 88206326c3..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_setopt.html +++ /dev/null @@ -1,75 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> -<html><head> -<title>curl_multi_setopt man page</title> -<meta name="generator" content="roffit"> -<STYLE type="text/css"> -P.level0 { - padding-left: 2em; -} - -P.level1 { - padding-left: 4em; -} - -P.level2 { - padding-left: 6em; -} - -span.emphasis { - font-style: italic; -} - -span.bold { - font-weight: bold; -} - -span.manpage { - font-weight: bold; -} - -h2.nroffsh { - background-color: #e0e0e0; -} - -span.nroffip { - font-weight: bold; - font-size: 120%; - font-family: monospace; -} - -p.roffit { - text-align: center; - font-size: 80%; -} -</STYLE> -</head><body> - -<p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2> -<p class="level0">curl_multi_setopt - set options for a curl multi handle <a name="SYNOPSIS"></a><h2 class="nroffsh">SYNOPSIS</h2> -<p class="level0">#include <curl/curl.h> -<p class="level0">CURLMcode curl_multi_setopt(CURLM * multi_handle, CURLMoption option, param); <a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2> -<p class="level0">curl_multi_setopt() is used to tell a libcurl multi handle how to behave. By using the appropriate options to <a class="emphasis" href="./curl_multi_setopt.html">curl_multi_setopt(3)</a>, you can change libcurl's behaviour when using that multi handle. All options are set with the <span Class="emphasis">option</span> followed by the parameter <span Class="emphasis">param</span>. That parameter can be a <span Class="bold">long</span>, a <span Class="bold">function pointer</span>, an <span Class="bold">object pointer</span> or a <span Class="bold">curl_off_t</span> type, depending on what the specific option expects. Read this manual carefully as bad input values may cause libcurl to behave badly! You can only set one option in each function call. -<p class="level0"><a name="OPTIONS"></a><h2 class="nroffsh">OPTIONS</h2> -<p class="level0"> -<p class="level0"><a name="CURLMOPTSOCKETFUNCTION"></a><span class="nroffip">CURLMOPT_SOCKETFUNCTION</span> -<p class="level1">Pass a pointer to a function matching the <span Class="bold">curl_socket_callback</span> prototype. The <a class="emphasis" href="./curl_multi_socket_action.html">curl_multi_socket_action(3)</a> function informs the application about updates in the socket (file descriptor) status by doing none, one, or multiple calls to the curl_socket_callback given in the <span Class="bold">param</span> argument. They update the status with changes since the previous time a <a class="emphasis" href="./curl_multi_socket.html">curl_multi_socket(3)</a> function was called. If the given callback pointer is NULL, no callback will be called. Set the callback's <span Class="bold">userp</span> argument with <a class="emphasis" href="#CURLMOPTSOCKETDATA">CURLMOPT_SOCKETDATA</a>. See <a class="emphasis" href="./curl_multi_socket.html">curl_multi_socket(3)</a> for more callback details. -<p class="level0"><a name="CURLMOPTSOCKETDATA"></a><span class="nroffip">CURLMOPT_SOCKETDATA</span> -<p class="level1">Pass a pointer to whatever you want passed to the <span Class="bold">curl_socket_callback</span>'s forth argument, the userp pointer. This is not used by libcurl but only passed-thru as-is. Set the callback pointer with <a class="emphasis" href="#CURLMOPTSOCKETFUNCTION">CURLMOPT_SOCKETFUNCTION</a>. -<p class="level0"><a name="CURLMOPTPIPELINING"></a><span class="nroffip">CURLMOPT_PIPELINING</span> -<p class="level1">Pass a long set to 1 to enable or 0 to disable. Enabling pipelining on a multi handle will make it attempt to perform HTTP Pipelining as far as possible for transfers using this handle. This means that if you add a second request that can use an already existing connection, the second request will be "piped" on the same connection rather than being executed in parallel. (Added in 7.16.0) -<p class="level0"><a name="CURLMOPTTIMERFUNCTION"></a><span class="nroffip">CURLMOPT_TIMERFUNCTION</span> -<p class="level1">Pass a pointer to a function matching the <span Class="bold">curl_multi_timer_callback</span> prototype. This function will then be called when the timeout value changes. The timeout value is at what latest time the application should call one of the "performing" functions of the multi interface (<a class="emphasis" href="./curl_multi_socket_action.html">curl_multi_socket_action(3)</a> and <a class="emphasis" href="./curl_multi_perform.html">curl_multi_perform(3)</a>) - to allow libcurl to keep timeouts and retries etc to work. A timeout value of -1 means that there is no timeout at all, and 0 means that the timeout is already reached. Libcurl attempts to limit calling this only when the fixed future timeout time actually changes. See also <a class="emphasis" href="#CURLMOPTTIMERDATA">CURLMOPT_TIMERDATA</a>. This callback can be used instead of, or in addition to, <a class="emphasis" href="./curl_multi_timeout.html">curl_multi_timeout(3)</a>. (Added in 7.16.0) -<p class="level0"><a name="CURLMOPTTIMERDATA"></a><span class="nroffip">CURLMOPT_TIMERDATA</span> -<p class="level1">Pass a pointer to whatever you want passed to the <span Class="bold">curl_multi_timer_callback</span>'s third argument, the userp pointer. This is not used by libcurl but only passed-thru as-is. Set the callback pointer with <a class="emphasis" href="#CURLMOPTTIMERFUNCTION">CURLMOPT_TIMERFUNCTION</a>. (Added in 7.16.0) -<p class="level0"><a name="CURLMOPTMAXCONNECTS"></a><span class="nroffip">CURLMOPT_MAXCONNECTS</span> -<p class="level1">Pass a long. The set number will be used as the maximum amount of simultaneously open connections that libcurl may cache. Default is 10, and libcurl will enlarge the size for each added easy handle to make it fit 4 times the number of added easy handles. -<p class="level1">By setting this option, you can prevent the cache size from growing beyond the limit set by you. -<p class="level1">When the cache is full, curl closes the oldest one in the cache to prevent the number of open connections from increasing. -<p class="level1">This option is for the multi handle's use only, when using the easy interface you should instead use the <span Class="emphasis">CURLOPT_MAXCONNECTS</span> option. -<p class="level1">(Added in 7.16.3) <a name="RETURNS"></a><h2 class="nroffsh">RETURNS</h2> -<p class="level0">The standard CURLMcode for multi interface error codes. Note that it returns a CURLM_UNKNOWN_OPTION if you try setting an option that this version of libcurl doesn't know of. <a name="AVAILABILITY"></a><h2 class="nroffsh">AVAILABILITY</h2> -<p class="level0">This function was added in libcurl 7.15.4. <a name="SEE"></a><h2 class="nroffsh">SEE ALSO</h2> -<p class="level0"><a class="manpage" href="./curl_multi_cleanup.html">curl_multi_cleanup (3)</a> <a class="manpage" href="./curl_multi_init.html"> curl_multi_init (3)</a> <span Class="manpage"> </span> <a class="manpage" href="./curl_multi_socket.html">curl_multi_socket (3)</a> <a class="manpage" href="./curl_multi_info_read.html"> curl_multi_info_read (3)</a> <p class="roffit"> - This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>. -</body></html> diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_setopt.pdf b/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_setopt.pdf Binary files differdeleted file mode 100644 index 6a60caa45a..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_setopt.pdf +++ /dev/null diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_socket.3 b/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_socket.3 deleted file mode 100644 index 6b262f2927..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_socket.3 +++ /dev/null @@ -1,158 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at http://curl.haxx.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" ************************************************************************** -.TH curl_multi_socket 3 "9 Jul 2006" "libcurl 7.16.0" "libcurl Manual" -.SH NAME -curl_multi_socket \- reads/writes available data -.SH SYNOPSIS -.nf -#include <curl/curl.h> -CURLMcode curl_multi_socket(CURLM * multi_handle, curl_socket_t sockfd, - int *running_handles); - -CURLMcode curl_multi_socket_all(CURLM *multi_handle, - int *running_handles); -.fi -.SH DESCRIPTION -These functions are deprecated. Do not use! See -\fIcurl_multi_socket_action(3)\fP instead! - -At return, the integer \fBrunning_handles\fP points to will contain the number -of still running easy handles within the multi handle. When this number -reaches zero, all transfers are complete/done. Note that when you call -\fIcurl_multi_socket_action(3)\fP on a specific socket and the counter -decreases by one, it DOES NOT necessarily mean that this exact socket/transfer -is the one that completed. Use \fIcurl_multi_info_read(3)\fP to figure out -which easy handle that completed. - -The \fBcurl_multi_socket_action(3)\fP functions inform the application about -updates in the socket (file descriptor) status by doing none, one, or multiple -calls to the socket callback function set with the CURLMOPT_SOCKETFUNCTION -option to \fIcurl_multi_setopt(3)\fP. They update the status with changes -since the previous time the callback was called. - -Get the timeout time by setting the \fICURLMOPT_TIMERFUNCTION\fP option with -\fIcurl_multi_setopt(3)\fP. Your application will then get called with -information on how long to wait for socket actions at most before doing the -timeout action: call the \fBcurl_multi_socket_action(3)\fP function with the -\fBsockfd\fP argument set to CURL_SOCKET_TIMEOUT. You can also use the -\fIcurl_multi_timeout(3)\fP function to poll the value at any given time, but -for an event-based system using the callback is far better than relying on -polling the timeout value. - -Usage of \fIcurl_multi_socket(3)\fP is deprecated, whereas the function is -equivalent to \fIcurl_multi_socket_action(3)\fP with \fBev_bitmask\fP set to -0. - -Force libcurl to (re-)check all its internal sockets and transfers instead of -just a single one by calling \fBcurl_multi_socket_all(3)\fP. Note that there -should not be any reason to use this function! -.SH "CALLBACK DETAILS" - -The socket \fBcallback\fP function uses a prototype like this -.nf - - int curl_socket_callback(CURL *easy, /* easy handle */ - curl_socket_t s, /* socket */ - int action, /* see values below */ - void *userp, /* private callback pointer */ - void *socketp); /* private socket pointer */ - -.fi -The callback MUST return 0. - -The \fIeasy\fP argument is a pointer to the easy handle that deals with this -particular socket. Note that a single handle may work with several sockets -simultaneously. - -The \fIs\fP argument is the actual socket value as you use it within your -system. - -The \fIaction\fP argument to the callback has one of five values: -.RS -.IP "CURL_POLL_NONE (0)" -register, not interested in readiness (yet) -.IP "CURL_POLL_IN (1)" -register, interested in read readiness -.IP "CURL_POLL_OUT (2)" -register, interested in write readiness -.IP "CURL_POLL_INOUT (3)" -register, interested in both read and write readiness -.IP "CURL_POLL_REMOVE (4)" -unregister -.RE - -The \fIsocketp\fP argument is a private pointer you have previously set with -\fIcurl_multi_assign(3)\fP to be associated with the \fIs\fP socket. If no -pointer has been set, socketp will be NULL. This argument is of course a -service to applications that want to keep certain data or structs that are -strictly associated to the given socket. - -The \fIuserp\fP argument is a private pointer you have previously set with -\fIcurl_multi_setopt(3)\fP and the CURLMOPT_SOCKETDATA option. -.SH "RETURN VALUE" -CURLMcode type, general libcurl multi interface error code. - -Legacy: If you receive \fICURLM_CALL_MULTI_PERFORM\fP, this basically means -that you should call \fIcurl_multi_socket(3)\fP again, before you wait for -more actions on libcurl's sockets. You don't have to do it immediately, but -the return code means that libcurl may have more data available to return or -that there may be more data to send off before it is "satisfied". - -In modern libcurls, \fICURLM_CALL_MULTI_PERFORM\fP or -\fICURLM_CALL_MULTI_SOKCET\fP should not be returned and no application needs -to care about them. - -NOTE that the return code is for the whole multi stack. Problems still might have -occurred on individual transfers even when one of these functions -return OK. -.SH "TYPICAL USAGE" -1. Create a multi handle - -2. Set the socket callback with CURLMOPT_SOCKETFUNCTION - -3. Set the timeout callback with CURLMOPT_TIMERFUNCTION, to get to know what -timeout value to use when waiting for socket activities. - -4. Add easy handles with curl_multi_add_handle() - -5. Provide some means to manage the sockets libcurl is using, so you can check -them for activity. This can be done through your application code, or by way -of an external library such as libevent or glib. - -6. Wait for activity on any of libcurl's sockets, use the timeout value your -callback has been told - -7, When activity is detected, call curl_multi_socket_action() for the -socket(s) that got action. If no activity is detected and the timeout expires, -call \fIcurl_multi_socket_action(3)\fP with \fICURL_SOCKET_TIMEOUT\fP - -8. Go back to step 6. -.SH AVAILABILITY -This function was added in libcurl 7.15.4, and is deemed stable since -7.16.0. - -\fIcurl_multi_socket(3)\fP is deprecated, use -\fIcurl_multi_socket_action(3)\fP instead! -.SH "SEE ALSO" -.BR curl_multi_cleanup "(3), " curl_multi_init "(3), " -.BR curl_multi_fdset "(3), " curl_multi_info_read "(3), " -.BR "the hiperfifo.c example" diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_socket.html b/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_socket.html deleted file mode 100644 index b532e6ae77..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_socket.html +++ /dev/null @@ -1,99 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> -<html><head> -<title>curl_multi_socket man page</title> -<meta name="generator" content="roffit"> -<STYLE type="text/css"> -P.level0 { - padding-left: 2em; -} - -P.level1 { - padding-left: 4em; -} - -P.level2 { - padding-left: 6em; -} - -span.emphasis { - font-style: italic; -} - -span.bold { - font-weight: bold; -} - -span.manpage { - font-weight: bold; -} - -h2.nroffsh { - background-color: #e0e0e0; -} - -span.nroffip { - font-weight: bold; - font-size: 120%; - font-family: monospace; -} - -p.roffit { - text-align: center; - font-size: 80%; -} -</STYLE> -</head><body> - -<p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2> -<p class="level0">curl_multi_socket - reads/writes available data <a name="SYNOPSIS"></a><h2 class="nroffsh">SYNOPSIS</h2> -<p class="level0"> -<p class="level0">#include <curl/curl.h> CURLMcode curl_multi_socket(CURLM * multi_handle, curl_socket_t sockfd, int *running_handles); -<p class="level0">CURLMcode curl_multi_socket_all(CURLM *multi_handle, int *running_handles); -<p class="level0"><a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2> -<p class="level0">These functions are deprecated. Do not use! See <a class="emphasis" href="./curl_multi_socket_action.html">curl_multi_socket_action(3)</a> instead! -<p class="level0">At return, the integer <span Class="bold">running_handles</span> points to will contain the number of still running easy handles within the multi handle. When this number reaches zero, all transfers are complete/done. Note that when you call <a class="emphasis" href="./curl_multi_socket_action.html">curl_multi_socket_action(3)</a> on a specific socket and the counter decreases by one, it DOES NOT necessarily mean that this exact socket/transfer is the one that completed. Use <a class="emphasis" href="./curl_multi_info_read.html">curl_multi_info_read(3)</a> to figure out which easy handle that completed. -<p class="level0">The <a class="bold" href="./curl_multi_socket_action.html">curl_multi_socket_action(3)</a> functions inform the application about updates in the socket (file descriptor) status by doing none, one, or multiple calls to the socket callback function set with the CURLMOPT_SOCKETFUNCTION option to <a class="emphasis" href="./curl_multi_setopt.html">curl_multi_setopt(3)</a>. They update the status with changes since the previous time the callback was called. -<p class="level0">Get the timeout time by setting the <span Class="emphasis">CURLMOPT_TIMERFUNCTION</span> option with <a class="emphasis" href="./curl_multi_setopt.html">curl_multi_setopt(3)</a>. Your application will then get called with information on how long to wait for socket actions at most before doing the timeout action: call the <a class="bold" href="./curl_multi_socket_action.html">curl_multi_socket_action(3)</a> function with the <span Class="bold">sockfd</span> argument set to CURL_SOCKET_TIMEOUT. You can also use the <a class="emphasis" href="./curl_multi_timeout.html">curl_multi_timeout(3)</a> function to poll the value at any given time, but for an event-based system using the callback is far better than relying on polling the timeout value. -<p class="level0">Usage of <a class="emphasis" href="./curl_multi_socket.html">curl_multi_socket(3)</a> is deprecated, whereas the function is equivalent to <a class="emphasis" href="./curl_multi_socket_action.html">curl_multi_socket_action(3)</a> with <span Class="bold">ev_bitmask</span> set to 0. -<p class="level0">Force libcurl to (re-)check all its internal sockets and transfers instead of just a single one by calling <a class="bold" href="./curl_multi_socket_all.html">curl_multi_socket_all(3)</a>. Note that there should not be any reason to use this function! <a name="CALLBACK"></a><h2 class="nroffsh">CALLBACK DETAILS</h2> -<p class="level0"> -<p class="level0">The socket <span Class="bold">callback</span> function uses a prototype like this -<p class="level0"> -<p class="level0"> int curl_socket_callback(CURL *easy, /* easy handle */ curl_socket_t s, /* socket */ int action, /* see values below */ void *userp, /* private callback pointer */ void *socketp); /* private socket pointer */ -<p class="level0"> -<p class="level0">The callback MUST return 0. -<p class="level0">The <span Class="emphasis">easy</span> argument is a pointer to the easy handle that deals with this particular socket. Note that a single handle may work with several sockets simultaneously. -<p class="level0">The <span Class="emphasis">s</span> argument is the actual socket value as you use it within your system. -<p class="level0">The <span Class="emphasis">action</span> argument to the callback has one of five values: -<p class="level1"> -<p class="level0"><a name="CURLPOLLNONE"></a><span class="nroffip">CURL_POLL_NONE (0)</span> -<p class="level1">register, not interested in readiness (yet) -<p class="level0"><a name="CURLPOLLIN"></a><span class="nroffip">CURL_POLL_IN (1)</span> -<p class="level1">register, interested in read readiness -<p class="level0"><a name="CURLPOLLOUT"></a><span class="nroffip">CURL_POLL_OUT (2)</span> -<p class="level1">register, interested in write readiness -<p class="level0"><a name="CURLPOLLINOUT"></a><span class="nroffip">CURL_POLL_INOUT (3)</span> -<p class="level1">register, interested in both read and write readiness -<p class="level0"><a name="CURLPOLLREMOVE"></a><span class="nroffip">CURL_POLL_REMOVE (4)</span> -<p class="level1">unregister -<p class="level0"> -<p class="level0">The <span Class="emphasis">socketp</span> argument is a private pointer you have previously set with <a class="emphasis" href="./curl_multi_assign.html">curl_multi_assign(3)</a> to be associated with the <span Class="emphasis">s</span> socket. If no pointer has been set, socketp will be NULL. This argument is of course a service to applications that want to keep certain data or structs that are strictly associated to the given socket. -<p class="level0">The <span Class="emphasis">userp</span> argument is a private pointer you have previously set with <a class="emphasis" href="./curl_multi_setopt.html">curl_multi_setopt(3)</a> and the CURLMOPT_SOCKETDATA option. <a name="RETURN"></a><h2 class="nroffsh">RETURN VALUE</h2> -<p class="level0">CURLMcode type, general libcurl multi interface error code. -<p class="level0">Legacy: If you receive <span Class="emphasis">CURLM_CALL_MULTI_PERFORM</span>, this basically means that you should call <a class="emphasis" href="./curl_multi_socket.html">curl_multi_socket(3)</a> again, before you wait for more actions on libcurl's sockets. You don't have to do it immediately, but the return code means that libcurl may have more data available to return or that there may be more data to send off before it is "satisfied". -<p class="level0">In modern libcurls, <span Class="emphasis">CURLM_CALL_MULTI_PERFORM</span> or <span Class="emphasis">CURLM_CALL_MULTI_SOKCET</span> should not be returned and no application needs to care about them. -<p class="level0">NOTE that the return code is for the whole multi stack. Problems still might have occurred on individual transfers even when one of these functions return OK. <a name="TYPICAL"></a><h2 class="nroffsh">TYPICAL USAGE</h2> -<p class="level0">1. Create a multi handle -<p class="level0">2. Set the socket callback with CURLMOPT_SOCKETFUNCTION -<p class="level0">3. Set the timeout callback with CURLMOPT_TIMERFUNCTION, to get to know what timeout value to use when waiting for socket activities. -<p class="level0">4. Add easy handles with curl_multi_add_handle() -<p class="level0">5. Provide some means to manage the sockets libcurl is using, so you can check them for activity. This can be done through your application code, or by way of an external library such as libevent or glib. -<p class="level0">6. Wait for activity on any of libcurl's sockets, use the timeout value your callback has been told -<p class="level0">7, When activity is detected, call curl_multi_socket_action() for the socket(s) that got action. If no activity is detected and the timeout expires, call <a class="emphasis" href="./curl_multi_socket_action.html">curl_multi_socket_action(3)</a> with <span Class="emphasis">CURL_SOCKET_TIMEOUT</span> -<p class="level0">8. Go back to step 6. <a name="AVAILABILITY"></a><h2 class="nroffsh">AVAILABILITY</h2> -<p class="level0">This function was added in libcurl 7.15.4, and is deemed stable since 7.16.0. -<p class="level0"><a class="emphasis" href="./curl_multi_socket.html">curl_multi_socket(3)</a> is deprecated, use <a class="emphasis" href="./curl_multi_socket_action.html">curl_multi_socket_action(3)</a> instead! <a name="SEE"></a><h2 class="nroffsh">SEE ALSO</h2> -<p class="level0"><a class="manpage" href="./curl_multi_cleanup.html">curl_multi_cleanup (3)</a> <a class="manpage" href="./curl_multi_init.html"> curl_multi_init (3)</a> <span Class="manpage"> </span> <a class="manpage" href="./curl_multi_fdset.html">curl_multi_fdset (3)</a> <a class="manpage" href="./curl_multi_info_read.html"> curl_multi_info_read (3)</a> <span Class="manpage"> </span> <span Class="manpage">the hiperfifo.c example</span> <p class="roffit"> - This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>. -</body></html> diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_socket.pdf b/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_socket.pdf Binary files differdeleted file mode 100644 index 5a342d4f60..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_socket.pdf +++ /dev/null diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_socket_action.3 b/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_socket_action.3 deleted file mode 100644 index ac3b176c74..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_socket_action.3 +++ /dev/null @@ -1,149 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at http://curl.haxx.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" ************************************************************************** -.TH curl_multi_socket_action 3 "9 Jul 2006" "libcurl 7.16.0" "libcurl Manual" -.SH NAME -curl_multi_socket_action \- reads/writes available data given an action -.SH SYNOPSIS -.nf -#include <curl/curl.h> - -CURLMcode curl_multi_socket_action(CURLM * multi_handle, - curl_socket_t sockfd, int ev_bitmask, - int *running_handles); -.fi -.SH DESCRIPTION -When the application has detected action on a socket handled by libcurl, it -should call \fIcurl_multi_socket_action(3)\fP with the \fBsockfd\fP argument -set to the socket with the action. When the events on a socket are known, they -can be passed as an events bitmask \fBev_bitmask\fP by first setting -\fBev_bitmask\fP to 0, and then adding using bitwise OR (|) any combination of -events to be chosen from CURL_CSELECT_IN, CURL_CSELECT_OUT or -CURL_CSELECT_ERR. When the events on a socket are unknown, pass 0 instead, and -libcurl will test the descriptor internally. - -At return, the integer \fBrunning_handles\fP points to will contain the number -of running easy handles within the multi handle. When this number reaches -zero, all transfers are complete/done. When you call -\fIcurl_multi_socket_action(3)\fP on a specific socket and the counter -decreases by one, it DOES NOT necessarily mean that this exact socket/transfer -is the one that completed. Use \fIcurl_multi_info_read(3)\fP to figure out -which easy handle that completed. - -The \fBcurl_multi_socket_action(3)\fP functions inform the application about -updates in the socket (file descriptor) status by doing none, one, or multiple -calls to the socket callback function set with the CURLMOPT_SOCKETFUNCTION -option to \fIcurl_multi_setopt(3)\fP. They update the status with changes -since the previous time the callback was called. - -Get the timeout time by setting the \fICURLMOPT_TIMERFUNCTION\fP option with -\fIcurl_multi_setopt(3)\fP. Your application will then get called with -information on how long to wait for socket actions at most before doing the -timeout action: call the \fBcurl_multi_socket_action(3)\fP function with the -\fBsockfd\fP argument set to CURL_SOCKET_TIMEOUT. You can also use the -\fIcurl_multi_timeout(3)\fP function to poll the value at any given time, but -for an event-based system using the callback is far better than relying on -polling the timeout value. -.SH "CALLBACK DETAILS" - -The socket \fBcallback\fP function uses a prototype like this -.nf - - int curl_socket_callback(CURL *easy, /* easy handle */ - curl_socket_t s, /* socket */ - int action, /* see values below */ - void *userp, /* private callback pointer */ - void *socketp); /* private socket pointer */ - -.fi -The callback MUST return 0. - -The \fIeasy\fP argument is a pointer to the easy handle that deals with this -particular socket. Note that a single handle may work with several sockets -simultaneously. - -The \fIs\fP argument is the actual socket value as you use it within your -system. - -The \fIaction\fP argument to the callback has one of five values: -.RS -.IP "CURL_POLL_NONE (0)" -register, not interested in readiness (yet) -.IP "CURL_POLL_IN (1)" -register, interested in read readiness -.IP "CURL_POLL_OUT (2)" -register, interested in write readiness -.IP "CURL_POLL_INOUT (3)" -register, interested in both read and write readiness -.IP "CURL_POLL_REMOVE (4)" -unregister -.RE - -The \fIsocketp\fP argument is a private pointer you have previously set with -\fIcurl_multi_assign(3)\fP to be associated with the \fIs\fP socket. If no -pointer has been set, socketp will be NULL. This argument is of course a -service to applications that want to keep certain data or structs that are -strictly associated to the given socket. - -The \fIuserp\fP argument is a private pointer you have previously set with -\fIcurl_multi_setopt(3)\fP and the CURLMOPT_SOCKETDATA option. -.SH "RETURN VALUE" -CURLMcode type, general libcurl multi interface error code. - -Before version 7.20.0: If you receive \fICURLM_CALL_MULTI_PERFORM\fP, this -basically means that you should call \fIcurl_multi_socket_action(3)\fP again -before you wait for more actions on libcurl's sockets. You don't have to do it -immediately, but the return code means that libcurl may have more data -available to return or that there may be more data to send off before it is -"satisfied". - -The return code from this function is for the whole multi stack. Problems -still might have occurred on individual transfers even when one of these -functions return OK. -.SH "TYPICAL USAGE" -1. Create a multi handle - -2. Set the socket callback with CURLMOPT_SOCKETFUNCTION - -3. Set the timeout callback with CURLMOPT_TIMERFUNCTION, to get to know what -timeout value to use when waiting for socket activities. - -4. Add easy handles with curl_multi_add_handle() - -5. Provide some means to manage the sockets libcurl is using, so you can check -them for activity. This can be done through your application code, or by way -of an external library such as libevent or glib. - -6. Call curl_multi_socket_action(...CURL_SOCKET_TIMEOUT...) to kickstart -everything. To get one or more callbacks called. - -7. Wait for activity on any of libcurl's sockets, use the timeout value your -callback has been told - -8, When activity is detected, call curl_multi_socket_action() for the -socket(s) that got action. If no activity is detected and the timeout expires, -call \fIcurl_multi_socket_action(3)\fP with \fICURL_SOCKET_TIMEOUT\fP -.SH AVAILABILITY -This function was added in libcurl 7.15.4, and is deemed stable since 7.16.0. -.SH "SEE ALSO" -.BR curl_multi_cleanup "(3), " curl_multi_init "(3), " -.BR curl_multi_fdset "(3), " curl_multi_info_read "(3), " -.BR "the hiperfifo.c example" diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_socket_action.html b/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_socket_action.html deleted file mode 100644 index 81856143d1..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_socket_action.html +++ /dev/null @@ -1,95 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> -<html><head> -<title>curl_multi_socket_action man page</title> -<meta name="generator" content="roffit"> -<STYLE type="text/css"> -P.level0 { - padding-left: 2em; -} - -P.level1 { - padding-left: 4em; -} - -P.level2 { - padding-left: 6em; -} - -span.emphasis { - font-style: italic; -} - -span.bold { - font-weight: bold; -} - -span.manpage { - font-weight: bold; -} - -h2.nroffsh { - background-color: #e0e0e0; -} - -span.nroffip { - font-weight: bold; - font-size: 120%; - font-family: monospace; -} - -p.roffit { - text-align: center; - font-size: 80%; -} -</STYLE> -</head><body> - -<p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2> -<p class="level0">curl_multi_socket_action - reads/writes available data given an action <a name="SYNOPSIS"></a><h2 class="nroffsh">SYNOPSIS</h2> -<p class="level0"> -<p class="level0">#include <curl/curl.h> -<p class="level0">CURLMcode curl_multi_socket_action(CURLM * multi_handle, curl_socket_t sockfd, int ev_bitmask, int *running_handles); -<p class="level0"><a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2> -<p class="level0">When the application has detected action on a socket handled by libcurl, it should call <a class="emphasis" href="./curl_multi_socket_action.html">curl_multi_socket_action(3)</a> with the <span Class="bold">sockfd</span> argument set to the socket with the action. When the events on a socket are known, they can be passed as an events bitmask <span Class="bold">ev_bitmask</span> by first setting <span Class="bold">ev_bitmask</span> to 0, and then adding using bitwise OR (|) any combination of events to be chosen from CURL_CSELECT_IN, CURL_CSELECT_OUT or CURL_CSELECT_ERR. When the events on a socket are unknown, pass 0 instead, and libcurl will test the descriptor internally. -<p class="level0">At return, the integer <span Class="bold">running_handles</span> points to will contain the number of running easy handles within the multi handle. When this number reaches zero, all transfers are complete/done. When you call <a class="emphasis" href="./curl_multi_socket_action.html">curl_multi_socket_action(3)</a> on a specific socket and the counter decreases by one, it DOES NOT necessarily mean that this exact socket/transfer is the one that completed. Use <a class="emphasis" href="./curl_multi_info_read.html">curl_multi_info_read(3)</a> to figure out which easy handle that completed. -<p class="level0">The <a class="bold" href="./curl_multi_socket_action.html">curl_multi_socket_action(3)</a> functions inform the application about updates in the socket (file descriptor) status by doing none, one, or multiple calls to the socket callback function set with the CURLMOPT_SOCKETFUNCTION option to <a class="emphasis" href="./curl_multi_setopt.html">curl_multi_setopt(3)</a>. They update the status with changes since the previous time the callback was called. -<p class="level0">Get the timeout time by setting the <span Class="emphasis">CURLMOPT_TIMERFUNCTION</span> option with <a class="emphasis" href="./curl_multi_setopt.html">curl_multi_setopt(3)</a>. Your application will then get called with information on how long to wait for socket actions at most before doing the timeout action: call the <a class="bold" href="./curl_multi_socket_action.html">curl_multi_socket_action(3)</a> function with the <span Class="bold">sockfd</span> argument set to CURL_SOCKET_TIMEOUT. You can also use the <a class="emphasis" href="./curl_multi_timeout.html">curl_multi_timeout(3)</a> function to poll the value at any given time, but for an event-based system using the callback is far better than relying on polling the timeout value. <a name="CALLBACK"></a><h2 class="nroffsh">CALLBACK DETAILS</h2> -<p class="level0"> -<p class="level0">The socket <span Class="bold">callback</span> function uses a prototype like this -<p class="level0"> -<p class="level0"> int curl_socket_callback(CURL *easy, /* easy handle */ curl_socket_t s, /* socket */ int action, /* see values below */ void *userp, /* private callback pointer */ void *socketp); /* private socket pointer */ -<p class="level0"> -<p class="level0">The callback MUST return 0. -<p class="level0">The <span Class="emphasis">easy</span> argument is a pointer to the easy handle that deals with this particular socket. Note that a single handle may work with several sockets simultaneously. -<p class="level0">The <span Class="emphasis">s</span> argument is the actual socket value as you use it within your system. -<p class="level0">The <span Class="emphasis">action</span> argument to the callback has one of five values: -<p class="level1"> -<p class="level0"><a name="CURLPOLLNONE"></a><span class="nroffip">CURL_POLL_NONE (0)</span> -<p class="level1">register, not interested in readiness (yet) -<p class="level0"><a name="CURLPOLLIN"></a><span class="nroffip">CURL_POLL_IN (1)</span> -<p class="level1">register, interested in read readiness -<p class="level0"><a name="CURLPOLLOUT"></a><span class="nroffip">CURL_POLL_OUT (2)</span> -<p class="level1">register, interested in write readiness -<p class="level0"><a name="CURLPOLLINOUT"></a><span class="nroffip">CURL_POLL_INOUT (3)</span> -<p class="level1">register, interested in both read and write readiness -<p class="level0"><a name="CURLPOLLREMOVE"></a><span class="nroffip">CURL_POLL_REMOVE (4)</span> -<p class="level1">unregister -<p class="level0"> -<p class="level0">The <span Class="emphasis">socketp</span> argument is a private pointer you have previously set with <a class="emphasis" href="./curl_multi_assign.html">curl_multi_assign(3)</a> to be associated with the <span Class="emphasis">s</span> socket. If no pointer has been set, socketp will be NULL. This argument is of course a service to applications that want to keep certain data or structs that are strictly associated to the given socket. -<p class="level0">The <span Class="emphasis">userp</span> argument is a private pointer you have previously set with <a class="emphasis" href="./curl_multi_setopt.html">curl_multi_setopt(3)</a> and the CURLMOPT_SOCKETDATA option. <a name="RETURN"></a><h2 class="nroffsh">RETURN VALUE</h2> -<p class="level0">CURLMcode type, general libcurl multi interface error code. -<p class="level0">Before version 7.20.0: If you receive <span Class="emphasis">CURLM_CALL_MULTI_PERFORM</span>, this basically means that you should call <a class="emphasis" href="./curl_multi_socket_action.html">curl_multi_socket_action(3)</a> again before you wait for more actions on libcurl's sockets. You don't have to do it immediately, but the return code means that libcurl may have more data available to return or that there may be more data to send off before it is "satisfied". -<p class="level0">The return code from this function is for the whole multi stack. Problems still might have occurred on individual transfers even when one of these functions return OK. <a name="TYPICAL"></a><h2 class="nroffsh">TYPICAL USAGE</h2> -<p class="level0">1. Create a multi handle -<p class="level0">2. Set the socket callback with CURLMOPT_SOCKETFUNCTION -<p class="level0">3. Set the timeout callback with CURLMOPT_TIMERFUNCTION, to get to know what timeout value to use when waiting for socket activities. -<p class="level0">4. Add easy handles with curl_multi_add_handle() -<p class="level0">5. Provide some means to manage the sockets libcurl is using, so you can check them for activity. This can be done through your application code, or by way of an external library such as libevent or glib. -<p class="level0">6. Call curl_multi_socket_action(...CURL_SOCKET_TIMEOUT...) to kickstart everything. To get one or more callbacks called. -<p class="level0">7. Wait for activity on any of libcurl's sockets, use the timeout value your callback has been told -<p class="level0">8, When activity is detected, call curl_multi_socket_action() for the socket(s) that got action. If no activity is detected and the timeout expires, call <a class="emphasis" href="./curl_multi_socket_action.html">curl_multi_socket_action(3)</a> with <span Class="emphasis">CURL_SOCKET_TIMEOUT</span> <a name="AVAILABILITY"></a><h2 class="nroffsh">AVAILABILITY</h2> -<p class="level0">This function was added in libcurl 7.15.4, and is deemed stable since 7.16.0. <a name="SEE"></a><h2 class="nroffsh">SEE ALSO</h2> -<p class="level0"><a class="manpage" href="./curl_multi_cleanup.html">curl_multi_cleanup (3)</a> <a class="manpage" href="./curl_multi_init.html"> curl_multi_init (3)</a> <span Class="manpage"> </span> <a class="manpage" href="./curl_multi_fdset.html">curl_multi_fdset (3)</a> <a class="manpage" href="./curl_multi_info_read.html"> curl_multi_info_read (3)</a> <span Class="manpage"> </span> <span Class="manpage">the hiperfifo.c example</span> <p class="roffit"> - This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>. -</body></html> diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_socket_action.pdf b/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_socket_action.pdf Binary files differdeleted file mode 100644 index bb0561b475..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_socket_action.pdf +++ /dev/null diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_strerror.3 b/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_strerror.3 deleted file mode 100644 index 40d0974c5e..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_strerror.3 +++ /dev/null @@ -1,37 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at http://curl.haxx.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" ************************************************************************** -.TH curl_multi_strerror 3 "26 Apr 2004" "libcurl 7.12" "libcurl Manual" -.SH NAME -curl_multi_strerror - return string describing error code -.SH SYNOPSIS -.nf -.B #include <curl/curl.h> -.BI "const char *curl_multi_strerror(CURLMcode " errornum ");" -.SH DESCRIPTION -The curl_multi_strerror() function returns a string describing the CURLMcode -error code passed in the argument \fIerrornum\fP. -.SH AVAILABILITY -This function was added in libcurl 7.12.0 -.SH RETURN VALUE -A pointer to a zero terminated string. -.SH "SEE ALSO" -.BR libcurl-errors "(3), " curl_easy_strerror "(3), " curl_share_strerror "(3)" diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_strerror.html b/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_strerror.html deleted file mode 100644 index 670dde1824..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_strerror.html +++ /dev/null @@ -1,57 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> -<html><head> -<title>curl_multi_strerror man page</title> -<meta name="generator" content="roffit"> -<STYLE type="text/css"> -P.level0 { - padding-left: 2em; -} - -P.level1 { - padding-left: 4em; -} - -P.level2 { - padding-left: 6em; -} - -span.emphasis { - font-style: italic; -} - -span.bold { - font-weight: bold; -} - -span.manpage { - font-weight: bold; -} - -h2.nroffsh { - background-color: #e0e0e0; -} - -span.nroffip { - font-weight: bold; - font-size: 120%; - font-family: monospace; -} - -p.roffit { - text-align: center; - font-size: 80%; -} -</STYLE> -</head><body> - -<p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2> -<p class="level0">curl_multi_strerror - return string describing error code <a name="SYNOPSIS"></a><h2 class="nroffsh">SYNOPSIS</h2> -<p class="level0"> -<p class="level0"><span Class="bold">#include <curl/curl.h></span> <span Class="bold">const char *curl_multi_strerror(CURLMcode errornum );</span> <a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2> -<p class="level0">The curl_multi_strerror() function returns a string describing the CURLMcode error code passed in the argument <span Class="emphasis">errornum</span>. <a name="AVAILABILITY"></a><h2 class="nroffsh">AVAILABILITY</h2> -<p class="level0">This function was added in libcurl 7.12.0 <a name="RETURN"></a><h2 class="nroffsh">RETURN VALUE</h2> -<p class="level0">A pointer to a zero terminated string. <a name="SEE"></a><h2 class="nroffsh">SEE ALSO</h2> -<p class="level0"><span Class="manpage">libcurl-errors (3)</span> <a class="manpage" href="./curl_easy_strerror.html"> curl_easy_strerror (3)</a> <a class="manpage" href="./curl_share_strerror.html"> curl_share_strerror (3)</a> <p class="roffit"> - This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>. -</body></html> diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_strerror.pdf b/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_strerror.pdf Binary files differdeleted file mode 100644 index e37bbe7b5e..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_strerror.pdf +++ /dev/null diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_timeout.3 b/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_timeout.3 deleted file mode 100644 index 5ad8008ead..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_timeout.3 +++ /dev/null @@ -1,63 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at http://curl.haxx.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" ************************************************************************** -.TH curl_multi_timeout 3 "2 Jan 2006" "libcurl 7.16.0" "libcurl Manual" -.SH NAME -curl_multi_timeout \- how long to wait for action before proceeding -.SH SYNOPSIS -#include <curl/curl.h> - -CURLMcode curl_multi_timeout(CURLM *multi_handle, long *timeout); -.SH DESCRIPTION - -An application using the libcurl multi interface should call -\fBcurl_multi_timeout(3)\fP to figure out how long it should wait for socket -actions \- at most \- before proceeding. - -Proceeding means either doing the socket-style timeout action: call the -\fBcurl_multi_socket_action(3)\fP function with the \fBsockfd\fP argument set -to CURL_SOCKET_TIMEOUT, or call \fBcurl_multi_perform(3)\fP if you're using -the simpler and older multi interface approach. - -The timeout value returned in the long \fBtimeout\fP points to, is in number -of milliseconds at this very moment. If 0, it means you should proceed -immediately without waiting for anything. If it returns -1, there's no timeout -at all set. - -An application that uses the multi_socket API SHOULD not use this function, but -SHOULD instead use \fIcurl_multi_setopt(3)\fP and its -\fPCURLMOPT_TIMERFUNCTION\fP option for proper and desired behavior. - -Note: if libcurl returns a -1 timeout here, it just means that libcurl -currently has no stored timeout value. You must not wait too long (more than a -few seconds perhaps) before you call curl_multi_perform() again. -.SH "RETURN VALUE" -The standard CURLMcode for multi interface error codes. -.SH "TYPICAL USAGE" -Call \fBcurl_multi_timeout(3)\fP, then wait for action on the sockets. You -figure out which sockets to wait for by calling \fBcurl_multi_fdset(3)\fP or -by a previous call to \fBcurl_multi_socket(3)\fP. -.SH AVAILABILITY -This function was added in libcurl 7.15.4. -.SH "SEE ALSO" -.BR curl_multi_fdset "(3), " curl_multi_info_read "(3), " -.BR curl_multi_socket "(3), " curl_multi_setopt "(3) " - diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_timeout.html b/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_timeout.html deleted file mode 100644 index 7b7cdd5a51..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_timeout.html +++ /dev/null @@ -1,64 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> -<html><head> -<title>curl_multi_timeout man page</title> -<meta name="generator" content="roffit"> -<STYLE type="text/css"> -P.level0 { - padding-left: 2em; -} - -P.level1 { - padding-left: 4em; -} - -P.level2 { - padding-left: 6em; -} - -span.emphasis { - font-style: italic; -} - -span.bold { - font-weight: bold; -} - -span.manpage { - font-weight: bold; -} - -h2.nroffsh { - background-color: #e0e0e0; -} - -span.nroffip { - font-weight: bold; - font-size: 120%; - font-family: monospace; -} - -p.roffit { - text-align: center; - font-size: 80%; -} -</STYLE> -</head><body> - -<p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2> -<p class="level0">curl_multi_timeout - how long to wait for action before proceeding <a name="SYNOPSIS"></a><h2 class="nroffsh">SYNOPSIS</h2> -<p class="level0">#include <curl/curl.h> -<p class="level0">CURLMcode curl_multi_timeout(CURLM *multi_handle, long *timeout); <a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2> -<p class="level0"> -<p class="level0">An application using the libcurl multi interface should call <a class="bold" href="./curl_multi_timeout.html">curl_multi_timeout(3)</a> to figure out how long it should wait for socket actions - at most - before proceeding. -<p class="level0">Proceeding means either doing the socket-style timeout action: call the <a class="bold" href="./curl_multi_socket_action.html">curl_multi_socket_action(3)</a> function with the <span Class="bold">sockfd</span> argument set to CURL_SOCKET_TIMEOUT, or call <a class="bold" href="./curl_multi_perform.html">curl_multi_perform(3)</a> if you're using the simpler and older multi interface approach. -<p class="level0">The timeout value returned in the long <span Class="bold">timeout</span> points to, is in number of milliseconds at this very moment. If 0, it means you should proceed immediately without waiting for anything. If it returns -1, there's no timeout at all set. -<p class="level0">An application that uses the multi_socket API SHOULD not use this function, but SHOULD instead use <a class="emphasis" href="./curl_multi_setopt.html">curl_multi_setopt(3)</a> and its </span>CURLMOPT_TIMERFUNCTION</span> option for proper and desired behavior. -<p class="level0">Note: if libcurl returns a -1 timeout here, it just means that libcurl currently has no stored timeout value. You must not wait too long (more than a few seconds perhaps) before you call curl_multi_perform() again. <a name="RETURN"></a><h2 class="nroffsh">RETURN VALUE</h2> -<p class="level0">The standard CURLMcode for multi interface error codes. <a name="TYPICAL"></a><h2 class="nroffsh">TYPICAL USAGE</h2> -<p class="level0">Call <a class="bold" href="./curl_multi_timeout.html">curl_multi_timeout(3)</a>, then wait for action on the sockets. You figure out which sockets to wait for by calling <a class="bold" href="./curl_multi_fdset.html">curl_multi_fdset(3)</a> or by a previous call to <a class="bold" href="./curl_multi_socket.html">curl_multi_socket(3)</a>. <a name="AVAILABILITY"></a><h2 class="nroffsh">AVAILABILITY</h2> -<p class="level0">This function was added in libcurl 7.15.4. <a name="SEE"></a><h2 class="nroffsh">SEE ALSO</h2> -<p class="level0"><a class="manpage" href="./curl_multi_fdset.html">curl_multi_fdset (3)</a> <a class="manpage" href="./curl_multi_info_read.html"> curl_multi_info_read (3)</a> <span Class="manpage"> </span> <a class="manpage" href="./curl_multi_socket.html">curl_multi_socket (3)</a> <a class="manpage" href="./curl_multi_setopt.html"> curl_multi_setopt (3) </a> -<p class="level0"><p class="roffit"> - This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>. -</body></html> diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_timeout.pdf b/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_timeout.pdf Binary files differdeleted file mode 100644 index 14b90a6808..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_timeout.pdf +++ /dev/null diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_wait.3 b/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_wait.3 deleted file mode 100644 index b14760bf3f..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_wait.3 +++ /dev/null @@ -1,75 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at http://curl.haxx.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" ************************************************************************** -.TH curl_multi_wait 3 "12 Jul 2012" "libcurl 7.28.0" "libcurl Manual" -.SH NAME -curl_multi_wait - polls on all easy handles in a multi handle -.SH SYNOPSIS -.nf -#include <curl/curl.h> - -CURLMcode curl_multi_wait(CURLM *multi_handle, - struct curl_waitfd extra_fds[], - unsigned int extra_nfds, - int timeout_ms, - int *numfds); -.ad -.SH DESCRIPTION -This function polls on all file descriptors used by the curl easy handles -contained in the given multi handle set. It will block until activity is -detected on at least one of the handles or \fItimeout_ms\fP has passed. - -The calling application may pass additional curl_waitfd structures which are -similar to \fIpoll(2)\fP's pollfd structure to be waited on in the same call. - -On completion, if \fInumfds\fP is supplied, it will be populated with the -number of file descriptors on which interesting events occured. - -If no extra file descriptors are provided and libcurl has no file descriptor -to offer to wait for, this function will return immediately. - -This function is encouraged to be used instead of select(3) when using the -multi interface to allow applications to easier circumvent the common problem -with 1024 maximum file descriptors. -.SH curl_waitfd -.nf -struct curl_waitfd { - curl_socket_t fd; - short events; - short revents; -}; -.fi -.IP CURL_WAIT_POLLIN -Bit flag to curl_waitfd.events indicating the socket should poll on read -events such as new data received. -.IP CURL_WAIT_POLLPRI -Bit flag to curl_waitfd.events indicating the socket should poll on high -priority read events such as out of band data. -.IP CURL_WAIT_POLLOUT -Bit flag to curl_waitfd.events indicating the socket should poll on write -events such as the socket being clear to write without blocking. -.SH RETURN VALUE -CURLMcode type, general libcurl multi interface error code. See -\fIlibcurl-errors(3)\fP -.SH AVAILABILITY -This function was added in libcurl 7.28.0. -.SH "SEE ALSO" -.BR curl_multi_fdset "(3), " curl_multi_perform "(3)" diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_wait.html b/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_wait.html deleted file mode 100644 index 14b37b3222..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_wait.html +++ /dev/null @@ -1,72 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> -<html><head> -<title>curl_multi_wait man page</title> -<meta name="generator" content="roffit"> -<STYLE type="text/css"> -P.level0 { - padding-left: 2em; -} - -P.level1 { - padding-left: 4em; -} - -P.level2 { - padding-left: 6em; -} - -span.emphasis { - font-style: italic; -} - -span.bold { - font-weight: bold; -} - -span.manpage { - font-weight: bold; -} - -h2.nroffsh { - background-color: #e0e0e0; -} - -span.nroffip { - font-weight: bold; - font-size: 120%; - font-family: monospace; -} - -p.roffit { - text-align: center; - font-size: 80%; -} -</STYLE> -</head><body> - -<p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2> -<p class="level0">curl_multi_wait - polls on all easy handles in a multi handle <a name="SYNOPSIS"></a><h2 class="nroffsh">SYNOPSIS</h2> -<p class="level0"> -<p class="level0">#include <curl/curl.h> -<p class="level0">CURLMcode curl_multi_wait(CURLM *multi_handle, struct curl_waitfd extra_fds[], unsigned int extra_nfds, int timeout_ms, int *numfds); -<p class="level0"><a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2> -<p class="level0">This function polls on all file descriptors used by the curl easy handles contained in the given multi handle set. It will block until activity is detected on at least one of the handles or <span Class="emphasis">timeout_ms</span> has passed. -<p class="level0">The calling application may pass additional curl_waitfd structures which are similar to <span Class="emphasis">poll(2)</span>'s pollfd structure to be waited on in the same call. -<p class="level0">On completion, if <span Class="emphasis">numfds</span> is supplied, it will be populated with the number of file descriptors on which interesting events occured. -<p class="level0">If no extra file descriptors are provided and libcurl has no file descriptor to offer to wait for, this function will return immediately. -<p class="level0">This function is encouraged to be used instead of select(3) when using the multi interface to allow applications to easier circumvent the common problem with 1024 maximum file descriptors. <a name="curlwaitfd"></a><h2 class="nroffsh">curl_waitfd</h2> -<p class="level0"> -<p class="level0">struct curl_waitfd { curl_socket_t fd; short events; short revents; }; -<p class="level0"> -<p class="level0"><a name="CURLWAITPOLLIN"></a><span class="nroffip">CURL_WAIT_POLLIN</span> -<p class="level1">Bit flag to curl_waitfd.events indicating the socket should poll on read events such as new data received. -<p class="level0"><a name="CURLWAITPOLLPRI"></a><span class="nroffip">CURL_WAIT_POLLPRI</span> -<p class="level1">Bit flag to curl_waitfd.events indicating the socket should poll on high priority read events such as out of band data. -<p class="level0"><a name="CURLWAITPOLLOUT"></a><span class="nroffip">CURL_WAIT_POLLOUT</span> -<p class="level1">Bit flag to curl_waitfd.events indicating the socket should poll on write events such as the socket being clear to write without blocking. <a name="RETURN"></a><h2 class="nroffsh">RETURN VALUE</h2> -<p class="level0">CURLMcode type, general libcurl multi interface error code. See <span Class="emphasis">libcurl-errors(3)</span> <a name="AVAILABILITY"></a><h2 class="nroffsh">AVAILABILITY</h2> -<p class="level0">This function was added in libcurl 7.28.0. <a name="SEE"></a><h2 class="nroffsh">SEE ALSO</h2> -<p class="level0"><a class="manpage" href="./curl_multi_fdset.html">curl_multi_fdset (3)</a> <a class="manpage" href="./curl_multi_perform.html"> curl_multi_perform (3)</a> <p class="roffit"> - This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>. -</body></html> diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_wait.pdf b/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_wait.pdf Binary files differdeleted file mode 100644 index c69c9cd355..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_multi_wait.pdf +++ /dev/null diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_share_cleanup.3 b/plugins/FTPFileYM/curl/docs/libcurl/curl_share_cleanup.3 deleted file mode 100644 index 3af1707bb1..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_share_cleanup.3 +++ /dev/null @@ -1,40 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at http://curl.haxx.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" ************************************************************************** -.TH curl_share_cleanup 3 "8 Aug 2003" "libcurl 7.10.7" "libcurl Manual" -.SH NAME -curl_share_cleanup - Clean up a shared object -.SH SYNOPSIS -.B #include <curl/curl.h> -.sp -.BI "CURLSHcode curl_share_cleanup(CURLSH *" share_handle ");" -.ad -.SH DESCRIPTION -This function deletes a shared object. The share handle cannot be used anymore -when this function has been called. - -.SH RETURN VALUE -CURLSHE_OK (zero) means that the option was set properly, non-zero means an -error occurred as \fI<curl/curl.h>\fP defines. See the \fIlibcurl-errors.3\fP -man page for the full list with descriptions. If an error occurs, then the -share object will not be deleted. -.SH "SEE ALSO" -.BR curl_share_init "(3), " curl_share_setopt "(3)" diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_share_cleanup.html b/plugins/FTPFileYM/curl/docs/libcurl/curl_share_cleanup.html deleted file mode 100644 index 3e1e6370f2..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_share_cleanup.html +++ /dev/null @@ -1,58 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> -<html><head> -<title>curl_share_cleanup man page</title> -<meta name="generator" content="roffit"> -<STYLE type="text/css"> -P.level0 { - padding-left: 2em; -} - -P.level1 { - padding-left: 4em; -} - -P.level2 { - padding-left: 6em; -} - -span.emphasis { - font-style: italic; -} - -span.bold { - font-weight: bold; -} - -span.manpage { - font-weight: bold; -} - -h2.nroffsh { - background-color: #e0e0e0; -} - -span.nroffip { - font-weight: bold; - font-size: 120%; - font-family: monospace; -} - -p.roffit { - text-align: center; - font-size: 80%; -} -</STYLE> -</head><body> - -<p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2> -<p class="level0">curl_share_cleanup - Clean up a shared object <a name="SYNOPSIS"></a><h2 class="nroffsh">SYNOPSIS</h2> -<p class="level0"><span Class="bold">#include <curl/curl.h></span> -<p class="level0"><span Class="bold">CURLSHcode curl_share_cleanup(CURLSH * share_handle );</span> -<p class="level0"><a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2> -<p class="level0">This function deletes a shared object. The share handle cannot be used anymore when this function has been called. -<p class="level0"><a name="RETURN"></a><h2 class="nroffsh">RETURN VALUE</h2> -<p class="level0">CURLSHE_OK (zero) means that the option was set properly, non-zero means an error occurred as <span Class="emphasis"><curl/curl.h></span> defines. See the <span Class="emphasis">libcurl-errors.3</span> man page for the full list with descriptions. If an error occurs, then the share object will not be deleted. <a name="SEE"></a><h2 class="nroffsh">SEE ALSO</h2> -<p class="level0"><a class="manpage" href="./curl_share_init.html">curl_share_init (3)</a> <a class="manpage" href="./curl_share_setopt.html"> curl_share_setopt (3)</a> <p class="roffit"> - This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>. -</body></html> diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_share_cleanup.pdf b/plugins/FTPFileYM/curl/docs/libcurl/curl_share_cleanup.pdf Binary files differdeleted file mode 100644 index b8e3315893..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_share_cleanup.pdf +++ /dev/null diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_share_init.3 b/plugins/FTPFileYM/curl/docs/libcurl/curl_share_init.3 deleted file mode 100644 index ce00d958ea..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_share_init.3 +++ /dev/null @@ -1,44 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at http://curl.haxx.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" ************************************************************************** -.TH curl_share_init 3 "8 Aug 2003" "libcurl 7.10.7" "libcurl Manual" -.SH NAME -curl_share_init - Create a shared object -.SH SYNOPSIS -.B #include <curl/curl.h> -.sp -.BI "CURLSH *curl_share_init( );" -.ad -.SH DESCRIPTION -This function returns a CURLSH handle to be used as input to all the other -share-functions, sometimes referred to as a share handle in some places in the -documentation. This init call MUST have a corresponding call to -\fIcurl_share_cleanup\fP when all operations using the share are complete. - -This \fIshare handle\fP is what you pass to curl using the \fICURLOPT_SHARE\fP -option with \fIcurl_easy_setopt(3)\fP, to make that specific curl handle use -the data in this share. -.SH RETURN VALUE -If this function returns NULL, something went wrong (out of memory, etc.) -and therefore the share object was not created. -.SH "SEE ALSO" -.BR curl_share_cleanup "(3), " curl_share_setopt "(3)" - diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_share_init.html b/plugins/FTPFileYM/curl/docs/libcurl/curl_share_init.html deleted file mode 100644 index ebf555be4d..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_share_init.html +++ /dev/null @@ -1,59 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> -<html><head> -<title>curl_share_init man page</title> -<meta name="generator" content="roffit"> -<STYLE type="text/css"> -P.level0 { - padding-left: 2em; -} - -P.level1 { - padding-left: 4em; -} - -P.level2 { - padding-left: 6em; -} - -span.emphasis { - font-style: italic; -} - -span.bold { - font-weight: bold; -} - -span.manpage { - font-weight: bold; -} - -h2.nroffsh { - background-color: #e0e0e0; -} - -span.nroffip { - font-weight: bold; - font-size: 120%; - font-family: monospace; -} - -p.roffit { - text-align: center; - font-size: 80%; -} -</STYLE> -</head><body> - -<p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2> -<p class="level0">curl_share_init - Create a shared object <a name="SYNOPSIS"></a><h2 class="nroffsh">SYNOPSIS</h2> -<p class="level0"><span Class="bold">#include <curl/curl.h></span> -<p class="level0"><span Class="bold">CURLSH *curl_share_init( );</span> -<p class="level0"><a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2> -<p class="level0">This function returns a CURLSH handle to be used as input to all the other share-functions, sometimes referred to as a share handle in some places in the documentation. This init call MUST have a corresponding call to <span Class="emphasis">curl_share_cleanup</span> when all operations using the share are complete. -<p class="level0">This <span Class="emphasis">share handle</span> is what you pass to curl using the <span Class="emphasis">CURLOPT_SHARE</span> option with <a class="emphasis" href="./curl_easy_setopt.html">curl_easy_setopt(3)</a>, to make that specific curl handle use the data in this share. <a name="RETURN"></a><h2 class="nroffsh">RETURN VALUE</h2> -<p class="level0">If this function returns NULL, something went wrong (out of memory, etc.) and therefore the share object was not created. <a name="SEE"></a><h2 class="nroffsh">SEE ALSO</h2> -<p class="level0"><a class="manpage" href="./curl_share_cleanup.html">curl_share_cleanup (3)</a> <a class="manpage" href="./curl_share_setopt.html"> curl_share_setopt (3)</a> -<p class="level0"><p class="roffit"> - This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>. -</body></html> diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_share_init.pdf b/plugins/FTPFileYM/curl/docs/libcurl/curl_share_init.pdf Binary files differdeleted file mode 100644 index e660cb6e30..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_share_init.pdf +++ /dev/null diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_share_setopt.3 b/plugins/FTPFileYM/curl/docs/libcurl/curl_share_setopt.3 deleted file mode 100644 index c196743ff3..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_share_setopt.3 +++ /dev/null @@ -1,85 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at http://curl.haxx.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" ************************************************************************** -.TH curl_share_setopt 3 "8 Aug 2003" "libcurl 7.10.7" "libcurl Manual" -.SH NAME -curl_share_setopt - Set options for a shared object -.SH SYNOPSIS -.B #include <curl/curl.h> -.sp -CURLSHcode curl_share_setopt(CURLSH *share, CURLSHoption option, parameter); -.ad -.SH DESCRIPTION -Set the \fIoption\fP to \fIparameter\fP for the given \fIshare\fP. -.SH OPTIONS -.IP CURLSHOPT_LOCKFUNC -The \fIparameter\fP must be a pointer to a function matching the following -prototype: - -void lock_function(CURL *handle, curl_lock_data data, curl_lock_access access, -void *userptr); - -\fIdata\fP defines what data libcurl wants to lock, and you must make sure that -only one lock is given at any time for each kind of data. - -\fIaccess\fP defines what access type libcurl wants, shared or single. - -\fIuserptr\fP is the pointer you set with \fICURLSHOPT_USERDATA\fP. -.IP CURLSHOPT_UNLOCKFUNC -The \fIparameter\fP must be a pointer to a function matching the following -prototype: - -void unlock_function(CURL *handle, curl_lock_data data, void *userptr); - -\fIdata\fP defines what data libcurl wants to unlock, and you must make sure -that only one lock is given at any time for each kind of data. - -\fIuserptr\fP is the pointer you set with \fICURLSHOPT_USERDATA\fP. -.IP CURLSHOPT_SHARE -The \fIparameter\fP specifies a type of data that should be shared. This may -be set to one of the values described below. -.RS -.IP CURL_LOCK_DATA_COOKIE -Cookie data will be shared across the easy handles using this shared object. -.IP CURL_LOCK_DATA_DNS -Cached DNS hosts will be shared across the easy handles using this shared -object. Note that when you use the multi interface, all easy handles added to -the same multi handle will share DNS cache by default without this having to -be used! -.IP CURL_LOCK_DATA_SSL_SESSION -SSL session IDs will be shared across the easy handles using this shared -object. This will reduce the time spent in the SSL handshake when reconnecting -to the same server. Note SSL session IDs are reused within the same easy handle -by default. -.RE -.IP CURLSHOPT_UNSHARE -This option does the opposite of \fICURLSHOPT_SHARE\fP. It specifies that -the specified \fIparameter\fP will no longer be shared. Valid values are -the same as those for \fICURLSHOPT_SHARE\fP. -.IP CURLSHOPT_USERDATA -The \fIparameter\fP allows you to specify a pointer to data that will be passed -to the lock_function and unlock_function each time it is called. -.SH RETURN VALUE -CURLSHE_OK (zero) means that the option was set properly, non-zero means an -error occurred as \fI<curl/curl.h>\fP defines. See the \fIlibcurl-errors.3\fP -man page for the full list with descriptions. -.SH "SEE ALSO" -.BR curl_share_cleanup "(3), " curl_share_init "(3)" diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_share_setopt.html b/plugins/FTPFileYM/curl/docs/libcurl/curl_share_setopt.html deleted file mode 100644 index 14b3677022..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_share_setopt.html +++ /dev/null @@ -1,83 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> -<html><head> -<title>curl_share_setopt man page</title> -<meta name="generator" content="roffit"> -<STYLE type="text/css"> -P.level0 { - padding-left: 2em; -} - -P.level1 { - padding-left: 4em; -} - -P.level2 { - padding-left: 6em; -} - -span.emphasis { - font-style: italic; -} - -span.bold { - font-weight: bold; -} - -span.manpage { - font-weight: bold; -} - -h2.nroffsh { - background-color: #e0e0e0; -} - -span.nroffip { - font-weight: bold; - font-size: 120%; - font-family: monospace; -} - -p.roffit { - text-align: center; - font-size: 80%; -} -</STYLE> -</head><body> - -<p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2> -<p class="level0">curl_share_setopt - Set options for a shared object <a name="SYNOPSIS"></a><h2 class="nroffsh">SYNOPSIS</h2> -<p class="level0"><span Class="bold">#include <curl/curl.h></span> -<p class="level0">CURLSHcode curl_share_setopt(CURLSH *share, CURLSHoption option, parameter); -<p class="level0"><a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2> -<p class="level0">Set the <span Class="emphasis">option</span> to <span Class="emphasis">parameter</span> for the given <span Class="emphasis">share</span>. <a name="OPTIONS"></a><h2 class="nroffsh">OPTIONS</h2> -<p class="level0"> -<p class="level0"><a name="CURLSHOPTLOCKFUNC"></a><span class="nroffip">CURLSHOPT_LOCKFUNC</span> -<p class="level1">The <span Class="emphasis">parameter</span> must be a pointer to a function matching the following prototype: -<p class="level1">void lock_function(CURL *handle, curl_lock_data data, curl_lock_access access, void *userptr); -<p class="level1"><span Class="emphasis">data</span> defines what data libcurl wants to lock, and you must make sure that only one lock is given at any time for each kind of data. -<p class="level1"><span Class="emphasis">access</span> defines what access type libcurl wants, shared or single. -<p class="level1"><span Class="emphasis">userptr</span> is the pointer you set with <a class="emphasis" href="#CURLSHOPTUSERDATA">CURLSHOPT_USERDATA</a>. -<p class="level0"><a name="CURLSHOPTUNLOCKFUNC"></a><span class="nroffip">CURLSHOPT_UNLOCKFUNC</span> -<p class="level1">The <span Class="emphasis">parameter</span> must be a pointer to a function matching the following prototype: -<p class="level1">void unlock_function(CURL *handle, curl_lock_data data, void *userptr); -<p class="level1"><span Class="emphasis">data</span> defines what data libcurl wants to unlock, and you must make sure that only one lock is given at any time for each kind of data. -<p class="level1"><span Class="emphasis">userptr</span> is the pointer you set with <a class="emphasis" href="#CURLSHOPTUSERDATA">CURLSHOPT_USERDATA</a>. -<p class="level0"><a name="CURLSHOPTSHARE"></a><span class="nroffip">CURLSHOPT_SHARE</span> -<p class="level1">The <span Class="emphasis">parameter</span> specifies a type of data that should be shared. This may be set to one of the values described below. -<p class="level2"> -<p class="level1"><a name="CURLLOCKDATACOOKIE"></a><span class="nroffip">CURL_LOCK_DATA_COOKIE</span> -<p class="level2">Cookie data will be shared across the easy handles using this shared object. -<p class="level1"><a name="CURLLOCKDATADNS"></a><span class="nroffip">CURL_LOCK_DATA_DNS</span> -<p class="level2">Cached DNS hosts will be shared across the easy handles using this shared object. Note that when you use the multi interface, all easy handles added to the same multi handle will share DNS cache by default without this having to be used! -<p class="level1"><a name="CURLLOCKDATASSLSESSION"></a><span class="nroffip">CURL_LOCK_DATA_SSL_SESSION</span> -<p class="level2">SSL session IDs will be shared across the easy handles using this shared object. This will reduce the time spent in the SSL handshake when reconnecting to the same server. Note SSL session IDs are reused within the same easy handle by default. -<p class="level1"> -<p class="level0"><a name="CURLSHOPTUNSHARE"></a><span class="nroffip">CURLSHOPT_UNSHARE</span> -<p class="level1">This option does the opposite of <a class="emphasis" href="#CURLSHOPTSHARE">CURLSHOPT_SHARE</a>. It specifies that the specified <span Class="emphasis">parameter</span> will no longer be shared. Valid values are the same as those for <a class="emphasis" href="#CURLSHOPTSHARE">CURLSHOPT_SHARE</a>. -<p class="level0"><a name="CURLSHOPTUSERDATA"></a><span class="nroffip">CURLSHOPT_USERDATA</span> -<p class="level1">The <span Class="emphasis">parameter</span> allows you to specify a pointer to data that will be passed to the lock_function and unlock_function each time it is called. <a name="RETURN"></a><h2 class="nroffsh">RETURN VALUE</h2> -<p class="level0">CURLSHE_OK (zero) means that the option was set properly, non-zero means an error occurred as <span Class="emphasis"><curl/curl.h></span> defines. See the <span Class="emphasis">libcurl-errors.3</span> man page for the full list with descriptions. <a name="SEE"></a><h2 class="nroffsh">SEE ALSO</h2> -<p class="level0"><a class="manpage" href="./curl_share_cleanup.html">curl_share_cleanup (3)</a> <a class="manpage" href="./curl_share_init.html"> curl_share_init (3)</a> <p class="roffit"> - This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>. -</body></html> diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_share_setopt.pdf b/plugins/FTPFileYM/curl/docs/libcurl/curl_share_setopt.pdf Binary files differdeleted file mode 100644 index 9b435db002..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_share_setopt.pdf +++ /dev/null diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_share_strerror.3 b/plugins/FTPFileYM/curl/docs/libcurl/curl_share_strerror.3 deleted file mode 100644 index f1bc398671..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_share_strerror.3 +++ /dev/null @@ -1,37 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at http://curl.haxx.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" ************************************************************************** -.TH curl_share_strerror 3 "26 Apr 2004" "libcurl 7.12" "libcurl Manual" -.SH NAME -curl_share_strerror - return string describing error code -.SH SYNOPSIS -.nf -.B #include <curl/curl.h> -.BI "const char *curl_share_strerror(CURLSHcode " errornum ");" -.SH DESCRIPTION -The curl_share_strerror() function returns a string describing the CURLSHcode -error code passed in the argument \fIerrornum\fP. -.SH AVAILABILITY -This function was added in libcurl 7.12.0 -.SH RETURN VALUE -A pointer to a zero terminated string. -.SH "SEE ALSO" -.BR libcurl-errors "(3), " curl_multi_strerror "(3), " curl_easy_strerror "(3)" diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_share_strerror.html b/plugins/FTPFileYM/curl/docs/libcurl/curl_share_strerror.html deleted file mode 100644 index 59e8f8ce28..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_share_strerror.html +++ /dev/null @@ -1,57 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> -<html><head> -<title>curl_share_strerror man page</title> -<meta name="generator" content="roffit"> -<STYLE type="text/css"> -P.level0 { - padding-left: 2em; -} - -P.level1 { - padding-left: 4em; -} - -P.level2 { - padding-left: 6em; -} - -span.emphasis { - font-style: italic; -} - -span.bold { - font-weight: bold; -} - -span.manpage { - font-weight: bold; -} - -h2.nroffsh { - background-color: #e0e0e0; -} - -span.nroffip { - font-weight: bold; - font-size: 120%; - font-family: monospace; -} - -p.roffit { - text-align: center; - font-size: 80%; -} -</STYLE> -</head><body> - -<p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2> -<p class="level0">curl_share_strerror - return string describing error code <a name="SYNOPSIS"></a><h2 class="nroffsh">SYNOPSIS</h2> -<p class="level0"> -<p class="level0"><span Class="bold">#include <curl/curl.h></span> <span Class="bold">const char *curl_share_strerror(CURLSHcode errornum );</span> <a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2> -<p class="level0">The curl_share_strerror() function returns a string describing the CURLSHcode error code passed in the argument <span Class="emphasis">errornum</span>. <a name="AVAILABILITY"></a><h2 class="nroffsh">AVAILABILITY</h2> -<p class="level0">This function was added in libcurl 7.12.0 <a name="RETURN"></a><h2 class="nroffsh">RETURN VALUE</h2> -<p class="level0">A pointer to a zero terminated string. <a name="SEE"></a><h2 class="nroffsh">SEE ALSO</h2> -<p class="level0"><span Class="manpage">libcurl-errors (3)</span> <a class="manpage" href="./curl_multi_strerror.html"> curl_multi_strerror (3)</a> <a class="manpage" href="./curl_easy_strerror.html"> curl_easy_strerror (3)</a> <p class="roffit"> - This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>. -</body></html> diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_share_strerror.pdf b/plugins/FTPFileYM/curl/docs/libcurl/curl_share_strerror.pdf Binary files differdeleted file mode 100644 index 4af5aa3f89..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_share_strerror.pdf +++ /dev/null diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_slist_append.3 b/plugins/FTPFileYM/curl/docs/libcurl/curl_slist_append.3 deleted file mode 100644 index 529560e8ae..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_slist_append.3 +++ /dev/null @@ -1,56 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at http://curl.haxx.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" ************************************************************************** -.TH curl_slist_append 3 "19 Jun 2003" "libcurl 7.10.4" "libcurl Manual" -.SH NAME -curl_slist_append - add a string to an slist -.SH SYNOPSIS -.B #include <curl/curl.h> -.sp -.BI "struct curl_slist *curl_slist_append(struct curl_slist *" list, -.BI "const char * "string ");" -.ad -.SH DESCRIPTION -curl_slist_append() appends a specified string to a linked list of -strings. The existing \fIlist\fP should be passed as the first argument while -the new list is returned from this function. The specified \fIstring\fP has -been appended when this function returns. curl_slist_append() copies the -string. - -The list should be freed again (after usage) with -\fBcurl_slist_free_all(3)\fP. -.SH RETURN VALUE -A null pointer is returned if anything went wrong, otherwise the new list -pointer is returned. -.SH EXAMPLE -.nf - CURL handle; - struct curl_slist *slist=NULL; - - slist = curl_slist_append(slist, "pragma:"); - curl_easy_setopt(handle, CURLOPT_HTTPHEADER, slist); - - curl_easy_perform(handle); - - curl_slist_free_all(slist); /* free the list again */ -.fi -.SH "SEE ALSO" -.BR curl_slist_free_all "(3), " diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_slist_append.html b/plugins/FTPFileYM/curl/docs/libcurl/curl_slist_append.html deleted file mode 100644 index 9c22a1e10a..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_slist_append.html +++ /dev/null @@ -1,64 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> -<html><head> -<title>curl_slist_append man page</title> -<meta name="generator" content="roffit"> -<STYLE type="text/css"> -P.level0 { - padding-left: 2em; -} - -P.level1 { - padding-left: 4em; -} - -P.level2 { - padding-left: 6em; -} - -span.emphasis { - font-style: italic; -} - -span.bold { - font-weight: bold; -} - -span.manpage { - font-weight: bold; -} - -h2.nroffsh { - background-color: #e0e0e0; -} - -span.nroffip { - font-weight: bold; - font-size: 120%; - font-family: monospace; -} - -p.roffit { - text-align: center; - font-size: 80%; -} -</STYLE> -</head><body> - -<p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2> -<p class="level0">curl_slist_append - add a string to an slist <a name="SYNOPSIS"></a><h2 class="nroffsh">SYNOPSIS</h2> -<p class="level0"><span Class="bold">#include <curl/curl.h></span> -<p class="level0"><span Class="bold">struct curl_slist *curl_slist_append(struct curl_slist * list,</span> <span Class="bold">const char * string );</span> -<p class="level0"><a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2> -<p class="level0">curl_slist_append() appends a specified string to a linked list of strings. The existing <span Class="emphasis">list</span> should be passed as the first argument while the new list is returned from this function. The specified <span Class="emphasis">string</span> has been appended when this function returns. curl_slist_append() copies the string. -<p class="level0">The list should be freed again (after usage) with <a class="bold" href="./curl_slist_free_all.html">curl_slist_free_all(3)</a>. <a name="RETURN"></a><h2 class="nroffsh">RETURN VALUE</h2> -<p class="level0">A null pointer is returned if anything went wrong, otherwise the new list pointer is returned. <a name="EXAMPLE"></a><h2 class="nroffsh">EXAMPLE</h2> -<p class="level0"> -<p class="level0"> CURL handle; struct curl_slist *slist=NULL; -<p class="level0"> slist = curl_slist_append(slist, "pragma:"); curl_easy_setopt(handle, CURLOPT_HTTPHEADER, slist); -<p class="level0"> curl_easy_perform(handle); -<p class="level0"> curl_slist_free_all(slist); /* free the list again */ -<p class="level0"><a name="SEE"></a><h2 class="nroffsh">SEE ALSO</h2> -<p class="level0"><a class="manpage" href="./curl_slist_free_all.html">curl_slist_free_all (3)</a> <span Class="manpage"> </span> <p class="roffit"> - This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>. -</body></html> diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_slist_append.pdf b/plugins/FTPFileYM/curl/docs/libcurl/curl_slist_append.pdf deleted file mode 100644 index b026552b64..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_slist_append.pdf +++ /dev/null @@ -1,116 +0,0 @@ -%PDF-1.4 -%Çì¢ -5 0 obj -<</Length 6 0 R/Filter /FlateDecode>> -stream -xœuUÛnÛF}çWÒ‡†µæ.¹$·i -¨‰€8eU¢‹vaÐÔJbK‘ -/PóùèÎ./¢,™{8sæÌ™Ù/` -¶ú´ßñÁ¸Yù°+
vƃêCh¿âü" PÂѼCÁgà‡ÂƒA© >…ðd<šq]¤Ïeš”Õst<Êlód:O¤É‹:±&ŒÛĶ}ó.Êê(…q¸õwø٘؄QŒczé‰àŠãA87ÌÅÔz‹Œñ”rÂ…ƒ¬ÂaÞͬðŸ_f×öaB™:¶Çï)¢Í"(«"ÉvPåe M´Aú æŸP:Ýú¯Åýr}»>ÃZŠmBó§$‹Óz#á•õFý!û_œ¹ºLYÇÕ@¸Ñd…å߬¨ÝÕÉ<âóV¸¾¤D}›¶€8Ï0D¼ -Œ£q} î’.L£ÆeæîÙ¬E<YïFâ±ÝHgë«Ûex{¿¸lÎY'›x®÷C¡šŸ¥êÑQÆÉ7¹6í•ýkQå,W˜x¦%Ê·-¦$î%Hm+¥ ¢«à?öEö"86q.Ô¼äŽës®mUîó:ÝÀ‹„cT–r£ÞA·0"\ÖÕÉuŽJ¨Ó·‰F…ÂrŸxÔm[¤€BwõAfœöI*õ+™Th—xŽŽÀ'ÜõDKö”ªÃf.4¤k¹$)¡U]d¨Ð¶Èmë,®’<kDêä}¥³}¬™8£Ÿ4Ÿ?èxì±¾)³FÁ åôr -›Ž"“Ó^f—LZ–ضq3Äù1‘~
¢Ò„W¦ª@÷þÜŒm!1I´³¸Ú;3£$ƒ'3ÚV²€ºŒv#ž’j¯Ý1˜áܺœWn-$†’ò9JÓóÊ:«¡ºôóFF¦cxü<%æj>¬ð‡E—šÓùÃL‡e8’z
~?8æ46ܧBt”ë4…cždªÎaç“-n7ÁB0ßüŠÊã´ÇŠ<Û]CŽÂ§¤ìí6àÀ8#1ë׆’$靖ÃM1ûsz·œ¿ZáN@x_ÕöQ¶I¥^=êñøÕ_ïóù;\•Ý¶ÕgïÇ|¥ÿ»†7Ç"Ú¢Ÿß¨Ýö¶‹¯ñ2*¿>—²ÊÕ“Ùp¸Eè~> -Ãå§ÙôãluÝÜÍûmÞóûGYlóâÐhPʺëŒÕE‚›+mdÝ]Zwд¡¯nöíõm”ë/«Ù¦óõý.«Q—SѺü•Á}NDo6S€¾r&”R‚ë7_ëÃöê\»x[Ê9Ž7ñnÿ\gÀlÛѱ]¯»Ä© -4ßñó?€…d«endstream -endobj -6 0 obj -1006 -endobj -4 0 obj -<</Type/Page/MediaBox [0 0 595 842] -/Rotate 0/Parent 3 0 R -/Resources<</ProcSet[/PDF /Text] -/ExtGState 11 0 R -/Font 12 0 R ->> -/Contents 5 0 R ->> -endobj -3 0 obj -<< /Type /Pages /Kids [ -4 0 R -] /Count 1 ->> -endobj -1 0 obj -<</Type /Catalog /Pages 3 0 R -/Metadata 14 0 R ->> -endobj -7 0 obj -<</Type/ExtGState -/OPM 1>>endobj -11 0 obj -<</R7 -7 0 R>> -endobj -12 0 obj -<</R10 -10 0 R/R9 -9 0 R/R8 -8 0 R>> -endobj -10 0 obj -<</BaseFont/Times-Italic/Type/Font -/Subtype/Type1>> -endobj -9 0 obj -<</BaseFont/Times-Bold/Type/Font -/Subtype/Type1>> -endobj -8 0 obj -<</BaseFont/Times-Roman/Type/Font -/Encoding 13 0 R/Subtype/Type1>> -endobj -13 0 obj -<</Type/Encoding/Differences[ -140/fi]>> -endobj -14 0 obj -<</Type/Metadata -/Subtype/XML/Length 1346>>stream -<?xpacket begin='' id='W5M0MpCehiHzreSzNTczkc9d'?> -<?adobe-xap-filters esc="CRLF"?> -<x:xmpmeta xmlns:x='adobe:ns:meta/' x:xmptk='XMP toolkit 2.9.1-13, framework 1.6'> -<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' xmlns:iX='http://ns.adobe.com/iX/1.0/'> -<rdf:Description rdf:about='uuid:b82cf4ad-a861-11ed-0000-b52b3dcd9ad6' xmlns:pdf='http://ns.adobe.com/pdf/1.3/' pdf:Producer='GPL Ghostscript 9.05'/> -<rdf:Description rdf:about='uuid:b82cf4ad-a861-11ed-0000-b52b3dcd9ad6' xmlns:xmp='http://ns.adobe.com/xap/1.0/'><xmp:ModifyDate>2013-02-06T11:08:36+01:00</xmp:ModifyDate> -<xmp:CreateDate>2013-02-06T11:08:36+01:00</xmp:CreateDate> -<xmp:CreatorTool>groff version 1.22.1</xmp:CreatorTool></rdf:Description> -<rdf:Description rdf:about='uuid:b82cf4ad-a861-11ed-0000-b52b3dcd9ad6' xmlns:xapMM='http://ns.adobe.com/xap/1.0/mm/' xapMM:DocumentID='uuid:b82cf4ad-a861-11ed-0000-b52b3dcd9ad6'/> -<rdf:Description rdf:about='uuid:b82cf4ad-a861-11ed-0000-b52b3dcd9ad6' xmlns:dc='http://purl.org/dc/elements/1.1/' dc:format='application/pdf'><dc:title><rdf:Alt><rdf:li xml:lang='x-default'>Untitled</rdf:li></rdf:Alt></dc:title></rdf:Description> -</rdf:RDF> -</x:xmpmeta> - - -<?xpacket end='w'?> -endstream -endobj -2 0 obj -<</Producer(GPL Ghostscript 9.05) -/CreationDate(D:20130206110836+01'00') -/ModDate(D:20130206110836+01'00') -/Creator(groff version 1.22.1)>>endobj -xref -0 15 -0000000000 65535 f -0000001330 00000 n -0000003210 00000 n -0000001271 00000 n -0000001111 00000 n -0000000015 00000 n -0000001091 00000 n -0000001395 00000 n -0000001649 00000 n -0000001584 00000 n -0000001516 00000 n -0000001436 00000 n -0000001466 00000 n -0000001731 00000 n -0000001787 00000 n -trailer -<< /Size 15 /Root 1 0 R /Info 2 0 R -/ID [<6C32F323F7F9DE703BF4C77DA956A37A><6C32F323F7F9DE703BF4C77DA956A37A>] ->> -startxref -3364 -%%EOF diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_slist_free_all.3 b/plugins/FTPFileYM/curl/docs/libcurl/curl_slist_free_all.3 deleted file mode 100644 index fab3d6080a..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_slist_free_all.3 +++ /dev/null @@ -1,37 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at http://curl.haxx.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" ************************************************************************** -.TH curl_slist_free_all 3 "5 March 2001" "libcurl 7.0" "libcurl Manual" -.SH NAME -curl_slist_free_all - free an entire curl_slist list -.SH SYNOPSIS -.B #include <curl/curl.h> -.sp -.BI "void curl_slist_free_all(struct curl_slist *" list); -.ad -.SH DESCRIPTION -curl_slist_free_all() removes all traces of a previously built curl_slist -linked list. -.SH RETURN VALUE -Nothing. -.SH "SEE ALSO" -.BR curl_slist_append "(3), " - diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_slist_free_all.html b/plugins/FTPFileYM/curl/docs/libcurl/curl_slist_free_all.html deleted file mode 100644 index 0bd7418ec4..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_slist_free_all.html +++ /dev/null @@ -1,58 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> -<html><head> -<title>curl_slist_free_all man page</title> -<meta name="generator" content="roffit"> -<STYLE type="text/css"> -P.level0 { - padding-left: 2em; -} - -P.level1 { - padding-left: 4em; -} - -P.level2 { - padding-left: 6em; -} - -span.emphasis { - font-style: italic; -} - -span.bold { - font-weight: bold; -} - -span.manpage { - font-weight: bold; -} - -h2.nroffsh { - background-color: #e0e0e0; -} - -span.nroffip { - font-weight: bold; - font-size: 120%; - font-family: monospace; -} - -p.roffit { - text-align: center; - font-size: 80%; -} -</STYLE> -</head><body> - -<p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2> -<p class="level0">curl_slist_free_all - free an entire curl_slist list <a name="SYNOPSIS"></a><h2 class="nroffsh">SYNOPSIS</h2> -<p class="level0"><span Class="bold">#include <curl/curl.h></span> -<p class="level0"><span Class="bold">void curl_slist_free_all(struct curl_slist * list);</span> -<p class="level0"><a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2> -<p class="level0">curl_slist_free_all() removes all traces of a previously built curl_slist linked list. <a name="RETURN"></a><h2 class="nroffsh">RETURN VALUE</h2> -<p class="level0">Nothing. <a name="SEE"></a><h2 class="nroffsh">SEE ALSO</h2> -<p class="level0"><a class="manpage" href="./curl_slist_append.html">curl_slist_append (3)</a> <span Class="manpage"> </span> -<p class="level0"><p class="roffit"> - This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>. -</body></html> diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_slist_free_all.pdf b/plugins/FTPFileYM/curl/docs/libcurl/curl_slist_free_all.pdf deleted file mode 100644 index bb9475f296..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_slist_free_all.pdf +++ /dev/null @@ -1,105 +0,0 @@ -%PDF-1.4 -%Çì¢ -5 0 obj -<</Length 6 0 R/Filter /FlateDecode>> -stream -xœ…SYÓ0~ϯ‰DܱSç©@Šz,m µ¨Ê¦iHÓnŽ®ø÷؉æ¢+dɉ<3žï?R¨–þÆGc°pa_{ãÑ`Mô'>ÂÇP&xê Üm
—ƒëÛÔó!<Œy„OÆŠÄu‘mÊ,-«Í®H’M”ekb¯MÈÒ3-."ºdåu”ÁKæð‹a!åLöˆ%_B ¾P(l‰Af#óµD-£LPáÛY¸5È40ß=Ìé]°WaT8oÁÔ/D9$y•I¨½µÃ’8,æP¯i»ü>›ß-ÇËç4
U7&¯Ò<ÎêmïÕŵÑÕn)3$
>lx]N/Ÿú-©I·×R™Jtt=ÒiVVEW}Ðo
†{΢£eR)kóÝ¿¬8ʶ}fŸƒå§Åø.Ïg×ÊöÈÝ´QÚ^$ÇSGQ4V!£®«1\ãT´d¹ç{C*#jÝEêÙÈ:%¤UUÅI §Dp.“¥…M.é©.³ßð`r$ušU×æ¿L†mf²m<¥Z¢>&\5Øù¯È"ï3øf2{(¥ad4¹tå
-f§êæ{ú¿ M–ó¦§it>'ùöZ}W½ãë!Í£yÛHÍ£B¼°¹n¥¸{‚s -X[/¦Ïz;Ô–Nè@TÄàˆ¬©"uº jN‚Ðø*×zÑendstream -endobj -6 0 obj -546 -endobj -4 0 obj -<</Type/Page/MediaBox [0 0 595 842] -/Rotate 0/Parent 3 0 R -/Resources<</ProcSet[/PDF /Text] -/ExtGState 11 0 R -/Font 12 0 R ->> -/Contents 5 0 R ->> -endobj -3 0 obj -<< /Type /Pages /Kids [ -4 0 R -] /Count 1 ->> -endobj -1 0 obj -<</Type /Catalog /Pages 3 0 R -/Metadata 13 0 R ->> -endobj -7 0 obj -<</Type/ExtGState -/OPM 1>>endobj -11 0 obj -<</R7 -7 0 R>> -endobj -12 0 obj -<</R10 -10 0 R/R9 -9 0 R/R8 -8 0 R>> -endobj -10 0 obj -<</BaseFont/Times-Italic/Type/Font -/Subtype/Type1>> -endobj -9 0 obj -<</BaseFont/Times-Bold/Type/Font -/Subtype/Type1>> -endobj -8 0 obj -<</BaseFont/Times-Roman/Type/Font -/Subtype/Type1>> -endobj -13 0 obj -<</Type/Metadata -/Subtype/XML/Length 1346>>stream -<?xpacket begin='' id='W5M0MpCehiHzreSzNTczkc9d'?> -<?adobe-xap-filters esc="CRLF"?> -<x:xmpmeta xmlns:x='adobe:ns:meta/' x:xmptk='XMP toolkit 2.9.1-13, framework 1.6'> -<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' xmlns:iX='http://ns.adobe.com/iX/1.0/'> -<rdf:Description rdf:about='uuid:b82cf4ad-a861-11ed-0000-224f381b10d2' xmlns:pdf='http://ns.adobe.com/pdf/1.3/' pdf:Producer='GPL Ghostscript 9.05'/> -<rdf:Description rdf:about='uuid:b82cf4ad-a861-11ed-0000-224f381b10d2' xmlns:xmp='http://ns.adobe.com/xap/1.0/'><xmp:ModifyDate>2013-02-06T11:08:36+01:00</xmp:ModifyDate> -<xmp:CreateDate>2013-02-06T11:08:36+01:00</xmp:CreateDate> -<xmp:CreatorTool>groff version 1.22.1</xmp:CreatorTool></rdf:Description> -<rdf:Description rdf:about='uuid:b82cf4ad-a861-11ed-0000-224f381b10d2' xmlns:xapMM='http://ns.adobe.com/xap/1.0/mm/' xapMM:DocumentID='uuid:b82cf4ad-a861-11ed-0000-224f381b10d2'/> -<rdf:Description rdf:about='uuid:b82cf4ad-a861-11ed-0000-224f381b10d2' xmlns:dc='http://purl.org/dc/elements/1.1/' dc:format='application/pdf'><dc:title><rdf:Alt><rdf:li xml:lang='x-default'>Untitled</rdf:li></rdf:Alt></dc:title></rdf:Description> -</rdf:RDF> -</x:xmpmeta> - - -<?xpacket end='w'?> -endstream -endobj -2 0 obj -<</Producer(GPL Ghostscript 9.05) -/CreationDate(D:20130206110836+01'00') -/ModDate(D:20130206110836+01'00') -/Creator(groff version 1.22.1)>>endobj -xref -0 14 -0000000000 65535 f -0000000869 00000 n -0000002677 00000 n -0000000810 00000 n -0000000650 00000 n -0000000015 00000 n -0000000631 00000 n -0000000934 00000 n -0000001188 00000 n -0000001123 00000 n -0000001055 00000 n -0000000975 00000 n -0000001005 00000 n -0000001254 00000 n -trailer -<< /Size 14 /Root 1 0 R /Info 2 0 R -/ID [<9FD59BE10F91097FB361BE00CF172282><9FD59BE10F91097FB361BE00CF172282>] ->> -startxref -2831 -%%EOF diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_strequal.3 b/plugins/FTPFileYM/curl/docs/libcurl/curl_strequal.3 deleted file mode 100644 index ce575d7acc..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_strequal.3 +++ /dev/null @@ -1,51 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at http://curl.haxx.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" ************************************************************************** -.TH curl_strequal 3 "30 April 2004" "libcurl 7.12" "libcurl Manual" -.SH NAME -curl_strequal, curl_strnequal - case insensitive string comparisons -.SH SYNOPSIS -.B #include <curl/curl.h> -.sp -.BI "int curl_strequal(char *" str1 ", char *" str2 ");" -.sp -.BI "int curl_strenqual(char *" str1 ", char *" str2 ", size_t " len ");" -.SH DESCRIPTION -The -.B curl_strequal() -function compares the two strings \fIstr1\fP and \fIstr2\fP, ignoring the case -of the characters. It returns a non-zero (TRUE) integer if the strings are -identical. -.sp -The \fBcurl_strnequal()\fP function is similar, except it only compares the -first \fIlen\fP characters of \fIstr1\fP. -.sp -These functions are provided by libcurl to enable applications to compare -strings in a truly portable manner. There are no standard portable case -insensitive string comparison functions. These two work on all platforms. -.SH AVAILABILITY -These functions will be removed from the public libcurl API in a near -future. They will instead be made "available" by source code access only, and -then as curlx_strequal() and curlx_strenqual(). -.SH RETURN VALUE -Non-zero if the strings are identical. Zero if they're not. -.SH "SEE ALSO" -.BR strcmp "(3), " strcasecmp "(3)" diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_strequal.html b/plugins/FTPFileYM/curl/docs/libcurl/curl_strequal.html deleted file mode 100644 index c4f6b550ee..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_strequal.html +++ /dev/null @@ -1,60 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> -<html><head> -<title>curl_strequal man page</title> -<meta name="generator" content="roffit"> -<STYLE type="text/css"> -P.level0 { - padding-left: 2em; -} - -P.level1 { - padding-left: 4em; -} - -P.level2 { - padding-left: 6em; -} - -span.emphasis { - font-style: italic; -} - -span.bold { - font-weight: bold; -} - -span.manpage { - font-weight: bold; -} - -h2.nroffsh { - background-color: #e0e0e0; -} - -span.nroffip { - font-weight: bold; - font-size: 120%; - font-family: monospace; -} - -p.roffit { - text-align: center; - font-size: 80%; -} -</STYLE> -</head><body> - -<p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2> -<p class="level0">curl_strequal, curl_strnequal - case insensitive string comparisons <a name="SYNOPSIS"></a><h2 class="nroffsh">SYNOPSIS</h2> -<p class="level0"><span Class="bold">#include <curl/curl.h></span> -<p class="level0"><span Class="bold">int curl_strequal(char * str1 , char * str2 );</span> -<p class="level0"><span Class="bold">int curl_strenqual(char * str1 , char * str2 , size_t len );</span> <a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2> -<p class="level0">The <span Class="bold">curl_strequal()</span> function compares the two strings <span Class="emphasis">str1</span> and <span Class="emphasis">str2</span>, ignoring the case of the characters. It returns a non-zero (TRUE) integer if the strings are identical. -<p class="level0">The <span Class="bold">curl_strnequal()</span> function is similar, except it only compares the first <span Class="emphasis">len</span> characters of <span Class="emphasis">str1</span>. -<p class="level0">These functions are provided by libcurl to enable applications to compare strings in a truly portable manner. There are no standard portable case insensitive string comparison functions. These two work on all platforms. <a name="AVAILABILITY"></a><h2 class="nroffsh">AVAILABILITY</h2> -<p class="level0">These functions will be removed from the public libcurl API in a near future. They will instead be made "available" by source code access only, and then as curlx_strequal() and curlx_strenqual(). <a name="RETURN"></a><h2 class="nroffsh">RETURN VALUE</h2> -<p class="level0">Non-zero if the strings are identical. Zero if they're not. <a name="SEE"></a><h2 class="nroffsh">SEE ALSO</h2> -<p class="level0"><span Class="manpage">strcmp (3)</span> <span Class="manpage"> strcasecmp (3)</span> <p class="roffit"> - This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>. -</body></html> diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_strequal.pdf b/plugins/FTPFileYM/curl/docs/libcurl/curl_strequal.pdf Binary files differdeleted file mode 100644 index 55fa9468d6..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_strequal.pdf +++ /dev/null diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_unescape.3 b/plugins/FTPFileYM/curl/docs/libcurl/curl_unescape.3 deleted file mode 100644 index 2a24866d3e..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_unescape.3 +++ /dev/null @@ -1,48 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at http://curl.haxx.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" ************************************************************************** -.TH curl_unescape 3 "22 March 2001" "libcurl 7.7" "libcurl Manual" -.SH NAME -curl_unescape - URL decodes the given string -.SH SYNOPSIS -.B #include <curl/curl.h> -.sp -.BI "char *curl_unescape( char *" url ", int "length " );" -.ad -.SH DESCRIPTION -Obsolete function. Use \fIcurl_easy_unescape(3)\fP instead! - -This function will convert the given URL encoded input string to a "plain -string" and return that as a new allocated string. All input characters that -are URL encoded (%XX where XX is a two-digit hexadecimal number) will be -converted to their plain text versions. - -If the 'length' argument is set to 0, curl_unescape() will use strlen() on the -input 'url' string to find out the size. - -You must curl_free() the returned string when you're done with it. -.SH AVAILABILITY -Since 7.15.4, \fIcurl_easy_unescape(3)\fP should be used. This function will -be removed in a future release. -.SH RETURN VALUE -A pointer to a zero terminated string or NULL if it failed. -.SH "SEE ALSO" -.I curl_easy_escape(3), curl_easy_unescape(3), curl_free(3), RFC 2396 diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_unescape.html b/plugins/FTPFileYM/curl/docs/libcurl/curl_unescape.html deleted file mode 100644 index b8e434c017..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_unescape.html +++ /dev/null @@ -1,61 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> -<html><head> -<title>curl_unescape man page</title> -<meta name="generator" content="roffit"> -<STYLE type="text/css"> -P.level0 { - padding-left: 2em; -} - -P.level1 { - padding-left: 4em; -} - -P.level2 { - padding-left: 6em; -} - -span.emphasis { - font-style: italic; -} - -span.bold { - font-weight: bold; -} - -span.manpage { - font-weight: bold; -} - -h2.nroffsh { - background-color: #e0e0e0; -} - -span.nroffip { - font-weight: bold; - font-size: 120%; - font-family: monospace; -} - -p.roffit { - text-align: center; - font-size: 80%; -} -</STYLE> -</head><body> - -<p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2> -<p class="level0">curl_unescape - URL decodes the given string <a name="SYNOPSIS"></a><h2 class="nroffsh">SYNOPSIS</h2> -<p class="level0"><span Class="bold">#include <curl/curl.h></span> -<p class="level0"><span Class="bold">char *curl_unescape( char * url , int length );</span> -<p class="level0"><a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2> -<p class="level0">Obsolete function. Use <a class="emphasis" href="./curl_easy_unescape.html">curl_easy_unescape(3)</a> instead! -<p class="level0">This function will convert the given URL encoded input string to a "plain string" and return that as a new allocated string. All input characters that are URL encoded (%XX where XX is a two-digit hexadecimal number) will be converted to their plain text versions. -<p class="level0">If the 'length' argument is set to 0, curl_unescape() will use strlen() on the input 'url' string to find out the size. -<p class="level0">You must curl_free() the returned string when you're done with it. <a name="AVAILABILITY"></a><h2 class="nroffsh">AVAILABILITY</h2> -<p class="level0">Since 7.15.4, <a class="emphasis" href="./curl_easy_unescape.html">curl_easy_unescape(3)</a> should be used. This function will be removed in a future release. <a name="RETURN"></a><h2 class="nroffsh">RETURN VALUE</h2> -<p class="level0">A pointer to a zero terminated string or NULL if it failed. <a name="SEE"></a><h2 class="nroffsh">SEE ALSO</h2> -<p class="level0"><span Class="emphasis">curl_easy_escape(3), curl_easy_unescape(3), curl_free(3), <a href="http://www.ietf.org/rfc/rfc2396.txt">RFC 2396</a></span> <p class="roffit"> - This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>. -</body></html> diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_unescape.pdf b/plugins/FTPFileYM/curl/docs/libcurl/curl_unescape.pdf Binary files differdeleted file mode 100644 index 47b010b23c..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_unescape.pdf +++ /dev/null diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_version.3 b/plugins/FTPFileYM/curl/docs/libcurl/curl_version.3 deleted file mode 100644 index 003329800e..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_version.3 +++ /dev/null @@ -1,36 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at http://curl.haxx.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" ************************************************************************** -.TH curl_version 3 "5 March 2001" "libcurl 7.0" "libcurl Manual" -.SH NAME -curl_version - returns the libcurl version string -.SH SYNOPSIS -.B #include <curl/curl.h> -.sp -.BI "char *curl_version( );" -.ad -.SH DESCRIPTION -Returns a human readable string with the version number of libcurl and some of -its important components (like OpenSSL version). -.SH RETURN VALUE -A pointer to a zero terminated string. -.SH "SEE ALSO" -.BR curl_version_info "(3)" diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_version.html b/plugins/FTPFileYM/curl/docs/libcurl/curl_version.html deleted file mode 100644 index 31ce531ecf..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_version.html +++ /dev/null @@ -1,57 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> -<html><head> -<title>curl_version man page</title> -<meta name="generator" content="roffit"> -<STYLE type="text/css"> -P.level0 { - padding-left: 2em; -} - -P.level1 { - padding-left: 4em; -} - -P.level2 { - padding-left: 6em; -} - -span.emphasis { - font-style: italic; -} - -span.bold { - font-weight: bold; -} - -span.manpage { - font-weight: bold; -} - -h2.nroffsh { - background-color: #e0e0e0; -} - -span.nroffip { - font-weight: bold; - font-size: 120%; - font-family: monospace; -} - -p.roffit { - text-align: center; - font-size: 80%; -} -</STYLE> -</head><body> - -<p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2> -<p class="level0">curl_version - returns the libcurl version string <a name="SYNOPSIS"></a><h2 class="nroffsh">SYNOPSIS</h2> -<p class="level0"><span Class="bold">#include <curl/curl.h></span> -<p class="level0"><span Class="bold">char *curl_version( );</span> -<p class="level0"><a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2> -<p class="level0">Returns a human readable string with the version number of libcurl and some of its important components (like OpenSSL version). <a name="RETURN"></a><h2 class="nroffsh">RETURN VALUE</h2> -<p class="level0">A pointer to a zero terminated string. <a name="SEE"></a><h2 class="nroffsh">SEE ALSO</h2> -<p class="level0"><a class="manpage" href="./curl_version_info.html">curl_version_info (3)</a> <p class="roffit"> - This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>. -</body></html> diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_version.pdf b/plugins/FTPFileYM/curl/docs/libcurl/curl_version.pdf Binary files differdeleted file mode 100644 index 645dcf01c6..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_version.pdf +++ /dev/null diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_version_info.3 b/plugins/FTPFileYM/curl/docs/libcurl/curl_version_info.3 deleted file mode 100644 index ccb2028341..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_version_info.3 +++ /dev/null @@ -1,154 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at http://curl.haxx.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" ************************************************************************** -.\" -.TH curl_version_info 3 "10 June 2009" "libcurl 7.19.6" "libcurl Manual" -.SH NAME -curl_version_info - returns run-time libcurl version info -.SH SYNOPSIS -.B #include <curl/curl.h> -.sp -.BI "curl_version_info_data *curl_version_info( CURLversion "type ");" -.ad -.SH DESCRIPTION -Returns a pointer to a filled in struct with information about various -run-time features in libcurl. \fItype\fP should be set to the version of this -functionality by the time you write your program. This way, libcurl will -always return a proper struct that your program understands, while programs in -the future might get a different struct. CURLVERSION_NOW will be the most -recent one for the library you have installed: - - data = curl_version_info(CURLVERSION_NOW); - -Applications should use this information to judge if things are possible to do -or not, instead of using compile-time checks, as dynamic/DLL libraries can be -changed independent of applications. - -The curl_version_info_data struct looks like this - -.nf -typedef struct { - CURLversion age; /* see description below */ - - /* when 'age' is 0 or higher, the members below also exist: */ - const char *version; /* human readable string */ - unsigned int version_num; /* numeric representation */ - const char *host; /* human readable string */ - int features; /* bitmask, see below */ - char *ssl_version; /* human readable string */ - long ssl_version_num; /* not used, always zero */ - const char *libz_version; /* human readable string */ - const char **protocols; /* list of protocols */ - - /* when 'age' is 1 or higher, the members below also exist: */ - const char *ares; /* human readable string */ - int ares_num; /* number */ - - /* when 'age' is 2 or higher, the member below also exists: */ - const char *libidn; /* human readable string */ - - /* when 'age' is 3 or higher, the members below also exist: */ - int iconv_ver_num; /* '_libiconv_version' if iconv support enabled */ - - const char *libssh_version; /* human readable string */ - -} curl_version_info_data; -.fi - -\fIage\fP describes what the age of this struct is. The number depends on how -new the libcurl you're using is. You are however guaranteed to get a struct that you -have a matching struct for in the header, as you tell libcurl your "age" with -the input argument. - -\fIversion\fP is just an ascii string for the libcurl version. - -\fIversion_num\fP is a 24 bit number created like this: <8 bits major number> -| <8 bits minor number> | <8 bits patch number>. Version 7.9.8 is therefore -returned as 0x070908. - -\fIhost\fP is an ascii string showing what host information that this libcurl -was built for. As discovered by a configure script or set by the build -environment. - -\fIfeatures\fP can have none, one or more bits set, and the currently defined -bits are: -.RS -.IP CURL_VERSION_IPV6 -supports IPv6 -.IP CURL_VERSION_KERBEROS4 -supports kerberos4 (when using FTP) -.IP CURL_VERSION_SSL -supports SSL (HTTPS/FTPS) (Added in 7.10) -.IP CURL_VERSION_LIBZ -supports HTTP deflate using libz (Added in 7.10) -.IP CURL_VERSION_NTLM -supports HTTP NTLM (added in 7.10.6) -.IP CURL_VERSION_GSSNEGOTIATE -supports HTTP GSS-Negotiate (added in 7.10.6) -.IP CURL_VERSION_DEBUG -libcurl was built with debug capabilities (added in 7.10.6) -.IP CURL_VERSION_CURLDEBUG -libcurl was built with memory tracking debug capabilities. This is mainly of -interest for libcurl hackers. (added in 7.19.6) -.IP CURL_VERSION_ASYNCHDNS -libcurl was built with support for asynchronous name lookups, which allows -more exact timeouts (even on Windows) and less blocking when using the multi -interface. (added in 7.10.7) -.IP CURL_VERSION_SPNEGO -libcurl was built with support for SPNEGO authentication (Simple and Protected -GSS-API Negotiation Mechanism, defined in RFC 2478.) (added in 7.10.8) -.IP CURL_VERSION_LARGEFILE -libcurl was built with support for large files. (Added in 7.11.1) -.IP CURL_VERSION_IDN -libcurl was built with support for IDNA, domain names with international -letters. (Added in 7.12.0) -.IP CURL_VERSION_SSPI -libcurl was built with support for SSPI. This is only available on Windows and -makes libcurl use Windows-provided functions for NTLM authentication. It also -allows libcurl to use the current user and the current user's password without -the app having to pass them on. (Added in 7.13.2) -.IP CURL_VERSION_CONV -libcurl was built with support for character conversions, as provided by the -CURLOPT_CONV_* callbacks. (Added in 7.15.4) -.IP CURL_VERSION_TLSAUTH_SRP -libcurl was built with support for TLS-SRP. (Added in 7.21.4) -.IP CURL_VERSION_NTLM_WB -libcurl was built with support for NTLM delegation to a winbind helper. -(Added in 7.22.0) -.RE -\fIssl_version\fP is an ASCII string for the OpenSSL version used. If libcurl -has no SSL support, this is NULL. - -\fIssl_version_num\fP is the numerical OpenSSL version value as defined by the -OpenSSL project. If libcurl has no SSL support, this is 0. - -\fIlibz_version\fP is an ASCII string (there is no numerical version). If -libcurl has no libz support, this is NULL. - -\fIprotocols\fP is a pointer to an array of char * pointers, containing the -names protocols that libcurl supports (using lowercase letters). The protocol -names are the same as would be used in URLs. The array is terminated by a NULL -entry. -.SH RETURN VALUE -A pointer to a curl_version_info_data struct. -.SH "SEE ALSO" -\fIcurl_version(3)\fP - diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_version_info.html b/plugins/FTPFileYM/curl/docs/libcurl/curl_version_info.html deleted file mode 100644 index d3517c2292..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_version_info.html +++ /dev/null @@ -1,112 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> -<html><head> -<title>curl_version_info man page</title> -<meta name="generator" content="roffit"> -<STYLE type="text/css"> -P.level0 { - padding-left: 2em; -} - -P.level1 { - padding-left: 4em; -} - -P.level2 { - padding-left: 6em; -} - -span.emphasis { - font-style: italic; -} - -span.bold { - font-weight: bold; -} - -span.manpage { - font-weight: bold; -} - -h2.nroffsh { - background-color: #e0e0e0; -} - -span.nroffip { - font-weight: bold; - font-size: 120%; - font-family: monospace; -} - -p.roffit { - text-align: center; - font-size: 80%; -} -</STYLE> -</head><body> - -<p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2> -<p class="level0">curl_version_info - returns run-time libcurl version info <a name="SYNOPSIS"></a><h2 class="nroffsh">SYNOPSIS</h2> -<p class="level0"><span Class="bold">#include <curl/curl.h></span> -<p class="level0"><span Class="bold">curl_version_info_data *curl_version_info( CURLversion type );</span> -<p class="level0"><a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2> -<p class="level0">Returns a pointer to a filled in struct with information about various run-time features in libcurl. <span Class="emphasis">type</span> should be set to the version of this functionality by the time you write your program. This way, libcurl will always return a proper struct that your program understands, while programs in the future might get a different struct. CURLVERSION_NOW will be the most recent one for the library you have installed: -<p class="level0"> data = curl_version_info(CURLVERSION_NOW); -<p class="level0">Applications should use this information to judge if things are possible to do or not, instead of using compile-time checks, as dynamic/DLL libraries can be changed independent of applications. -<p class="level0">The curl_version_info_data struct looks like this -<p class="level0"> -<p class="level0">typedef struct { CURLversion age; /* see description below */ -<p class="level0"> /* when 'age' is 0 or higher, the members below also exist: */ const char *version; /* human readable string */ unsigned int version_num; /* numeric representation */ const char *host; /* human readable string */ int features; /* bitmask, see below */ char *ssl_version; /* human readable string */ long ssl_version_num; /* not used, always zero */ const char *libz_version; /* human readable string */ const char **protocols; /* list of protocols */ -<p class="level0"> /* when 'age' is 1 or higher, the members below also exist: */ const char *ares; /* human readable string */ int ares_num; /* number */ -<p class="level0"> /* when 'age' is 2 or higher, the member below also exists: */ const char *libidn; /* human readable string */ -<p class="level0"> /* when 'age' is 3 or higher, the members below also exist: */ int iconv_ver_num; /* '_libiconv_version' if iconv support enabled */ -<p class="level0"> const char *libssh_version; /* human readable string */ -<p class="level0">} curl_version_info_data; -<p class="level0"> -<p class="level0"><span Class="emphasis">age</span> describes what the age of this struct is. The number depends on how new the libcurl you're using is. You are however guaranteed to get a struct that you have a matching struct for in the header, as you tell libcurl your "age" with the input argument. -<p class="level0"><span Class="emphasis">version</span> is just an ascii string for the libcurl version. -<p class="level0"><span Class="emphasis">version_num</span> is a 24 bit number created like this: <8 bits major number> | <8 bits minor number> | <8 bits patch number>. Version 7.9.8 is therefore returned as 0x070908. -<p class="level0"><span Class="emphasis">host</span> is an ascii string showing what host information that this libcurl was built for. As discovered by a configure script or set by the build environment. -<p class="level0"><span Class="emphasis">features</span> can have none, one or more bits set, and the currently defined bits are: -<p class="level1"> -<p class="level0"><a name="CURLVERSIONIPV6"></a><span class="nroffip">CURL_VERSION_IPV6</span> -<p class="level1">supports IPv6 -<p class="level0"><a name="CURLVERSIONKERBEROS4"></a><span class="nroffip">CURL_VERSION_KERBEROS4</span> -<p class="level1">supports kerberos4 (when using FTP) -<p class="level0"><a name="CURLVERSIONSSL"></a><span class="nroffip">CURL_VERSION_SSL</span> -<p class="level1">supports SSL (HTTPS/FTPS) (Added in 7.10) -<p class="level0"><a name="CURLVERSIONLIBZ"></a><span class="nroffip">CURL_VERSION_LIBZ</span> -<p class="level1">supports HTTP deflate using libz (Added in 7.10) -<p class="level0"><a name="CURLVERSIONNTLM"></a><span class="nroffip">CURL_VERSION_NTLM</span> -<p class="level1">supports HTTP NTLM (added in 7.10.6) -<p class="level0"><a name="CURLVERSIONGSSNEGOTIATE"></a><span class="nroffip">CURL_VERSION_GSSNEGOTIATE</span> -<p class="level1">supports HTTP GSS-Negotiate (added in 7.10.6) -<p class="level0"><a name="CURLVERSIONDEBUG"></a><span class="nroffip">CURL_VERSION_DEBUG</span> -<p class="level1">libcurl was built with debug capabilities (added in 7.10.6) -<p class="level0"><a name="CURLVERSIONCURLDEBUG"></a><span class="nroffip">CURL_VERSION_CURLDEBUG</span> -<p class="level1">libcurl was built with memory tracking debug capabilities. This is mainly of interest for libcurl hackers. (added in 7.19.6) -<p class="level0"><a name="CURLVERSIONASYNCHDNS"></a><span class="nroffip">CURL_VERSION_ASYNCHDNS</span> -<p class="level1">libcurl was built with support for asynchronous name lookups, which allows more exact timeouts (even on Windows) and less blocking when using the multi interface. (added in 7.10.7) -<p class="level0"><a name="CURLVERSIONSPNEGO"></a><span class="nroffip">CURL_VERSION_SPNEGO</span> -<p class="level1">libcurl was built with support for SPNEGO authentication (Simple and Protected GSS-API Negotiation Mechanism, defined in <a href="http://www.ietf.org/rfc/rfc2478.txt">RFC 2478</a>.) (added in 7.10.8) -<p class="level0"><a name="CURLVERSIONLARGEFILE"></a><span class="nroffip">CURL_VERSION_LARGEFILE</span> -<p class="level1">libcurl was built with support for large files. (Added in 7.11.1) -<p class="level0"><a name="CURLVERSIONIDN"></a><span class="nroffip">CURL_VERSION_IDN</span> -<p class="level1">libcurl was built with support for IDNA, domain names with international letters. (Added in 7.12.0) -<p class="level0"><a name="CURLVERSIONSSPI"></a><span class="nroffip">CURL_VERSION_SSPI</span> -<p class="level1">libcurl was built with support for SSPI. This is only available on Windows and makes libcurl use Windows-provided functions for NTLM authentication. It also allows libcurl to use the current user and the current user's password without the app having to pass them on. (Added in 7.13.2) -<p class="level0"><a name="CURLVERSIONCONV"></a><span class="nroffip">CURL_VERSION_CONV</span> -<p class="level1">libcurl was built with support for character conversions, as provided by the CURLOPT_CONV_* callbacks. (Added in 7.15.4) -<p class="level0"><a name="CURLVERSIONTLSAUTHSRP"></a><span class="nroffip">CURL_VERSION_TLSAUTH_SRP</span> -<p class="level1">libcurl was built with support for TLS-SRP. (Added in 7.21.4) -<p class="level0"><a name="CURLVERSIONNTLMWB"></a><span class="nroffip">CURL_VERSION_NTLM_WB</span> -<p class="level1">libcurl was built with support for NTLM delegation to a winbind helper. (Added in 7.22.0) -<p class="level0"><span Class="emphasis">ssl_version</span> is an ASCII string for the OpenSSL version used. If libcurl has no SSL support, this is NULL. -<p class="level0"><span Class="emphasis">ssl_version_num</span> is the numerical OpenSSL version value as defined by the OpenSSL project. If libcurl has no SSL support, this is 0. -<p class="level0"><span Class="emphasis">libz_version</span> is an ASCII string (there is no numerical version). If libcurl has no libz support, this is NULL. -<p class="level0"><span Class="emphasis">protocols</span> is a pointer to an array of char * pointers, containing the names protocols that libcurl supports (using lowercase letters). The protocol names are the same as would be used in URLs. The array is terminated by a NULL entry. <a name="RETURN"></a><h2 class="nroffsh">RETURN VALUE</h2> -<p class="level0">A pointer to a curl_version_info_data struct. <a name="SEE"></a><h2 class="nroffsh">SEE ALSO</h2> -<p class="level0"><a class="emphasis" href="./curl_version.html">curl_version(3)</a> -<p class="level0"><p class="roffit"> - This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>. -</body></html> diff --git a/plugins/FTPFileYM/curl/docs/libcurl/curl_version_info.pdf b/plugins/FTPFileYM/curl/docs/libcurl/curl_version_info.pdf Binary files differdeleted file mode 100644 index c4783d2b1a..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/curl_version_info.pdf +++ /dev/null diff --git a/plugins/FTPFileYM/curl/docs/libcurl/index.html b/plugins/FTPFileYM/curl/docs/libcurl/index.html deleted file mode 100644 index 287a2dd694..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/index.html +++ /dev/null @@ -1,61 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> -<html><head> -<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -<title>Index to libcurl documentation</title> -</head> - -<body> -<h1 align="center">Index to libcurl documentation</h1> - -<h2>Programs</h2> -<p><a href="../index.html">curl and tools</a> - -<h2>Overviews</h2> -<A HREF="libcurl.html">libcurl</A> -<br><a href="libcurl-easy.html">libcurl-easy</a> -<br><a href="libcurl-multi.html">libcurl-multi</a> -<br><a href="libcurl-share.html">libcurl-share</a> -<br><a href="libcurl-errors.html">libcurl-errors</a> -<br><a href="libcurl-tutorial.html">libcurl-tutorial</a> - -<H2>Library Functions (A-Z)</H2> -<a href="curl_easy_cleanup.html">curl_easy_cleanup</A> -<br><a href="curl_easy_duphandle.html">curl_easy_duphandle</A> -<br><a href="curl_easy_getinfo.html">curl_easy_getinfo</A> -<br><a href="curl_easy_init.html">curl_easy_init</A> -<br><a href="curl_easy_perform.html">curl_easy_perform</A> -<br><a href="curl_easy_recv.html">curl_easy_recv</A> -<br><a href="curl_easy_reset.html">curl_easy_reset</A> -<br><a href="curl_easy_send.html">curl_easy_send</A> -<br><a href="curl_easy_setopt.html">curl_easy_setopt</A> -<br><a href="curl_easy_strerror.html">curl_easy_strerror</A> -<br><a href="curl_escape.html">curl_escape</A> -<br><a href="curl_formadd.html">curl_formadd</A> -<br><a href="curl_formfree.html">curl_formfree</A> -<br><a href="curl_free.html">curl_free</A> -<br><a href="curl_getdate.html">curl_getdate</A> -<br><a href="curl_getenv.html">curl_getenv</A> -<br><a href="curl_global_cleanup.html">curl_global_cleanup</A> -<br><a href="curl_global_init.html">curl_global_init</A> -<br><a href="curl_global_init_mem.html">curl_global_init_mem</A> -<br><a href="curl_mprintf.html">curl_mprintf</A> -<br><a href="curl_multi_add_handle.html">curl_multi_add_handle</a> -<br><a href="curl_multi_cleanup.html">curl_multi_cleanup</a> -<br><a href="curl_multi_fdset.html">curl_multi_fdset</a> -<br><a href="curl_multi_info_read.html">curl_multi_info_read</a> -<br><a href="curl_multi_init.html">curl_multi_init</a> -<br><a href="curl_multi_perform.html">curl_multi_perform</a> -<br><a href="curl_multi_remove_handle.html">curl_multi_remove_handle</a> -<br><a href="curl_multi_strerror.html">curl_multi_strerror.html</a> -<br><a href="curl_share_cleanup.html">curl_share_cleanup</A> -<br><a href="curl_share_init.html">curl_share_init</A> -<br><a href="curl_share_setopt.html">curl_share_setopt</A> -<br><a href="curl_share_strerror.html">curl_share_strerror.html</a> -<br><a href="curl_slist_append.html">curl_slist_append</A> -<br><a href="curl_slist_free_all.html">curl_slist_free_all</A> -<br><a href="curl_strequal.html">curl_strequal and curl_strnequal</A> -<br><a href="curl_unescape.html">curl_unescape</A> -<br><a href="curl_version.html">curl_version</A> -<br><a href="curl_version_info.html">curl_version_info</A> - -</body></html> diff --git a/plugins/FTPFileYM/curl/docs/libcurl/libcurl-easy.3 b/plugins/FTPFileYM/curl/docs/libcurl/libcurl-easy.3 deleted file mode 100644 index 698a4ce720..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/libcurl-easy.3 +++ /dev/null @@ -1,45 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at http://curl.haxx.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" ************************************************************************** -.TH libcurl 3 "12 Aug 2003" "libcurl 7.10.7" "libcurl easy interface" -.SH NAME -libcurl-easy \- easy interface overview -.SH DESCRIPTION -When using libcurl's "easy" interface you init your session and get a handle -(often referred to as an "easy handle"), which you use as input to the easy -interface functions you use. Use \fIcurl_easy_init(3)\fP to get the handle. - -You continue by setting all the options you want in the upcoming transfer, the -most important among them is the URL itself (you can't transfer anything -without a specified URL as you may have figured out yourself). You might want -to set some callbacks as well that will be called from the library when data -is available etc. \fIcurl_easy_setopt(3)\fP is used for all this. - -When all is setup, you tell libcurl to perform the transfer using -\fIcurl_easy_perform(3)\fP. It will then do the entire operation and won't -return until it is done (successfully or not). - -After the transfer has been made, you can set new options and make another -transfer, or if you're done, cleanup the session by calling -\fIcurl_easy_cleanup(3)\fP. If you want persistent connections, you don't -cleanup immediately, but instead run ahead and perform other transfers using -the same easy handle. - diff --git a/plugins/FTPFileYM/curl/docs/libcurl/libcurl-easy.html b/plugins/FTPFileYM/curl/docs/libcurl/libcurl-easy.html deleted file mode 100644 index e10411fb31..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/libcurl-easy.html +++ /dev/null @@ -1,56 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> -<html><head> -<title>libcurl man page</title> -<meta name="generator" content="roffit"> -<STYLE type="text/css"> -P.level0 { - padding-left: 2em; -} - -P.level1 { - padding-left: 4em; -} - -P.level2 { - padding-left: 6em; -} - -span.emphasis { - font-style: italic; -} - -span.bold { - font-weight: bold; -} - -span.manpage { - font-weight: bold; -} - -h2.nroffsh { - background-color: #e0e0e0; -} - -span.nroffip { - font-weight: bold; - font-size: 120%; - font-family: monospace; -} - -p.roffit { - text-align: center; - font-size: 80%; -} -</STYLE> -</head><body> - -<p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2> -<p class="level0">libcurl-easy - easy interface overview <a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2> -<p class="level0">When using libcurl's "easy" interface you init your session and get a handle (often referred to as an "easy handle"), which you use as input to the easy interface functions you use. Use <a class="emphasis" href="./curl_easy_init.html">curl_easy_init(3)</a> to get the handle. -<p class="level0">You continue by setting all the options you want in the upcoming transfer, the most important among them is the URL itself (you can't transfer anything without a specified URL as you may have figured out yourself). You might want to set some callbacks as well that will be called from the library when data is available etc. <a class="emphasis" href="./curl_easy_setopt.html">curl_easy_setopt(3)</a> is used for all this. -<p class="level0">When all is setup, you tell libcurl to perform the transfer using <a class="emphasis" href="./curl_easy_perform.html">curl_easy_perform(3)</a>. It will then do the entire operation and won't return until it is done (successfully or not). -<p class="level0">After the transfer has been made, you can set new options and make another transfer, or if you're done, cleanup the session by calling <a class="emphasis" href="./curl_easy_cleanup.html">curl_easy_cleanup(3)</a>. If you want persistent connections, you don't cleanup immediately, but instead run ahead and perform other transfers using the same easy handle. -<p class="level0"><p class="roffit"> - This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>. -</body></html> diff --git a/plugins/FTPFileYM/curl/docs/libcurl/libcurl-easy.pdf b/plugins/FTPFileYM/curl/docs/libcurl/libcurl-easy.pdf Binary files differdeleted file mode 100644 index 49610acf77..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/libcurl-easy.pdf +++ /dev/null diff --git a/plugins/FTPFileYM/curl/docs/libcurl/libcurl-errors.3 b/plugins/FTPFileYM/curl/docs/libcurl/libcurl-errors.3 deleted file mode 100644 index beee3971fd..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/libcurl-errors.3 +++ /dev/null @@ -1,289 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at http://curl.haxx.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" ************************************************************************** -.\" -.TH libcurl-errors 3 "1 Jan 2010" "libcurl 7.20.0" "libcurl errors" -.SH NAME -libcurl-errors \- error codes in libcurl -.SH DESCRIPTION -This man page includes most, if not all, available error codes in libcurl. -Why they occur and possibly what you can do to fix the problem are also included. -.SH "CURLcode" -Almost all "easy" interface functions return a CURLcode error code. No matter -what, using the \fIcurl_easy_setopt(3)\fP option \fICURLOPT_ERRORBUFFER\fP is -a good idea as it will give you a human readable error string that may offer -more details about the cause of the error than just the error code. -\fIcurl_easy_strerror(3)\fP can be called to get an error string from a -given CURLcode number. - -CURLcode is one of the following: -.IP "CURLE_OK (0)" -All fine. Proceed as usual. -.IP "CURLE_UNSUPPORTED_PROTOCOL (1)" -The URL you passed to libcurl used a protocol that this libcurl does not -support. The support might be a compile-time option that you didn't use, it -can be a misspelled protocol string or just a protocol libcurl has no code -for. -.IP "CURLE_FAILED_INIT (2)" -Very early initialization code failed. This is likely to be an internal error -or problem, or a resource problem where something fundamental couldn't get -done at init time. -.IP "CURLE_URL_MALFORMAT (3)" -The URL was not properly formatted. -.IP "CURLE_NOT_BUILT_IN (4)" -A requested feature, protocol or option was not found built-in in this libcurl -due to a build-time decision. This means that a feature or option was not -enabled or explicitly disabled when libcurl was built and in order to get it -to function you have to get a rebuilt libcurl. -.IP "CURLE_COULDNT_RESOLVE_PROXY (5)" -Couldn't resolve proxy. The given proxy host could not be resolved. -.IP "CURLE_COULDNT_RESOLVE_HOST (6)" -Couldn't resolve host. The given remote host was not resolved. -.IP "CURLE_COULDNT_CONNECT (7)" -Failed to connect() to host or proxy. -.IP "CURLE_FTP_WEIRD_SERVER_REPLY (8)" -After connecting to a FTP server, libcurl expects to get a certain reply -back. This error code implies that it got a strange or bad reply. The given -remote server is probably not an OK FTP server. -.IP "CURLE_REMOTE_ACCESS_DENIED (9)" -We were denied access to the resource given in the URL. For FTP, this occurs -while trying to change to the remote directory. -.IP "CURLE_FTP_ACCEPT_FAILED (10)" -While waiting for the server to connect back when an active FTP session is -used, an error code was sent over the control connection or similar. -.IP "CURLE_FTP_WEIRD_PASS_REPLY (11)" -After having sent the FTP password to the server, libcurl expects a proper -reply. This error code indicates that an unexpected code was returned. -.IP "CURLE_FTP_ACCEPT_TIMEOUT (12)" -During an active FTP session while waiting for the server to connect, the -\fICURLOPT_ACCEPTTIMOUT_MS\fP (or the internal default) timeout expired. -.IP "CURLE_FTP_WEIRD_PASV_REPLY (13)" -libcurl failed to get a sensible result back from the server as a response to -either a PASV or a EPSV command. The server is flawed. -.IP "CURLE_FTP_WEIRD_227_FORMAT (14)" -FTP servers return a 227-line as a response to a PASV command. If libcurl -fails to parse that line, this return code is passed back. -.IP "CURLE_FTP_CANT_GET_HOST (15)" -An internal failure to lookup the host used for the new connection. -.IP "CURLE_FTP_COULDNT_SET_TYPE (17)" -Received an error when trying to set the transfer mode to binary or ASCII. -.IP "CURLE_PARTIAL_FILE (18)" -A file transfer was shorter or larger than expected. This happens when the -server first reports an expected transfer size, and then delivers data that -doesn't match the previously given size. -.IP "CURLE_FTP_COULDNT_RETR_FILE (19)" -This was either a weird reply to a 'RETR' command or a zero byte transfer -complete. -.IP "CURLE_QUOTE_ERROR (21)" -When sending custom "QUOTE" commands to the remote server, one of the commands -returned an error code that was 400 or higher (for FTP) or otherwise -indicated unsuccessful completion of the command. -.IP "CURLE_HTTP_RETURNED_ERROR (22)" -This is returned if CURLOPT_FAILONERROR is set TRUE and the HTTP server -returns an error code that is >= 400. -.IP "CURLE_WRITE_ERROR (23)" -An error occurred when writing received data to a local file, or an error was -returned to libcurl from a write callback. -.IP "CURLE_UPLOAD_FAILED (25)" -Failed starting the upload. For FTP, the server typically denied the STOR -command. The error buffer usually contains the server's explanation for this. -.IP "CURLE_READ_ERROR (26)" -There was a problem reading a local file or an error returned by the read -callback. -.IP "CURLE_OUT_OF_MEMORY (27)" -A memory allocation request failed. This is serious badness and -things are severely screwed up if this ever occurs. -.IP "CURLE_OPERATION_TIMEDOUT (28)" -Operation timeout. The specified time-out period was reached according to the -conditions. -.IP "CURLE_FTP_PORT_FAILED (30)" -The FTP PORT command returned error. This mostly happens when you haven't -specified a good enough address for libcurl to use. See \fICURLOPT_FTPPORT\fP. -.IP "CURLE_FTP_COULDNT_USE_REST (31)" -The FTP REST command returned error. This should never happen if the server is -sane. -.IP "CURLE_RANGE_ERROR (33)" -The server does not support or accept range requests. -.IP "CURLE_HTTP_POST_ERROR (34)" -This is an odd error that mainly occurs due to internal confusion. -.IP "CURLE_SSL_CONNECT_ERROR (35)" -A problem occurred somewhere in the SSL/TLS handshake. You really want the -error buffer and read the message there as it pinpoints the problem slightly -more. Could be certificates (file formats, paths, permissions), passwords, and -others. -.IP "CURLE_BAD_DOWNLOAD_RESUME (36)" -The download could not be resumed because the specified offset was out of the -file boundary. -.IP "CURLE_FILE_COULDNT_READ_FILE (37)" -A file given with FILE:// couldn't be opened. Most likely because the file -path doesn't identify an existing file. Did you check file permissions? -.IP "CURLE_LDAP_CANNOT_BIND (38)" -LDAP cannot bind. LDAP bind operation failed. -.IP "CURLE_LDAP_SEARCH_FAILED (39)" -LDAP search failed. -.IP "CURLE_FUNCTION_NOT_FOUND (41)" -Function not found. A required zlib function was not found. -.IP "CURLE_ABORTED_BY_CALLBACK (42)" -Aborted by callback. A callback returned "abort" to libcurl. -.IP "CURLE_BAD_FUNCTION_ARGUMENT (43)" -Internal error. A function was called with a bad parameter. -.IP "CURLE_INTERFACE_FAILED (45)" -Interface error. A specified outgoing interface could not be used. Set which -interface to use for outgoing connections' source IP address with -CURLOPT_INTERFACE. -.IP "CURLE_TOO_MANY_REDIRECTS (47)" -Too many redirects. When following redirects, libcurl hit the maximum amount. -Set your limit with CURLOPT_MAXREDIRS. -.IP "CURLE_UNKNOWN_OPTION (48)" -An option passed to libcurl is not recognized/known. Refer to the appropriate -documentation. This is most likely a problem in the program that uses -libcurl. The error buffer might contain more specific information about which -exact option it concerns. -.IP "CURLE_TELNET_OPTION_SYNTAX (49)" -A telnet option string was Illegally formatted. -.IP "CURLE_PEER_FAILED_VERIFICATION (51)" -The remote server's SSL certificate or SSH md5 fingerprint was deemed not OK. -.IP "CURLE_GOT_NOTHING (52)" -Nothing was returned from the server, and under the circumstances, getting -nothing is considered an error. -.IP "CURLE_SSL_ENGINE_NOTFOUND (53)" -The specified crypto engine wasn't found. -.IP "CURLE_SSL_ENGINE_SETFAILED (54)" -Failed setting the selected SSL crypto engine as default! -.IP "CURLE_SEND_ERROR (55)" -Failed sending network data. -.IP "CURLE_RECV_ERROR (56)" -Failure with receiving network data. -.IP "CURLE_SSL_CERTPROBLEM (58)" -problem with the local client certificate. -.IP "CURLE_SSL_CIPHER (59)" -Couldn't use specified cipher. -.IP "CURLE_SSL_CACERT (60)" -Peer certificate cannot be authenticated with known CA certificates. -.IP "CURLE_BAD_CONTENT_ENCODING (61)" -Unrecognized transfer encoding. -.IP "CURLE_LDAP_INVALID_URL (62)" -Invalid LDAP URL. -.IP "CURLE_FILESIZE_EXCEEDED (63)" -Maximum file size exceeded. -.IP "CURLE_USE_SSL_FAILED (64)" -Requested FTP SSL level failed. -.IP "CURLE_SEND_FAIL_REWIND (65)" -When doing a send operation curl had to rewind the data to retransmit, but the -rewinding operation failed. -.IP "CURLE_SSL_ENGINE_INITFAILED (66)" -Initiating the SSL Engine failed. -.IP "CURLE_LOGIN_DENIED (67)" -The remote server denied curl to login (Added in 7.13.1) -.IP "CURLE_TFTP_NOTFOUND (68)" -File not found on TFTP server. -.IP "CURLE_TFTP_PERM (69)" -Permission problem on TFTP server. -.IP "CURLE_REMOTE_DISK_FULL (70)" -Out of disk space on the server. -.IP "CURLE_TFTP_ILLEGAL (71)" -Illegal TFTP operation. -.IP "CURLE_TFTP_UNKNOWNID (72)" -Unknown TFTP transfer ID. -.IP "CURLE_REMOTE_FILE_EXISTS (73)" -File already exists and will not be overwritten. -.IP "CURLE_TFTP_NOSUCHUSER (74)" -This error should never be returned by a properly functioning TFTP server. -.IP "CURLE_CONV_FAILED (75)" -Character conversion failed. -.IP "CURLE_CONV_REQD (76)" -Caller must register conversion callbacks. -.IP "CURLE_SSL_CACERT_BADFILE (77)" -Problem with reading the SSL CA cert (path? access rights?) -.IP "CURLE_REMOTE_FILE_NOT_FOUND (78)" -The resource referenced in the URL does not exist. -.IP "CURLE_SSH (79)" -An unspecified error occurred during the SSH session. -.IP "CURLE_SSL_SHUTDOWN_FAILED (80)" -Failed to shut down the SSL connection. -.IP "CURLE_AGAIN (81)" -Socket is not ready for send/recv wait till it's ready and try again. This -return code is only returned from \fIcurl_easy_recv(3)\fP and -\fIcurl_easy_send(3)\fP (Added in 7.18.2) -.IP "CURLE_SSL_CRL_BADFILE (82)" -Failed to load CRL file (Added in 7.19.0) -.IP "CURLE_SSL_ISSUER_ERROR (83)" -Issuer check failed (Added in 7.19.0) -.IP "CURLE_FTP_PRET_FAILED (84)" -The FTP server does not understand the PRET command at all or does not support -the given argument. Be careful when using \fICURLOPT_CUSTOMREQUEST\fP, a -custom LIST command will be sent with PRET CMD before PASV as well. (Added in -7.20.0) -.IP "CURLE_RTSP_CSEQ_ERROR (85)" -Mismatch of RTSP CSeq numbers. -.IP "CURLE_RTSP_SESSION_ERROR (86)" -Mismatch of RTSP Session Identifiers. -.IP "CURLE_FTP_BAD_FILE_LIST (87)" -Unable to parse FTP file list (during FTP wildcard downloading). -.IP "CURLE_CHUNK_FAILED (88)" -Chunk callback reported error. -.IP "CURLE_OBSOLETE*" -These error codes will never be returned. They were used in an old libcurl -version and are currently unused. -.SH "CURLMcode" -This is the generic return code used by functions in the libcurl multi -interface. Also consider \fIcurl_multi_strerror(3)\fP. -.IP "CURLM_CALL_MULTI_PERFORM (-1)" -This is not really an error. It means you should call -\fIcurl_multi_perform(3)\fP again without doing select() or similar in -between. Before version 7.20.0 this could be returned by -\fIcurl_multi_perform(3)\fP, but in later versions this return code is never -used. -.IP "CURLM_OK (0)" -Things are fine. -.IP "CURLM_BAD_HANDLE (1)" -The passed-in handle is not a valid CURLM handle. -.IP "CURLM_BAD_EASY_HANDLE (2)" -An easy handle was not good/valid. It could mean that it isn't an easy handle -at all, or possibly that the handle already is in used by this or another -multi handle. -.IP "CURLM_OUT_OF_MEMORY (3)" -You are doomed. -.IP "CURLM_INTERNAL_ERROR (4)" -This can only be returned if libcurl bugs. Please report it to us! -.IP "CURLM_BAD_SOCKET (5)" -The passed-in socket is not a valid one that libcurl already knows about. -(Added in 7.15.4) -.IP "CURLM_UNKNOWN_OPTION (6)" -curl_multi_setopt() with unsupported option -(Added in 7.15.4) -.SH "CURLSHcode" -The "share" interface will return a CURLSHcode to indicate when an error has -occurred. Also consider \fIcurl_share_strerror(3)\fP. -.IP "CURLSHE_OK (0)" -All fine. Proceed as usual. -.IP "CURLSHE_BAD_OPTION (1)" -An invalid option was passed to the function. -.IP "CURLSHE_IN_USE (2)" -The share object is currently in use. -.IP "CURLSHE_INVALID (3)" -An invalid share object was passed to the function. -.IP "CURLSHE_NOMEM (4)" -Not enough memory was available. -(Added in 7.12.0) -.IP "CURLSHE_NOT_BUILT_IN (5)" -The requested sharing could not be done because the library you use don't have -that particular feature enabled. (Added in 7.23.0) diff --git a/plugins/FTPFileYM/curl/docs/libcurl/libcurl-errors.html b/plugins/FTPFileYM/curl/docs/libcurl/libcurl-errors.html deleted file mode 100644 index cb90129281..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/libcurl-errors.html +++ /dev/null @@ -1,244 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> -<html><head> -<title>libcurl-errors man page</title> -<meta name="generator" content="roffit"> -<STYLE type="text/css"> -P.level0 { - padding-left: 2em; -} - -P.level1 { - padding-left: 4em; -} - -P.level2 { - padding-left: 6em; -} - -span.emphasis { - font-style: italic; -} - -span.bold { - font-weight: bold; -} - -span.manpage { - font-weight: bold; -} - -h2.nroffsh { - background-color: #e0e0e0; -} - -span.nroffip { - font-weight: bold; - font-size: 120%; - font-family: monospace; -} - -p.roffit { - text-align: center; - font-size: 80%; -} -</STYLE> -</head><body> - -<p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2> -<p class="level0">libcurl-errors - error codes in libcurl <a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2> -<p class="level0">This man page includes most, if not all, available error codes in libcurl. Why they occur and possibly what you can do to fix the problem are also included. <a name="CURLcode"></a><h2 class="nroffsh">CURLcode</h2> -<p class="level0">Almost all "easy" interface functions return a CURLcode error code. No matter what, using the <a class="emphasis" href="./curl_easy_setopt.html">curl_easy_setopt(3)</a> option <span Class="emphasis">CURLOPT_ERRORBUFFER</span> is a good idea as it will give you a human readable error string that may offer more details about the cause of the error than just the error code. <a class="emphasis" href="./curl_easy_strerror.html">curl_easy_strerror(3)</a> can be called to get an error string from a given CURLcode number. -<p class="level0">CURLcode is one of the following: -<p class="level0"><a name="CURLEOK"></a><span class="nroffip">CURLE_OK (0)</span> -<p class="level1">All fine. Proceed as usual. -<p class="level0"><a name="CURLEUNSUPPORTEDPROTOCOL"></a><span class="nroffip">CURLE_UNSUPPORTED_PROTOCOL (1)</span> -<p class="level1">The URL you passed to libcurl used a protocol that this libcurl does not support. The support might be a compile-time option that you didn't use, it can be a misspelled protocol string or just a protocol libcurl has no code for. -<p class="level0"><a name="CURLEFAILEDINIT"></a><span class="nroffip">CURLE_FAILED_INIT (2)</span> -<p class="level1">Very early initialization code failed. This is likely to be an internal error or problem, or a resource problem where something fundamental couldn't get done at init time. -<p class="level0"><a name="CURLEURLMALFORMAT"></a><span class="nroffip">CURLE_URL_MALFORMAT (3)</span> -<p class="level1">The URL was not properly formatted. -<p class="level0"><a name="CURLENOTBUILTIN"></a><span class="nroffip">CURLE_NOT_BUILT_IN (4)</span> -<p class="level1">A requested feature, protocol or option was not found built-in in this libcurl due to a build-time decision. This means that a feature or option was not enabled or explicitly disabled when libcurl was built and in order to get it to function you have to get a rebuilt libcurl. -<p class="level0"><a name="CURLECOULDNTRESOLVEPROXY"></a><span class="nroffip">CURLE_COULDNT_RESOLVE_PROXY (5)</span> -<p class="level1">Couldn't resolve proxy. The given proxy host could not be resolved. -<p class="level0"><a name="CURLECOULDNTRESOLVEHOST"></a><span class="nroffip">CURLE_COULDNT_RESOLVE_HOST (6)</span> -<p class="level1">Couldn't resolve host. The given remote host was not resolved. -<p class="level0"><a name="CURLECOULDNTCONNECT"></a><span class="nroffip">CURLE_COULDNT_CONNECT (7)</span> -<p class="level1">Failed to connect() to host or proxy. -<p class="level0"><a name="CURLEFTPWEIRDSERVERREPLY"></a><span class="nroffip">CURLE_FTP_WEIRD_SERVER_REPLY (8)</span> -<p class="level1">After connecting to a FTP server, libcurl expects to get a certain reply back. This error code implies that it got a strange or bad reply. The given remote server is probably not an OK FTP server. -<p class="level0"><a name="CURLEREMOTEACCESSDENIED"></a><span class="nroffip">CURLE_REMOTE_ACCESS_DENIED (9)</span> -<p class="level1">We were denied access to the resource given in the URL. For FTP, this occurs while trying to change to the remote directory. -<p class="level0"><a name="CURLEFTPACCEPTFAILED"></a><span class="nroffip">CURLE_FTP_ACCEPT_FAILED (10)</span> -<p class="level1">While waiting for the server to connect back when an active FTP session is used, an error code was sent over the control connection or similar. -<p class="level0"><a name="CURLEFTPWEIRDPASSREPLY"></a><span class="nroffip">CURLE_FTP_WEIRD_PASS_REPLY (11)</span> -<p class="level1">After having sent the FTP password to the server, libcurl expects a proper reply. This error code indicates that an unexpected code was returned. -<p class="level0"><a name="CURLEFTPACCEPTTIMEOUT"></a><span class="nroffip">CURLE_FTP_ACCEPT_TIMEOUT (12)</span> -<p class="level1">During an active FTP session while waiting for the server to connect, the <span Class="emphasis">CURLOPT_ACCEPTTIMOUT_MS</span> (or the internal default) timeout expired. -<p class="level0"><a name="CURLEFTPWEIRDPASVREPLY"></a><span class="nroffip">CURLE_FTP_WEIRD_PASV_REPLY (13)</span> -<p class="level1">libcurl failed to get a sensible result back from the server as a response to either a PASV or a EPSV command. The server is flawed. -<p class="level0"><a name="CURLEFTPWEIRD227FORMAT"></a><span class="nroffip">CURLE_FTP_WEIRD_227_FORMAT (14)</span> -<p class="level1">FTP servers return a 227-line as a response to a PASV command. If libcurl fails to parse that line, this return code is passed back. -<p class="level0"><a name="CURLEFTPCANTGETHOST"></a><span class="nroffip">CURLE_FTP_CANT_GET_HOST (15)</span> -<p class="level1">An internal failure to lookup the host used for the new connection. -<p class="level0"><a name="CURLEFTPCOULDNTSETTYPE"></a><span class="nroffip">CURLE_FTP_COULDNT_SET_TYPE (17)</span> -<p class="level1">Received an error when trying to set the transfer mode to binary or ASCII. -<p class="level0"><a name="CURLEPARTIALFILE"></a><span class="nroffip">CURLE_PARTIAL_FILE (18)</span> -<p class="level1">A file transfer was shorter or larger than expected. This happens when the server first reports an expected transfer size, and then delivers data that doesn't match the previously given size. -<p class="level0"><a name="CURLEFTPCOULDNTRETRFILE"></a><span class="nroffip">CURLE_FTP_COULDNT_RETR_FILE (19)</span> -<p class="level1">This was either a weird reply to a 'RETR' command or a zero byte transfer complete. -<p class="level0"><a name="CURLEQUOTEERROR"></a><span class="nroffip">CURLE_QUOTE_ERROR (21)</span> -<p class="level1">When sending custom "QUOTE" commands to the remote server, one of the commands returned an error code that was 400 or higher (for FTP) or otherwise indicated unsuccessful completion of the command. -<p class="level0"><a name="CURLEHTTPRETURNEDERROR"></a><span class="nroffip">CURLE_HTTP_RETURNED_ERROR (22)</span> -<p class="level1">This is returned if CURLOPT_FAILONERROR is set TRUE and the HTTP server returns an error code that is >= 400. -<p class="level0"><a name="CURLEWRITEERROR"></a><span class="nroffip">CURLE_WRITE_ERROR (23)</span> -<p class="level1">An error occurred when writing received data to a local file, or an error was returned to libcurl from a write callback. -<p class="level0"><a name="CURLEUPLOADFAILED"></a><span class="nroffip">CURLE_UPLOAD_FAILED (25)</span> -<p class="level1">Failed starting the upload. For FTP, the server typically denied the STOR command. The error buffer usually contains the server's explanation for this. -<p class="level0"><a name="CURLEREADERROR"></a><span class="nroffip">CURLE_READ_ERROR (26)</span> -<p class="level1">There was a problem reading a local file or an error returned by the read callback. -<p class="level0"><a name="CURLEOUTOFMEMORY"></a><span class="nroffip">CURLE_OUT_OF_MEMORY (27)</span> -<p class="level1">A memory allocation request failed. This is serious badness and things are severely screwed up if this ever occurs. -<p class="level0"><a name="CURLEOPERATIONTIMEDOUT"></a><span class="nroffip">CURLE_OPERATION_TIMEDOUT (28)</span> -<p class="level1">Operation timeout. The specified time-out period was reached according to the conditions. -<p class="level0"><a name="CURLEFTPPORTFAILED"></a><span class="nroffip">CURLE_FTP_PORT_FAILED (30)</span> -<p class="level1">The FTP PORT command returned error. This mostly happens when you haven't specified a good enough address for libcurl to use. See <span Class="emphasis">CURLOPT_FTPPORT</span>. -<p class="level0"><a name="CURLEFTPCOULDNTUSEREST"></a><span class="nroffip">CURLE_FTP_COULDNT_USE_REST (31)</span> -<p class="level1">The FTP REST command returned error. This should never happen if the server is sane. -<p class="level0"><a name="CURLERANGEERROR"></a><span class="nroffip">CURLE_RANGE_ERROR (33)</span> -<p class="level1">The server does not support or accept range requests. -<p class="level0"><a name="CURLEHTTPPOSTERROR"></a><span class="nroffip">CURLE_HTTP_POST_ERROR (34)</span> -<p class="level1">This is an odd error that mainly occurs due to internal confusion. -<p class="level0"><a name="CURLESSLCONNECTERROR"></a><span class="nroffip">CURLE_SSL_CONNECT_ERROR (35)</span> -<p class="level1">A problem occurred somewhere in the SSL/TLS handshake. You really want the error buffer and read the message there as it pinpoints the problem slightly more. Could be certificates (file formats, paths, permissions), passwords, and others. -<p class="level0"><a name="CURLEBADDOWNLOADRESUME"></a><span class="nroffip">CURLE_BAD_DOWNLOAD_RESUME (36)</span> -<p class="level1">The download could not be resumed because the specified offset was out of the file boundary. -<p class="level0"><a name="CURLEFILECOULDNTREADFILE"></a><span class="nroffip">CURLE_FILE_COULDNT_READ_FILE (37)</span> -<p class="level1">A file given with FILE:// couldn't be opened. Most likely because the file path doesn't identify an existing file. Did you check file permissions? -<p class="level0"><a name="CURLELDAPCANNOTBIND"></a><span class="nroffip">CURLE_LDAP_CANNOT_BIND (38)</span> -<p class="level1">LDAP cannot bind. LDAP bind operation failed. -<p class="level0"><a name="CURLELDAPSEARCHFAILED"></a><span class="nroffip">CURLE_LDAP_SEARCH_FAILED (39)</span> -<p class="level1">LDAP search failed. -<p class="level0"><a name="CURLEFUNCTIONNOTFOUND"></a><span class="nroffip">CURLE_FUNCTION_NOT_FOUND (41)</span> -<p class="level1">Function not found. A required zlib function was not found. -<p class="level0"><a name="CURLEABORTEDBYCALLBACK"></a><span class="nroffip">CURLE_ABORTED_BY_CALLBACK (42)</span> -<p class="level1">Aborted by callback. A callback returned "abort" to libcurl. -<p class="level0"><a name="CURLEBADFUNCTIONARGUMENT"></a><span class="nroffip">CURLE_BAD_FUNCTION_ARGUMENT (43)</span> -<p class="level1">Internal error. A function was called with a bad parameter. -<p class="level0"><a name="CURLEINTERFACEFAILED"></a><span class="nroffip">CURLE_INTERFACE_FAILED (45)</span> -<p class="level1">Interface error. A specified outgoing interface could not be used. Set which interface to use for outgoing connections' source IP address with CURLOPT_INTERFACE. -<p class="level0"><a name="CURLETOOMANYREDIRECTS"></a><span class="nroffip">CURLE_TOO_MANY_REDIRECTS (47)</span> -<p class="level1">Too many redirects. When following redirects, libcurl hit the maximum amount. Set your limit with CURLOPT_MAXREDIRS. -<p class="level0"><a name="CURLEUNKNOWNOPTION"></a><span class="nroffip">CURLE_UNKNOWN_OPTION (48)</span> -<p class="level1">An option passed to libcurl is not recognized/known. Refer to the appropriate documentation. This is most likely a problem in the program that uses libcurl. The error buffer might contain more specific information about which exact option it concerns. -<p class="level0"><a name="CURLETELNETOPTIONSYNTAX"></a><span class="nroffip">CURLE_TELNET_OPTION_SYNTAX (49)</span> -<p class="level1">A telnet option string was Illegally formatted. -<p class="level0"><a name="CURLEPEERFAILEDVERIFICATION"></a><span class="nroffip">CURLE_PEER_FAILED_VERIFICATION (51)</span> -<p class="level1">The remote server's SSL certificate or SSH md5 fingerprint was deemed not OK. -<p class="level0"><a name="CURLEGOTNOTHING"></a><span class="nroffip">CURLE_GOT_NOTHING (52)</span> -<p class="level1">Nothing was returned from the server, and under the circumstances, getting nothing is considered an error. -<p class="level0"><a name="CURLESSLENGINENOTFOUND"></a><span class="nroffip">CURLE_SSL_ENGINE_NOTFOUND (53)</span> -<p class="level1">The specified crypto engine wasn't found. -<p class="level0"><a name="CURLESSLENGINESETFAILED"></a><span class="nroffip">CURLE_SSL_ENGINE_SETFAILED (54)</span> -<p class="level1">Failed setting the selected SSL crypto engine as default! -<p class="level0"><a name="CURLESENDERROR"></a><span class="nroffip">CURLE_SEND_ERROR (55)</span> -<p class="level1">Failed sending network data. -<p class="level0"><a name="CURLERECVERROR"></a><span class="nroffip">CURLE_RECV_ERROR (56)</span> -<p class="level1">Failure with receiving network data. -<p class="level0"><a name="CURLESSLCERTPROBLEM"></a><span class="nroffip">CURLE_SSL_CERTPROBLEM (58)</span> -<p class="level1">problem with the local client certificate. -<p class="level0"><a name="CURLESSLCIPHER"></a><span class="nroffip">CURLE_SSL_CIPHER (59)</span> -<p class="level1">Couldn't use specified cipher. -<p class="level0"><a name="CURLESSLCACERT"></a><span class="nroffip">CURLE_SSL_CACERT (60)</span> -<p class="level1">Peer certificate cannot be authenticated with known CA certificates. -<p class="level0"><a name="CURLEBADCONTENTENCODING"></a><span class="nroffip">CURLE_BAD_CONTENT_ENCODING (61)</span> -<p class="level1">Unrecognized transfer encoding. -<p class="level0"><a name="CURLELDAPINVALIDURL"></a><span class="nroffip">CURLE_LDAP_INVALID_URL (62)</span> -<p class="level1">Invalid LDAP URL. -<p class="level0"><a name="CURLEFILESIZEEXCEEDED"></a><span class="nroffip">CURLE_FILESIZE_EXCEEDED (63)</span> -<p class="level1">Maximum file size exceeded. -<p class="level0"><a name="CURLEUSESSLFAILED"></a><span class="nroffip">CURLE_USE_SSL_FAILED (64)</span> -<p class="level1">Requested FTP SSL level failed. -<p class="level0"><a name="CURLESENDFAILREWIND"></a><span class="nroffip">CURLE_SEND_FAIL_REWIND (65)</span> -<p class="level1">When doing a send operation curl had to rewind the data to retransmit, but the rewinding operation failed. -<p class="level0"><a name="CURLESSLENGINEINITFAILED"></a><span class="nroffip">CURLE_SSL_ENGINE_INITFAILED (66)</span> -<p class="level1">Initiating the SSL Engine failed. -<p class="level0"><a name="CURLELOGINDENIED"></a><span class="nroffip">CURLE_LOGIN_DENIED (67)</span> -<p class="level1">The remote server denied curl to login (Added in 7.13.1) -<p class="level0"><a name="CURLETFTPNOTFOUND"></a><span class="nroffip">CURLE_TFTP_NOTFOUND (68)</span> -<p class="level1">File not found on TFTP server. -<p class="level0"><a name="CURLETFTPPERM"></a><span class="nroffip">CURLE_TFTP_PERM (69)</span> -<p class="level1">Permission problem on TFTP server. -<p class="level0"><a name="CURLEREMOTEDISKFULL"></a><span class="nroffip">CURLE_REMOTE_DISK_FULL (70)</span> -<p class="level1">Out of disk space on the server. -<p class="level0"><a name="CURLETFTPILLEGAL"></a><span class="nroffip">CURLE_TFTP_ILLEGAL (71)</span> -<p class="level1">Illegal TFTP operation. -<p class="level0"><a name="CURLETFTPUNKNOWNID"></a><span class="nroffip">CURLE_TFTP_UNKNOWNID (72)</span> -<p class="level1">Unknown TFTP transfer ID. -<p class="level0"><a name="CURLEREMOTEFILEEXISTS"></a><span class="nroffip">CURLE_REMOTE_FILE_EXISTS (73)</span> -<p class="level1">File already exists and will not be overwritten. -<p class="level0"><a name="CURLETFTPNOSUCHUSER"></a><span class="nroffip">CURLE_TFTP_NOSUCHUSER (74)</span> -<p class="level1">This error should never be returned by a properly functioning TFTP server. -<p class="level0"><a name="CURLECONVFAILED"></a><span class="nroffip">CURLE_CONV_FAILED (75)</span> -<p class="level1">Character conversion failed. -<p class="level0"><a name="CURLECONVREQD"></a><span class="nroffip">CURLE_CONV_REQD (76)</span> -<p class="level1">Caller must register conversion callbacks. -<p class="level0"><a name="CURLESSLCACERTBADFILE"></a><span class="nroffip">CURLE_SSL_CACERT_BADFILE (77)</span> -<p class="level1">Problem with reading the SSL CA cert (path? access rights?) -<p class="level0"><a name="CURLEREMOTEFILENOTFOUND"></a><span class="nroffip">CURLE_REMOTE_FILE_NOT_FOUND (78)</span> -<p class="level1">The resource referenced in the URL does not exist. -<p class="level0"><a name="CURLESSH"></a><span class="nroffip">CURLE_SSH (79)</span> -<p class="level1">An unspecified error occurred during the SSH session. -<p class="level0"><a name="CURLESSLSHUTDOWNFAILED"></a><span class="nroffip">CURLE_SSL_SHUTDOWN_FAILED (80)</span> -<p class="level1">Failed to shut down the SSL connection. -<p class="level0"><a name="CURLEAGAIN"></a><span class="nroffip">CURLE_AGAIN (81)</span> -<p class="level1">Socket is not ready for send/recv wait till it's ready and try again. This return code is only returned from <a class="emphasis" href="./curl_easy_recv.html">curl_easy_recv(3)</a> and <a class="emphasis" href="./curl_easy_send.html">curl_easy_send(3)</a> (Added in 7.18.2) -<p class="level0"><a name="CURLESSLCRLBADFILE"></a><span class="nroffip">CURLE_SSL_CRL_BADFILE (82)</span> -<p class="level1">Failed to load CRL file (Added in 7.19.0) -<p class="level0"><a name="CURLESSLISSUERERROR"></a><span class="nroffip">CURLE_SSL_ISSUER_ERROR (83)</span> -<p class="level1">Issuer check failed (Added in 7.19.0) -<p class="level0"><a name="CURLEFTPPRETFAILED"></a><span class="nroffip">CURLE_FTP_PRET_FAILED (84)</span> -<p class="level1">The FTP server does not understand the PRET command at all or does not support the given argument. Be careful when using <span Class="emphasis">CURLOPT_CUSTOMREQUEST</span>, a custom LIST command will be sent with PRET CMD before PASV as well. (Added in 7.20.0) -<p class="level0"><a name="CURLERTSPCSEQERROR"></a><span class="nroffip">CURLE_RTSP_CSEQ_ERROR (85)</span> -<p class="level1">Mismatch of RTSP CSeq numbers. -<p class="level0"><a name="CURLERTSPSESSIONERROR"></a><span class="nroffip">CURLE_RTSP_SESSION_ERROR (86)</span> -<p class="level1">Mismatch of RTSP Session Identifiers. -<p class="level0"><a name="CURLEFTPBADFILELIST"></a><span class="nroffip">CURLE_FTP_BAD_FILE_LIST (87)</span> -<p class="level1">Unable to parse FTP file list (during FTP wildcard downloading). -<p class="level0"><a name="CURLECHUNKFAILED"></a><span class="nroffip">CURLE_CHUNK_FAILED (88)</span> -<p class="level1">Chunk callback reported error. -<p class="level0"><a name="CURLEOBSOLETE"></a><span class="nroffip">CURLE_OBSOLETE*</span> -<p class="level1">These error codes will never be returned. They were used in an old libcurl version and are currently unused. <a name="CURLMcode"></a><h2 class="nroffsh">CURLMcode</h2> -<p class="level0">This is the generic return code used by functions in the libcurl multi interface. Also consider <a class="emphasis" href="./curl_multi_strerror.html">curl_multi_strerror(3)</a>. -<p class="level0"><a name="CURLMCALLMULTIPERFORM"></a><span class="nroffip">CURLM_CALL_MULTI_PERFORM (-1)</span> -<p class="level1">This is not really an error. It means you should call <a class="emphasis" href="./curl_multi_perform.html">curl_multi_perform(3)</a> again without doing select() or similar in between. Before version 7.20.0 this could be returned by <a class="emphasis" href="./curl_multi_perform.html">curl_multi_perform(3)</a>, but in later versions this return code is never used. -<p class="level0"><a name="CURLMOK"></a><span class="nroffip">CURLM_OK (0)</span> -<p class="level1">Things are fine. -<p class="level0"><a name="CURLMBADHANDLE"></a><span class="nroffip">CURLM_BAD_HANDLE (1)</span> -<p class="level1">The passed-in handle is not a valid CURLM handle. -<p class="level0"><a name="CURLMBADEASYHANDLE"></a><span class="nroffip">CURLM_BAD_EASY_HANDLE (2)</span> -<p class="level1">An easy handle was not good/valid. It could mean that it isn't an easy handle at all, or possibly that the handle already is in used by this or another multi handle. -<p class="level0"><a name="CURLMOUTOFMEMORY"></a><span class="nroffip">CURLM_OUT_OF_MEMORY (3)</span> -<p class="level1">You are doomed. -<p class="level0"><a name="CURLMINTERNALERROR"></a><span class="nroffip">CURLM_INTERNAL_ERROR (4)</span> -<p class="level1">This can only be returned if libcurl bugs. Please report it to us! -<p class="level0"><a name="CURLMBADSOCKET"></a><span class="nroffip">CURLM_BAD_SOCKET (5)</span> -<p class="level1">The passed-in socket is not a valid one that libcurl already knows about. (Added in 7.15.4) -<p class="level0"><a name="CURLMUNKNOWNOPTION"></a><span class="nroffip">CURLM_UNKNOWN_OPTION (6)</span> -<p class="level1">curl_multi_setopt() with unsupported option (Added in 7.15.4) <a name="CURLSHcode"></a><h2 class="nroffsh">CURLSHcode</h2> -<p class="level0">The "share" interface will return a CURLSHcode to indicate when an error has occurred. Also consider <a class="emphasis" href="./curl_share_strerror.html">curl_share_strerror(3)</a>. -<p class="level0"><a name="CURLSHEOK"></a><span class="nroffip">CURLSHE_OK (0)</span> -<p class="level1">All fine. Proceed as usual. -<p class="level0"><a name="CURLSHEBADOPTION"></a><span class="nroffip">CURLSHE_BAD_OPTION (1)</span> -<p class="level1">An invalid option was passed to the function. -<p class="level0"><a name="CURLSHEINUSE"></a><span class="nroffip">CURLSHE_IN_USE (2)</span> -<p class="level1">The share object is currently in use. -<p class="level0"><a name="CURLSHEINVALID"></a><span class="nroffip">CURLSHE_INVALID (3)</span> -<p class="level1">An invalid share object was passed to the function. -<p class="level0"><a name="CURLSHENOMEM"></a><span class="nroffip">CURLSHE_NOMEM (4)</span> -<p class="level1">Not enough memory was available. (Added in 7.12.0) -<p class="level0"><a name="CURLSHENOTBUILTIN"></a><span class="nroffip">CURLSHE_NOT_BUILT_IN (5)</span> -<p class="level1">The requested sharing could not be done because the library you use don't have that particular feature enabled. (Added in 7.23.0) <p class="roffit"> - This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>. -</body></html> diff --git a/plugins/FTPFileYM/curl/docs/libcurl/libcurl-errors.pdf b/plugins/FTPFileYM/curl/docs/libcurl/libcurl-errors.pdf Binary files differdeleted file mode 100644 index 6a5f3be3ce..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/libcurl-errors.pdf +++ /dev/null diff --git a/plugins/FTPFileYM/curl/docs/libcurl/libcurl-multi.3 b/plugins/FTPFileYM/curl/docs/libcurl/libcurl-multi.3 deleted file mode 100644 index 2af0299619..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/libcurl-multi.3 +++ /dev/null @@ -1,151 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at http://curl.haxx.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" ************************************************************************** -.\" -.TH libcurl-multi 3 "3 Feb 2007" "libcurl 7.16.0" "libcurl multi interface" -.SH NAME -libcurl-multi \- how to use the multi interface -.SH DESCRIPTION -This is an overview on how to use the libcurl multi interface in your C -programs. There are specific man pages for each function mentioned in -here. There's also the \fIlibcurl-tutorial(3)\fP man page for a complete -tutorial to programming with libcurl and the \fIlibcurl-easy(3)\fP man page -for an overview of the libcurl easy interface. - -All functions in the multi interface are prefixed with curl_multi. -.SH "OBJECTIVES" -The multi interface offers several abilities that the easy interface doesn't. -They are mainly: - -1. Enable a "pull" interface. The application that uses libcurl decides where -and when to ask libcurl to get/send data. - -2. Enable multiple simultaneous transfers in the same thread without making it -complicated for the application. - -3. Enable the application to wait for action on its own file descriptors and -curl's file descriptors simultaneous easily. -.SH "ONE MULTI HANDLE MANY EASY HANDLES" -To use the multi interface, you must first create a 'multi handle' with -\fIcurl_multi_init(3)\fP. This handle is then used as input to all further -curl_multi_* functions. - -Each single transfer is built up with an easy handle. You must create them, -and setup the appropriate options for each easy handle, as outlined in the -\fIlibcurl(3)\fP man page, using \fIcurl_easy_setopt(3)\fP. - -When the easy handle is setup for a transfer, then instead of using -\fIcurl_easy_perform(3)\fP (as when using the easy interface for transfers), -you should instead add the easy handle to the multi handle using -\fIcurl_multi_add_handle(3)\fP. The multi handle is sometimes referred to as a -\'multi stack\' because of the fact that it may hold a large amount of easy -handles. - -Should you change your mind, the easy handle is again removed from the multi -stack using \fIcurl_multi_remove_handle(3)\fP. Once removed from the multi -handle, you can again use other easy interface functions like -\fIcurl_easy_perform(3)\fP on the handle or whatever you think is necessary. - -Adding the easy handle to the multi handle does not start the transfer. -Remember that one of the main ideas with this interface is to let your -application drive. You drive the transfers by invoking -\fIcurl_multi_perform(3)\fP. libcurl will then transfer data if there is -anything available to transfer. It'll use the callbacks and everything else -you have setup in the individual easy handles. It'll transfer data on all -current transfers in the multi stack that are ready to transfer anything. It -may be all, it may be none. - -Your application can acquire knowledge from libcurl when it would like to get -invoked to transfer data, so that you don't have to busy-loop and call that -\fIcurl_multi_perform(3)\fP like crazy. \fIcurl_multi_fdset(3)\fP offers an -interface using which you can extract fd_sets from libcurl to use in select() -or poll() calls in order to get to know when the transfers in the multi stack -might need attention. This also makes it very easy for your program to wait -for input on your own private file descriptors at the same time or perhaps -timeout every now and then, should you want that. - -\fIcurl_multi_perform(3)\fP stores the number of still running transfers in -one of its input arguments, and by reading that you can figure out when all -the transfers in the multi handles are done. 'done' does not mean -successful. One or more of the transfers may have failed. Tracking when this -number changes, you know when one or more transfers are done. - -To get information about completed transfers, to figure out success or not and -similar, \fIcurl_multi_info_read(3)\fP should be called. It can return a -message about a current or previous transfer. Repeated invokes of the function -get more messages until the message queue is empty. The information you -receive there includes an easy handle pointer which you may use to identify -which easy handle the information regards. - -When a single transfer is completed, the easy handle is still left added to -the multi stack. You need to first remove the easy handle with -\fIcurl_multi_remove_handle(3)\fP and then close it with -\fIcurl_easy_cleanup(3)\fP, or possibly set new options to it and add it again -with \fIcurl_multi_add_handle(3)\fP to start another transfer. - -When all transfers in the multi stack are done, cleanup the multi handle with -\fIcurl_multi_cleanup(3)\fP. Be careful and please note that you \fBMUST\fP -invoke separate \fIcurl_easy_cleanup(3)\fP calls on every single easy handle -to clean them up properly. - -If you want to re-use an easy handle that was added to the multi handle for -transfer, you must first remove it from the multi stack and then re-add it -again (possibly after having altered some options at your own choice). -.SH "MULTI_SOCKET" -\fIcurl_multi_socket_action(3)\fP function offers a way for applications to -not only avoid being forced to use select(), but it also offers a much more -high-performance API that will make a significant difference for applications -using large numbers of simultaneous connections. - -\fIcurl_multi_socket_action(3)\fP is then used instead of -\fIcurl_multi_perform(3)\fP. - -When using this API, you add easy handles to the multi handle just as with the -normal multi interface. Then you also set two callbacks with the -CURLMOPT_SOCKETFUNCTION and CURLMOPT_TIMERFUNCTION options to -\fIcurl_multi_setopt(3)\fP. - -The API is then designed to inform your application about which sockets -libcurl is currently using and for what activities (read and/or write) on -those sockets your application is expected to wait for. - -Your application must then make sure to receive all sockets informed about in -the CURLMOPT_SOCKETFUNCTION callback and make sure it reacts on the given -activity on them. When a socket has the given activity, you call -\fIcurl_multi_socket_action(3)\fP specifying which socket and action there -are. - -The CURLMOPT_TIMERFUNCTION callback is called to set a timeout. When that -timeout expires, your application should call the -\fIcurl_multi_socket_action(3)\fP function saying it was due to a timeout. -.SH "BLOCKING" -A few areas in the code are still using blocking code, even when used from the -multi interface. While we certainly want and intend for these to get fixed in -the future, you should be aware of the following current restrictions: - -.nf - - Name resolves unless the c-ares or threaded-resolver backends are used - - NSS SSL connections - - HTTP proxy CONNECT operations - - SOCKS proxy handshakes - - file:// transfers - - TELNET transfers -.fi diff --git a/plugins/FTPFileYM/curl/docs/libcurl/libcurl-multi.html b/plugins/FTPFileYM/curl/docs/libcurl/libcurl-multi.html deleted file mode 100644 index efcc540265..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/libcurl-multi.html +++ /dev/null @@ -1,78 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> -<html><head> -<title>libcurl-multi man page</title> -<meta name="generator" content="roffit"> -<STYLE type="text/css"> -P.level0 { - padding-left: 2em; -} - -P.level1 { - padding-left: 4em; -} - -P.level2 { - padding-left: 6em; -} - -span.emphasis { - font-style: italic; -} - -span.bold { - font-weight: bold; -} - -span.manpage { - font-weight: bold; -} - -h2.nroffsh { - background-color: #e0e0e0; -} - -span.nroffip { - font-weight: bold; - font-size: 120%; - font-family: monospace; -} - -p.roffit { - text-align: center; - font-size: 80%; -} -</STYLE> -</head><body> - -<p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2> -<p class="level0">libcurl-multi - how to use the multi interface <a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2> -<p class="level0">This is an overview on how to use the libcurl multi interface in your C programs. There are specific man pages for each function mentioned in here. There's also the <span Class="emphasis">libcurl-tutorial(3)</span> man page for a complete tutorial to programming with libcurl and the <span Class="emphasis">libcurl-easy(3)</span> man page for an overview of the libcurl easy interface. -<p class="level0">All functions in the multi interface are prefixed with curl_multi. <a name="OBJECTIVES"></a><h2 class="nroffsh">OBJECTIVES</h2> -<p class="level0">The multi interface offers several abilities that the easy interface doesn't. They are mainly: -<p class="level0">1. Enable a "pull" interface. The application that uses libcurl decides where and when to ask libcurl to get/send data. -<p class="level0">2. Enable multiple simultaneous transfers in the same thread without making it complicated for the application. -<p class="level0">3. Enable the application to wait for action on its own file descriptors and curl's file descriptors simultaneous easily. <a name="ONE"></a><h2 class="nroffsh">ONE MULTI HANDLE MANY EASY HANDLES</h2> -<p class="level0">To use the multi interface, you must first create a 'multi handle' with <a class="emphasis" href="./curl_multi_init.html">curl_multi_init(3)</a>. This handle is then used as input to all further curl_multi_* functions. -<p class="level0">Each single transfer is built up with an easy handle. You must create them, and setup the appropriate options for each easy handle, as outlined in the <a class="emphasis" href="./libcurl.html">libcurl(3)</a> man page, using <a class="emphasis" href="./curl_easy_setopt.html">curl_easy_setopt(3)</a>. -<p class="level0">When the easy handle is setup for a transfer, then instead of using <a class="emphasis" href="./curl_easy_perform.html">curl_easy_perform(3)</a> (as when using the easy interface for transfers), you should instead add the easy handle to the multi handle using <a class="emphasis" href="./curl_multi_add_handle.html">curl_multi_add_handle(3)</a>. The multi handle is sometimes referred to as a ´multi stack´ because of the fact that it may hold a large amount of easy handles. -<p class="level0">Should you change your mind, the easy handle is again removed from the multi stack using <a class="emphasis" href="./curl_multi_remove_handle.html">curl_multi_remove_handle(3)</a>. Once removed from the multi handle, you can again use other easy interface functions like <a class="emphasis" href="./curl_easy_perform.html">curl_easy_perform(3)</a> on the handle or whatever you think is necessary. -<p class="level0">Adding the easy handle to the multi handle does not start the transfer. Remember that one of the main ideas with this interface is to let your application drive. You drive the transfers by invoking <a class="emphasis" href="./curl_multi_perform.html">curl_multi_perform(3)</a>. libcurl will then transfer data if there is anything available to transfer. It'll use the callbacks and everything else you have setup in the individual easy handles. It'll transfer data on all current transfers in the multi stack that are ready to transfer anything. It may be all, it may be none. -<p class="level0">Your application can acquire knowledge from libcurl when it would like to get invoked to transfer data, so that you don't have to busy-loop and call that <a class="emphasis" href="./curl_multi_perform.html">curl_multi_perform(3)</a> like crazy. <a class="emphasis" href="./curl_multi_fdset.html">curl_multi_fdset(3)</a> offers an interface using which you can extract fd_sets from libcurl to use in select() or poll() calls in order to get to know when the transfers in the multi stack might need attention. This also makes it very easy for your program to wait for input on your own private file descriptors at the same time or perhaps timeout every now and then, should you want that. -<p class="level0"><a class="emphasis" href="./curl_multi_perform.html">curl_multi_perform(3)</a> stores the number of still running transfers in one of its input arguments, and by reading that you can figure out when all the transfers in the multi handles are done. 'done' does not mean successful. One or more of the transfers may have failed. Tracking when this number changes, you know when one or more transfers are done. -<p class="level0">To get information about completed transfers, to figure out success or not and similar, <a class="emphasis" href="./curl_multi_info_read.html">curl_multi_info_read(3)</a> should be called. It can return a message about a current or previous transfer. Repeated invokes of the function get more messages until the message queue is empty. The information you receive there includes an easy handle pointer which you may use to identify which easy handle the information regards. -<p class="level0">When a single transfer is completed, the easy handle is still left added to the multi stack. You need to first remove the easy handle with <a class="emphasis" href="./curl_multi_remove_handle.html">curl_multi_remove_handle(3)</a> and then close it with <a class="emphasis" href="./curl_easy_cleanup.html">curl_easy_cleanup(3)</a>, or possibly set new options to it and add it again with <a class="emphasis" href="./curl_multi_add_handle.html">curl_multi_add_handle(3)</a> to start another transfer. -<p class="level0">When all transfers in the multi stack are done, cleanup the multi handle with <a class="emphasis" href="./curl_multi_cleanup.html">curl_multi_cleanup(3)</a>. Be careful and please note that you <span Class="bold">MUST</span> invoke separate <a class="emphasis" href="./curl_easy_cleanup.html">curl_easy_cleanup(3)</a> calls on every single easy handle to clean them up properly. -<p class="level0">If you want to re-use an easy handle that was added to the multi handle for transfer, you must first remove it from the multi stack and then re-add it again (possibly after having altered some options at your own choice). <a name="MULTISOCKET"></a><h2 class="nroffsh">MULTI_SOCKET</h2> -<p class="level0"><a class="emphasis" href="./curl_multi_socket_action.html">curl_multi_socket_action(3)</a> function offers a way for applications to not only avoid being forced to use select(), but it also offers a much more high-performance API that will make a significant difference for applications using large numbers of simultaneous connections. -<p class="level0"><a class="emphasis" href="./curl_multi_socket_action.html">curl_multi_socket_action(3)</a> is then used instead of <a class="emphasis" href="./curl_multi_perform.html">curl_multi_perform(3)</a>. -<p class="level0">When using this API, you add easy handles to the multi handle just as with the normal multi interface. Then you also set two callbacks with the CURLMOPT_SOCKETFUNCTION and CURLMOPT_TIMERFUNCTION options to <a class="emphasis" href="./curl_multi_setopt.html">curl_multi_setopt(3)</a>. -<p class="level0">The API is then designed to inform your application about which sockets libcurl is currently using and for what activities (read and/or write) on those sockets your application is expected to wait for. -<p class="level0">Your application must then make sure to receive all sockets informed about in the CURLMOPT_SOCKETFUNCTION callback and make sure it reacts on the given activity on them. When a socket has the given activity, you call <a class="emphasis" href="./curl_multi_socket_action.html">curl_multi_socket_action(3)</a> specifying which socket and action there are. -<p class="level0">The CURLMOPT_TIMERFUNCTION callback is called to set a timeout. When that timeout expires, your application should call the <a class="emphasis" href="./curl_multi_socket_action.html">curl_multi_socket_action(3)</a> function saying it was due to a timeout. <a name="BLOCKING"></a><h2 class="nroffsh">BLOCKING</h2> -<p class="level0">A few areas in the code are still using blocking code, even when used from the multi interface. While we certainly want and intend for these to get fixed in the future, you should be aware of the following current restrictions: -<p class="level0"> -<p class="level0"> - Name resolves unless the c-ares or threaded-resolver backends are used - NSS SSL connections - HTTP proxy CONNECT operations - SOCKS proxy handshakes - file:// transfers - TELNET transfers -<p class="level0"><p class="roffit"> - This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>. -</body></html> diff --git a/plugins/FTPFileYM/curl/docs/libcurl/libcurl-multi.pdf b/plugins/FTPFileYM/curl/docs/libcurl/libcurl-multi.pdf Binary files differdeleted file mode 100644 index b52ca85a5d..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/libcurl-multi.pdf +++ /dev/null diff --git a/plugins/FTPFileYM/curl/docs/libcurl/libcurl-share.3 b/plugins/FTPFileYM/curl/docs/libcurl/libcurl-share.3 deleted file mode 100644 index 5839021526..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/libcurl-share.3 +++ /dev/null @@ -1,62 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at http://curl.haxx.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" ************************************************************************** -.TH libcurl-share 3 "8 Aug 2003" "libcurl 7.10.7" "libcurl share interface" -.SH NAME -libcurl-share \- how to use the share interface -.SH DESCRIPTION -This is an overview on how to use the libcurl share interface in your C -programs. There are specific man pages for each function mentioned in -here. - -All functions in the share interface are prefixed with curl_share. - -.SH "OBJECTIVES" -The share interface was added to enable sharing of data between curl -\&"handles". -.SH "ONE SET OF DATA - MANY TRANSFERS" -You can have multiple easy handles share data between them. Have them update -and use the \fBsame\fP cookie database or DNS cache! This way, each single -transfer will take advantage from data updates made by the other transfer(s). -.SH "SHARE OBJECT" -You create a shared object with \fIcurl_share_init(3)\fP. It returns a handle -for a newly created one. - -You tell the shared object what data you want it to share by using -\fIcurl_share_setopt(3)\fP. - -Since you can use this share from multiple threads, and libcurl has no -internal thread synchronization, you must provide mutex callbacks if you're -using this multi-threaded. You set lock and unlock functions with -\fIcurl_share_setopt(3)\fP too. - -Then, you make an easy handle to use this share, you set the -\fICURLOPT_SHARE\fP option with \fIcurl_easy_setopt(3)\fP, and pass in share -handle. You can make any number of easy handles share the same share handle. - -To make an easy handle stop using that particular share, you set -\fICURLOPT_SHARE\fP to NULL for that easy handle. To make a handle stop -sharing a particular data, you can \fICURLSHOPT_UNSHARE\fP it. - -When you're done using the share, make sure that no easy handle is still using -it, and call \fIcurl_share_cleanup(3)\fP on the handle. -.SH "SEE ALSO" -.BR curl_share_init "(3), " curl_share_setopt "(3), " curl_share_cleanup "(3)" diff --git a/plugins/FTPFileYM/curl/docs/libcurl/libcurl-share.html b/plugins/FTPFileYM/curl/docs/libcurl/libcurl-share.html deleted file mode 100644 index 8802d5b7f4..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/libcurl-share.html +++ /dev/null @@ -1,63 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> -<html><head> -<title>libcurl-share man page</title> -<meta name="generator" content="roffit"> -<STYLE type="text/css"> -P.level0 { - padding-left: 2em; -} - -P.level1 { - padding-left: 4em; -} - -P.level2 { - padding-left: 6em; -} - -span.emphasis { - font-style: italic; -} - -span.bold { - font-weight: bold; -} - -span.manpage { - font-weight: bold; -} - -h2.nroffsh { - background-color: #e0e0e0; -} - -span.nroffip { - font-weight: bold; - font-size: 120%; - font-family: monospace; -} - -p.roffit { - text-align: center; - font-size: 80%; -} -</STYLE> -</head><body> - -<p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2> -<p class="level0">libcurl-share - how to use the share interface <a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2> -<p class="level0">This is an overview on how to use the libcurl share interface in your C programs. There are specific man pages for each function mentioned in here. -<p class="level0">All functions in the share interface are prefixed with curl_share. -<p class="level0"><a name="OBJECTIVES"></a><h2 class="nroffsh">OBJECTIVES</h2> -<p class="level0">The share interface was added to enable sharing of data between curl "handles". <a name="ONE"></a><h2 class="nroffsh">ONE SET OF DATA - MANY TRANSFERS</h2> -<p class="level0">You can have multiple easy handles share data between them. Have them update and use the <span Class="bold">same</span> cookie database or DNS cache! This way, each single transfer will take advantage from data updates made by the other transfer(s). <a name="SHARE"></a><h2 class="nroffsh">SHARE OBJECT</h2> -<p class="level0">You create a shared object with <a class="emphasis" href="./curl_share_init.html">curl_share_init(3)</a>. It returns a handle for a newly created one. -<p class="level0">You tell the shared object what data you want it to share by using <a class="emphasis" href="./curl_share_setopt.html">curl_share_setopt(3)</a>. -<p class="level0">Since you can use this share from multiple threads, and libcurl has no internal thread synchronization, you must provide mutex callbacks if you're using this multi-threaded. You set lock and unlock functions with <a class="emphasis" href="./curl_share_setopt.html">curl_share_setopt(3)</a> too. -<p class="level0">Then, you make an easy handle to use this share, you set the <span Class="emphasis">CURLOPT_SHARE</span> option with <a class="emphasis" href="./curl_easy_setopt.html">curl_easy_setopt(3)</a>, and pass in share handle. You can make any number of easy handles share the same share handle. -<p class="level0">To make an easy handle stop using that particular share, you set <span Class="emphasis">CURLOPT_SHARE</span> to NULL for that easy handle. To make a handle stop sharing a particular data, you can <span Class="emphasis">CURLSHOPT_UNSHARE</span> it. -<p class="level0">When you're done using the share, make sure that no easy handle is still using it, and call <a class="emphasis" href="./curl_share_cleanup.html">curl_share_cleanup(3)</a> on the handle. <a name="SEE"></a><h2 class="nroffsh">SEE ALSO</h2> -<p class="level0"><a class="manpage" href="./curl_share_init.html">curl_share_init (3)</a> <a class="manpage" href="./curl_share_setopt.html"> curl_share_setopt (3)</a> <a class="manpage" href="./curl_share_cleanup.html"> curl_share_cleanup (3)</a> <p class="roffit"> - This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>. -</body></html> diff --git a/plugins/FTPFileYM/curl/docs/libcurl/libcurl-share.pdf b/plugins/FTPFileYM/curl/docs/libcurl/libcurl-share.pdf Binary files differdeleted file mode 100644 index 799d9db5ad..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/libcurl-share.pdf +++ /dev/null diff --git a/plugins/FTPFileYM/curl/docs/libcurl/libcurl-tutorial.3 b/plugins/FTPFileYM/curl/docs/libcurl/libcurl-tutorial.3 deleted file mode 100644 index 1cca23f335..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/libcurl-tutorial.3 +++ /dev/null @@ -1,1369 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at http://curl.haxx.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" ************************************************************************** -.\" -.TH libcurl-tutorial 3 "4 Mar 2009" "libcurl" "libcurl programming" -.SH NAME -libcurl-tutorial \- libcurl programming tutorial -.SH "Objective" -This document attempts to describe the general principles and some basic -approaches to consider when programming with libcurl. The text will focus -mainly on the C interface but might apply fairly well on other interfaces as -well as they usually follow the C one pretty closely. - -This document will refer to 'the user' as the person writing the source code -that uses libcurl. That would probably be you or someone in your position. -What will be generally referred to as 'the program' will be the collected -source code that you write that is using libcurl for transfers. The program -is outside libcurl and libcurl is outside of the program. - -To get more details on all options and functions described herein, please -refer to their respective man pages. - -.SH "Building" -There are many different ways to build C programs. This chapter will assume a -UNIX-style build process. If you use a different build system, you can still -read this to get general information that may apply to your environment as -well. -.IP "Compiling the Program" -Your compiler needs to know where the libcurl headers are located. Therefore -you must set your compiler's include path to point to the directory where you -installed them. The 'curl-config'[3] tool can be used to get this information: - -$ curl-config --cflags - -.IP "Linking the Program with libcurl" -When having compiled the program, you need to link your object files to create -a single executable. For that to succeed, you need to link with libcurl and -possibly also with other libraries that libcurl itself depends on. Like the -OpenSSL libraries, but even some standard OS libraries may be needed on the -command line. To figure out which flags to use, once again the 'curl-config' -tool comes to the rescue: - -$ curl-config --libs - -.IP "SSL or Not" -libcurl can be built and customized in many ways. One of the things that -varies from different libraries and builds is the support for SSL-based -transfers, like HTTPS and FTPS. If a supported SSL library was detected -properly at build-time, libcurl will be built with SSL support. To figure out -if an installed libcurl has been built with SSL support enabled, use -\&'curl-config' like this: - -$ curl-config --feature - -And if SSL is supported, the keyword 'SSL' will be written to stdout, -possibly together with a few other features that could be either on or off on -for different libcurls. - -See also the "Features libcurl Provides" further down. -.IP "autoconf macro" -When you write your configure script to detect libcurl and setup variables -accordingly, we offer a prewritten macro that probably does everything you -need in this area. See docs/libcurl/libcurl.m4 file - it includes docs on how -to use it. - -.SH "Portable Code in a Portable World" -The people behind libcurl have put a considerable effort to make libcurl work -on a large amount of different operating systems and environments. - -You program libcurl the same way on all platforms that libcurl runs on. There -are only very few minor considerations that differ. If you just make sure to -write your code portable enough, you may very well create yourself a very -portable program. libcurl shouldn't stop you from that. - -.SH "Global Preparation" -The program must initialize some of the libcurl functionality globally. That -means it should be done exactly once, no matter how many times you intend to -use the library. Once for your program's entire life time. This is done using - - curl_global_init() - -and it takes one parameter which is a bit pattern that tells libcurl what to -initialize. Using \fICURL_GLOBAL_ALL\fP will make it initialize all known -internal sub modules, and might be a good default option. The current two bits -that are specified are: -.RS -.IP "CURL_GLOBAL_WIN32" -which only does anything on Windows machines. When used on -a Windows machine, it'll make libcurl initialize the win32 socket -stuff. Without having that initialized properly, your program cannot use -sockets properly. You should only do this once for each application, so if -your program already does this or of another library in use does it, you -should not tell libcurl to do this as well. -.IP CURL_GLOBAL_SSL -which only does anything on libcurls compiled and built SSL-enabled. On these -systems, this will make libcurl initialize the SSL library properly for this -application. This only needs to be done once for each application so if your -program or another library already does this, this bit should not be needed. -.RE - -libcurl has a default protection mechanism that detects if -\fIcurl_global_init(3)\fP hasn't been called by the time -\fIcurl_easy_perform(3)\fP is called and if that is the case, libcurl runs the -function itself with a guessed bit pattern. Please note that depending solely -on this is not considered nice nor very good. - -When the program no longer uses libcurl, it should call -\fIcurl_global_cleanup(3)\fP, which is the opposite of the init call. It will -then do the reversed operations to cleanup the resources the -\fIcurl_global_init(3)\fP call initialized. - -Repeated calls to \fIcurl_global_init(3)\fP and \fIcurl_global_cleanup(3)\fP -should be avoided. They should only be called once each. - -.SH "Features libcurl Provides" -It is considered best-practice to determine libcurl features at run-time -rather than at build-time (if possible of course). By calling -\fIcurl_version_info(3)\fP and checking out the details of the returned -struct, your program can figure out exactly what the currently running libcurl -supports. - -.SH "Handle the Easy libcurl" -libcurl first introduced the so called easy interface. All operations in the -easy interface are prefixed with 'curl_easy'. - -Recent libcurl versions also offer the multi interface. More about that -interface, what it is targeted for and how to use it is detailed in a separate -chapter further down. You still need to understand the easy interface first, -so please continue reading for better understanding. - -To use the easy interface, you must first create yourself an easy handle. You -need one handle for each easy session you want to perform. Basically, you -should use one handle for every thread you plan to use for transferring. You -must never share the same handle in multiple threads. - -Get an easy handle with - - easyhandle = curl_easy_init(); - -It returns an easy handle. Using that you proceed to the next step: setting -up your preferred actions. A handle is just a logic entity for the upcoming -transfer or series of transfers. - -You set properties and options for this handle using -\fIcurl_easy_setopt(3)\fP. They control how the subsequent transfer or -transfers will be made. Options remain set in the handle until set again to -something different. Alas, multiple requests using the same handle will use -the same options. - -Many of the options you set in libcurl are "strings", pointers to data -terminated with a zero byte. When you set strings with -\fIcurl_easy_setopt(3)\fP, libcurl makes its own copy so that they don't -need to be kept around in your application after being set[4]. - -One of the most basic properties to set in the handle is the URL. You set -your preferred URL to transfer with CURLOPT_URL in a manner similar to: - -.nf - curl_easy_setopt(handle, CURLOPT_URL, "http://domain.com/"); -.fi - -Let's assume for a while that you want to receive data as the URL identifies a -remote resource you want to get here. Since you write a sort of application -that needs this transfer, I assume that you would like to get the data passed -to you directly instead of simply getting it passed to stdout. So, you write -your own function that matches this prototype: - - size_t write_data(void *buffer, size_t size, size_t nmemb, void *userp); - -You tell libcurl to pass all data to this function by issuing a function -similar to this: - - curl_easy_setopt(easyhandle, CURLOPT_WRITEFUNCTION, write_data); - -You can control what data your callback function gets in the fourth argument -by setting another property: - - curl_easy_setopt(easyhandle, CURLOPT_WRITEDATA, &internal_struct); - -Using that property, you can easily pass local data between your application -and the function that gets invoked by libcurl. libcurl itself won't touch the -data you pass with \fICURLOPT_WRITEDATA\fP. - -libcurl offers its own default internal callback that will take care of the data -if you don't set the callback with \fICURLOPT_WRITEFUNCTION\fP. It will then -simply output the received data to stdout. You can have the default callback -write the data to a different file handle by passing a 'FILE *' to a file -opened for writing with the \fICURLOPT_WRITEDATA\fP option. - -Now, we need to take a step back and have a deep breath. Here's one of those -rare platform-dependent nitpicks. Did you spot it? On some platforms[2], -libcurl won't be able to operate on files opened by the program. Thus, if you -use the default callback and pass in an open file with -\fICURLOPT_WRITEDATA\fP, it will crash. You should therefore avoid this to -make your program run fine virtually everywhere. - -(\fICURLOPT_WRITEDATA\fP was formerly known as \fICURLOPT_FILE\fP. Both names -still work and do the same thing). - -If you're using libcurl as a win32 DLL, you MUST use the -\fICURLOPT_WRITEFUNCTION\fP if you set \fICURLOPT_WRITEDATA\fP - or you will -experience crashes. - -There are of course many more options you can set, and we'll get back to a few -of them later. Let's instead continue to the actual transfer: - - success = curl_easy_perform(easyhandle); - -\fIcurl_easy_perform(3)\fP will connect to the remote site, do the necessary -commands and receive the transfer. Whenever it receives data, it calls the -callback function we previously set. The function may get one byte at a time, -or it may get many kilobytes at once. libcurl delivers as much as possible as -often as possible. Your callback function should return the number of bytes it -\&"took care of". If that is not the exact same amount of bytes that was -passed to it, libcurl will abort the operation and return with an error code. - -When the transfer is complete, the function returns a return code that informs -you if it succeeded in its mission or not. If a return code isn't enough for -you, you can use the CURLOPT_ERRORBUFFER to point libcurl to a buffer of yours -where it'll store a human readable error message as well. - -If you then want to transfer another file, the handle is ready to be used -again. Mind you, it is even preferred that you re-use an existing handle if -you intend to make another transfer. libcurl will then attempt to re-use the -previous connection. - -For some protocols, downloading a file can involve a complicated process of -logging in, setting the transfer mode, changing the current directory and -finally transferring the file data. libcurl takes care of all that -complication for you. Given simply the URL to a file, libcurl will take care -of all the details needed to get the file moved from one machine to another. - -.SH "Multi-threading Issues" -The first basic rule is that you must \fBnever\fP simultaneously share a -libcurl handle (be it easy or multi or whatever) between multiple -threads. Only use one handle in one thread at any time. You can pass the -handles around among threads, but you must never use a single handle from more -than one thread at any given time. - -libcurl is completely thread safe, except for two issues: signals and SSL/TLS -handlers. Signals are used for timing out name resolves (during DNS lookup) - -when built without c-ares support and not on Windows. - -If you are accessing HTTPS or FTPS URLs in a multi-threaded manner, you are -then of course using the underlying SSL library multi-threaded and those libs -might have their own requirements on this issue. Basically, you need to -provide one or two functions to allow it to function properly. For all -details, see this: - -OpenSSL - - http://www.openssl.org/docs/crypto/threads.html#DESCRIPTION - -GnuTLS - - http://www.gnu.org/software/gnutls/manual/html_node/Multi_002dthreaded-applications.html - -NSS - - is claimed to be thread-safe already without anything required. - -PolarSSL - - Required actions unknown. - -yassl - - Required actions unknown. - -axTLS - - Required actions unknown. - -When using multiple threads you should set the CURLOPT_NOSIGNAL option to 1 -for all handles. Everything will or might work fine except that timeouts are -not honored during the DNS lookup - which you can work around by building -libcurl with c-ares support. c-ares is a library that provides asynchronous -name resolves. On some platforms, libcurl simply will not function properly -multi-threaded unless this option is set. - -Also, note that CURLOPT_DNS_USE_GLOBAL_CACHE is not thread-safe. - -.SH "When It Doesn't Work" -There will always be times when the transfer fails for some reason. You might -have set the wrong libcurl option or misunderstood what the libcurl option -actually does, or the remote server might return non-standard replies that -confuse the library which then confuses your program. - -There's one golden rule when these things occur: set the CURLOPT_VERBOSE -option to 1. It'll cause the library to spew out the entire protocol -details it sends, some internal info and some received protocol data as well -(especially when using FTP). If you're using HTTP, adding the headers in the -received output to study is also a clever way to get a better understanding -why the server behaves the way it does. Include headers in the normal body -output with CURLOPT_HEADER set 1. - -Of course, there are bugs left. We need to know about them to be able -to fix them, so we're quite dependent on your bug reports! When you do report -suspected bugs in libcurl, please include as many details as you possibly can: a -protocol dump that CURLOPT_VERBOSE produces, library version, as much as -possible of your code that uses libcurl, operating system name and version, -compiler name and version etc. - -If CURLOPT_VERBOSE is not enough, you increase the level of debug data your -application receive by using the CURLOPT_DEBUGFUNCTION. - -Getting some in-depth knowledge about the protocols involved is never wrong, -and if you're trying to do funny things, you might very well understand -libcurl and how to use it better if you study the appropriate RFC documents -at least briefly. - -.SH "Upload Data to a Remote Site" -libcurl tries to keep a protocol independent approach to most transfers, thus -uploading to a remote FTP site is very similar to uploading data to a HTTP -server with a PUT request. - -Of course, first you either create an easy handle or you re-use one existing -one. Then you set the URL to operate on just like before. This is the remote -URL, that we now will upload. - -Since we write an application, we most likely want libcurl to get the upload -data by asking us for it. To make it do that, we set the read callback and -the custom pointer libcurl will pass to our read callback. The read callback -should have a prototype similar to: - - size_t function(char *bufptr, size_t size, size_t nitems, void *userp); - -Where bufptr is the pointer to a buffer we fill in with data to upload and -size*nitems is the size of the buffer and therefore also the maximum amount -of data we can return to libcurl in this call. The 'userp' pointer is the -custom pointer we set to point to a struct of ours to pass private data -between the application and the callback. - - curl_easy_setopt(easyhandle, CURLOPT_READFUNCTION, read_function); - - curl_easy_setopt(easyhandle, CURLOPT_READDATA, &filedata); - -Tell libcurl that we want to upload: - - curl_easy_setopt(easyhandle, CURLOPT_UPLOAD, 1L); - -A few protocols won't behave properly when uploads are done without any prior -knowledge of the expected file size. So, set the upload file size using the -CURLOPT_INFILESIZE_LARGE for all known file sizes like this[1]: - -.nf - /* in this example, file_size must be an curl_off_t variable */ - curl_easy_setopt(easyhandle, CURLOPT_INFILESIZE_LARGE, file_size); -.fi - -When you call \fIcurl_easy_perform(3)\fP this time, it'll perform all the -necessary operations and when it has invoked the upload it'll call your -supplied callback to get the data to upload. The program should return as much -data as possible in every invoke, as that is likely to make the upload perform -as fast as possible. The callback should return the number of bytes it wrote -in the buffer. Returning 0 will signal the end of the upload. - -.SH "Passwords" -Many protocols use or even require that user name and password are provided -to be able to download or upload the data of your choice. libcurl offers -several ways to specify them. - -Most protocols support that you specify the name and password in the URL -itself. libcurl will detect this and use them accordingly. This is written -like this: - - protocol://user:password@example.com/path/ - -If you need any odd letters in your user name or password, you should enter -them URL encoded, as %XX where XX is a two-digit hexadecimal number. - -libcurl also provides options to set various passwords. The user name and -password as shown embedded in the URL can instead get set with the -CURLOPT_USERPWD option. The argument passed to libcurl should be a char * to -a string in the format "user:password". In a manner like this: - - curl_easy_setopt(easyhandle, CURLOPT_USERPWD, "myname:thesecret"); - -Another case where name and password might be needed at times, is for those -users who need to authenticate themselves to a proxy they use. libcurl offers -another option for this, the CURLOPT_PROXYUSERPWD. It is used quite similar -to the CURLOPT_USERPWD option like this: - - curl_easy_setopt(easyhandle, CURLOPT_PROXYUSERPWD, "myname:thesecret"); - -There's a long time UNIX "standard" way of storing ftp user names and -passwords, namely in the $HOME/.netrc file. The file should be made private -so that only the user may read it (see also the "Security Considerations" -chapter), as it might contain the password in plain text. libcurl has the -ability to use this file to figure out what set of user name and password to -use for a particular host. As an extension to the normal functionality, -libcurl also supports this file for non-FTP protocols such as HTTP. To make -curl use this file, use the CURLOPT_NETRC option: - - curl_easy_setopt(easyhandle, CURLOPT_NETRC, 1L); - -And a very basic example of how such a .netrc file may look like: - -.nf - machine myhost.mydomain.com - login userlogin - password secretword -.fi - -All these examples have been cases where the password has been optional, or -at least you could leave it out and have libcurl attempt to do its job -without it. There are times when the password isn't optional, like when -you're using an SSL private key for secure transfers. - -To pass the known private key password to libcurl: - - curl_easy_setopt(easyhandle, CURLOPT_KEYPASSWD, "keypassword"); - -.SH "HTTP Authentication" -The previous chapter showed how to set user name and password for getting -URLs that require authentication. When using the HTTP protocol, there are -many different ways a client can provide those credentials to the server and -you can control which way libcurl will (attempt to) use them. The default HTTP -authentication method is called 'Basic', which is sending the name and -password in clear-text in the HTTP request, base64-encoded. This is insecure. - -At the time of this writing, libcurl can be built to use: Basic, Digest, NTLM, -Negotiate, GSS-Negotiate and SPNEGO. You can tell libcurl which one to use -with CURLOPT_HTTPAUTH as in: - - curl_easy_setopt(easyhandle, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST); - -And when you send authentication to a proxy, you can also set authentication -type the same way but instead with CURLOPT_PROXYAUTH: - - curl_easy_setopt(easyhandle, CURLOPT_PROXYAUTH, CURLAUTH_NTLM); - -Both these options allow you to set multiple types (by ORing them together), -to make libcurl pick the most secure one out of the types the server/proxy -claims to support. This method does however add a round-trip since libcurl -must first ask the server what it supports: - - curl_easy_setopt(easyhandle, CURLOPT_HTTPAUTH, - CURLAUTH_DIGEST|CURLAUTH_BASIC); - -For convenience, you can use the 'CURLAUTH_ANY' define (instead of a list -with specific types) which allows libcurl to use whatever method it wants. - -When asking for multiple types, libcurl will pick the available one it -considers "best" in its own internal order of preference. - -.SH "HTTP POSTing" -We get many questions regarding how to issue HTTP POSTs with libcurl the -proper way. This chapter will thus include examples using both different -versions of HTTP POST that libcurl supports. - -The first version is the simple POST, the most common version, that most HTML -pages using the <form> tag uses. We provide a pointer to the data and tell -libcurl to post it all to the remote site: - -.nf - char *data="name=daniel&project=curl"; - curl_easy_setopt(easyhandle, CURLOPT_POSTFIELDS, data); - curl_easy_setopt(easyhandle, CURLOPT_URL, "http://posthere.com/"); - - curl_easy_perform(easyhandle); /* post away! */ -.fi - -Simple enough, huh? Since you set the POST options with the -CURLOPT_POSTFIELDS, this automatically switches the handle to use POST in the -upcoming request. - -Ok, so what if you want to post binary data that also requires you to set the -Content-Type: header of the post? Well, binary posts prevent libcurl from -being able to do strlen() on the data to figure out the size, so therefore we -must tell libcurl the size of the post data. Setting headers in libcurl -requests are done in a generic way, by building a list of our own headers and -then passing that list to libcurl. - -.nf - struct curl_slist *headers=NULL; - headers = curl_slist_append(headers, "Content-Type: text/xml"); - - /* post binary data */ - curl_easy_setopt(easyhandle, CURLOPT_POSTFIELDS, binaryptr); - - /* set the size of the postfields data */ - curl_easy_setopt(easyhandle, CURLOPT_POSTFIELDSIZE, 23L); - - /* pass our list of custom made headers */ - curl_easy_setopt(easyhandle, CURLOPT_HTTPHEADER, headers); - - curl_easy_perform(easyhandle); /* post away! */ - - curl_slist_free_all(headers); /* free the header list */ -.fi - -While the simple examples above cover the majority of all cases where HTTP -POST operations are required, they don't do multi-part formposts. Multi-part -formposts were introduced as a better way to post (possibly large) binary data -and were first documented in the RFC1867 (updated in RFC2388). They're called -multi-part because they're built by a chain of parts, each part being a single -unit of data. Each part has its own name and contents. You can in fact create -and post a multi-part formpost with the regular libcurl POST support described -above, but that would require that you build a formpost yourself and provide -to libcurl. To make that easier, libcurl provides \fIcurl_formadd(3)\fP. Using -this function, you add parts to the form. When you're done adding parts, you -post the whole form. - -The following example sets two simple text parts with plain textual contents, -and then a file with binary contents and uploads the whole thing. - -.nf - struct curl_httppost *post=NULL; - struct curl_httppost *last=NULL; - curl_formadd(&post, &last, - CURLFORM_COPYNAME, "name", - CURLFORM_COPYCONTENTS, "daniel", CURLFORM_END); - curl_formadd(&post, &last, - CURLFORM_COPYNAME, "project", - CURLFORM_COPYCONTENTS, "curl", CURLFORM_END); - curl_formadd(&post, &last, - CURLFORM_COPYNAME, "logotype-image", - CURLFORM_FILECONTENT, "curl.png", CURLFORM_END); - - /* Set the form info */ - curl_easy_setopt(easyhandle, CURLOPT_HTTPPOST, post); - - curl_easy_perform(easyhandle); /* post away! */ - - /* free the post data again */ - curl_formfree(post); -.fi - -Multipart formposts are chains of parts using MIME-style separators and -headers. It means that each one of these separate parts get a few headers set -that describe the individual content-type, size etc. To enable your -application to handicraft this formpost even more, libcurl allows you to -supply your own set of custom headers to such an individual form part. You can -of course supply headers to as many parts as you like, but this little example -will show how you set headers to one specific part when you add that to the -post handle: - -.nf - struct curl_slist *headers=NULL; - headers = curl_slist_append(headers, "Content-Type: text/xml"); - - curl_formadd(&post, &last, - CURLFORM_COPYNAME, "logotype-image", - CURLFORM_FILECONTENT, "curl.xml", - CURLFORM_CONTENTHEADER, headers, - CURLFORM_END); - - curl_easy_perform(easyhandle); /* post away! */ - - curl_formfree(post); /* free post */ - curl_slist_free_all(headers); /* free custom header list */ -.fi - -Since all options on an easyhandle are "sticky", they remain the same until -changed even if you do call \fIcurl_easy_perform(3)\fP, you may need to tell -curl to go back to a plain GET request if you intend to do one as your -next request. You force an easyhandle to go back to GET by using the -CURLOPT_HTTPGET option: - - curl_easy_setopt(easyhandle, CURLOPT_HTTPGET, 1L); - -Just setting CURLOPT_POSTFIELDS to "" or NULL will *not* stop libcurl from -doing a POST. It will just make it POST without any data to send! - -.SH "Showing Progress" - -For historical and traditional reasons, libcurl has a built-in progress meter -that can be switched on and then makes it present a progress meter in your -terminal. - -Switch on the progress meter by, oddly enough, setting CURLOPT_NOPROGRESS to -zero. This option is set to 1 by default. - -For most applications however, the built-in progress meter is useless and -what instead is interesting is the ability to specify a progress -callback. The function pointer you pass to libcurl will then be called on -irregular intervals with information about the current transfer. - -Set the progress callback by using CURLOPT_PROGRESSFUNCTION. And pass a -pointer to a function that matches this prototype: - -.nf - int progress_callback(void *clientp, - double dltotal, - double dlnow, - double ultotal, - double ulnow); -.fi - -If any of the input arguments is unknown, a 0 will be passed. The first -argument, the 'clientp' is the pointer you pass to libcurl with -CURLOPT_PROGRESSDATA. libcurl won't touch it. - -.SH "libcurl with C++" - -There's basically only one thing to keep in mind when using C++ instead of C -when interfacing libcurl: - -The callbacks CANNOT be non-static class member functions - -Example C++ code: - -.nf -class AClass { - static size_t write_data(void *ptr, size_t size, size_t nmemb, - void *ourpointer) - { - /* do what you want with the data */ - } - } -.fi - -.SH "Proxies" - -What "proxy" means according to Merriam-Webster: "a person authorized to act -for another" but also "the agency, function, or office of a deputy who acts as -a substitute for another". - -Proxies are exceedingly common these days. Companies often only offer Internet -access to employees through their proxies. Network clients or user-agents ask -the proxy for documents, the proxy does the actual request and then it returns -them. - -libcurl supports SOCKS and HTTP proxies. When a given URL is wanted, libcurl -will ask the proxy for it instead of trying to connect to the actual host -identified in the URL. - -If you're using a SOCKS proxy, you may find that libcurl doesn't quite support -all operations through it. - -For HTTP proxies: the fact that the proxy is a HTTP proxy puts certain -restrictions on what can actually happen. A requested URL that might not be a -HTTP URL will be still be passed to the HTTP proxy to deliver back to -libcurl. This happens transparently, and an application may not need to -know. I say "may", because at times it is very important to understand that -all operations over a HTTP proxy use the HTTP protocol. For example, you -can't invoke your own custom FTP commands or even proper FTP directory -listings. - -.IP "Proxy Options" - -To tell libcurl to use a proxy at a given port number: - - curl_easy_setopt(easyhandle, CURLOPT_PROXY, "proxy-host.com:8080"); - -Some proxies require user authentication before allowing a request, and you -pass that information similar to this: - - curl_easy_setopt(easyhandle, CURLOPT_PROXYUSERPWD, "user:password"); - -If you want to, you can specify the host name only in the CURLOPT_PROXY -option, and set the port number separately with CURLOPT_PROXYPORT. - -Tell libcurl what kind of proxy it is with CURLOPT_PROXYTYPE (if not, it will -default to assume a HTTP proxy): - - curl_easy_setopt(easyhandle, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4); - -.IP "Environment Variables" - -libcurl automatically checks and uses a set of environment variables to know -what proxies to use for certain protocols. The names of the variables are -following an ancient de facto standard and are built up as "[protocol]_proxy" -(note the lower casing). Which makes the variable \&'http_proxy' checked for a -name of a proxy to use when the input URL is HTTP. Following the same rule, -the variable named 'ftp_proxy' is checked for FTP URLs. Again, the proxies are -always HTTP proxies, the different names of the variables simply allows -different HTTP proxies to be used. - -The proxy environment variable contents should be in the format -\&"[protocol://][user:password@]machine[:port]". Where the protocol:// part is -simply ignored if present (so http://proxy and bluerk://proxy will do the -same) and the optional port number specifies on which port the proxy operates -on the host. If not specified, the internal default port number will be used -and that is most likely *not* the one you would like it to be. - -There are two special environment variables. 'all_proxy' is what sets proxy -for any URL in case the protocol specific variable wasn't set, and -\&'no_proxy' defines a list of hosts that should not use a proxy even though a -variable may say so. If 'no_proxy' is a plain asterisk ("*") it matches all -hosts. - -To explicitly disable libcurl's checking for and using the proxy environment -variables, set the proxy name to "" - an empty string - with CURLOPT_PROXY. -.IP "SSL and Proxies" - -SSL is for secure point-to-point connections. This involves strong encryption -and similar things, which effectively makes it impossible for a proxy to -operate as a "man in between" which the proxy's task is, as previously -discussed. Instead, the only way to have SSL work over a HTTP proxy is to ask -the proxy to tunnel trough everything without being able to check or fiddle -with the traffic. - -Opening an SSL connection over a HTTP proxy is therefor a matter of asking the -proxy for a straight connection to the target host on a specified port. This -is made with the HTTP request CONNECT. ("please mr proxy, connect me to that -remote host"). - -Because of the nature of this operation, where the proxy has no idea what kind -of data that is passed in and out through this tunnel, this breaks some of the -very few advantages that come from using a proxy, such as caching. Many -organizations prevent this kind of tunneling to other destination port numbers -than 443 (which is the default HTTPS port number). - -.IP "Tunneling Through Proxy" -As explained above, tunneling is required for SSL to work and often even -restricted to the operation intended for SSL; HTTPS. - -This is however not the only time proxy-tunneling might offer benefits to -you or your application. - -As tunneling opens a direct connection from your application to the remote -machine, it suddenly also re-introduces the ability to do non-HTTP -operations over a HTTP proxy. You can in fact use things such as FTP -upload or FTP custom commands this way. - -Again, this is often prevented by the administrators of proxies and is -rarely allowed. - -Tell libcurl to use proxy tunneling like this: - - curl_easy_setopt(easyhandle, CURLOPT_HTTPPROXYTUNNEL, 1L); - -In fact, there might even be times when you want to do plain HTTP -operations using a tunnel like this, as it then enables you to operate on -the remote server instead of asking the proxy to do so. libcurl will not -stand in the way for such innovative actions either! - -.IP "Proxy Auto-Config" - -Netscape first came up with this. It is basically a web page (usually using a -\&.pac extension) with a Javascript that when executed by the browser with the -requested URL as input, returns information to the browser on how to connect -to the URL. The returned information might be "DIRECT" (which means no proxy -should be used), "PROXY host:port" (to tell the browser where the proxy for -this particular URL is) or "SOCKS host:port" (to direct the browser to a SOCKS -proxy). - -libcurl has no means to interpret or evaluate Javascript and thus it doesn't -support this. If you get yourself in a position where you face this nasty -invention, the following advice have been mentioned and used in the past: - -- Depending on the Javascript complexity, write up a script that translates it -to another language and execute that. - -- Read the Javascript code and rewrite the same logic in another language. - -- Implement a Javascript interpreter; people have successfully used the -Mozilla Javascript engine in the past. - -- Ask your admins to stop this, for a static proxy setup or similar. - -.SH "Persistence Is The Way to Happiness" - -Re-cycling the same easy handle several times when doing multiple requests is -the way to go. - -After each single \fIcurl_easy_perform(3)\fP operation, libcurl will keep the -connection alive and open. A subsequent request using the same easy handle to -the same host might just be able to use the already open connection! This -reduces network impact a lot. - -Even if the connection is dropped, all connections involving SSL to the same -host again, will benefit from libcurl's session ID cache that drastically -reduces re-connection time. - -FTP connections that are kept alive save a lot of time, as the command- -response round-trips are skipped, and also you don't risk getting blocked -without permission to login again like on many FTP servers only allowing N -persons to be logged in at the same time. - -libcurl caches DNS name resolving results, to make lookups of a previously -looked up name a lot faster. - -Other interesting details that improve performance for subsequent requests -may also be added in the future. - -Each easy handle will attempt to keep the last few connections alive for a -while in case they are to be used again. You can set the size of this "cache" -with the CURLOPT_MAXCONNECTS option. Default is 5. There is very seldom any -point in changing this value, and if you think of changing this it is often -just a matter of thinking again. - -To force your upcoming request to not use an already existing connection (it -will even close one first if there happens to be one alive to the same host -you're about to operate on), you can do that by setting CURLOPT_FRESH_CONNECT -to 1. In a similar spirit, you can also forbid the upcoming request to be -"lying" around and possibly get re-used after the request by setting -CURLOPT_FORBID_REUSE to 1. - -.SH "HTTP Headers Used by libcurl" -When you use libcurl to do HTTP requests, it'll pass along a series of headers -automatically. It might be good for you to know and understand these. You -can replace or remove them by using the CURLOPT_HTTPHEADER option. - -.IP "Host" -This header is required by HTTP 1.1 and even many 1.0 servers and should be -the name of the server we want to talk to. This includes the port number if -anything but default. - -.IP "Accept" -\&"*/*". - -.IP "Expect" -When doing POST requests, libcurl sets this header to \&"100-continue" to ask -the server for an "OK" message before it proceeds with sending the data part -of the post. If the POSTed data amount is deemed "small", libcurl will not use -this header. - -.SH "Customizing Operations" -There is an ongoing development today where more and more protocols are built -upon HTTP for transport. This has obvious benefits as HTTP is a tested and -reliable protocol that is widely deployed and has excellent proxy-support. - -When you use one of these protocols, and even when doing other kinds of -programming you may need to change the traditional HTTP (or FTP or...) -manners. You may need to change words, headers or various data. - -libcurl is your friend here too. - -.IP CUSTOMREQUEST -If just changing the actual HTTP request keyword is what you want, like when -GET, HEAD or POST is not good enough for you, CURLOPT_CUSTOMREQUEST is there -for you. It is very simple to use: - - curl_easy_setopt(easyhandle, CURLOPT_CUSTOMREQUEST, "MYOWNREQUEST"); - -When using the custom request, you change the request keyword of the actual -request you are performing. Thus, by default you make a GET request but you can -also make a POST operation (as described before) and then replace the POST -keyword if you want to. You're the boss. - -.IP "Modify Headers" -HTTP-like protocols pass a series of headers to the server when doing the -request, and you're free to pass any amount of extra headers that you -think fit. Adding headers is this easy: - -.nf - struct curl_slist *headers=NULL; /* init to NULL is important */ - - headers = curl_slist_append(headers, "Hey-server-hey: how are you?"); - headers = curl_slist_append(headers, "X-silly-content: yes"); - - /* pass our list of custom made headers */ - curl_easy_setopt(easyhandle, CURLOPT_HTTPHEADER, headers); - - curl_easy_perform(easyhandle); /* transfer http */ - - curl_slist_free_all(headers); /* free the header list */ -.fi - -\&... and if you think some of the internally generated headers, such as -Accept: or Host: don't contain the data you want them to contain, you can -replace them by simply setting them too: - -.nf - headers = curl_slist_append(headers, "Accept: Agent-007"); - headers = curl_slist_append(headers, "Host: munged.host.line"); -.fi - -.IP "Delete Headers" -If you replace an existing header with one with no contents, you will prevent -the header from being sent. For instance, if you want to completely prevent the -\&"Accept:" header from being sent, you can disable it with code similar to this: - - headers = curl_slist_append(headers, "Accept:"); - -Both replacing and canceling internal headers should be done with careful -consideration and you should be aware that you may violate the HTTP protocol -when doing so. - -.IP "Enforcing chunked transfer-encoding" - -By making sure a request uses the custom header "Transfer-Encoding: chunked" -when doing a non-GET HTTP operation, libcurl will switch over to "chunked" -upload, even though the size of the data to upload might be known. By default, -libcurl usually switches over to chunked upload automatically if the upload -data size is unknown. - -.IP "HTTP Version" - -All HTTP requests includes the version number to tell the server which version -we support. libcurl speaks HTTP 1.1 by default. Some very old servers don't -like getting 1.1-requests and when dealing with stubborn old things like that, -you can tell libcurl to use 1.0 instead by doing something like this: - - curl_easy_setopt(easyhandle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); - -.IP "FTP Custom Commands" - -Not all protocols are HTTP-like, and thus the above may not help you when -you want to make, for example, your FTP transfers to behave differently. - -Sending custom commands to a FTP server means that you need to send the -commands exactly as the FTP server expects them (RFC959 is a good guide -here), and you can only use commands that work on the control-connection -alone. All kinds of commands that require data interchange and thus need -a data-connection must be left to libcurl's own judgement. Also be aware -that libcurl will do its very best to change directory to the target -directory before doing any transfer, so if you change directory (with CWD -or similar) you might confuse libcurl and then it might not attempt to -transfer the file in the correct remote directory. - -A little example that deletes a given file before an operation: - -.nf - headers = curl_slist_append(headers, "DELE file-to-remove"); - - /* pass the list of custom commands to the handle */ - curl_easy_setopt(easyhandle, CURLOPT_QUOTE, headers); - - curl_easy_perform(easyhandle); /* transfer ftp data! */ - - curl_slist_free_all(headers); /* free the header list */ -.fi - -If you would instead want this operation (or chain of operations) to happen -_after_ the data transfer took place the option to \fIcurl_easy_setopt(3)\fP -would instead be called CURLOPT_POSTQUOTE and used the exact same way. - -The custom FTP command will be issued to the server in the same order they are -added to the list, and if a command gets an error code returned back from the -server, no more commands will be issued and libcurl will bail out with an -error code (CURLE_QUOTE_ERROR). Note that if you use CURLOPT_QUOTE to send -commands before a transfer, no transfer will actually take place when a quote -command has failed. - -If you set the CURLOPT_HEADER to 1, you will tell libcurl to get -information about the target file and output "headers" about it. The headers -will be in "HTTP-style", looking like they do in HTTP. - -The option to enable headers or to run custom FTP commands may be useful to -combine with CURLOPT_NOBODY. If this option is set, no actual file content -transfer will be performed. - -.IP "FTP Custom CUSTOMREQUEST" -If you do want to list the contents of a FTP directory using your own defined FTP -command, CURLOPT_CUSTOMREQUEST will do just that. "NLST" is the default one -for listing directories but you're free to pass in your idea of a good -alternative. - -.SH "Cookies Without Chocolate Chips" -In the HTTP sense, a cookie is a name with an associated value. A server sends -the name and value to the client, and expects it to get sent back on every -subsequent request to the server that matches the particular conditions -set. The conditions include that the domain name and path match and that the -cookie hasn't become too old. - -In real-world cases, servers send new cookies to replace existing ones to -update them. Server use cookies to "track" users and to keep "sessions". - -Cookies are sent from server to clients with the header Set-Cookie: and -they're sent from clients to servers with the Cookie: header. - -To just send whatever cookie you want to a server, you can use CURLOPT_COOKIE -to set a cookie string like this: - - curl_easy_setopt(easyhandle, CURLOPT_COOKIE, "name1=var1; name2=var2;"); - -In many cases, that is not enough. You might want to dynamically save -whatever cookies the remote server passes to you, and make sure those cookies -are then used accordingly on later requests. - -One way to do this, is to save all headers you receive in a plain file and -when you make a request, you tell libcurl to read the previous headers to -figure out which cookies to use. Set the header file to read cookies from with -CURLOPT_COOKIEFILE. - -The CURLOPT_COOKIEFILE option also automatically enables the cookie parser in -libcurl. Until the cookie parser is enabled, libcurl will not parse or -understand incoming cookies and they will just be ignored. However, when the -parser is enabled the cookies will be understood and the cookies will be kept -in memory and used properly in subsequent requests when the same handle is -used. Many times this is enough, and you may not have to save the cookies to -disk at all. Note that the file you specify to CURLOPT_COOKIEFILE doesn't have -to exist to enable the parser, so a common way to just enable the parser and -not read any cookies is to use the name of a file you know doesn't exist. - -If you would rather use existing cookies that you've previously received with -your Netscape or Mozilla browsers, you can make libcurl use that cookie file -as input. The CURLOPT_COOKIEFILE is used for that too, as libcurl will -automatically find out what kind of file it is and act accordingly. - -Perhaps the most advanced cookie operation libcurl offers, is saving the -entire internal cookie state back into a Netscape/Mozilla formatted cookie -file. We call that the cookie-jar. When you set a file name with -CURLOPT_COOKIEJAR, that file name will be created and all received cookies -will be stored in it when \fIcurl_easy_cleanup(3)\fP is called. This enables -cookies to get passed on properly between multiple handles without any -information getting lost. - -.SH "FTP Peculiarities We Need" - -FTP transfers use a second TCP/IP connection for the data transfer. This is -usually a fact you can forget and ignore but at times this fact will come -back to haunt you. libcurl offers several different ways to customize how the -second connection is being made. - -libcurl can either connect to the server a second time or tell the server to -connect back to it. The first option is the default and it is also what works -best for all the people behind firewalls, NATs or IP-masquerading setups. -libcurl then tells the server to open up a new port and wait for a second -connection. This is by default attempted with EPSV first, and if that doesn't -work it tries PASV instead. (EPSV is an extension to the original FTP spec -and does not exist nor work on all FTP servers.) - -You can prevent libcurl from first trying the EPSV command by setting -CURLOPT_FTP_USE_EPSV to zero. - -In some cases, you will prefer to have the server connect back to you for the -second connection. This might be when the server is perhaps behind a firewall -or something and only allows connections on a single port. libcurl then -informs the remote server which IP address and port number to connect to. -This is made with the CURLOPT_FTPPORT option. If you set it to "-", libcurl -will use your system's "default IP address". If you want to use a particular -IP, you can set the full IP address, a host name to resolve to an IP address -or even a local network interface name that libcurl will get the IP address -from. - -When doing the "PORT" approach, libcurl will attempt to use the EPRT and the -LPRT before trying PORT, as they work with more protocols. You can disable -this behavior by setting CURLOPT_FTP_USE_EPRT to zero. - -.SH "Headers Equal Fun" - -Some protocols provide "headers", meta-data separated from the normal -data. These headers are by default not included in the normal data stream, -but you can make them appear in the data stream by setting CURLOPT_HEADER to -1. - -What might be even more useful, is libcurl's ability to separate the headers -from the data and thus make the callbacks differ. You can for example set a -different pointer to pass to the ordinary write callback by setting -CURLOPT_WRITEHEADER. - -Or, you can set an entirely separate function to receive the headers, by -using CURLOPT_HEADERFUNCTION. - -The headers are passed to the callback function one by one, and you can -depend on that fact. It makes it easier for you to add custom header parsers -etc. - -\&"Headers" for FTP transfers equal all the FTP server responses. They aren't -actually true headers, but in this case we pretend they are! ;-) - -.SH "Post Transfer Information" - - [ curl_easy_getinfo ] - -.SH "Security Considerations" - -The libcurl project takes security seriously. The library is written with -caution and precautions are taken to mitigate many kinds of risks encountered -while operating with potentially malicious servers on the Internet. It is a -powerful library, however, which allows application writers to make trade offs -between ease of writing and exposure to potential risky operations. If -used the right way, you can use libcurl to transfer data pretty safely. - -Many applications are used in closed networks where users and servers -can be trusted, but many others are used on arbitrary servers and are fed -input from potentially untrusted users. Following is a discussion about -some risks in the ways in which applications commonly use libcurl and -potential mitigations of those risks. It is by no means comprehensive, but -shows classes of attacks that robust applications should consider. The -Common Weakness Enumeration project at http://cwe.mitre.org/ is a good -reference for many of these and similar types of weaknesses of which -application writers should be aware. - -.IP "Command Lines" -If you use a command line tool (such as curl) that uses libcurl, and you give -options to the tool on the command line those options can very likely get read -by other users of your system when they use 'ps' or other tools to list -currently running processes. - -To avoid this problem, never feed sensitive things to programs using command -line options. Write them to a protected file and use the \-K option to -avoid this. - -.IP ".netrc" -\&.netrc is a pretty handy file/feature that allows you to login quickly and -automatically to frequently visited sites. The file contains passwords in -clear text and is a real security risk. In some cases, your .netrc is also -stored in a home directory that is NFS mounted or used on another network -based file system, so the clear text password will fly through your network -every time anyone reads that file! - -To avoid this problem, don't use .netrc files and never store passwords in -plain text anywhere. - -.IP "Clear Text Passwords" -Many of the protocols libcurl supports send name and password unencrypted as -clear text (HTTP Basic authentication, FTP, TELNET etc). It is very easy for -anyone on your network or a network nearby yours to just fire up a network -analyzer tool and eavesdrop on your passwords. Don't let the fact that HTTP -Basic uses base64 encoded passwords fool you. They may not look readable at a -first glance, but they very easily "deciphered" by anyone within seconds. - -To avoid this problem, use HTTP authentication methods or other protocols that -don't let snoopers see your password: HTTP with Digest, NTLM or GSS -authentication, HTTPS, FTPS, SCP, SFTP and FTP-Kerberos are a few examples. - -.IP "Redirects" -The CURLOPT_FOLLOWLOCATION option automatically follows HTTP redirects sent -by a remote server. These redirects can refer to any kind of URL, not just -HTTP. A redirect to a file: URL would cause the libcurl to read (or write) -arbitrary files from the local filesystem. If the application returns -the data back to the user (as would happen in some kinds of CGI scripts), -an attacker could leverage this to read otherwise forbidden data (e.g. -file://localhost/etc/passwd). - -If authentication credentials are stored in the ~/.netrc file, or Kerberos -is in use, any other URL type (not just file:) that requires -authentication is also at risk. A redirect such as -ftp://some-internal-server/private-file would then return data even when -the server is password protected. - -In the same way, if an unencrypted SSH private key has been configured for -the user running the libcurl application, SCP: or SFTP: URLs could access -password or private-key protected resources, -e.g. sftp://user@some-internal-server/etc/passwd - -The CURLOPT_REDIR_PROTOCOLS and CURLOPT_NETRC options can be used to -mitigate against this kind of attack. - -A redirect can also specify a location available only on the machine running -libcurl, including servers hidden behind a firewall from the attacker. -e.g. http://127.0.0.1/ or http://intranet/delete-stuff.cgi?delete=all or -tftp://bootp-server/pc-config-data - -Apps can mitigate against this by disabling CURLOPT_FOLLOWLOCATION and -handling redirects itself, sanitizing URLs as necessary. Alternately, an -app could leave CURLOPT_FOLLOWLOCATION enabled but set CURLOPT_REDIR_PROTOCOLS -and install a CURLOPT_OPENSOCKETFUNCTION callback function in which addresses -are sanitized before use. - -.IP "Private Resources" -A user who can control the DNS server of a domain being passed in within -a URL can change the address of the host to a local, private address -which the libcurl application will then use. e.g. The innocuous URL -http://fuzzybunnies.example.com/ could actually resolve to the IP address -of a server behind a firewall, such as 127.0.0.1 or 10.1.2.3 -Apps can mitigate against this by setting a CURLOPT_OPENSOCKETFUNCTION -and checking the address before a connection. - -All the malicious scenarios regarding redirected URLs apply just as well -to non-redirected URLs, if the user is allowed to specify an arbitrary URL -that could point to a private resource. For example, a web app providing -a translation service might happily translate file://localhost/etc/passwd -and display the result. Apps can mitigate against this with the -CURLOPT_PROTOCOLS option as well as by similar mitigation techniques for -redirections. - -A malicious FTP server could in response to the PASV command return an -IP address and port number for a server local to the app running libcurl -but behind a firewall. Apps can mitigate against this by using the -CURLOPT_FTP_SKIP_PASV_IP option or CURLOPT_FTPPORT. - -.IP Uploads -When uploading, a redirect can cause a local (or remote) file to be -overwritten. Apps must not allow any unsanitized URL to be passed in -for uploads. Also, CURLOPT_FOLLOWLOCATION should not be used on uploads. -Instead, the app should handle redirects itself, sanitizing each URL first. - -.IP Authentication -Use of CURLOPT_UNRESTRICTED_AUTH could cause authentication information to -be sent to an unknown second server. Apps can mitigate against this -by disabling CURLOPT_FOLLOWLOCATION and handling redirects itself, -sanitizing where necessary. - -Use of the CURLAUTH_ANY option to CURLOPT_HTTPAUTH could result in user -name and password being sent in clear text to an HTTP server. Instead, -use CURLAUTH_ANYSAFE which ensures that the password is encrypted over -the network, or else fail the request. - -Use of the CURLUSESSL_TRY option to CURLOPT_USE_SSL could result in user -name and password being sent in clear text to an FTP server. Instead, -use CURLUSESSL_CONTROL to ensure that an encrypted connection is used or -else fail the request. - -.IP Cookies -If cookies are enabled and cached, then a user could craft a URL which -performs some malicious action to a site whose authentication is already -stored in a cookie. e.g. http://mail.example.com/delete-stuff.cgi?delete=all -Apps can mitigate against this by disabling cookies or clearing them -between requests. - -.IP "Dangerous URLs" -SCP URLs can contain raw commands within the scp: URL, which is a side effect -of how the SCP protocol is designed. e.g. -scp://user:pass@host/a;date >/tmp/test; -Apps must not allow unsanitized SCP: URLs to be passed in for downloads. - -.IP "Denial of Service" -A malicious server could cause libcurl to effectively hang by sending -a trickle of data through, or even no data at all but just keeping the TCP -connection open. This could result in a denial-of-service attack. The -CURLOPT_TIMEOUT and/or CURLOPT_LOW_SPEED_LIMIT options can be used to -mitigate against this. - -A malicious server could cause libcurl to effectively hang by starting to -send data, then severing the connection without cleanly closing the -TCP connection. The app could install a CURLOPT_SOCKOPTFUNCTION callback -function and set the TCP SO_KEEPALIVE option to mitigate against this. -Setting one of the timeout options would also work against this attack. - -A malicious server could cause libcurl to download an infinite amount of -data, potentially causing all of memory or disk to be filled. Setting -the CURLOPT_MAXFILESIZE_LARGE option is not sufficient to guard against this. -Instead, the app should monitor the amount of data received within the -write or progress callback and abort once the limit is reached. - -A malicious HTTP server could cause an infinite redirection loop, causing a -denial-of-service. This can be mitigated by using the CURLOPT_MAXREDIRS -option. - -.IP "Arbitrary Headers" -User-supplied data must be sanitized when used in options like -CURLOPT_USERAGENT, CURLOPT_HTTPHEADER, CURLOPT_POSTFIELDS and others that -are used to generate structured data. Characters like embedded carriage -returns or ampersands could allow the user to create additional headers or -fields that could cause malicious transactions. - -.IP "Server-supplied Names" -A server can supply data which the application may, in some cases, use as -a file name. The curl command-line tool does this with --remote-header-name, -using the Content-disposition: header to generate a file name. An application -could also use CURLINFO_EFFECTIVE_URL to generate a file name from a -server-supplied redirect URL. Special care must be taken to sanitize such -names to avoid the possibility of a malicious server supplying one like -"/etc/passwd", "\autoexec.bat" or even ".bashrc". - -.IP "Server Certificates" -A secure application should never use the CURLOPT_SSL_VERIFYPEER option to -disable certificate validation. There are numerous attacks that are enabled -by apps that fail to properly validate server TLS/SSL certificates, -thus enabling a malicious server to spoof a legitimate one. HTTPS without -validated certificates is potentially as insecure as a plain HTTP connection. - -.IP "Showing What You Do" -On a related issue, be aware that even in situations like when you have -problems with libcurl and ask someone for help, everything you reveal in order -to get best possible help might also impose certain security related -risks. Host names, user names, paths, operating system specifics, etc (not to -mention passwords of course) may in fact be used by intruders to gain -additional information of a potential target. - -To avoid this problem, you must of course use your common sense. Often, you -can just edit out the sensitive data or just search/replace your true -information with faked data. - -.SH "Multiple Transfers Using the multi Interface" - -The easy interface as described in detail in this document is a synchronous -interface that transfers one file at a time and doesn't return until it is -done. - -The multi interface, on the other hand, allows your program to transfer -multiple files in both directions at the same time, without forcing you -to use multiple threads. The name might make it seem that the multi -interface is for multi-threaded programs, but the truth is almost the -reverse. The multi interface can allow a single-threaded application -to perform the same kinds of multiple, simultaneous transfers that -multi-threaded programs can perform. It allows many of the benefits -of multi-threaded transfers without the complexity of managing and -synchronizing many threads. - -To use this interface, you are better off if you first understand the basics -of how to use the easy interface. The multi interface is simply a way to make -multiple transfers at the same time by adding up multiple easy handles into -a "multi stack". - -You create the easy handles you want and you set all the options just like you -have been told above, and then you create a multi handle with -\fIcurl_multi_init(3)\fP and add all those easy handles to that multi handle -with \fIcurl_multi_add_handle(3)\fP. - -When you've added the handles you have for the moment (you can still add new -ones at any time), you start the transfers by calling -\fIcurl_multi_perform(3)\fP. - -\fIcurl_multi_perform(3)\fP is asynchronous. It will only execute as little as -possible and then return back control to your program. It is designed to never -block. - -The best usage of this interface is when you do a select() on all possible -file descriptors or sockets to know when to call libcurl again. This also -makes it easy for you to wait and respond to actions on your own application's -sockets/handles. You figure out what to select() for by using -\fIcurl_multi_fdset(3)\fP, that fills in a set of fd_set variables for you -with the particular file descriptors libcurl uses for the moment. - -When you then call select(), it'll return when one of the file handles signal -action and you then call \fIcurl_multi_perform(3)\fP to allow libcurl to do -what it wants to do. Take note that libcurl does also feature some time-out -code so we advise you to never use very long timeouts on select() before you -call \fIcurl_multi_perform(3)\fP, which thus should be called unconditionally -every now and then even if none of its file descriptors have signaled -ready. Another precaution you should use: always call -\fIcurl_multi_fdset(3)\fP immediately before the select() call since the -current set of file descriptors may change when calling a curl function. - -If you want to stop the transfer of one of the easy handles in the stack, you -can use \fIcurl_multi_remove_handle(3)\fP to remove individual easy -handles. Remember that easy handles should be \fIcurl_easy_cleanup(3)\fPed. - -When a transfer within the multi stack has finished, the counter of running -transfers (as filled in by \fIcurl_multi_perform(3)\fP) will decrease. When -the number reaches zero, all transfers are done. - -\fIcurl_multi_info_read(3)\fP can be used to get information about completed -transfers. It then returns the CURLcode for each easy transfer, to allow you -to figure out success on each individual transfer. - -.SH "SSL, Certificates and Other Tricks" - - [ seeding, passwords, keys, certificates, ENGINE, ca certs ] - -.SH "Sharing Data Between Easy Handles" -You can share some data between easy handles when the easy interface is used, -and some data is share automatically when you use the multi interface. - -When you add easy handles to a multi handle, these easy handles will -automatically share a lot of the data that otherwise would be kept on a -per-easy handle basis when the easy interface is used. - -The DNS cache is shared between handles within a multi handle, making -subsequent name resolvings faster and the connection pool that is kept to -better allow persistent connections and connection re-use is shared. If you're -using the easy interface, you can still share these between specific easy -handles by using the share interface, see \fIlibcurl-share(3)\fP. - -Some things are never shared automatically, not within multi handles, like for -example cookies so the only way to share that is with the share interface. -.SH "Footnotes" - -.IP "[1]" -libcurl 7.10.3 and later have the ability to switch over to chunked -Transfer-Encoding in cases where HTTP uploads are done with data of an unknown -size. -.IP "[2]" -This happens on Windows machines when libcurl is built and used as a -DLL. However, you can still do this on Windows if you link with a static -library. -.IP "[3]" -The curl-config tool is generated at build-time (on UNIX-like systems) and -should be installed with the 'make install' or similar instruction that -installs the library, header files, man pages etc. -.IP "[4]" -This behavior was different in versions before 7.17.0, where strings had to -remain valid past the end of the \fIcurl_easy_setopt(3)\fP call. diff --git a/plugins/FTPFileYM/curl/docs/libcurl/libcurl-tutorial.html b/plugins/FTPFileYM/curl/docs/libcurl/libcurl-tutorial.html deleted file mode 100644 index 74b728409c..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/libcurl-tutorial.html +++ /dev/null @@ -1,484 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> -<html><head> -<title>libcurl-tutorial man page</title> -<meta name="generator" content="roffit"> -<STYLE type="text/css"> -P.level0 { - padding-left: 2em; -} - -P.level1 { - padding-left: 4em; -} - -P.level2 { - padding-left: 6em; -} - -span.emphasis { - font-style: italic; -} - -span.bold { - font-weight: bold; -} - -span.manpage { - font-weight: bold; -} - -h2.nroffsh { - background-color: #e0e0e0; -} - -span.nroffip { - font-weight: bold; - font-size: 120%; - font-family: monospace; -} - -p.roffit { - text-align: center; - font-size: 80%; -} -</STYLE> -</head><body> - -<p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2> -<p class="level0">libcurl-tutorial - libcurl programming tutorial <a name="Objective"></a><h2 class="nroffsh">Objective</h2> -<p class="level0">This document attempts to describe the general principles and some basic approaches to consider when programming with libcurl. The text will focus mainly on the C interface but might apply fairly well on other interfaces as well as they usually follow the C one pretty closely. -<p class="level0">This document will refer to 'the user' as the person writing the source code that uses libcurl. That would probably be you or someone in your position. What will be generally referred to as 'the program' will be the collected source code that you write that is using libcurl for transfers. The program is outside libcurl and libcurl is outside of the program. -<p class="level0">To get more details on all options and functions described herein, please refer to their respective man pages. -<p class="level0"><a name="Building"></a><h2 class="nroffsh">Building</h2> -<p class="level0">There are many different ways to build C programs. This chapter will assume a UNIX-style build process. If you use a different build system, you can still read this to get general information that may apply to your environment as well. -<p class="level0"><a name="Compiling"></a><span class="nroffip">Compiling the Program</span> -<p class="level1">Your compiler needs to know where the libcurl headers are located. Therefore you must set your compiler's include path to point to the directory where you installed them. The 'curl-config'[3] tool can be used to get this information: -<p class="level1">$ curl-config --cflags -<p class="level1"> -<p class="level0"><a name="Linking"></a><span class="nroffip">Linking the Program with libcurl</span> -<p class="level1">When having compiled the program, you need to link your object files to create a single executable. For that to succeed, you need to link with libcurl and possibly also with other libraries that libcurl itself depends on. Like the OpenSSL libraries, but even some standard OS libraries may be needed on the command line. To figure out which flags to use, once again the 'curl-config' tool comes to the rescue: -<p class="level1">$ curl-config --libs -<p class="level1"> -<p class="level0"><a name="SSL"></a><span class="nroffip">SSL or Not</span> -<p class="level1">libcurl can be built and customized in many ways. One of the things that varies from different libraries and builds is the support for SSL-based transfers, like HTTPS and FTPS. If a supported SSL library was detected properly at build-time, libcurl will be built with SSL support. To figure out if an installed libcurl has been built with SSL support enabled, use 'curl-config' like this: -<p class="level1">$ curl-config --feature -<p class="level1">And if SSL is supported, the keyword 'SSL' will be written to stdout, possibly together with a few other features that could be either on or off on for different libcurls. -<p class="level1">See also the "Features libcurl Provides" further down. -<p class="level0"><a name="autoconf"></a><span class="nroffip">autoconf macro</span> -<p class="level1">When you write your configure script to detect libcurl and setup variables accordingly, we offer a prewritten macro that probably does everything you need in this area. See docs/libcurl/libcurl.m4 file - it includes docs on how to use it. -<p class="level1"><a name="Portable"></a><h2 class="nroffsh">Portable Code in a Portable World</h2> -<p class="level0">The people behind libcurl have put a considerable effort to make libcurl work on a large amount of different operating systems and environments. -<p class="level0">You program libcurl the same way on all platforms that libcurl runs on. There are only very few minor considerations that differ. If you just make sure to write your code portable enough, you may very well create yourself a very portable program. libcurl shouldn't stop you from that. -<p class="level0"><a name="Global"></a><h2 class="nroffsh">Global Preparation</h2> -<p class="level0">The program must initialize some of the libcurl functionality globally. That means it should be done exactly once, no matter how many times you intend to use the library. Once for your program's entire life time. This is done using -<p class="level0"> curl_global_init() -<p class="level0">and it takes one parameter which is a bit pattern that tells libcurl what to initialize. Using <span Class="emphasis">CURL_GLOBAL_ALL</span> will make it initialize all known internal sub modules, and might be a good default option. The current two bits that are specified are: -<p class="level1"> -<p class="level0"><a name="CURLGLOBALWIN32"></a><span class="nroffip">CURL_GLOBAL_WIN32</span> -<p class="level1">which only does anything on Windows machines. When used on a Windows machine, it'll make libcurl initialize the win32 socket stuff. Without having that initialized properly, your program cannot use sockets properly. You should only do this once for each application, so if your program already does this or of another library in use does it, you should not tell libcurl to do this as well. -<p class="level0"><a name="CURLGLOBALSSL"></a><span class="nroffip">CURL_GLOBAL_SSL</span> -<p class="level1">which only does anything on libcurls compiled and built SSL-enabled. On these systems, this will make libcurl initialize the SSL library properly for this application. This only needs to be done once for each application so if your program or another library already does this, this bit should not be needed. -<p class="level0"> -<p class="level0">libcurl has a default protection mechanism that detects if <a class="emphasis" href="./curl_global_init.html">curl_global_init(3)</a> hasn't been called by the time <a class="emphasis" href="./curl_easy_perform.html">curl_easy_perform(3)</a> is called and if that is the case, libcurl runs the function itself with a guessed bit pattern. Please note that depending solely on this is not considered nice nor very good. -<p class="level0">When the program no longer uses libcurl, it should call <a class="emphasis" href="./curl_global_cleanup.html">curl_global_cleanup(3)</a>, which is the opposite of the init call. It will then do the reversed operations to cleanup the resources the <a class="emphasis" href="./curl_global_init.html">curl_global_init(3)</a> call initialized. -<p class="level0">Repeated calls to <a class="emphasis" href="./curl_global_init.html">curl_global_init(3)</a> and <a class="emphasis" href="./curl_global_cleanup.html">curl_global_cleanup(3)</a> should be avoided. They should only be called once each. -<p class="level0"><a name="Features"></a><h2 class="nroffsh">Features libcurl Provides</h2> -<p class="level0">It is considered best-practice to determine libcurl features at run-time rather than at build-time (if possible of course). By calling <a class="emphasis" href="./curl_version_info.html">curl_version_info(3)</a> and checking out the details of the returned struct, your program can figure out exactly what the currently running libcurl supports. -<p class="level0"><a name="Handle"></a><h2 class="nroffsh">Handle the Easy libcurl</h2> -<p class="level0">libcurl first introduced the so called easy interface. All operations in the easy interface are prefixed with 'curl_easy'. -<p class="level0">Recent libcurl versions also offer the multi interface. More about that interface, what it is targeted for and how to use it is detailed in a separate chapter further down. You still need to understand the easy interface first, so please continue reading for better understanding. -<p class="level0">To use the easy interface, you must first create yourself an easy handle. You need one handle for each easy session you want to perform. Basically, you should use one handle for every thread you plan to use for transferring. You must never share the same handle in multiple threads. -<p class="level0">Get an easy handle with -<p class="level0"> easyhandle = curl_easy_init(); -<p class="level0">It returns an easy handle. Using that you proceed to the next step: setting up your preferred actions. A handle is just a logic entity for the upcoming transfer or series of transfers. -<p class="level0">You set properties and options for this handle using <a class="emphasis" href="./curl_easy_setopt.html">curl_easy_setopt(3)</a>. They control how the subsequent transfer or transfers will be made. Options remain set in the handle until set again to something different. Alas, multiple requests using the same handle will use the same options. -<p class="level0">Many of the options you set in libcurl are "strings", pointers to data terminated with a zero byte. When you set strings with <a class="emphasis" href="./curl_easy_setopt.html">curl_easy_setopt(3)</a>, libcurl makes its own copy so that they don't need to be kept around in your application after being set[4]. -<p class="level0">One of the most basic properties to set in the handle is the URL. You set your preferred URL to transfer with CURLOPT_URL in a manner similar to: -<p class="level0"> -<p class="level0"> curl_easy_setopt(handle, CURLOPT_URL, "<a href="http://domain.com/">http://domain.com/</a>"); -<p class="level0"> -<p class="level0">Let's assume for a while that you want to receive data as the URL identifies a remote resource you want to get here. Since you write a sort of application that needs this transfer, I assume that you would like to get the data passed to you directly instead of simply getting it passed to stdout. So, you write your own function that matches this prototype: -<p class="level0"> size_t write_data(void *buffer, size_t size, size_t nmemb, void *userp); -<p class="level0">You tell libcurl to pass all data to this function by issuing a function similar to this: -<p class="level0"> curl_easy_setopt(easyhandle, CURLOPT_WRITEFUNCTION, write_data); -<p class="level0">You can control what data your callback function gets in the fourth argument by setting another property: -<p class="level0"> curl_easy_setopt(easyhandle, CURLOPT_WRITEDATA, &internal_struct); -<p class="level0">Using that property, you can easily pass local data between your application and the function that gets invoked by libcurl. libcurl itself won't touch the data you pass with <span Class="emphasis">CURLOPT_WRITEDATA</span>. -<p class="level0">libcurl offers its own default internal callback that will take care of the data if you don't set the callback with <span Class="emphasis">CURLOPT_WRITEFUNCTION</span>. It will then simply output the received data to stdout. You can have the default callback write the data to a different file handle by passing a 'FILE *' to a file opened for writing with the <span Class="emphasis">CURLOPT_WRITEDATA</span> option. -<p class="level0">Now, we need to take a step back and have a deep breath. Here's one of those rare platform-dependent nitpicks. Did you spot it? On some platforms[2], libcurl won't be able to operate on files opened by the program. Thus, if you use the default callback and pass in an open file with <span Class="emphasis">CURLOPT_WRITEDATA</span>, it will crash. You should therefore avoid this to make your program run fine virtually everywhere. -<p class="level0">(<span Class="emphasis">CURLOPT_WRITEDATA</span> was formerly known as <span Class="emphasis">CURLOPT_FILE</span>. Both names still work and do the same thing). -<p class="level0">If you're using libcurl as a win32 DLL, you MUST use the <span Class="emphasis">CURLOPT_WRITEFUNCTION</span> if you set <span Class="emphasis">CURLOPT_WRITEDATA</span> - or you will experience crashes. -<p class="level0">There are of course many more options you can set, and we'll get back to a few of them later. Let's instead continue to the actual transfer: -<p class="level0"> success = curl_easy_perform(easyhandle); -<p class="level0"><a class="emphasis" href="./curl_easy_perform.html">curl_easy_perform(3)</a> will connect to the remote site, do the necessary commands and receive the transfer. Whenever it receives data, it calls the callback function we previously set. The function may get one byte at a time, or it may get many kilobytes at once. libcurl delivers as much as possible as often as possible. Your callback function should return the number of bytes it "took care of". If that is not the exact same amount of bytes that was passed to it, libcurl will abort the operation and return with an error code. -<p class="level0">When the transfer is complete, the function returns a return code that informs you if it succeeded in its mission or not. If a return code isn't enough for you, you can use the CURLOPT_ERRORBUFFER to point libcurl to a buffer of yours where it'll store a human readable error message as well. -<p class="level0">If you then want to transfer another file, the handle is ready to be used again. Mind you, it is even preferred that you re-use an existing handle if you intend to make another transfer. libcurl will then attempt to re-use the previous connection. -<p class="level0">For some protocols, downloading a file can involve a complicated process of logging in, setting the transfer mode, changing the current directory and finally transferring the file data. libcurl takes care of all that complication for you. Given simply the URL to a file, libcurl will take care of all the details needed to get the file moved from one machine to another. -<p class="level0"><a name="Multi-threading"></a><h2 class="nroffsh">Multi-threading Issues</h2> -<p class="level0">The first basic rule is that you must <span Class="bold">never</span> simultaneously share a libcurl handle (be it easy or multi or whatever) between multiple threads. Only use one handle in one thread at any time. You can pass the handles around among threads, but you must never use a single handle from more than one thread at any given time. -<p class="level0">libcurl is completely thread safe, except for two issues: signals and SSL/TLS handlers. Signals are used for timing out name resolves (during DNS lookup) - when built without c-ares support and not on Windows. -<p class="level0">If you are accessing HTTPS or FTPS URLs in a multi-threaded manner, you are then of course using the underlying SSL library multi-threaded and those libs might have their own requirements on this issue. Basically, you need to provide one or two functions to allow it to function properly. For all details, see this: -<p class="level0">OpenSSL -<p class="level0"> <a href="http://www.openssl.org/docs/crypto/threads.html">http://www.openssl.org/docs/crypto/threads.html</a>#DESCRIPTION -<p class="level0">GnuTLS -<p class="level0"> <a href="http://www.gnu.org/software/gnutls/manual/html_node/">http://www.gnu.org/software/gnutls/manual/html_node/</a>Multi_002dthreaded-applications.html -<p class="level0">NSS -<p class="level0"> is claimed to be thread-safe already without anything required. -<p class="level0">PolarSSL -<p class="level0"> Required actions unknown. -<p class="level0">yassl -<p class="level0"> Required actions unknown. -<p class="level0">axTLS -<p class="level0"> Required actions unknown. -<p class="level0">When using multiple threads you should set the CURLOPT_NOSIGNAL option to 1 for all handles. Everything will or might work fine except that timeouts are not honored during the DNS lookup - which you can work around by building libcurl with c-ares support. c-ares is a library that provides asynchronous name resolves. On some platforms, libcurl simply will not function properly multi-threaded unless this option is set. -<p class="level0">Also, note that CURLOPT_DNS_USE_GLOBAL_CACHE is not thread-safe. -<p class="level0"><a name="When"></a><h2 class="nroffsh">When It Doesn't Work</h2> -<p class="level0">There will always be times when the transfer fails for some reason. You might have set the wrong libcurl option or misunderstood what the libcurl option actually does, or the remote server might return non-standard replies that confuse the library which then confuses your program. -<p class="level0">There's one golden rule when these things occur: set the CURLOPT_VERBOSE option to 1. It'll cause the library to spew out the entire protocol details it sends, some internal info and some received protocol data as well (especially when using FTP). If you're using HTTP, adding the headers in the received output to study is also a clever way to get a better understanding why the server behaves the way it does. Include headers in the normal body output with CURLOPT_HEADER set 1. -<p class="level0">Of course, there are bugs left. We need to know about them to be able to fix them, so we're quite dependent on your bug reports! When you do report suspected bugs in libcurl, please include as many details as you possibly can: a protocol dump that CURLOPT_VERBOSE produces, library version, as much as possible of your code that uses libcurl, operating system name and version, compiler name and version etc. -<p class="level0">If CURLOPT_VERBOSE is not enough, you increase the level of debug data your application receive by using the CURLOPT_DEBUGFUNCTION. -<p class="level0">Getting some in-depth knowledge about the protocols involved is never wrong, and if you're trying to do funny things, you might very well understand libcurl and how to use it better if you study the appropriate RFC documents at least briefly. -<p class="level0"><a name="Upload"></a><h2 class="nroffsh">Upload Data to a Remote Site</h2> -<p class="level0">libcurl tries to keep a protocol independent approach to most transfers, thus uploading to a remote FTP site is very similar to uploading data to a HTTP server with a PUT request. -<p class="level0">Of course, first you either create an easy handle or you re-use one existing one. Then you set the URL to operate on just like before. This is the remote URL, that we now will upload. -<p class="level0">Since we write an application, we most likely want libcurl to get the upload data by asking us for it. To make it do that, we set the read callback and the custom pointer libcurl will pass to our read callback. The read callback should have a prototype similar to: -<p class="level0"> size_t function(char *bufptr, size_t size, size_t nitems, void *userp); -<p class="level0">Where bufptr is the pointer to a buffer we fill in with data to upload and size*nitems is the size of the buffer and therefore also the maximum amount of data we can return to libcurl in this call. The 'userp' pointer is the custom pointer we set to point to a struct of ours to pass private data between the application and the callback. -<p class="level0"> curl_easy_setopt(easyhandle, CURLOPT_READFUNCTION, read_function); -<p class="level0"> curl_easy_setopt(easyhandle, CURLOPT_READDATA, &filedata); -<p class="level0">Tell libcurl that we want to upload: -<p class="level0"> curl_easy_setopt(easyhandle, CURLOPT_UPLOAD, 1L); -<p class="level0">A few protocols won't behave properly when uploads are done without any prior knowledge of the expected file size. So, set the upload file size using the CURLOPT_INFILESIZE_LARGE for all known file sizes like this[1]: -<p class="level0"> -<p class="level0"> /* in this example, file_size must be an curl_off_t variable */ curl_easy_setopt(easyhandle, CURLOPT_INFILESIZE_LARGE, file_size); -<p class="level0"> -<p class="level0">When you call <a class="emphasis" href="./curl_easy_perform.html">curl_easy_perform(3)</a> this time, it'll perform all the necessary operations and when it has invoked the upload it'll call your supplied callback to get the data to upload. The program should return as much data as possible in every invoke, as that is likely to make the upload perform as fast as possible. The callback should return the number of bytes it wrote in the buffer. Returning 0 will signal the end of the upload. -<p class="level0"><a name="Passwords"></a><h2 class="nroffsh">Passwords</h2> -<p class="level0">Many protocols use or even require that user name and password are provided to be able to download or upload the data of your choice. libcurl offers several ways to specify them. -<p class="level0">Most protocols support that you specify the name and password in the URL itself. libcurl will detect this and use them accordingly. This is written like this: -<p class="level0"> protocol://user:password@example.com/path/ -<p class="level0">If you need any odd letters in your user name or password, you should enter them URL encoded, as %XX where XX is a two-digit hexadecimal number. -<p class="level0">libcurl also provides options to set various passwords. The user name and password as shown embedded in the URL can instead get set with the CURLOPT_USERPWD option. The argument passed to libcurl should be a char * to a string in the format "user:password". In a manner like this: -<p class="level0"> curl_easy_setopt(easyhandle, CURLOPT_USERPWD, "myname:thesecret"); -<p class="level0">Another case where name and password might be needed at times, is for those users who need to authenticate themselves to a proxy they use. libcurl offers another option for this, the CURLOPT_PROXYUSERPWD. It is used quite similar to the CURLOPT_USERPWD option like this: -<p class="level0"> curl_easy_setopt(easyhandle, CURLOPT_PROXYUSERPWD, "myname:thesecret"); -<p class="level0">There's a long time UNIX "standard" way of storing ftp user names and passwords, namely in the $HOME/.netrc file. The file should be made private so that only the user may read it (see also the "Security Considerations" chapter), as it might contain the password in plain text. libcurl has the ability to use this file to figure out what set of user name and password to use for a particular host. As an extension to the normal functionality, libcurl also supports this file for non-FTP protocols such as HTTP. To make curl use this file, use the CURLOPT_NETRC option: -<p class="level0"> curl_easy_setopt(easyhandle, CURLOPT_NETRC, 1L); -<p class="level0">And a very basic example of how such a .netrc file may look like: -<p class="level0"> -<p class="level0"> machine myhost.mydomain.com login userlogin password secretword -<p class="level0"> -<p class="level0">All these examples have been cases where the password has been optional, or at least you could leave it out and have libcurl attempt to do its job without it. There are times when the password isn't optional, like when you're using an SSL private key for secure transfers. -<p class="level0">To pass the known private key password to libcurl: -<p class="level0"> curl_easy_setopt(easyhandle, CURLOPT_KEYPASSWD, "keypassword"); -<p class="level0"><a name="HTTP"></a><h2 class="nroffsh">HTTP Authentication</h2> -<p class="level0">The previous chapter showed how to set user name and password for getting URLs that require authentication. When using the HTTP protocol, there are many different ways a client can provide those credentials to the server and you can control which way libcurl will (attempt to) use them. The default HTTP authentication method is called 'Basic', which is sending the name and password in clear-text in the HTTP request, base64-encoded. This is insecure. -<p class="level0">At the time of this writing, libcurl can be built to use: Basic, Digest, NTLM, Negotiate, GSS-Negotiate and SPNEGO. You can tell libcurl which one to use with CURLOPT_HTTPAUTH as in: -<p class="level0"> curl_easy_setopt(easyhandle, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST); -<p class="level0">And when you send authentication to a proxy, you can also set authentication type the same way but instead with CURLOPT_PROXYAUTH: -<p class="level0"> curl_easy_setopt(easyhandle, CURLOPT_PROXYAUTH, CURLAUTH_NTLM); -<p class="level0">Both these options allow you to set multiple types (by ORing them together), to make libcurl pick the most secure one out of the types the server/proxy claims to support. This method does however add a round-trip since libcurl must first ask the server what it supports: -<p class="level0"> curl_easy_setopt(easyhandle, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST|CURLAUTH_BASIC); -<p class="level0">For convenience, you can use the 'CURLAUTH_ANY' define (instead of a list with specific types) which allows libcurl to use whatever method it wants. -<p class="level0">When asking for multiple types, libcurl will pick the available one it considers "best" in its own internal order of preference. -<p class="level0"><a name="HTTP"></a><h2 class="nroffsh">HTTP POSTing</h2> -<p class="level0">We get many questions regarding how to issue HTTP POSTs with libcurl the proper way. This chapter will thus include examples using both different versions of HTTP POST that libcurl supports. -<p class="level0">The first version is the simple POST, the most common version, that most HTML pages using the <form> tag uses. We provide a pointer to the data and tell libcurl to post it all to the remote site: -<p class="level0"> -<p class="level0"> char *data="name=daniel&project=curl"; curl_easy_setopt(easyhandle, CURLOPT_POSTFIELDS, data); curl_easy_setopt(easyhandle, CURLOPT_URL, "<a href="http://posthere.com/">http://posthere.com/</a>"); -<p class="level0"> curl_easy_perform(easyhandle); /* post away! */ -<p class="level0"> -<p class="level0">Simple enough, huh? Since you set the POST options with the CURLOPT_POSTFIELDS, this automatically switches the handle to use POST in the upcoming request. -<p class="level0">Ok, so what if you want to post binary data that also requires you to set the Content-Type: header of the post? Well, binary posts prevent libcurl from being able to do strlen() on the data to figure out the size, so therefore we must tell libcurl the size of the post data. Setting headers in libcurl requests are done in a generic way, by building a list of our own headers and then passing that list to libcurl. -<p class="level0"> -<p class="level0"> struct curl_slist *headers=NULL; headers = curl_slist_append(headers, "Content-Type: text/xml"); -<p class="level0"> /* post binary data */ curl_easy_setopt(easyhandle, CURLOPT_POSTFIELDS, binaryptr); -<p class="level0"> /* set the size of the postfields data */ curl_easy_setopt(easyhandle, CURLOPT_POSTFIELDSIZE, 23L); -<p class="level0"> /* pass our list of custom made headers */ curl_easy_setopt(easyhandle, CURLOPT_HTTPHEADER, headers); -<p class="level0"> curl_easy_perform(easyhandle); /* post away! */ -<p class="level0"> curl_slist_free_all(headers); /* free the header list */ -<p class="level0"> -<p class="level0">While the simple examples above cover the majority of all cases where HTTP POST operations are required, they don't do multi-part formposts. Multi-part formposts were introduced as a better way to post (possibly large) binary data and were first documented in the <a href="http://www.ietf.org/rfc/rfc1867.txt">RFC 1867</a> (updated in RFC2388). They're called multi-part because they're built by a chain of parts, each part being a single unit of data. Each part has its own name and contents. You can in fact create and post a multi-part formpost with the regular libcurl POST support described above, but that would require that you build a formpost yourself and provide to libcurl. To make that easier, libcurl provides <a class="emphasis" href="./curl_formadd.html">curl_formadd(3)</a>. Using this function, you add parts to the form. When you're done adding parts, you post the whole form. -<p class="level0">The following example sets two simple text parts with plain textual contents, and then a file with binary contents and uploads the whole thing. -<p class="level0"> -<p class="level0"> struct curl_httppost *post=NULL; struct curl_httppost *last=NULL; curl_formadd(&post, &last, CURLFORM_COPYNAME, "name", CURLFORM_COPYCONTENTS, "daniel", CURLFORM_END); curl_formadd(&post, &last, CURLFORM_COPYNAME, "project", CURLFORM_COPYCONTENTS, "curl", CURLFORM_END); curl_formadd(&post, &last, CURLFORM_COPYNAME, "logotype-image", CURLFORM_FILECONTENT, "curl.png", CURLFORM_END); -<p class="level0"> /* Set the form info */ curl_easy_setopt(easyhandle, CURLOPT_HTTPPOST, post); -<p class="level0"> curl_easy_perform(easyhandle); /* post away! */ -<p class="level0"> /* free the post data again */ curl_formfree(post); -<p class="level0"> -<p class="level0">Multipart formposts are chains of parts using MIME-style separators and headers. It means that each one of these separate parts get a few headers set that describe the individual content-type, size etc. To enable your application to handicraft this formpost even more, libcurl allows you to supply your own set of custom headers to such an individual form part. You can of course supply headers to as many parts as you like, but this little example will show how you set headers to one specific part when you add that to the post handle: -<p class="level0"> -<p class="level0"> struct curl_slist *headers=NULL; headers = curl_slist_append(headers, "Content-Type: text/xml"); -<p class="level0"> curl_formadd(&post, &last, CURLFORM_COPYNAME, "logotype-image", CURLFORM_FILECONTENT, "curl.xml", CURLFORM_CONTENTHEADER, headers, CURLFORM_END); -<p class="level0"> curl_easy_perform(easyhandle); /* post away! */ -<p class="level0"> curl_formfree(post); /* free post */ curl_slist_free_all(headers); /* free custom header list */ -<p class="level0"> -<p class="level0">Since all options on an easyhandle are "sticky", they remain the same until changed even if you do call <a class="emphasis" href="./curl_easy_perform.html">curl_easy_perform(3)</a>, you may need to tell curl to go back to a plain GET request if you intend to do one as your next request. You force an easyhandle to go back to GET by using the CURLOPT_HTTPGET option: -<p class="level0"> curl_easy_setopt(easyhandle, CURLOPT_HTTPGET, 1L); -<p class="level0">Just setting CURLOPT_POSTFIELDS to "" or NULL will *not* stop libcurl from doing a POST. It will just make it POST without any data to send! -<p class="level0"><a name="Showing"></a><h2 class="nroffsh">Showing Progress</h2> -<p class="level0"> -<p class="level0">For historical and traditional reasons, libcurl has a built-in progress meter that can be switched on and then makes it present a progress meter in your terminal. -<p class="level0">Switch on the progress meter by, oddly enough, setting CURLOPT_NOPROGRESS to zero. This option is set to 1 by default. -<p class="level0">For most applications however, the built-in progress meter is useless and what instead is interesting is the ability to specify a progress callback. The function pointer you pass to libcurl will then be called on irregular intervals with information about the current transfer. -<p class="level0">Set the progress callback by using CURLOPT_PROGRESSFUNCTION. And pass a pointer to a function that matches this prototype: -<p class="level0"> -<p class="level0"> int progress_callback(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow); -<p class="level0"> -<p class="level0">If any of the input arguments is unknown, a 0 will be passed. The first argument, the 'clientp' is the pointer you pass to libcurl with CURLOPT_PROGRESSDATA. libcurl won't touch it. -<p class="level0"><a name="libcurl"></a><h2 class="nroffsh">libcurl with C++</h2> -<p class="level0"> -<p class="level0">There's basically only one thing to keep in mind when using C++ instead of C when interfacing libcurl: -<p class="level0">The callbacks CANNOT be non-static class member functions -<p class="level0">Example C++ code: -<p class="level0"> -<p class="level0">class AClass { static size_t write_data(void *ptr, size_t size, size_t nmemb, void *ourpointer) { /* do what you want with the data */ } } -<p class="level0"> -<p class="level0"><a name="Proxies"></a><h2 class="nroffsh">Proxies</h2> -<p class="level0"> -<p class="level0">What "proxy" means according to Merriam-Webster: "a person authorized to act for another" but also "the agency, function, or office of a deputy who acts as a substitute for another". -<p class="level0">Proxies are exceedingly common these days. Companies often only offer Internet access to employees through their proxies. Network clients or user-agents ask the proxy for documents, the proxy does the actual request and then it returns them. -<p class="level0">libcurl supports SOCKS and HTTP proxies. When a given URL is wanted, libcurl will ask the proxy for it instead of trying to connect to the actual host identified in the URL. -<p class="level0">If you're using a SOCKS proxy, you may find that libcurl doesn't quite support all operations through it. -<p class="level0">For HTTP proxies: the fact that the proxy is a HTTP proxy puts certain restrictions on what can actually happen. A requested URL that might not be a HTTP URL will be still be passed to the HTTP proxy to deliver back to libcurl. This happens transparently, and an application may not need to know. I say "may", because at times it is very important to understand that all operations over a HTTP proxy use the HTTP protocol. For example, you can't invoke your own custom FTP commands or even proper FTP directory listings. -<p class="level0"> -<p class="level0"><a name="Proxy"></a><span class="nroffip">Proxy Options</span> -<p class="level1"> -<p class="level1">To tell libcurl to use a proxy at a given port number: -<p class="level1"> curl_easy_setopt(easyhandle, CURLOPT_PROXY, "proxy-host.com:8080"); -<p class="level1">Some proxies require user authentication before allowing a request, and you pass that information similar to this: -<p class="level1"> curl_easy_setopt(easyhandle, CURLOPT_PROXYUSERPWD, "user:password"); -<p class="level1">If you want to, you can specify the host name only in the CURLOPT_PROXY option, and set the port number separately with CURLOPT_PROXYPORT. -<p class="level1">Tell libcurl what kind of proxy it is with CURLOPT_PROXYTYPE (if not, it will default to assume a HTTP proxy): -<p class="level1"> curl_easy_setopt(easyhandle, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4); -<p class="level1"> -<p class="level0"><a name="Environment"></a><span class="nroffip">Environment Variables</span> -<p class="level1"> -<p class="level1">libcurl automatically checks and uses a set of environment variables to know what proxies to use for certain protocols. The names of the variables are following an ancient de facto standard and are built up as "[protocol]_proxy" (note the lower casing). Which makes the variable 'http_proxy' checked for a name of a proxy to use when the input URL is HTTP. Following the same rule, the variable named 'ftp_proxy' is checked for FTP URLs. Again, the proxies are always HTTP proxies, the different names of the variables simply allows different HTTP proxies to be used. -<p class="level1">The proxy environment variable contents should be in the format "[protocol://][user:password@]machine[:port]". Where the protocol:// part is simply ignored if present (so <a href="http://proxy">http://proxy</a> and bluerk://proxy will do the same) and the optional port number specifies on which port the proxy operates on the host. If not specified, the internal default port number will be used and that is most likely *not* the one you would like it to be. -<p class="level1">There are two special environment variables. 'all_proxy' is what sets proxy for any URL in case the protocol specific variable wasn't set, and 'no_proxy' defines a list of hosts that should not use a proxy even though a variable may say so. If 'no_proxy' is a plain asterisk ("*") it matches all hosts. -<p class="level1">To explicitly disable libcurl's checking for and using the proxy environment variables, set the proxy name to "" - an empty string - with CURLOPT_PROXY. -<p class="level0"><a name="SSL"></a><span class="nroffip">SSL and Proxies</span> -<p class="level1"> -<p class="level1">SSL is for secure point-to-point connections. This involves strong encryption and similar things, which effectively makes it impossible for a proxy to operate as a "man in between" which the proxy's task is, as previously discussed. Instead, the only way to have SSL work over a HTTP proxy is to ask the proxy to tunnel trough everything without being able to check or fiddle with the traffic. -<p class="level1">Opening an SSL connection over a HTTP proxy is therefor a matter of asking the proxy for a straight connection to the target host on a specified port. This is made with the HTTP request CONNECT. ("please mr proxy, connect me to that remote host"). -<p class="level1">Because of the nature of this operation, where the proxy has no idea what kind of data that is passed in and out through this tunnel, this breaks some of the very few advantages that come from using a proxy, such as caching. Many organizations prevent this kind of tunneling to other destination port numbers than 443 (which is the default HTTPS port number). -<p class="level1"> -<p class="level0"><a name="Tunneling"></a><span class="nroffip">Tunneling Through Proxy</span> -<p class="level1">As explained above, tunneling is required for SSL to work and often even restricted to the operation intended for SSL; HTTPS. -<p class="level1">This is however not the only time proxy-tunneling might offer benefits to you or your application. -<p class="level1">As tunneling opens a direct connection from your application to the remote machine, it suddenly also re-introduces the ability to do non-HTTP operations over a HTTP proxy. You can in fact use things such as FTP upload or FTP custom commands this way. -<p class="level1">Again, this is often prevented by the administrators of proxies and is rarely allowed. -<p class="level1">Tell libcurl to use proxy tunneling like this: -<p class="level1"> curl_easy_setopt(easyhandle, CURLOPT_HTTPPROXYTUNNEL, 1L); -<p class="level1">In fact, there might even be times when you want to do plain HTTP operations using a tunnel like this, as it then enables you to operate on the remote server instead of asking the proxy to do so. libcurl will not stand in the way for such innovative actions either! -<p class="level1"> -<p class="level0"><a name="Proxy"></a><span class="nroffip">Proxy Auto-Config</span> -<p class="level1"> -<p class="level1">Netscape first came up with this. It is basically a web page (usually using a .pac extension) with a Javascript that when executed by the browser with the requested URL as input, returns information to the browser on how to connect to the URL. The returned information might be "DIRECT" (which means no proxy should be used), "PROXY host:port" (to tell the browser where the proxy for this particular URL is) or "SOCKS host:port" (to direct the browser to a SOCKS proxy). -<p class="level1">libcurl has no means to interpret or evaluate Javascript and thus it doesn't support this. If you get yourself in a position where you face this nasty invention, the following advice have been mentioned and used in the past: -<p class="level1">- Depending on the Javascript complexity, write up a script that translates it to another language and execute that. -<p class="level1">- Read the Javascript code and rewrite the same logic in another language. -<p class="level1">- Implement a Javascript interpreter; people have successfully used the Mozilla Javascript engine in the past. -<p class="level1">- Ask your admins to stop this, for a static proxy setup or similar. -<p class="level1"><a name="Persistence"></a><h2 class="nroffsh">Persistence Is The Way to Happiness</h2> -<p class="level0"> -<p class="level0">Re-cycling the same easy handle several times when doing multiple requests is the way to go. -<p class="level0">After each single <a class="emphasis" href="./curl_easy_perform.html">curl_easy_perform(3)</a> operation, libcurl will keep the connection alive and open. A subsequent request using the same easy handle to the same host might just be able to use the already open connection! This reduces network impact a lot. -<p class="level0">Even if the connection is dropped, all connections involving SSL to the same host again, will benefit from libcurl's session ID cache that drastically reduces re-connection time. -<p class="level0">FTP connections that are kept alive save a lot of time, as the command- response round-trips are skipped, and also you don't risk getting blocked without permission to login again like on many FTP servers only allowing N persons to be logged in at the same time. -<p class="level0">libcurl caches DNS name resolving results, to make lookups of a previously looked up name a lot faster. -<p class="level0">Other interesting details that improve performance for subsequent requests may also be added in the future. -<p class="level0">Each easy handle will attempt to keep the last few connections alive for a while in case they are to be used again. You can set the size of this "cache" with the CURLOPT_MAXCONNECTS option. Default is 5. There is very seldom any point in changing this value, and if you think of changing this it is often just a matter of thinking again. -<p class="level0">To force your upcoming request to not use an already existing connection (it will even close one first if there happens to be one alive to the same host you're about to operate on), you can do that by setting CURLOPT_FRESH_CONNECT to 1. In a similar spirit, you can also forbid the upcoming request to be "lying" around and possibly get re-used after the request by setting CURLOPT_FORBID_REUSE to 1. -<p class="level0"><a name="HTTP"></a><h2 class="nroffsh">HTTP Headers Used by libcurl</h2> -<p class="level0">When you use libcurl to do HTTP requests, it'll pass along a series of headers automatically. It might be good for you to know and understand these. You can replace or remove them by using the CURLOPT_HTTPHEADER option. -<p class="level0"> -<p class="level0"><a name="Host"></a><span class="nroffip">Host</span> -<p class="level1">This header is required by HTTP 1.1 and even many 1.0 servers and should be the name of the server we want to talk to. This includes the port number if anything but default. -<p class="level1"> -<p class="level0"><a name="Accept"></a><span class="nroffip">Accept</span> -<p class="level1">"*/*". -<p class="level1"> -<p class="level0"><a name="Expect"></a><span class="nroffip">Expect</span> -<p class="level1">When doing POST requests, libcurl sets this header to "100-continue" to ask the server for an "OK" message before it proceeds with sending the data part of the post. If the POSTed data amount is deemed "small", libcurl will not use this header. -<p class="level1"><a name="Customizing"></a><h2 class="nroffsh">Customizing Operations</h2> -<p class="level0">There is an ongoing development today where more and more protocols are built upon HTTP for transport. This has obvious benefits as HTTP is a tested and reliable protocol that is widely deployed and has excellent proxy-support. -<p class="level0">When you use one of these protocols, and even when doing other kinds of programming you may need to change the traditional HTTP (or FTP or...) manners. You may need to change words, headers or various data. -<p class="level0">libcurl is your friend here too. -<p class="level0"> -<p class="level0"><a name="CUSTOMREQUEST"></a><span class="nroffip">CUSTOMREQUEST</span> -<p class="level1">If just changing the actual HTTP request keyword is what you want, like when GET, HEAD or POST is not good enough for you, CURLOPT_CUSTOMREQUEST is there for you. It is very simple to use: -<p class="level1"> curl_easy_setopt(easyhandle, CURLOPT_CUSTOMREQUEST, "MYOWNREQUEST"); -<p class="level1">When using the custom request, you change the request keyword of the actual request you are performing. Thus, by default you make a GET request but you can also make a POST operation (as described before) and then replace the POST keyword if you want to. You're the boss. -<p class="level1"> -<p class="level0"><a name="Modify"></a><span class="nroffip">Modify Headers</span> -<p class="level1">HTTP-like protocols pass a series of headers to the server when doing the request, and you're free to pass any amount of extra headers that you think fit. Adding headers is this easy: -<p class="level1"> -<p class="level1"> struct curl_slist *headers=NULL; /* init to NULL is important */ -<p class="level1"> headers = curl_slist_append(headers, "Hey-server-hey: how are you?"); headers = curl_slist_append(headers, "X-silly-content: yes"); -<p class="level1"> /* pass our list of custom made headers */ curl_easy_setopt(easyhandle, CURLOPT_HTTPHEADER, headers); -<p class="level1"> curl_easy_perform(easyhandle); /* transfer http */ -<p class="level1"> curl_slist_free_all(headers); /* free the header list */ -<p class="level1"> -<p class="level1">... and if you think some of the internally generated headers, such as Accept: or Host: don't contain the data you want them to contain, you can replace them by simply setting them too: -<p class="level1"> -<p class="level1"> headers = curl_slist_append(headers, "Accept: Agent-007"); headers = curl_slist_append(headers, "Host: munged.host.line"); -<p class="level1"> -<p class="level1"> -<p class="level0"><a name="Delete"></a><span class="nroffip">Delete Headers</span> -<p class="level1">If you replace an existing header with one with no contents, you will prevent the header from being sent. For instance, if you want to completely prevent the "Accept:" header from being sent, you can disable it with code similar to this: -<p class="level1"> headers = curl_slist_append(headers, "Accept:"); -<p class="level1">Both replacing and canceling internal headers should be done with careful consideration and you should be aware that you may violate the HTTP protocol when doing so. -<p class="level1"> -<p class="level0"><a name="Enforcing"></a><span class="nroffip">Enforcing chunked transfer-encoding</span> -<p class="level1"> -<p class="level1">By making sure a request uses the custom header "Transfer-Encoding: chunked" when doing a non-GET HTTP operation, libcurl will switch over to "chunked" upload, even though the size of the data to upload might be known. By default, libcurl usually switches over to chunked upload automatically if the upload data size is unknown. -<p class="level1"> -<p class="level0"><a name="HTTP"></a><span class="nroffip">HTTP Version</span> -<p class="level1"> -<p class="level1">All HTTP requests includes the version number to tell the server which version we support. libcurl speaks HTTP 1.1 by default. Some very old servers don't like getting 1.1-requests and when dealing with stubborn old things like that, you can tell libcurl to use 1.0 instead by doing something like this: -<p class="level1"> curl_easy_setopt(easyhandle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); -<p class="level1"> -<p class="level0"><a name="FTP"></a><span class="nroffip">FTP Custom Commands</span> -<p class="level1"> -<p class="level1">Not all protocols are HTTP-like, and thus the above may not help you when you want to make, for example, your FTP transfers to behave differently. -<p class="level1">Sending custom commands to a FTP server means that you need to send the commands exactly as the FTP server expects them (<a href="http://www.ietf.org/rfc/rfc959.txt">RFC 959</a> is a good guide here), and you can only use commands that work on the control-connection alone. All kinds of commands that require data interchange and thus need a data-connection must be left to libcurl's own judgement. Also be aware that libcurl will do its very best to change directory to the target directory before doing any transfer, so if you change directory (with CWD or similar) you might confuse libcurl and then it might not attempt to transfer the file in the correct remote directory. -<p class="level1">A little example that deletes a given file before an operation: -<p class="level1"> -<p class="level1"> headers = curl_slist_append(headers, "DELE file-to-remove"); -<p class="level1"> /* pass the list of custom commands to the handle */ curl_easy_setopt(easyhandle, CURLOPT_QUOTE, headers); -<p class="level1"> curl_easy_perform(easyhandle); /* transfer ftp data! */ -<p class="level1"> curl_slist_free_all(headers); /* free the header list */ -<p class="level1"> -<p class="level1">If you would instead want this operation (or chain of operations) to happen _after_ the data transfer took place the option to <a class="emphasis" href="./curl_easy_setopt.html">curl_easy_setopt(3)</a> would instead be called CURLOPT_POSTQUOTE and used the exact same way. -<p class="level1">The custom FTP command will be issued to the server in the same order they are added to the list, and if a command gets an error code returned back from the server, no more commands will be issued and libcurl will bail out with an error code (CURLE_QUOTE_ERROR). Note that if you use CURLOPT_QUOTE to send commands before a transfer, no transfer will actually take place when a quote command has failed. -<p class="level1">If you set the CURLOPT_HEADER to 1, you will tell libcurl to get information about the target file and output "headers" about it. The headers will be in "HTTP-style", looking like they do in HTTP. -<p class="level1">The option to enable headers or to run custom FTP commands may be useful to combine with CURLOPT_NOBODY. If this option is set, no actual file content transfer will be performed. -<p class="level1"> -<p class="level0"><a name="FTP"></a><span class="nroffip">FTP Custom CUSTOMREQUEST</span> -<p class="level1">If you do want to list the contents of a FTP directory using your own defined FTP command, CURLOPT_CUSTOMREQUEST will do just that. "NLST" is the default one for listing directories but you're free to pass in your idea of a good alternative. -<p class="level1"><a name="Cookies"></a><h2 class="nroffsh">Cookies Without Chocolate Chips</h2> -<p class="level0">In the HTTP sense, a cookie is a name with an associated value. A server sends the name and value to the client, and expects it to get sent back on every subsequent request to the server that matches the particular conditions set. The conditions include that the domain name and path match and that the cookie hasn't become too old. -<p class="level0">In real-world cases, servers send new cookies to replace existing ones to update them. Server use cookies to "track" users and to keep "sessions". -<p class="level0">Cookies are sent from server to clients with the header Set-Cookie: and they're sent from clients to servers with the Cookie: header. -<p class="level0">To just send whatever cookie you want to a server, you can use CURLOPT_COOKIE to set a cookie string like this: -<p class="level0"> curl_easy_setopt(easyhandle, CURLOPT_COOKIE, "name1=var1; name2=var2;"); -<p class="level0">In many cases, that is not enough. You might want to dynamically save whatever cookies the remote server passes to you, and make sure those cookies are then used accordingly on later requests. -<p class="level0">One way to do this, is to save all headers you receive in a plain file and when you make a request, you tell libcurl to read the previous headers to figure out which cookies to use. Set the header file to read cookies from with CURLOPT_COOKIEFILE. -<p class="level0">The CURLOPT_COOKIEFILE option also automatically enables the cookie parser in libcurl. Until the cookie parser is enabled, libcurl will not parse or understand incoming cookies and they will just be ignored. However, when the parser is enabled the cookies will be understood and the cookies will be kept in memory and used properly in subsequent requests when the same handle is used. Many times this is enough, and you may not have to save the cookies to disk at all. Note that the file you specify to CURLOPT_COOKIEFILE doesn't have to exist to enable the parser, so a common way to just enable the parser and not read any cookies is to use the name of a file you know doesn't exist. -<p class="level0">If you would rather use existing cookies that you've previously received with your Netscape or Mozilla browsers, you can make libcurl use that cookie file as input. The CURLOPT_COOKIEFILE is used for that too, as libcurl will automatically find out what kind of file it is and act accordingly. -<p class="level0">Perhaps the most advanced cookie operation libcurl offers, is saving the entire internal cookie state back into a Netscape/Mozilla formatted cookie file. We call that the cookie-jar. When you set a file name with CURLOPT_COOKIEJAR, that file name will be created and all received cookies will be stored in it when <a class="emphasis" href="./curl_easy_cleanup.html">curl_easy_cleanup(3)</a> is called. This enables cookies to get passed on properly between multiple handles without any information getting lost. -<p class="level0"><a name="FTP"></a><h2 class="nroffsh">FTP Peculiarities We Need</h2> -<p class="level0"> -<p class="level0">FTP transfers use a second TCP/IP connection for the data transfer. This is usually a fact you can forget and ignore but at times this fact will come back to haunt you. libcurl offers several different ways to customize how the second connection is being made. -<p class="level0">libcurl can either connect to the server a second time or tell the server to connect back to it. The first option is the default and it is also what works best for all the people behind firewalls, NATs or IP-masquerading setups. libcurl then tells the server to open up a new port and wait for a second connection. This is by default attempted with EPSV first, and if that doesn't work it tries PASV instead. (EPSV is an extension to the original FTP spec and does not exist nor work on all FTP servers.) -<p class="level0">You can prevent libcurl from first trying the EPSV command by setting CURLOPT_FTP_USE_EPSV to zero. -<p class="level0">In some cases, you will prefer to have the server connect back to you for the second connection. This might be when the server is perhaps behind a firewall or something and only allows connections on a single port. libcurl then informs the remote server which IP address and port number to connect to. This is made with the CURLOPT_FTPPORT option. If you set it to "-", libcurl will use your system's "default IP address". If you want to use a particular IP, you can set the full IP address, a host name to resolve to an IP address or even a local network interface name that libcurl will get the IP address from. -<p class="level0">When doing the "PORT" approach, libcurl will attempt to use the EPRT and the LPRT before trying PORT, as they work with more protocols. You can disable this behavior by setting CURLOPT_FTP_USE_EPRT to zero. -<p class="level0"><a name="Headers"></a><h2 class="nroffsh">Headers Equal Fun</h2> -<p class="level0"> -<p class="level0">Some protocols provide "headers", meta-data separated from the normal data. These headers are by default not included in the normal data stream, but you can make them appear in the data stream by setting CURLOPT_HEADER to 1. -<p class="level0">What might be even more useful, is libcurl's ability to separate the headers from the data and thus make the callbacks differ. You can for example set a different pointer to pass to the ordinary write callback by setting CURLOPT_WRITEHEADER. -<p class="level0">Or, you can set an entirely separate function to receive the headers, by using CURLOPT_HEADERFUNCTION. -<p class="level0">The headers are passed to the callback function one by one, and you can depend on that fact. It makes it easier for you to add custom header parsers etc. -<p class="level0">"Headers" for FTP transfers equal all the FTP server responses. They aren't actually true headers, but in this case we pretend they are! ;-) -<p class="level0"><a name="Post"></a><h2 class="nroffsh">Post Transfer Information</h2> -<p class="level0"> -<p class="level0"> [ curl_easy_getinfo ] -<p class="level0"><a name="Security"></a><h2 class="nroffsh">Security Considerations</h2> -<p class="level0"> -<p class="level0">The libcurl project takes security seriously. The library is written with caution and precautions are taken to mitigate many kinds of risks encountered while operating with potentially malicious servers on the Internet. It is a powerful library, however, which allows application writers to make trade offs between ease of writing and exposure to potential risky operations. If used the right way, you can use libcurl to transfer data pretty safely. -<p class="level0">Many applications are used in closed networks where users and servers can be trusted, but many others are used on arbitrary servers and are fed input from potentially untrusted users. Following is a discussion about some risks in the ways in which applications commonly use libcurl and potential mitigations of those risks. It is by no means comprehensive, but shows classes of attacks that robust applications should consider. The Common Weakness Enumeration project at <a href="http://cwe.mitre.org/">http://cwe.mitre.org/</a> is a good reference for many of these and similar types of weaknesses of which application writers should be aware. -<p class="level0"> -<p class="level0"><a name="Command"></a><span class="nroffip">Command Lines</span> -<p class="level1">If you use a command line tool (such as curl) that uses libcurl, and you give options to the tool on the command line those options can very likely get read by other users of your system when they use 'ps' or other tools to list currently running processes. -<p class="level1">To avoid this problem, never feed sensitive things to programs using command line options. Write them to a protected file and use the -K option to avoid this. -<p class="level1"> -<p class="level0"><a name="netrc"></a><span class="nroffip">.netrc</span> -<p class="level1">.netrc is a pretty handy file/feature that allows you to login quickly and automatically to frequently visited sites. The file contains passwords in clear text and is a real security risk. In some cases, your .netrc is also stored in a home directory that is NFS mounted or used on another network based file system, so the clear text password will fly through your network every time anyone reads that file! -<p class="level1">To avoid this problem, don't use .netrc files and never store passwords in plain text anywhere. -<p class="level1"> -<p class="level0"><a name="Clear"></a><span class="nroffip">Clear Text Passwords</span> -<p class="level1">Many of the protocols libcurl supports send name and password unencrypted as clear text (HTTP Basic authentication, FTP, TELNET etc). It is very easy for anyone on your network or a network nearby yours to just fire up a network analyzer tool and eavesdrop on your passwords. Don't let the fact that HTTP Basic uses base64 encoded passwords fool you. They may not look readable at a first glance, but they very easily "deciphered" by anyone within seconds. -<p class="level1">To avoid this problem, use HTTP authentication methods or other protocols that don't let snoopers see your password: HTTP with Digest, NTLM or GSS authentication, HTTPS, FTPS, SCP, SFTP and FTP-Kerberos are a few examples. -<p class="level1"> -<p class="level0"><a name="Redirects"></a><span class="nroffip">Redirects</span> -<p class="level1">The CURLOPT_FOLLOWLOCATION option automatically follows HTTP redirects sent by a remote server. These redirects can refer to any kind of URL, not just HTTP. A redirect to a file: URL would cause the libcurl to read (or write) arbitrary files from the local filesystem. If the application returns the data back to the user (as would happen in some kinds of CGI scripts), an attacker could leverage this to read otherwise forbidden data (e.g. file://localhost/etc/passwd). -<p class="level1">If authentication credentials are stored in the ~/.netrc file, or Kerberos is in use, any other URL type (not just file:) that requires authentication is also at risk. A redirect such as <a href="ftp://some-internal-server/private-file">ftp://some-internal-server/private-file</a> would then return data even when the server is password protected. -<p class="level1">In the same way, if an unencrypted SSH private key has been configured for the user running the libcurl application, SCP: or SFTP: URLs could access password or private-key protected resources, e.g. s<a href="ftp://user">ftp://user</a>@some-internal-server/etc/passwd -<p class="level1">The CURLOPT_REDIR_PROTOCOLS and CURLOPT_NETRC options can be used to mitigate against this kind of attack. -<p class="level1">A redirect can also specify a location available only on the machine running libcurl, including servers hidden behind a firewall from the attacker. e.g. <a href="http://127.0.0.1/">http://127.0.0.1/</a> or <a href="http://intranet/delete-stuff.cgi">http://intranet/delete-stuff.cgi</a>?delete=all or t<a href="ftp://bootp-server/pc-config-data">ftp://bootp-server/pc-config-data</a> -<p class="level1">Apps can mitigate against this by disabling CURLOPT_FOLLOWLOCATION and handling redirects itself, sanitizing URLs as necessary. Alternately, an app could leave CURLOPT_FOLLOWLOCATION enabled but set CURLOPT_REDIR_PROTOCOLS and install a CURLOPT_OPENSOCKETFUNCTION callback function in which addresses are sanitized before use. -<p class="level1"> -<p class="level0"><a name="Private"></a><span class="nroffip">Private Resources</span> -<p class="level1">A user who can control the DNS server of a domain being passed in within a URL can change the address of the host to a local, private address which the libcurl application will then use. e.g. The innocuous URL <a href="http://fuzzybunnies.example.com/">http://fuzzybunnies.example.com/</a> could actually resolve to the IP address of a server behind a firewall, such as 127.0.0.1 or 10.1.2.3 Apps can mitigate against this by setting a CURLOPT_OPENSOCKETFUNCTION and checking the address before a connection. -<p class="level1">All the malicious scenarios regarding redirected URLs apply just as well to non-redirected URLs, if the user is allowed to specify an arbitrary URL that could point to a private resource. For example, a web app providing a translation service might happily translate file://localhost/etc/passwd and display the result. Apps can mitigate against this with the CURLOPT_PROTOCOLS option as well as by similar mitigation techniques for redirections. -<p class="level1">A malicious FTP server could in response to the PASV command return an IP address and port number for a server local to the app running libcurl but behind a firewall. Apps can mitigate against this by using the CURLOPT_FTP_SKIP_PASV_IP option or CURLOPT_FTPPORT. -<p class="level1"> -<p class="level0"><a name="Uploads"></a><span class="nroffip">Uploads</span> -<p class="level1">When uploading, a redirect can cause a local (or remote) file to be overwritten. Apps must not allow any unsanitized URL to be passed in for uploads. Also, CURLOPT_FOLLOWLOCATION should not be used on uploads. Instead, the app should handle redirects itself, sanitizing each URL first. -<p class="level1"> -<p class="level0"><a name="Authentication"></a><span class="nroffip">Authentication</span> -<p class="level1">Use of CURLOPT_UNRESTRICTED_AUTH could cause authentication information to be sent to an unknown second server. Apps can mitigate against this by disabling CURLOPT_FOLLOWLOCATION and handling redirects itself, sanitizing where necessary. -<p class="level1">Use of the CURLAUTH_ANY option to CURLOPT_HTTPAUTH could result in user name and password being sent in clear text to an HTTP server. Instead, use CURLAUTH_ANYSAFE which ensures that the password is encrypted over the network, or else fail the request. -<p class="level1">Use of the CURLUSESSL_TRY option to CURLOPT_USE_SSL could result in user name and password being sent in clear text to an FTP server. Instead, use CURLUSESSL_CONTROL to ensure that an encrypted connection is used or else fail the request. -<p class="level1"> -<p class="level0"><a name="Cookies"></a><span class="nroffip">Cookies</span> -<p class="level1">If cookies are enabled and cached, then a user could craft a URL which performs some malicious action to a site whose authentication is already stored in a cookie. e.g. <a href="http://mail.example.com/delete-stuff.cgi">http://mail.example.com/delete-stuff.cgi</a>?delete=all Apps can mitigate against this by disabling cookies or clearing them between requests. -<p class="level1"> -<p class="level0"><a name="Dangerous"></a><span class="nroffip">Dangerous URLs</span> -<p class="level1">SCP URLs can contain raw commands within the scp: URL, which is a side effect of how the SCP protocol is designed. e.g. scp://user:pass@host/a;date >/tmp/test; Apps must not allow unsanitized SCP: URLs to be passed in for downloads. -<p class="level1"> -<p class="level0"><a name="Denial"></a><span class="nroffip">Denial of Service</span> -<p class="level1">A malicious server could cause libcurl to effectively hang by sending a trickle of data through, or even no data at all but just keeping the TCP connection open. This could result in a denial-of-service attack. The CURLOPT_TIMEOUT and/or CURLOPT_LOW_SPEED_LIMIT options can be used to mitigate against this. -<p class="level1">A malicious server could cause libcurl to effectively hang by starting to send data, then severing the connection without cleanly closing the TCP connection. The app could install a CURLOPT_SOCKOPTFUNCTION callback function and set the TCP SO_KEEPALIVE option to mitigate against this. Setting one of the timeout options would also work against this attack. -<p class="level1">A malicious server could cause libcurl to download an infinite amount of data, potentially causing all of memory or disk to be filled. Setting the CURLOPT_MAXFILESIZE_LARGE option is not sufficient to guard against this. Instead, the app should monitor the amount of data received within the write or progress callback and abort once the limit is reached. -<p class="level1">A malicious HTTP server could cause an infinite redirection loop, causing a denial-of-service. This can be mitigated by using the CURLOPT_MAXREDIRS option. -<p class="level1"> -<p class="level0"><a name="Arbitrary"></a><span class="nroffip">Arbitrary Headers</span> -<p class="level1">User-supplied data must be sanitized when used in options like CURLOPT_USERAGENT, CURLOPT_HTTPHEADER, CURLOPT_POSTFIELDS and others that are used to generate structured data. Characters like embedded carriage returns or ampersands could allow the user to create additional headers or fields that could cause malicious transactions. -<p class="level1"> -<p class="level0"><a name="Server-supplied"></a><span class="nroffip">Server-supplied Names</span> -<p class="level1">A server can supply data which the application may, in some cases, use as a file name. The curl command-line tool does this with --remote-header-name, using the Content-disposition: header to generate a file name. An application could also use CURLINFO_EFFECTIVE_URL to generate a file name from a server-supplied redirect URL. Special care must be taken to sanitize such names to avoid the possibility of a malicious server supplying one like "/etc/passwd", "autoexec.bat" or even ".bashrc". -<p class="level1"> -<p class="level0"><a name="Server"></a><span class="nroffip">Server Certificates</span> -<p class="level1">A secure application should never use the CURLOPT_SSL_VERIFYPEER option to disable certificate validation. There are numerous attacks that are enabled by apps that fail to properly validate server TLS/SSL certificates, thus enabling a malicious server to spoof a legitimate one. HTTPS without validated certificates is potentially as insecure as a plain HTTP connection. -<p class="level1"> -<p class="level0"><a name="Showing"></a><span class="nroffip">Showing What You Do</span> -<p class="level1">On a related issue, be aware that even in situations like when you have problems with libcurl and ask someone for help, everything you reveal in order to get best possible help might also impose certain security related risks. Host names, user names, paths, operating system specifics, etc (not to mention passwords of course) may in fact be used by intruders to gain additional information of a potential target. -<p class="level1">To avoid this problem, you must of course use your common sense. Often, you can just edit out the sensitive data or just search/replace your true information with faked data. -<p class="level1"><a name="Multiple"></a><h2 class="nroffsh">Multiple Transfers Using the multi Interface</h2> -<p class="level0"> -<p class="level0">The easy interface as described in detail in this document is a synchronous interface that transfers one file at a time and doesn't return until it is done. -<p class="level0">The multi interface, on the other hand, allows your program to transfer multiple files in both directions at the same time, without forcing you to use multiple threads. The name might make it seem that the multi interface is for multi-threaded programs, but the truth is almost the reverse. The multi interface can allow a single-threaded application to perform the same kinds of multiple, simultaneous transfers that multi-threaded programs can perform. It allows many of the benefits of multi-threaded transfers without the complexity of managing and synchronizing many threads. -<p class="level0">To use this interface, you are better off if you first understand the basics of how to use the easy interface. The multi interface is simply a way to make multiple transfers at the same time by adding up multiple easy handles into a "multi stack". -<p class="level0">You create the easy handles you want and you set all the options just like you have been told above, and then you create a multi handle with <a class="emphasis" href="./curl_multi_init.html">curl_multi_init(3)</a> and add all those easy handles to that multi handle with <a class="emphasis" href="./curl_multi_add_handle.html">curl_multi_add_handle(3)</a>. -<p class="level0">When you've added the handles you have for the moment (you can still add new ones at any time), you start the transfers by calling <a class="emphasis" href="./curl_multi_perform.html">curl_multi_perform(3)</a>. -<p class="level0"><a class="emphasis" href="./curl_multi_perform.html">curl_multi_perform(3)</a> is asynchronous. It will only execute as little as possible and then return back control to your program. It is designed to never block. -<p class="level0">The best usage of this interface is when you do a select() on all possible file descriptors or sockets to know when to call libcurl again. This also makes it easy for you to wait and respond to actions on your own application's sockets/handles. You figure out what to select() for by using <a class="emphasis" href="./curl_multi_fdset.html">curl_multi_fdset(3)</a>, that fills in a set of fd_set variables for you with the particular file descriptors libcurl uses for the moment. -<p class="level0">When you then call select(), it'll return when one of the file handles signal action and you then call <a class="emphasis" href="./curl_multi_perform.html">curl_multi_perform(3)</a> to allow libcurl to do what it wants to do. Take note that libcurl does also feature some time-out code so we advise you to never use very long timeouts on select() before you call <a class="emphasis" href="./curl_multi_perform.html">curl_multi_perform(3)</a>, which thus should be called unconditionally every now and then even if none of its file descriptors have signaled ready. Another precaution you should use: always call <a class="emphasis" href="./curl_multi_fdset.html">curl_multi_fdset(3)</a> immediately before the select() call since the current set of file descriptors may change when calling a curl function. -<p class="level0">If you want to stop the transfer of one of the easy handles in the stack, you can use <a class="emphasis" href="./curl_multi_remove_handle.html">curl_multi_remove_handle(3)</a> to remove individual easy handles. Remember that easy handles should be <a class="emphasis" href="./curl_easy_cleanup.html">curl_easy_cleanup(3)</a>ed. -<p class="level0">When a transfer within the multi stack has finished, the counter of running transfers (as filled in by <a class="emphasis" href="./curl_multi_perform.html">curl_multi_perform(3)</a>) will decrease. When the number reaches zero, all transfers are done. -<p class="level0"><a class="emphasis" href="./curl_multi_info_read.html">curl_multi_info_read(3)</a> can be used to get information about completed transfers. It then returns the CURLcode for each easy transfer, to allow you to figure out success on each individual transfer. -<p class="level0"><a name="SSL"></a><h2 class="nroffsh">SSL, Certificates and Other Tricks</h2> -<p class="level0"> -<p class="level0"> [ seeding, passwords, keys, certificates, ENGINE, ca certs ] -<p class="level0"><a name="Sharing"></a><h2 class="nroffsh">Sharing Data Between Easy Handles</h2> -<p class="level0">You can share some data between easy handles when the easy interface is used, and some data is share automatically when you use the multi interface. -<p class="level0">When you add easy handles to a multi handle, these easy handles will automatically share a lot of the data that otherwise would be kept on a per-easy handle basis when the easy interface is used. -<p class="level0">The DNS cache is shared between handles within a multi handle, making subsequent name resolvings faster and the connection pool that is kept to better allow persistent connections and connection re-use is shared. If you're using the easy interface, you can still share these between specific easy handles by using the share interface, see <span Class="emphasis">libcurl-share(3)</span>. -<p class="level0">Some things are never shared automatically, not within multi handles, like for example cookies so the only way to share that is with the share interface. <a name="Footnotes"></a><h2 class="nroffsh">Footnotes</h2> -<p class="level0"> -<p class="level0"> -<p class="level0"><a name="1"></a><span class="nroffip">[1]</span> -<p class="level1">libcurl 7.10.3 and later have the ability to switch over to chunked Transfer-Encoding in cases where HTTP uploads are done with data of an unknown size. -<p class="level0"><a name="2"></a><span class="nroffip">[2]</span> -<p class="level1">This happens on Windows machines when libcurl is built and used as a DLL. However, you can still do this on Windows if you link with a static library. -<p class="level0"><a name="3"></a><span class="nroffip">[3]</span> -<p class="level1">The curl-config tool is generated at build-time (on UNIX-like systems) and should be installed with the 'make install' or similar instruction that installs the library, header files, man pages etc. -<p class="level0"><a name="4"></a><span class="nroffip">[4]</span> -<p class="level1">This behavior was different in versions before 7.17.0, where strings had to remain valid past the end of the <a class="emphasis" href="./curl_easy_setopt.html">curl_easy_setopt(3)</a> call. <p class="roffit"> - This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>. -</body></html> diff --git a/plugins/FTPFileYM/curl/docs/libcurl/libcurl-tutorial.pdf b/plugins/FTPFileYM/curl/docs/libcurl/libcurl-tutorial.pdf Binary files differdeleted file mode 100644 index e936b27ff7..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/libcurl-tutorial.pdf +++ /dev/null diff --git a/plugins/FTPFileYM/curl/docs/libcurl/libcurl.3 b/plugins/FTPFileYM/curl/docs/libcurl/libcurl.3 deleted file mode 100644 index d2dcd78388..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/libcurl.3 +++ /dev/null @@ -1,222 +0,0 @@ -.\" ************************************************************************** -.\" * _ _ ____ _ -.\" * Project ___| | | | _ \| | -.\" * / __| | | | |_) | | -.\" * | (__| |_| | _ <| |___ -.\" * \___|\___/|_| \_\_____| -.\" * -.\" * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. -.\" * -.\" * This software is licensed as described in the file COPYING, which -.\" * you should have received as part of this distribution. The terms -.\" * are also available at http://curl.haxx.se/docs/copyright.html. -.\" * -.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell -.\" * copies of the Software, and permit persons to whom the Software is -.\" * furnished to do so, under the terms of the COPYING file. -.\" * -.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -.\" * KIND, either express or implied. -.\" * -.\" ************************************************************************** -.TH libcurl 3 "19 March 2002" "libcurl 7.9.6" "libcurl overview" -.SH NAME -libcurl \- client-side URL transfers -.SH DESCRIPTION -This is a short overview on how to use libcurl in your C programs. There are -specific man pages for each function mentioned in here. There are also the -\fIlibcurl-easy(3)\fP man page, the \fIlibcurl-multi(3)\fP man page, the -\fIlibcurl-share(3)\fP man page and the \fIlibcurl-tutorial(3)\fP man page for -in-depth understanding on how to program with libcurl. - -There are more than thirty custom bindings available that bring libcurl access -to your favourite language. Look elsewhere for documentation on those. - -libcurl has a global constant environment that you must set up and -maintain while using libcurl. This essentially means you call -\fIcurl_global_init(3)\fP at the start of your program and -\fIcurl_global_cleanup(3)\fP at the end. See GLOBAL CONSTANTS below -for details. - -To transfer files, you always set up an "easy handle" using -\fIcurl_easy_init(3)\fP, but when you want the file(s) transferred you have -the option of using the "easy" interface, or the "multi" interface. - -The easy interface is a synchronous interface with which you call -\fIcurl_easy_perform(3)\fP and let it perform the transfer. When it is -completed, the function returns and you can continue. More details are found in -the \fIlibcurl-easy(3)\fP man page. - -The multi interface on the other hand is an asynchronous interface, that you -call and that performs only a little piece of the transfer on each invoke. It -is perfect if you want to do things while the transfer is in progress, or -similar. The multi interface allows you to select() on libcurl action, and -even to easily download multiple files simultaneously using a single thread. See further details in the \fIlibcurl-multi(3)\fP man page. - -You can have multiple easy handles share certain data, even if they are used -in different threads. This magic is setup using the share interface, as -described in the \fIlibcurl-share(3)\fP man page. - -There is also a series of other helpful functions to use, including these: -.RS -.IP curl_version_info() -gets detailed libcurl (and other used libraries) version info -.IP curl_getdate() -converts a date string to time_t -.IP curl_easy_getinfo() -get information about a performed transfer -.IP curl_formadd() -helps building an HTTP form POST -.IP curl_formfree() -free a list built with \fIcurl_formadd(3)\fP -.IP curl_slist_append() -builds a linked list -.IP curl_slist_free_all() -frees a whole curl_slist -.RE - -.SH "LINKING WITH LIBCURL" -On unix-like machines, there's a tool named curl-config that gets installed -with the rest of the curl stuff when 'make install' is performed. - -curl-config is added to make it easier for applications to link with libcurl -and developers to learn about libcurl and how to use it. - -Run 'curl-config --libs' to get the (additional) linker options you need to -link with the particular version of libcurl you've installed. See the -\fIcurl-config(1)\fP man page for further details. - -Unix-like operating system that ship libcurl as part of their distributions -often don't provide the curl-config tool, but simply install the library and -headers in the common path for this purpose. - -.SH "LIBCURL SYMBOL NAMES" -All public functions in the libcurl interface are prefixed with 'curl_' (with -a lowercase c). You can find other functions in the library source code, but -other prefixes indicate that the functions are private and may change without -further notice in the next release. - -Only use documented functions and functionality! -.SH "PORTABILITY" -libcurl works -.B exactly -the same, on any of the platforms it compiles and builds on. -.SH "THREADS" -Never ever call curl-functions simultaneously using the same handle from -several threads. libcurl is thread-safe and can be used in any number of -threads, but you must use separate curl handles if you want to use libcurl in -more than one thread simultaneously. - -The global environment functions are not thread-safe. See GLOBAL CONSTANTS -below for details. - -.SH "PERSISTENT CONNECTIONS" -Persistent connections means that libcurl can re-use the same connection for -several transfers, if the conditions are right. - -libcurl will \fBalways\fP attempt to use persistent connections. Whenever you -use \fIcurl_easy_perform(3)\fP or \fIcurl_multi_perform(3)\fP, libcurl will -attempt to use an existing connection to do the transfer, and if none exists -it'll open a new one that will be subject for re-use on a possible following -call to \fIcurl_easy_perform(3)\fP or \fIcurl_multi_perform(3)\fP. - -To allow libcurl to take full advantage of persistent connections, you should -do as many of your file transfers as possible using the same curl handle. When -you call \fIcurl_easy_cleanup(3)\fP, all the possibly open connections held by -libcurl will be closed and forgotten. - -Note that the options set with \fIcurl_easy_setopt(3)\fP will be used on -every repeated \fIcurl_easy_perform(3)\fP call. - -.SH "GLOBAL CONSTANTS" -There are a variety of constants that libcurl uses, mainly through its -internal use of other libraries, which are too complicated for the -library loader to set up. Therefore, a program must call a library -function after the program is loaded and running to finish setting up -the library code. For example, when libcurl is built for SSL -capability via the GNU TLS library, there is an elaborate tree inside -that library that describes the SSL protocol. - -\fIcurl_global_init()\fP is the function that you must call. This may -allocate resources (e.g. the memory for the GNU TLS tree mentioned -above), so the companion function \fIcurl_global_cleanup()\fP releases -them. - -The basic rule for constructing a program that uses libcurl is this: -Call \fIcurl_global_init()\fP, with a \fICURL_GLOBAL_ALL\fP argument, -immediately after the program starts, while it is still only one -thread and before it uses libcurl at all. Call -\fIcurl_global_cleanup()\fP immediately before the program exits, when -the program is again only one thread and after its last use of -libcurl. - -You can call both of these multiple times, as long as all calls meet -these requirements and the number of calls to each is the same. - -It isn't actually required that the functions be called at the beginning -and end of the program -- that's just usually the easiest way to do it. -It \fIis\fP required that the functions be called when no other thread -in the program is running. - -These global constant functions are \fInot thread safe\fP, so you must -not call them when any other thread in the program is running. It -isn't good enough that no other thread is using libcurl at the time, -because these functions internally call similar functions of other -libraries, and those functions are similarly thread-unsafe. You can't -generally know what these libraries are, or whether other threads are -using them. - -The global constant situation merits special consideration when the -code you are writing to use libcurl is not the main program, but rather -a modular piece of a program, e.g. another library. As a module, -your code doesn't know about other parts of the program -- it doesn't -know whether they use libcurl or not. And its code doesn't necessarily -run at the start and end of the whole program. - -A module like this must have global constant functions of its own, -just like \fIcurl_global_init()\fP and \fIcurl_global_cleanup()\fP. -The module thus has control at the beginning and end of the program -and has a place to call the libcurl functions. Note that if multiple -modules in the program use libcurl, they all will separately call the -libcurl functions, and that's OK because only the first -\fIcurl_global_init()\fP and the last \fIcurl_global_cleanup()\fP in a -program change anything. (libcurl uses a reference count in static -memory). - -In a C++ module, it is common to deal with the global constant -situation by defining a special class that represents the global -constant environment of the module. A program always has exactly one -object of the class, in static storage. That way, the program -automatically calls the constructor of the object as the program -starts up and the destructor as it terminates. As the author of this -libcurl-using module, you can make the constructor call -\fIcurl_global_init()\fP and the destructor call -\fIcurl_global_cleanup()\fP and satisfy libcurl's requirements without -your user having to think about it. - -\fIcurl_global_init()\fP has an argument that tells what particular -parts of the global constant environment to set up. In order to -successfully use any value except \fICURL_GLOBAL_ALL\fP (which says to -set up the whole thing), you must have specific knowledge of internal -workings of libcurl and all other parts of the program of which it is -part. - -A special part of the global constant environment is the identity of -the memory allocator. \fIcurl_global_init()\fP selects the system -default memory allocator, but you can use \fIcurl_global_init_mem()\fP -to supply one of your own. However, there is no way to use -\fIcurl_global_init_mem()\fP in a modular program -- all modules in -the program that might use libcurl would have to agree on one -allocator. - -There is a failsafe in libcurl that makes it usable in simple -situations without you having to worry about the global constant -environment at all: \fIcurl_easy_init()\fP sets up the environment -itself if it hasn't been done yet. The resources it acquires to do so -get released by the operating system automatically when the program -exits. - -This failsafe feature exists mainly for backward compatibility because -there was a time when the global functions didn't exist. Because it -is sufficient only in the simplest of programs, it is not recommended -for any program to rely on it. diff --git a/plugins/FTPFileYM/curl/docs/libcurl/libcurl.html b/plugins/FTPFileYM/curl/docs/libcurl/libcurl.html deleted file mode 100644 index e1c00f0d37..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/libcurl.html +++ /dev/null @@ -1,105 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> -<html><head> -<title>libcurl man page</title> -<meta name="generator" content="roffit"> -<STYLE type="text/css"> -P.level0 { - padding-left: 2em; -} - -P.level1 { - padding-left: 4em; -} - -P.level2 { - padding-left: 6em; -} - -span.emphasis { - font-style: italic; -} - -span.bold { - font-weight: bold; -} - -span.manpage { - font-weight: bold; -} - -h2.nroffsh { - background-color: #e0e0e0; -} - -span.nroffip { - font-weight: bold; - font-size: 120%; - font-family: monospace; -} - -p.roffit { - text-align: center; - font-size: 80%; -} -</STYLE> -</head><body> - -<p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2> -<p class="level0">libcurl - client-side URL transfers <a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2> -<p class="level0">This is a short overview on how to use libcurl in your C programs. There are specific man pages for each function mentioned in here. There are also the <span Class="emphasis">libcurl-easy(3)</span> man page, the <span Class="emphasis">libcurl-multi(3)</span> man page, the <span Class="emphasis">libcurl-share(3)</span> man page and the <span Class="emphasis">libcurl-tutorial(3)</span> man page for in-depth understanding on how to program with libcurl. -<p class="level0">There are more than thirty custom bindings available that bring libcurl access to your favourite language. Look elsewhere for documentation on those. -<p class="level0">libcurl has a global constant environment that you must set up and maintain while using libcurl. This essentially means you call <a class="emphasis" href="./curl_global_init.html">curl_global_init(3)</a> at the start of your program and <a class="emphasis" href="./curl_global_cleanup.html">curl_global_cleanup(3)</a> at the end. See GLOBAL CONSTANTS below for details. -<p class="level0">To transfer files, you always set up an "easy handle" using <a class="emphasis" href="./curl_easy_init.html">curl_easy_init(3)</a>, but when you want the file(s) transferred you have the option of using the "easy" interface, or the "multi" interface. -<p class="level0">The easy interface is a synchronous interface with which you call <a class="emphasis" href="./curl_easy_perform.html">curl_easy_perform(3)</a> and let it perform the transfer. When it is completed, the function returns and you can continue. More details are found in the <span Class="emphasis">libcurl-easy(3)</span> man page. -<p class="level0">The multi interface on the other hand is an asynchronous interface, that you call and that performs only a little piece of the transfer on each invoke. It is perfect if you want to do things while the transfer is in progress, or similar. The multi interface allows you to select() on libcurl action, and even to easily download multiple files simultaneously using a single thread. See further details in the <span Class="emphasis">libcurl-multi(3)</span> man page. -<p class="level0">You can have multiple easy handles share certain data, even if they are used in different threads. This magic is setup using the share interface, as described in the <span Class="emphasis">libcurl-share(3)</span> man page. -<p class="level0">There is also a series of other helpful functions to use, including these: -<p class="level1"> -<p class="level0"><a name="curlversioninfo"></a><span class="nroffip">curl_version_info()</span> -<p class="level1">gets detailed libcurl (and other used libraries) version info -<p class="level0"><a name="curlgetdate"></a><span class="nroffip">curl_getdate()</span> -<p class="level1">converts a date string to time_t -<p class="level0"><a name="curleasygetinfo"></a><span class="nroffip">curl_easy_getinfo()</span> -<p class="level1">get information about a performed transfer -<p class="level0"><a name="curlformadd"></a><span class="nroffip">curl_formadd()</span> -<p class="level1">helps building an HTTP form POST -<p class="level0"><a name="curlformfree"></a><span class="nroffip">curl_formfree()</span> -<p class="level1">free a list built with <a class="emphasis" href="./curl_formadd.html">curl_formadd(3)</a> -<p class="level0"><a name="curlslistappend"></a><span class="nroffip">curl_slist_append()</span> -<p class="level1">builds a linked list -<p class="level0"><a name="curlslistfreeall"></a><span class="nroffip">curl_slist_free_all()</span> -<p class="level1">frees a whole curl_slist -<p class="level0"> -<p class="level0"><a name="LINKING"></a><h2 class="nroffsh">LINKING WITH LIBCURL</h2> -<p class="level0">On unix-like machines, there's a tool named curl-config that gets installed with the rest of the curl stuff when 'make install' is performed. -<p class="level0">curl-config is added to make it easier for applications to link with libcurl and developers to learn about libcurl and how to use it. -<p class="level0">Run 'curl-config --libs' to get the (additional) linker options you need to link with the particular version of libcurl you've installed. See the <span Class="emphasis">curl-config(1)</span> man page for further details. -<p class="level0">Unix-like operating system that ship libcurl as part of their distributions often don't provide the curl-config tool, but simply install the library and headers in the common path for this purpose. -<p class="level0"><a name="LIBCURL"></a><h2 class="nroffsh">LIBCURL SYMBOL NAMES</h2> -<p class="level0">All public functions in the libcurl interface are prefixed with 'curl_' (with a lowercase c). You can find other functions in the library source code, but other prefixes indicate that the functions are private and may change without further notice in the next release. -<p class="level0">Only use documented functions and functionality! <a name="PORTABILITY"></a><h2 class="nroffsh">PORTABILITY</h2> -<p class="level0">libcurl works <span Class="bold">exactly</span> the same, on any of the platforms it compiles and builds on. <a name="THREADS"></a><h2 class="nroffsh">THREADS</h2> -<p class="level0">Never ever call curl-functions simultaneously using the same handle from several threads. libcurl is thread-safe and can be used in any number of threads, but you must use separate curl handles if you want to use libcurl in more than one thread simultaneously. -<p class="level0">The global environment functions are not thread-safe. See GLOBAL CONSTANTS below for details. -<p class="level0"><a name="PERSISTENT"></a><h2 class="nroffsh">PERSISTENT CONNECTIONS</h2> -<p class="level0">Persistent connections means that libcurl can re-use the same connection for several transfers, if the conditions are right. -<p class="level0">libcurl will <span Class="bold">always</span> attempt to use persistent connections. Whenever you use <a class="emphasis" href="./curl_easy_perform.html">curl_easy_perform(3)</a> or <a class="emphasis" href="./curl_multi_perform.html">curl_multi_perform(3)</a>, libcurl will attempt to use an existing connection to do the transfer, and if none exists it'll open a new one that will be subject for re-use on a possible following call to <a class="emphasis" href="./curl_easy_perform.html">curl_easy_perform(3)</a> or <a class="emphasis" href="./curl_multi_perform.html">curl_multi_perform(3)</a>. -<p class="level0">To allow libcurl to take full advantage of persistent connections, you should do as many of your file transfers as possible using the same curl handle. When you call <a class="emphasis" href="./curl_easy_cleanup.html">curl_easy_cleanup(3)</a>, all the possibly open connections held by libcurl will be closed and forgotten. -<p class="level0">Note that the options set with <a class="emphasis" href="./curl_easy_setopt.html">curl_easy_setopt(3)</a> will be used on every repeated <a class="emphasis" href="./curl_easy_perform.html">curl_easy_perform(3)</a> call. -<p class="level0"><a name="GLOBAL"></a><h2 class="nroffsh">GLOBAL CONSTANTS</h2> -<p class="level0">There are a variety of constants that libcurl uses, mainly through its internal use of other libraries, which are too complicated for the library loader to set up. Therefore, a program must call a library function after the program is loaded and running to finish setting up the library code. For example, when libcurl is built for SSL capability via the GNU TLS library, there is an elaborate tree inside that library that describes the SSL protocol. -<p class="level0"><span Class="emphasis">curl_global_init()</span> is the function that you must call. This may allocate resources (e.g. the memory for the GNU TLS tree mentioned above), so the companion function <span Class="emphasis">curl_global_cleanup()</span> releases them. -<p class="level0">The basic rule for constructing a program that uses libcurl is this: Call <span Class="emphasis">curl_global_init()</span>, with a <span Class="emphasis">CURL_GLOBAL_ALL</span> argument, immediately after the program starts, while it is still only one thread and before it uses libcurl at all. Call <span Class="emphasis">curl_global_cleanup()</span> immediately before the program exits, when the program is again only one thread and after its last use of libcurl. -<p class="level0">You can call both of these multiple times, as long as all calls meet these requirements and the number of calls to each is the same. -<p class="level0">It isn't actually required that the functions be called at the beginning and end of the program -- that's just usually the easiest way to do it. It <span Class="emphasis">is</span> required that the functions be called when no other thread in the program is running. -<p class="level0">These global constant functions are <span Class="emphasis">not thread safe</span>, so you must not call them when any other thread in the program is running. It isn't good enough that no other thread is using libcurl at the time, because these functions internally call similar functions of other libraries, and those functions are similarly thread-unsafe. You can't generally know what these libraries are, or whether other threads are using them. -<p class="level0">The global constant situation merits special consideration when the code you are writing to use libcurl is not the main program, but rather a modular piece of a program, e.g. another library. As a module, your code doesn't know about other parts of the program -- it doesn't know whether they use libcurl or not. And its code doesn't necessarily run at the start and end of the whole program. -<p class="level0">A module like this must have global constant functions of its own, just like <span Class="emphasis">curl_global_init()</span> and <span Class="emphasis">curl_global_cleanup()</span>. The module thus has control at the beginning and end of the program and has a place to call the libcurl functions. Note that if multiple modules in the program use libcurl, they all will separately call the libcurl functions, and that's OK because only the first <span Class="emphasis">curl_global_init()</span> and the last <span Class="emphasis">curl_global_cleanup()</span> in a program change anything. (libcurl uses a reference count in static memory). -<p class="level0">In a C++ module, it is common to deal with the global constant situation by defining a special class that represents the global constant environment of the module. A program always has exactly one object of the class, in static storage. That way, the program automatically calls the constructor of the object as the program starts up and the destructor as it terminates. As the author of this libcurl-using module, you can make the constructor call <span Class="emphasis">curl_global_init()</span> and the destructor call <span Class="emphasis">curl_global_cleanup()</span> and satisfy libcurl's requirements without your user having to think about it. -<p class="level0"><span Class="emphasis">curl_global_init()</span> has an argument that tells what particular parts of the global constant environment to set up. In order to successfully use any value except <span Class="emphasis">CURL_GLOBAL_ALL</span> (which says to set up the whole thing), you must have specific knowledge of internal workings of libcurl and all other parts of the program of which it is part. -<p class="level0">A special part of the global constant environment is the identity of the memory allocator. <span Class="emphasis">curl_global_init()</span> selects the system default memory allocator, but you can use <span Class="emphasis">curl_global_init_mem()</span> to supply one of your own. However, there is no way to use <span Class="emphasis">curl_global_init_mem()</span> in a modular program -- all modules in the program that might use libcurl would have to agree on one allocator. -<p class="level0">There is a failsafe in libcurl that makes it usable in simple situations without you having to worry about the global constant environment at all: <span Class="emphasis">curl_easy_init()</span> sets up the environment itself if it hasn't been done yet. The resources it acquires to do so get released by the operating system automatically when the program exits. -<p class="level0">This failsafe feature exists mainly for backward compatibility because there was a time when the global functions didn't exist. Because it is sufficient only in the simplest of programs, it is not recommended for any program to rely on it. <p class="roffit"> - This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>. -</body></html> diff --git a/plugins/FTPFileYM/curl/docs/libcurl/libcurl.m4 b/plugins/FTPFileYM/curl/docs/libcurl/libcurl.m4 deleted file mode 100644 index d7d5a52591..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/libcurl.m4 +++ /dev/null @@ -1,251 +0,0 @@ -# LIBCURL_CHECK_CONFIG ([DEFAULT-ACTION], [MINIMUM-VERSION], -# [ACTION-IF-YES], [ACTION-IF-NO]) -# ---------------------------------------------------------- -# David Shaw <dshaw@jabberwocky.com> May-09-2006 -# -# Checks for libcurl. DEFAULT-ACTION is the string yes or no to -# specify whether to default to --with-libcurl or --without-libcurl. -# If not supplied, DEFAULT-ACTION is yes. MINIMUM-VERSION is the -# minimum version of libcurl to accept. Pass the version as a regular -# version number like 7.10.1. If not supplied, any version is -# accepted. ACTION-IF-YES is a list of shell commands to run if -# libcurl was successfully found and passed the various tests. -# ACTION-IF-NO is a list of shell commands that are run otherwise. -# Note that using --without-libcurl does run ACTION-IF-NO. -# -# This macro #defines HAVE_LIBCURL if a working libcurl setup is -# found, and sets @LIBCURL@ and @LIBCURL_CPPFLAGS@ to the necessary -# values. Other useful defines are LIBCURL_FEATURE_xxx where xxx are -# the various features supported by libcurl, and LIBCURL_PROTOCOL_yyy -# where yyy are the various protocols supported by libcurl. Both xxx -# and yyy are capitalized. See the list of AH_TEMPLATEs at the top of -# the macro for the complete list of possible defines. Shell -# variables $libcurl_feature_xxx and $libcurl_protocol_yyy are also -# defined to 'yes' for those features and protocols that were found. -# Note that xxx and yyy keep the same capitalization as in the -# curl-config list (e.g. it's "HTTP" and not "http"). -# -# Users may override the detected values by doing something like: -# LIBCURL="-lcurl" LIBCURL_CPPFLAGS="-I/usr/myinclude" ./configure -# -# For the sake of sanity, this macro assumes that any libcurl that is -# found is after version 7.7.2, the first version that included the -# curl-config script. Note that it is very important for people -# packaging binary versions of libcurl to include this script! -# Without curl-config, we can only guess what protocols are available, -# or use curl_version_info to figure it out at runtime. - -AC_DEFUN([LIBCURL_CHECK_CONFIG], -[ - AH_TEMPLATE([LIBCURL_FEATURE_SSL],[Defined if libcurl supports SSL]) - AH_TEMPLATE([LIBCURL_FEATURE_KRB4],[Defined if libcurl supports KRB4]) - AH_TEMPLATE([LIBCURL_FEATURE_IPV6],[Defined if libcurl supports IPv6]) - AH_TEMPLATE([LIBCURL_FEATURE_LIBZ],[Defined if libcurl supports libz]) - AH_TEMPLATE([LIBCURL_FEATURE_ASYNCHDNS],[Defined if libcurl supports AsynchDNS]) - AH_TEMPLATE([LIBCURL_FEATURE_IDN],[Defined if libcurl supports IDN]) - AH_TEMPLATE([LIBCURL_FEATURE_SSPI],[Defined if libcurl supports SSPI]) - AH_TEMPLATE([LIBCURL_FEATURE_NTLM],[Defined if libcurl supports NTLM]) - - AH_TEMPLATE([LIBCURL_PROTOCOL_HTTP],[Defined if libcurl supports HTTP]) - AH_TEMPLATE([LIBCURL_PROTOCOL_HTTPS],[Defined if libcurl supports HTTPS]) - AH_TEMPLATE([LIBCURL_PROTOCOL_FTP],[Defined if libcurl supports FTP]) - AH_TEMPLATE([LIBCURL_PROTOCOL_FTPS],[Defined if libcurl supports FTPS]) - AH_TEMPLATE([LIBCURL_PROTOCOL_FILE],[Defined if libcurl supports FILE]) - AH_TEMPLATE([LIBCURL_PROTOCOL_TELNET],[Defined if libcurl supports TELNET]) - AH_TEMPLATE([LIBCURL_PROTOCOL_LDAP],[Defined if libcurl supports LDAP]) - AH_TEMPLATE([LIBCURL_PROTOCOL_DICT],[Defined if libcurl supports DICT]) - AH_TEMPLATE([LIBCURL_PROTOCOL_TFTP],[Defined if libcurl supports TFTP]) - AH_TEMPLATE([LIBCURL_PROTOCOL_RTSP],[Defined if libcurl supports RTSP]) - AH_TEMPLATE([LIBCURL_PROTOCOL_POP3],[Defined if libcurl supports POP3]) - AH_TEMPLATE([LIBCURL_PROTOCOL_IMAP],[Defined if libcurl supports IMAP]) - AH_TEMPLATE([LIBCURL_PROTOCOL_SMTP],[Defined if libcurl supports SMTP]) - - AC_ARG_WITH(libcurl, - AC_HELP_STRING([--with-libcurl=PREFIX],[look for the curl library in PREFIX/lib and headers in PREFIX/include]), - [_libcurl_with=$withval],[_libcurl_with=ifelse([$1],,[yes],[$1])]) - - if test "$_libcurl_with" != "no" ; then - - AC_PROG_AWK - - _libcurl_version_parse="eval $AWK '{split(\$NF,A,\".\"); X=256*256*A[[1]]+256*A[[2]]+A[[3]]; print X;}'" - - _libcurl_try_link=yes - - if test -d "$_libcurl_with" ; then - LIBCURL_CPPFLAGS="-I$withval/include" - _libcurl_ldflags="-L$withval/lib" - AC_PATH_PROG([_libcurl_config],[curl-config],[], - ["$withval/bin"]) - else - AC_PATH_PROG([_libcurl_config],[curl-config],[],[$PATH]) - fi - - if test x$_libcurl_config != "x" ; then - AC_CACHE_CHECK([for the version of libcurl], - [libcurl_cv_lib_curl_version], - [libcurl_cv_lib_curl_version=`$_libcurl_config --version | $AWK '{print $[]2}'`]) - - _libcurl_version=`echo $libcurl_cv_lib_curl_version | $_libcurl_version_parse` - _libcurl_wanted=`echo ifelse([$2],,[0],[$2]) | $_libcurl_version_parse` - - if test $_libcurl_wanted -gt 0 ; then - AC_CACHE_CHECK([for libcurl >= version $2], - [libcurl_cv_lib_version_ok], - [ - if test $_libcurl_version -ge $_libcurl_wanted ; then - libcurl_cv_lib_version_ok=yes - else - libcurl_cv_lib_version_ok=no - fi - ]) - fi - - if test $_libcurl_wanted -eq 0 || test x$libcurl_cv_lib_version_ok = xyes ; then - if test x"$LIBCURL_CPPFLAGS" = "x" ; then - LIBCURL_CPPFLAGS=`$_libcurl_config --cflags` - fi - if test x"$LIBCURL" = "x" ; then - LIBCURL=`$_libcurl_config --libs` - - # This is so silly, but Apple actually has a bug in their - # curl-config script. Fixed in Tiger, but there are still - # lots of Panther installs around. - case "${host}" in - powerpc-apple-darwin7*) - LIBCURL=`echo $LIBCURL | sed -e 's|-arch i386||g'` - ;; - esac - fi - - # All curl-config scripts support --feature - _libcurl_features=`$_libcurl_config --feature` - - # Is it modern enough to have --protocols? (7.12.4) - if test $_libcurl_version -ge 461828 ; then - _libcurl_protocols=`$_libcurl_config --protocols` - fi - else - _libcurl_try_link=no - fi - - unset _libcurl_wanted - fi - - if test $_libcurl_try_link = yes ; then - - # we didn't find curl-config, so let's see if the user-supplied - # link line (or failing that, "-lcurl") is enough. - LIBCURL=${LIBCURL-"$_libcurl_ldflags -lcurl"} - - AC_CACHE_CHECK([whether libcurl is usable], - [libcurl_cv_lib_curl_usable], - [ - _libcurl_save_cppflags=$CPPFLAGS - CPPFLAGS="$LIBCURL_CPPFLAGS $CPPFLAGS" - _libcurl_save_libs=$LIBS - LIBS="$LIBCURL $LIBS" - - AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <curl/curl.h>]],[[ -/* Try and use a few common options to force a failure if we are - missing symbols or can't link. */ -int x; -curl_easy_setopt(NULL,CURLOPT_URL,NULL); -x=CURL_ERROR_SIZE; -x=CURLOPT_WRITEFUNCTION; -x=CURLOPT_FILE; -x=CURLOPT_ERRORBUFFER; -x=CURLOPT_STDERR; -x=CURLOPT_VERBOSE; -if (x) ; -]])],libcurl_cv_lib_curl_usable=yes,libcurl_cv_lib_curl_usable=no) - - CPPFLAGS=$_libcurl_save_cppflags - LIBS=$_libcurl_save_libs - unset _libcurl_save_cppflags - unset _libcurl_save_libs - ]) - - if test $libcurl_cv_lib_curl_usable = yes ; then - - # Does curl_free() exist in this version of libcurl? - # If not, fake it with free() - - _libcurl_save_cppflags=$CPPFLAGS - CPPFLAGS="$CPPFLAGS $LIBCURL_CPPFLAGS" - _libcurl_save_libs=$LIBS - LIBS="$LIBS $LIBCURL" - - AC_CHECK_FUNC(curl_free,, - AC_DEFINE(curl_free,free, - [Define curl_free() as free() if our version of curl lacks curl_free.])) - - CPPFLAGS=$_libcurl_save_cppflags - LIBS=$_libcurl_save_libs - unset _libcurl_save_cppflags - unset _libcurl_save_libs - - AC_DEFINE(HAVE_LIBCURL,1, - [Define to 1 if you have a functional curl library.]) - AC_SUBST(LIBCURL_CPPFLAGS) - AC_SUBST(LIBCURL) - - for _libcurl_feature in $_libcurl_features ; do - AC_DEFINE_UNQUOTED(AS_TR_CPP(libcurl_feature_$_libcurl_feature),[1]) - eval AS_TR_SH(libcurl_feature_$_libcurl_feature)=yes - done - - if test "x$_libcurl_protocols" = "x" ; then - - # We don't have --protocols, so just assume that all - # protocols are available - _libcurl_protocols="HTTP FTP FILE TELNET LDAP DICT TFTP" - - if test x$libcurl_feature_SSL = xyes ; then - _libcurl_protocols="$_libcurl_protocols HTTPS" - - # FTPS wasn't standards-compliant until version - # 7.11.0 (0x070b00 == 461568) - if test $_libcurl_version -ge 461568; then - _libcurl_protocols="$_libcurl_protocols FTPS" - fi - fi - - # RTSP, IMAP, POP3 and SMTP were added in - # 7.20.0 (0x071400 == 463872) - if test $_libcurl_version -ge 463872; then - _libcurl_protocols="$_libcurl_protocols RTSP IMAP POP3 SMTP" - fi - fi - - for _libcurl_protocol in $_libcurl_protocols ; do - AC_DEFINE_UNQUOTED(AS_TR_CPP(libcurl_protocol_$_libcurl_protocol),[1]) - eval AS_TR_SH(libcurl_protocol_$_libcurl_protocol)=yes - done - else - unset LIBCURL - unset LIBCURL_CPPFLAGS - fi - fi - - unset _libcurl_try_link - unset _libcurl_version_parse - unset _libcurl_config - unset _libcurl_feature - unset _libcurl_features - unset _libcurl_protocol - unset _libcurl_protocols - unset _libcurl_version - unset _libcurl_ldflags - fi - - if test x$_libcurl_with = xno || test x$libcurl_cv_lib_curl_usable != xyes ; then - # This is the IF-NO path - ifelse([$4],,:,[$4]) - else - # This is the IF-YES path - ifelse([$3],,:,[$3]) - fi - - unset _libcurl_with -])dnl diff --git a/plugins/FTPFileYM/curl/docs/libcurl/libcurl.pdf b/plugins/FTPFileYM/curl/docs/libcurl/libcurl.pdf Binary files differdeleted file mode 100644 index 1707a3788d..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/libcurl.pdf +++ /dev/null diff --git a/plugins/FTPFileYM/curl/docs/libcurl/symbols-in-versions b/plugins/FTPFileYM/curl/docs/libcurl/symbols-in-versions deleted file mode 100644 index 1de1aceb73..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/symbols-in-versions +++ /dev/null @@ -1,705 +0,0 @@ - _ _ ____ _ - ___| | | | _ \| | - / __| | | | |_) | | - | (__| |_| | _ <| |___ - \___|\___/|_| \_\_____| - - This document lists defines and other symbols present in libcurl, together - with exact information about the first libcurl version that provides the - symbol, the first version in which the symbol was marked as deprecated and - for a few symbols the last version that featured it. The names appear in - alphabetical order. - - Name Introduced Deprecated Removed - -CURLAUTH_ANY 7.10.6 -CURLAUTH_ANYSAFE 7.10.6 -CURLAUTH_BASIC 7.10.6 -CURLAUTH_DIGEST 7.10.6 -CURLAUTH_DIGEST_IE 7.19.3 -CURLAUTH_GSSNEGOTIATE 7.10.6 -CURLAUTH_NONE 7.10.6 -CURLAUTH_NTLM 7.10.6 -CURLAUTH_NTLM_WB 7.22.0 -CURLAUTH_ONLY 7.21.3 -CURLCLOSEPOLICY_CALLBACK 7.7 -CURLCLOSEPOLICY_LEAST_RECENTLY_USED 7.7 -CURLCLOSEPOLICY_LEAST_TRAFFIC 7.7 -CURLCLOSEPOLICY_NONE 7.7 -CURLCLOSEPOLICY_OLDEST 7.7 -CURLCLOSEPOLICY_SLOWEST 7.7 -CURLE_ABORTED_BY_CALLBACK 7.1 -CURLE_AGAIN 7.18.2 -CURLE_ALREADY_COMPLETE 7.7.2 -CURLE_BAD_CALLING_ORDER 7.1 7.17.0 -CURLE_BAD_CONTENT_ENCODING 7.10 -CURLE_BAD_DOWNLOAD_RESUME 7.10 -CURLE_BAD_FUNCTION_ARGUMENT 7.1 -CURLE_BAD_PASSWORD_ENTERED 7.4.2 7.17.0 -CURLE_CHUNK_FAILED 7.21.0 -CURLE_CONV_FAILED 7.15.4 -CURLE_CONV_REQD 7.15.4 -CURLE_COULDNT_CONNECT 7.1 -CURLE_COULDNT_RESOLVE_HOST 7.1 -CURLE_COULDNT_RESOLVE_PROXY 7.1 -CURLE_FAILED_INIT 7.1 -CURLE_FILESIZE_EXCEEDED 7.10.8 -CURLE_FILE_COULDNT_READ_FILE 7.1 -CURLE_FTP_ACCEPT_FAILED 7.24.0 -CURLE_FTP_ACCEPT_TIMEOUT 7.24.0 -CURLE_FTP_ACCESS_DENIED 7.1 -CURLE_FTP_BAD_DOWNLOAD_RESUME 7.1 7.1 -CURLE_FTP_BAD_FILE_LIST 7.21.0 -CURLE_FTP_CANT_GET_HOST 7.1 -CURLE_FTP_CANT_RECONNECT 7.1 7.17.0 -CURLE_FTP_COULDNT_GET_SIZE 7.1 7.17.0 -CURLE_FTP_COULDNT_RETR_FILE 7.1 -CURLE_FTP_COULDNT_SET_ASCII 7.1 7.17.0 -CURLE_FTP_COULDNT_SET_BINARY 7.1 7.17.0 -CURLE_FTP_COULDNT_SET_TYPE 7.17.0 -CURLE_FTP_COULDNT_STOR_FILE 7.1 -CURLE_FTP_COULDNT_USE_REST 7.1 -CURLE_FTP_PARTIAL_FILE 7.1 7.1 -CURLE_FTP_PORT_FAILED 7.1 -CURLE_FTP_PRET_FAILED 7.20.0 -CURLE_FTP_QUOTE_ERROR 7.1 7.17.0 -CURLE_FTP_SSL_FAILED 7.11.0 7.17.0 -CURLE_FTP_USER_PASSWORD_INCORRECT 7.1 7.17.0 -CURLE_FTP_WEIRD_227_FORMAT 7.1 -CURLE_FTP_WEIRD_PASS_REPLY 7.1 -CURLE_FTP_WEIRD_PASV_REPLY 7.1 -CURLE_FTP_WEIRD_SERVER_REPLY 7.1 -CURLE_FTP_WEIRD_USER_REPLY 7.1 7.17.0 -CURLE_FTP_WRITE_ERROR 7.1 7.17.0 -CURLE_FUNCTION_NOT_FOUND 7.1 -CURLE_GOT_NOTHING 7.9.1 -CURLE_HTTP_NOT_FOUND 7.1 -CURLE_HTTP_PORT_FAILED 7.3 7.12.0 -CURLE_HTTP_POST_ERROR 7.1 -CURLE_HTTP_RANGE_ERROR 7.1 7.17.0 -CURLE_HTTP_RETURNED_ERROR 7.10.3 -CURLE_INTERFACE_FAILED 7.12.0 -CURLE_LDAP_CANNOT_BIND 7.1 -CURLE_LDAP_INVALID_URL 7.10.8 -CURLE_LDAP_SEARCH_FAILED 7.1 -CURLE_LIBRARY_NOT_FOUND 7.1 7.17.0 -CURLE_LOGIN_DENIED 7.13.1 -CURLE_MALFORMAT_USER 7.1 7.17.0 -CURLE_NOT_BUILT_IN 7.21.5 -CURLE_OK 7.1 -CURLE_OPERATION_TIMEDOUT 7.10.2 -CURLE_OPERATION_TIMEOUTED 7.1 7.17.0 -CURLE_OUT_OF_MEMORY 7.1 -CURLE_PARTIAL_FILE 7.1 -CURLE_PEER_FAILED_VERIFICATION 7.17.1 -CURLE_QUOTE_ERROR 7.17.0 -CURLE_RANGE_ERROR 7.17.0 -CURLE_READ_ERROR 7.1 -CURLE_RECV_ERROR 7.10 -CURLE_REMOTE_ACCESS_DENIED 7.17.0 -CURLE_REMOTE_DISK_FULL 7.17.0 -CURLE_REMOTE_FILE_EXISTS 7.17.0 -CURLE_REMOTE_FILE_NOT_FOUND 7.16.1 -CURLE_RTSP_CSEQ_ERROR 7.20.0 -CURLE_RTSP_SESSION_ERROR 7.20.0 -CURLE_SEND_ERROR 7.10 -CURLE_SEND_FAIL_REWIND 7.12.3 -CURLE_SHARE_IN_USE 7.9.6 7.17.0 -CURLE_SSH 7.16.1 -CURLE_SSL_CACERT 7.10 -CURLE_SSL_CACERT_BADFILE 7.16.0 -CURLE_SSL_CERTPROBLEM 7.10 -CURLE_SSL_CIPHER 7.10 -CURLE_SSL_CONNECT_ERROR 7.1 -CURLE_SSL_CRL_BADFILE 7.19.0 -CURLE_SSL_ENGINE_INITFAILED 7.12.3 -CURLE_SSL_ENGINE_NOTFOUND 7.9.3 -CURLE_SSL_ENGINE_SETFAILED 7.9.3 -CURLE_SSL_ISSUER_ERROR 7.19.0 -CURLE_SSL_PEER_CERTIFICATE 7.8 7.17.1 -CURLE_SSL_SHUTDOWN_FAILED 7.16.1 -CURLE_TELNET_OPTION_SYNTAX 7.7 -CURLE_TFTP_DISKFULL 7.15.0 7.17.0 -CURLE_TFTP_EXISTS 7.15.0 7.17.0 -CURLE_TFTP_ILLEGAL 7.15.0 -CURLE_TFTP_NOSUCHUSER 7.15.0 -CURLE_TFTP_NOTFOUND 7.15.0 -CURLE_TFTP_PERM 7.15.0 -CURLE_TFTP_UNKNOWNID 7.15.0 -CURLE_TOO_MANY_REDIRECTS 7.5 -CURLE_UNKNOWN_OPTION 7.21.5 -CURLE_UNKNOWN_TELNET_OPTION 7.7 -CURLE_UNSUPPORTED_PROTOCOL 7.1 -CURLE_UPLOAD_FAILED 7.16.3 -CURLE_URL_MALFORMAT 7.1 -CURLE_URL_MALFORMAT_USER 7.1 7.17.0 -CURLE_USE_SSL_FAILED 7.17.0 -CURLE_WRITE_ERROR 7.1 -CURLFILETYPE_DEVICE_BLOCK 7.21.0 -CURLFILETYPE_DEVICE_CHAR 7.21.0 -CURLFILETYPE_DIRECTORY 7.21.0 -CURLFILETYPE_DOOR 7.21.0 -CURLFILETYPE_FILE 7.21.0 -CURLFILETYPE_NAMEDPIPE 7.21.0 -CURLFILETYPE_SOCKET 7.21.0 -CURLFILETYPE_SYMLINK 7.21.0 -CURLFILETYPE_UNKNOWN 7.21.0 -CURLFINFOFLAG_KNOWN_FILENAME 7.21.0 -CURLFINFOFLAG_KNOWN_FILETYPE 7.21.0 -CURLFINFOFLAG_KNOWN_GID 7.21.0 -CURLFINFOFLAG_KNOWN_HLINKCOUNT 7.21.0 -CURLFINFOFLAG_KNOWN_PERM 7.21.0 -CURLFINFOFLAG_KNOWN_SIZE 7.21.0 -CURLFINFOFLAG_KNOWN_TIME 7.21.0 -CURLFINFOFLAG_KNOWN_UID 7.21.0 -CURLFORM_ARRAY 7.9.1 -CURLFORM_ARRAY_END 7.9.1 7.9.5 7.9.6 -CURLFORM_ARRAY_START 7.9.1 7.9.5 7.9.6 -CURLFORM_BUFFER 7.9.8 -CURLFORM_BUFFERLENGTH 7.9.8 -CURLFORM_BUFFERPTR 7.9.8 -CURLFORM_CONTENTHEADER 7.9.3 -CURLFORM_CONTENTSLENGTH 7.9 -CURLFORM_CONTENTTYPE 7.9 -CURLFORM_COPYCONTENTS 7.9 -CURLFORM_COPYNAME 7.9 -CURLFORM_END 7.9 -CURLFORM_FILE 7.9 -CURLFORM_FILECONTENT 7.9.1 -CURLFORM_FILENAME 7.9.6 -CURLFORM_NAMELENGTH 7.9 -CURLFORM_NOTHING 7.9 -CURLFORM_PTRCONTENTS 7.9 -CURLFORM_PTRNAME 7.9 -CURLFORM_STREAM 7.18.2 -CURLFTPAUTH_DEFAULT 7.12.2 -CURLFTPAUTH_SSL 7.12.2 -CURLFTPAUTH_TLS 7.12.2 -CURLFTPMETHOD_DEFAULT 7.15.3 -CURLFTPMETHOD_MULTICWD 7.15.3 -CURLFTPMETHOD_NOCWD 7.15.3 -CURLFTPMETHOD_SINGLECWD 7.15.3 -CURLFTPSSL_ALL 7.11.0 7.17.0 -CURLFTPSSL_CCC_ACTIVE 7.16.2 -CURLFTPSSL_CCC_NONE 7.16.2 -CURLFTPSSL_CCC_PASSIVE 7.16.1 -CURLFTPSSL_CONTROL 7.11.0 7.17.0 -CURLFTPSSL_NONE 7.11.0 7.17.0 -CURLFTPSSL_TRY 7.11.0 7.17.0 -CURLFTP_CREATE_DIR 7.19.4 -CURLFTP_CREATE_DIR_NONE 7.19.4 -CURLFTP_CREATE_DIR_RETRY 7.19.4 -CURLGSSAPI_DELEGATION_FLAG 7.22.0 -CURLGSSAPI_DELEGATION_NONE 7.22.0 -CURLGSSAPI_DELEGATION_POLICY_FLAG 7.22.0 -CURLINFO_APPCONNECT_TIME 7.19.0 -CURLINFO_CERTINFO 7.19.1 -CURLINFO_CONDITION_UNMET 7.19.4 -CURLINFO_CONNECT_TIME 7.4.1 -CURLINFO_CONTENT_LENGTH_DOWNLOAD 7.6.1 -CURLINFO_CONTENT_LENGTH_UPLOAD 7.6.1 -CURLINFO_CONTENT_TYPE 7.9.4 -CURLINFO_COOKIELIST 7.14.1 -CURLINFO_DATA_IN 7.9.6 -CURLINFO_DATA_OUT 7.9.6 -CURLINFO_DOUBLE 7.4.1 -CURLINFO_EFFECTIVE_URL 7.4 -CURLINFO_END 7.9.6 -CURLINFO_FILETIME 7.5 -CURLINFO_FTP_ENTRY_PATH 7.15.4 -CURLINFO_HEADER_IN 7.9.6 -CURLINFO_HEADER_OUT 7.9.6 -CURLINFO_HEADER_SIZE 7.4.1 -CURLINFO_HTTPAUTH_AVAIL 7.10.8 -CURLINFO_HTTP_CODE 7.4.1 7.10.8 -CURLINFO_HTTP_CONNECTCODE 7.10.7 -CURLINFO_LASTONE 7.4.1 -CURLINFO_LASTSOCKET 7.15.2 -CURLINFO_LOCAL_IP 7.21.0 -CURLINFO_LOCAL_PORT 7.21.0 -CURLINFO_LONG 7.4.1 -CURLINFO_MASK 7.4.1 -CURLINFO_NAMELOOKUP_TIME 7.4.1 -CURLINFO_NONE 7.4.1 -CURLINFO_NUM_CONNECTS 7.12.3 -CURLINFO_OS_ERRNO 7.12.2 -CURLINFO_PRETRANSFER_TIME 7.4.1 -CURLINFO_PRIMARY_IP 7.19.0 -CURLINFO_PRIMARY_PORT 7.21.0 -CURLINFO_PRIVATE 7.10.3 -CURLINFO_PROXYAUTH_AVAIL 7.10.8 -CURLINFO_REDIRECT_COUNT 7.9.7 -CURLINFO_REDIRECT_TIME 7.9.7 -CURLINFO_REDIRECT_URL 7.18.2 -CURLINFO_REQUEST_SIZE 7.4.1 -CURLINFO_RESPONSE_CODE 7.10.8 -CURLINFO_RTSP_CLIENT_CSEQ 7.20.0 -CURLINFO_RTSP_CSEQ_RECV 7.20.0 -CURLINFO_RTSP_SERVER_CSEQ 7.20.0 -CURLINFO_RTSP_SESSION_ID 7.20.0 -CURLINFO_SIZE_DOWNLOAD 7.4.1 -CURLINFO_SIZE_UPLOAD 7.4.1 -CURLINFO_SLIST 7.12.3 -CURLINFO_SPEED_DOWNLOAD 7.4.1 -CURLINFO_SPEED_UPLOAD 7.4.1 -CURLINFO_SSL_DATA_IN 7.12.1 -CURLINFO_SSL_DATA_OUT 7.12.1 -CURLINFO_SSL_ENGINES 7.12.3 -CURLINFO_SSL_VERIFYRESULT 7.5 -CURLINFO_STARTTRANSFER_TIME 7.9.2 -CURLINFO_STRING 7.4.1 -CURLINFO_TEXT 7.9.6 -CURLINFO_TOTAL_TIME 7.4.1 -CURLINFO_TYPEMASK 7.4.1 -CURLIOCMD_NOP 7.12.3 -CURLIOCMD_RESTARTREAD 7.12.3 -CURLIOE_FAILRESTART 7.12.3 -CURLIOE_OK 7.12.3 -CURLIOE_UNKNOWNCMD 7.12.3 -CURLKHMATCH_MISMATCH 7.19.6 -CURLKHMATCH_MISSING 7.19.6 -CURLKHMATCH_OK 7.19.6 -CURLKHSTAT_DEFER 7.19.6 -CURLKHSTAT_FINE 7.19.6 -CURLKHSTAT_FINE_ADD_TO_FILE 7.19.6 -CURLKHSTAT_REJECT 7.19.6 -CURLKHTYPE_DSS 7.19.6 -CURLKHTYPE_RSA 7.19.6 -CURLKHTYPE_RSA1 7.19.6 -CURLKHTYPE_UNKNOWN 7.19.6 -CURLMOPT_MAXCONNECTS 7.16.3 -CURLMOPT_PIPELINING 7.16.0 -CURLMOPT_SOCKETDATA 7.15.4 -CURLMOPT_SOCKETFUNCTION 7.15.4 -CURLMOPT_TIMERDATA 7.16.0 -CURLMOPT_TIMERFUNCTION 7.16.0 -CURLMSG_DONE 7.9.6 -CURLMSG_NONE 7.9.6 -CURLM_BAD_EASY_HANDLE 7.9.6 -CURLM_BAD_HANDLE 7.9.6 -CURLM_BAD_SOCKET 7.15.4 -CURLM_CALL_MULTI_PERFORM 7.9.6 -CURLM_CALL_MULTI_SOCKET 7.15.5 -CURLM_INTERNAL_ERROR 7.9.6 -CURLM_OK 7.9.6 -CURLM_OUT_OF_MEMORY 7.9.6 -CURLM_UNKNOWN_OPTION 7.15.4 -CURLOPTTYPE_FUNCTIONPOINT 7.1 -CURLOPTTYPE_LONG 7.1 -CURLOPTTYPE_OBJECTPOINT 7.1 -CURLOPTTYPE_OFF_T 7.11.0 -CURLOPT_ACCEPTTIMEOUT_MS 7.24.0 -CURLOPT_ACCEPT_ENCODING 7.21.6 -CURLOPT_ADDRESS_SCOPE 7.19.0 -CURLOPT_APPEND 7.17.0 -CURLOPT_AUTOREFERER 7.1 -CURLOPT_BUFFERSIZE 7.10 -CURLOPT_CAINFO 7.4.2 -CURLOPT_CAPATH 7.9.8 -CURLOPT_CERTINFO 7.19.1 -CURLOPT_CHUNK_BGN_FUNCTION 7.21.0 -CURLOPT_CHUNK_DATA 7.21.0 -CURLOPT_CHUNK_END_FUNCTION 7.21.0 -CURLOPT_CLOSEFUNCTION 7.7 7.11.1 7.15.5 -CURLOPT_CLOSEPOLICY 7.7 7.16.1 -CURLOPT_CLOSESOCKETDATA 7.21.7 -CURLOPT_CLOSESOCKETFUNCTION 7.21.7 -CURLOPT_CONNECTTIMEOUT 7.7 -CURLOPT_CONNECTTIMEOUT_MS 7.16.2 -CURLOPT_CONNECT_ONLY 7.15.2 -CURLOPT_CONV_FROM_NETWORK_FUNCTION 7.15.4 -CURLOPT_CONV_FROM_UTF8_FUNCTION 7.15.4 -CURLOPT_CONV_TO_NETWORK_FUNCTION 7.15.4 -CURLOPT_COOKIE 7.1 -CURLOPT_COOKIEFILE 7.1 -CURLOPT_COOKIEJAR 7.9 -CURLOPT_COOKIELIST 7.14.1 -CURLOPT_COOKIESESSION 7.9.7 -CURLOPT_COPYPOSTFIELDS 7.17.1 -CURLOPT_CRLF 7.1 -CURLOPT_CRLFILE 7.19.0 -CURLOPT_CUSTOMREQUEST 7.1 -CURLOPT_DEBUGDATA 7.9.6 -CURLOPT_DEBUGFUNCTION 7.9.6 -CURLOPT_DIRLISTONLY 7.17.0 -CURLOPT_DNS_CACHE_TIMEOUT 7.9.3 -CURLOPT_DNS_SERVERS 7.24.0 -CURLOPT_DNS_USE_GLOBAL_CACHE 7.9.3 7.11.1 -CURLOPT_EGDSOCKET 7.7 -CURLOPT_ENCODING 7.10 -CURLOPT_ERRORBUFFER 7.1 -CURLOPT_FAILONERROR 7.1 -CURLOPT_FILE 7.1 7.9.7 -CURLOPT_FILETIME 7.5 -CURLOPT_FNMATCH_DATA 7.21.0 -CURLOPT_FNMATCH_FUNCTION 7.21.0 -CURLOPT_FOLLOWLOCATION 7.1 -CURLOPT_FORBID_REUSE 7.7 -CURLOPT_FRESH_CONNECT 7.7 -CURLOPT_FTPAPPEND 7.1 7.16.4 -CURLOPT_FTPASCII 7.1 7.11.1 7.15.5 -CURLOPT_FTPLISTONLY 7.1 7.16.4 -CURLOPT_FTPPORT 7.1 -CURLOPT_FTPSSLAUTH 7.12.2 -CURLOPT_FTP_ACCOUNT 7.13.0 -CURLOPT_FTP_ALTERNATIVE_TO_USER 7.15.5 -CURLOPT_FTP_CREATE_MISSING_DIRS 7.10.7 -CURLOPT_FTP_FILEMETHOD 7.15.1 -CURLOPT_FTP_RESPONSE_TIMEOUT 7.10.8 -CURLOPT_FTP_SKIP_PASV_IP 7.15.0 -CURLOPT_FTP_SSL 7.11.0 7.16.4 -CURLOPT_FTP_SSL_CCC 7.16.1 -CURLOPT_FTP_USE_EPRT 7.10.5 -CURLOPT_FTP_USE_EPSV 7.9.2 -CURLOPT_FTP_USE_PRET 7.20.0 -CURLOPT_GSSAPI_DELEGATION 7.22.0 -CURLOPT_HEADER 7.1 -CURLOPT_HEADERDATA 7.10 -CURLOPT_HEADERFUNCTION 7.7.2 -CURLOPT_HTTP200ALIASES 7.10.3 -CURLOPT_HTTPAUTH 7.10.6 -CURLOPT_HTTPGET 7.8.1 -CURLOPT_HTTPHEADER 7.1 -CURLOPT_HTTPPOST 7.1 -CURLOPT_HTTPPROXYTUNNEL 7.3 -CURLOPT_HTTPREQUEST 7.1 - 7.15.5 -CURLOPT_HTTP_CONTENT_DECODING 7.16.2 -CURLOPT_HTTP_TRANSFER_DECODING 7.16.2 -CURLOPT_HTTP_VERSION 7.9.1 -CURLOPT_IGNORE_CONTENT_LENGTH 7.14.1 -CURLOPT_INFILE 7.1 7.9.7 -CURLOPT_INFILESIZE 7.1 -CURLOPT_INFILESIZE_LARGE 7.11.0 -CURLOPT_INTERFACE 7.3 -CURLOPT_INTERLEAVEDATA 7.20.0 -CURLOPT_INTERLEAVEFUNCTION 7.20.0 -CURLOPT_IOCTLDATA 7.12.3 -CURLOPT_IOCTLFUNCTION 7.12.3 -CURLOPT_IPRESOLVE 7.10.8 -CURLOPT_ISSUERCERT 7.19.0 -CURLOPT_KEYPASSWD 7.17.0 -CURLOPT_KRB4LEVEL 7.3 7.17.0 -CURLOPT_KRBLEVEL 7.16.4 -CURLOPT_LOCALPORT 7.15.2 -CURLOPT_LOCALPORTRANGE 7.15.2 -CURLOPT_LOW_SPEED_LIMIT 7.1 -CURLOPT_LOW_SPEED_TIME 7.1 -CURLOPT_MAIL_AUTH 7.25.0 -CURLOPT_MAIL_FROM 7.20.0 -CURLOPT_MAIL_RCPT 7.20.0 -CURLOPT_MAXCONNECTS 7.7 -CURLOPT_MAXFILESIZE 7.10.8 -CURLOPT_MAXFILESIZE_LARGE 7.11.0 -CURLOPT_MAXREDIRS 7.5 -CURLOPT_MAX_RECV_SPEED_LARGE 7.15.5 -CURLOPT_MAX_SEND_SPEED_LARGE 7.15.5 -CURLOPT_MUTE 7.1 7.8 7.15.5 -CURLOPT_NETRC 7.1 -CURLOPT_NETRC_FILE 7.11.0 -CURLOPT_NEW_DIRECTORY_PERMS 7.16.4 -CURLOPT_NEW_FILE_PERMS 7.16.4 -CURLOPT_NOBODY 7.1 -CURLOPT_NOPROGRESS 7.1 -CURLOPT_NOPROXY 7.19.4 -CURLOPT_NOSIGNAL 7.10 -CURLOPT_NOTHING 7.1.1 7.11.1 7.11.0 -CURLOPT_OPENSOCKETDATA 7.17.1 -CURLOPT_OPENSOCKETFUNCTION 7.17.1 -CURLOPT_PASSWDDATA 7.4.2 7.11.1 7.15.5 -CURLOPT_PASSWDFUNCTION 7.4.2 7.11.1 7.15.5 -CURLOPT_PASSWORD 7.19.1 -CURLOPT_PASV_HOST 7.12.1 7.16.0 7.15.5 -CURLOPT_PORT 7.1 -CURLOPT_POST 7.1 -CURLOPT_POST301 7.17.1 7.19.1 -CURLOPT_POSTFIELDS 7.1 -CURLOPT_POSTFIELDSIZE 7.2 -CURLOPT_POSTFIELDSIZE_LARGE 7.11.1 -CURLOPT_POSTQUOTE 7.1 -CURLOPT_POSTREDIR 7.19.1 -CURLOPT_PREQUOTE 7.9.5 -CURLOPT_PRIVATE 7.10.3 -CURLOPT_PROGRESSDATA 7.1 -CURLOPT_PROGRESSFUNCTION 7.1 -CURLOPT_PROTOCOLS 7.19.4 -CURLOPT_PROXY 7.1 -CURLOPT_PROXYAUTH 7.10.7 -CURLOPT_PROXYPASSWORD 7.19.1 -CURLOPT_PROXYPORT 7.1 -CURLOPT_PROXYTYPE 7.10 -CURLOPT_PROXYUSERNAME 7.19.1 -CURLOPT_PROXYUSERPWD 7.1 -CURLOPT_PROXY_TRANSFER_MODE 7.18.0 -CURLOPT_PUT 7.1 -CURLOPT_QUOTE 7.1 -CURLOPT_RANDOM_FILE 7.7 -CURLOPT_RANGE 7.1 -CURLOPT_READDATA 7.9.7 -CURLOPT_READFUNCTION 7.1 -CURLOPT_REDIR_PROTOCOLS 7.19.4 -CURLOPT_REFERER 7.1 -CURLOPT_RESOLVE 7.21.3 -CURLOPT_RESUME_FROM 7.1 -CURLOPT_RESUME_FROM_LARGE 7.11.0 -CURLOPT_RTSPHEADER 7.20.0 -CURLOPT_RTSP_CLIENT_CSEQ 7.20.0 -CURLOPT_RTSP_REQUEST 7.20.0 -CURLOPT_RTSP_SERVER_CSEQ 7.20.0 -CURLOPT_RTSP_SESSION_ID 7.20.0 -CURLOPT_RTSP_STREAM_URI 7.20.0 -CURLOPT_RTSP_TRANSPORT 7.20.0 -CURLOPT_SEEKDATA 7.18.0 -CURLOPT_SEEKFUNCTION 7.18.0 -CURLOPT_SERVER_RESPONSE_TIMEOUT 7.20.0 -CURLOPT_SHARE 7.10 -CURLOPT_SOCKOPTDATA 7.16.0 -CURLOPT_SOCKOPTFUNCTION 7.16.0 -CURLOPT_SOCKS5_GSSAPI_NEC 7.19.4 -CURLOPT_SOCKS5_GSSAPI_SERVICE 7.19.4 -CURLOPT_SOURCE_HOST 7.12.1 - 7.15.5 -CURLOPT_SOURCE_PATH 7.12.1 - 7.15.5 -CURLOPT_SOURCE_PORT 7.12.1 - 7.15.5 -CURLOPT_SOURCE_POSTQUOTE 7.12.1 - 7.15.5 -CURLOPT_SOURCE_PREQUOTE 7.12.1 - 7.15.5 -CURLOPT_SOURCE_QUOTE 7.13.0 - 7.15.5 -CURLOPT_SOURCE_URL 7.13.0 - 7.15.5 -CURLOPT_SOURCE_USERPWD 7.12.1 - 7.15.5 -CURLOPT_SSH_AUTH_TYPES 7.16.1 -CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 7.17.1 -CURLOPT_SSH_KEYDATA 7.19.6 -CURLOPT_SSH_KEYFUNCTION 7.19.6 -CURLOPT_SSH_KNOWNHOSTS 7.19.6 -CURLOPT_SSH_PRIVATE_KEYFILE 7.16.1 -CURLOPT_SSH_PUBLIC_KEYFILE 7.16.1 -CURLOPT_SSLCERT 7.1 -CURLOPT_SSLCERTPASSWD 7.1.1 7.17.0 -CURLOPT_SSLCERTTYPE 7.9.3 -CURLOPT_SSLENGINE 7.9.3 -CURLOPT_SSLENGINE_DEFAULT 7.9.3 -CURLOPT_SSLKEY 7.9.3 -CURLOPT_SSLKEYPASSWD 7.9.3 7.17.0 -CURLOPT_SSLKEYTYPE 7.9.3 -CURLOPT_SSLVERSION 7.1 -CURLOPT_SSL_CIPHER_LIST 7.9 -CURLOPT_SSL_CTX_DATA 7.10.6 -CURLOPT_SSL_CTX_FUNCTION 7.10.6 -CURLOPT_SSL_OPTIONS 7.25.0 -CURLOPT_SSL_SESSIONID_CACHE 7.16.0 -CURLOPT_SSL_VERIFYHOST 7.8.1 -CURLOPT_SSL_VERIFYPEER 7.4.2 -CURLOPT_STDERR 7.1 -CURLOPT_TCP_KEEPALIVE 7.25.0 -CURLOPT_TCP_KEEPIDLE 7.25.0 -CURLOPT_TCP_KEEPINTVL 7.25.0 -CURLOPT_TCP_NODELAY 7.11.2 -CURLOPT_TELNETOPTIONS 7.7 -CURLOPT_TFTP_BLKSIZE 7.19.4 -CURLOPT_TIMECONDITION 7.1 -CURLOPT_TIMEOUT 7.1 -CURLOPT_TIMEOUT_MS 7.16.2 -CURLOPT_TIMEVALUE 7.1 -CURLOPT_TLSAUTH_PASSWORD 7.21.4 -CURLOPT_TLSAUTH_TYPE 7.21.4 -CURLOPT_TLSAUTH_USERNAME 7.21.4 -CURLOPT_TRANSFERTEXT 7.1.1 -CURLOPT_TRANSFER_ENCODING 7.21.6 -CURLOPT_UNRESTRICTED_AUTH 7.10.4 -CURLOPT_UPLOAD 7.1 -CURLOPT_URL 7.1 -CURLOPT_USERAGENT 7.1 -CURLOPT_USERNAME 7.19.1 -CURLOPT_USERPWD 7.1 -CURLOPT_USE_SSL 7.17.0 -CURLOPT_VERBOSE 7.1 -CURLOPT_WILDCARDMATCH 7.21.0 -CURLOPT_WRITEDATA 7.9.7 -CURLOPT_WRITEFUNCTION 7.1 -CURLOPT_WRITEHEADER 7.1 -CURLOPT_WRITEINFO 7.1 -CURLPAUSE_ALL 7.18.0 -CURLPAUSE_CONT 7.18.0 -CURLPAUSE_RECV 7.18.0 -CURLPAUSE_RECV_CONT 7.18.0 -CURLPAUSE_SEND 7.18.0 -CURLPAUSE_SEND_CONT 7.18.0 -CURLPROTO_ALL 7.19.4 -CURLPROTO_DICT 7.19.4 -CURLPROTO_FILE 7.19.4 -CURLPROTO_FTP 7.19.4 -CURLPROTO_FTPS 7.19.4 -CURLPROTO_GOPHER 7.21.2 -CURLPROTO_HTTP 7.19.4 -CURLPROTO_HTTPS 7.19.4 -CURLPROTO_IMAP 7.20.0 -CURLPROTO_IMAPS 7.20.0 -CURLPROTO_LDAP 7.19.4 -CURLPROTO_LDAPS 7.19.4 -CURLPROTO_POP3 7.20.0 -CURLPROTO_POP3S 7.20.0 -CURLPROTO_RTMP 7.21.0 -CURLPROTO_RTMPE 7.21.0 -CURLPROTO_RTMPS 7.21.0 -CURLPROTO_RTMPT 7.21.0 -CURLPROTO_RTMPTE 7.21.0 -CURLPROTO_RTMPTS 7.21.0 -CURLPROTO_RTSP 7.20.0 -CURLPROTO_SCP 7.19.4 -CURLPROTO_SFTP 7.19.4 -CURLPROTO_SMTP 7.20.0 -CURLPROTO_SMTPS 7.20.0 -CURLPROTO_TELNET 7.19.4 -CURLPROTO_TFTP 7.19.4 -CURLPROXY_HTTP 7.10 -CURLPROXY_HTTP_1_0 7.19.4 -CURLPROXY_SOCKS4 7.10 -CURLPROXY_SOCKS4A 7.18.0 -CURLPROXY_SOCKS5 7.10 -CURLPROXY_SOCKS5_HOSTNAME 7.18.0 -CURLSHE_BAD_OPTION 7.10.3 -CURLSHE_INVALID 7.10.3 -CURLSHE_IN_USE 7.10.3 -CURLSHE_NOMEM 7.12.0 -CURLSHE_NOT_BUILT_IN 7.23.0 -CURLSHE_OK 7.10.3 -CURLSHOPT_LOCKFUNC 7.10.3 -CURLSHOPT_NONE 7.10.3 -CURLSHOPT_SHARE 7.10.3 -CURLSHOPT_UNLOCKFUNC 7.10.3 -CURLSHOPT_UNSHARE 7.10.3 -CURLSHOPT_USERDATA 7.10.3 -CURLSOCKTYPE_ACCEPT 7.28.0 -CURLSOCKTYPE_IPCXN 7.16.0 -CURLSSH_AUTH_AGENT 7.28.0 -CURLSSH_AUTH_ANY 7.16.1 -CURLSSH_AUTH_DEFAULT 7.16.1 -CURLSSH_AUTH_HOST 7.16.1 -CURLSSH_AUTH_KEYBOARD 7.16.1 -CURLSSH_AUTH_NONE 7.16.1 -CURLSSH_AUTH_PASSWORD 7.16.1 -CURLSSH_AUTH_PUBLICKEY 7.16.1 -CURLSSLOPT_ALLOW_BEAST 7.25.0 -CURLUSESSL_ALL 7.17.0 -CURLUSESSL_CONTROL 7.17.0 -CURLUSESSL_NONE 7.17.0 -CURLUSESSL_TRY 7.17.0 -CURLVERSION_FIRST 7.10 -CURLVERSION_FOURTH 7.16.1 -CURLVERSION_NOW 7.10 -CURLVERSION_SECOND 7.11.1 -CURLVERSION_THIRD 7.12.0 -CURL_CHUNK_BGN_FUNC_FAIL 7.21.0 -CURL_CHUNK_BGN_FUNC_OK 7.21.0 -CURL_CHUNK_BGN_FUNC_SKIP 7.21.0 -CURL_CHUNK_END_FUNC_FAIL 7.21.0 -CURL_CHUNK_END_FUNC_OK 7.21.0 -CURL_CSELECT_ERR 7.16.3 -CURL_CSELECT_IN 7.16.3 -CURL_CSELECT_OUT 7.16.3 -CURL_EASY_NONE 7.14.0 - 7.15.4 -CURL_EASY_TIMEOUT 7.14.0 - 7.15.4 -CURL_ERROR_SIZE 7.1 -CURL_FNMATCHFUNC_FAIL 7.21.0 -CURL_FNMATCHFUNC_MATCH 7.21.0 -CURL_FNMATCHFUNC_NOMATCH 7.21.0 -CURL_FORMADD_DISABLED 7.12.1 -CURL_FORMADD_ILLEGAL_ARRAY 7.9.8 -CURL_FORMADD_INCOMPLETE 7.9.8 -CURL_FORMADD_MEMORY 7.9.8 -CURL_FORMADD_NULL 7.9.8 -CURL_FORMADD_OK 7.9.8 -CURL_FORMADD_OPTION_TWICE 7.9.8 -CURL_FORMADD_UNKNOWN_OPTION 7.9.8 -CURL_GLOBAL_ALL 7.8 -CURL_GLOBAL_DEFAULT 7.8 -CURL_GLOBAL_NOTHING 7.8 -CURL_GLOBAL_SSL 7.8 -CURL_GLOBAL_WIN32 7.8.1 -CURL_HTTP_VERSION_1_0 7.9.1 -CURL_HTTP_VERSION_1_1 7.9.1 -CURL_HTTP_VERSION_NONE 7.9.1 -CURL_IPRESOLVE_V4 7.10.8 -CURL_IPRESOLVE_V6 7.10.8 -CURL_IPRESOLVE_WHATEVER 7.10.8 -CURL_LOCK_ACCESS_NONE 7.10.3 -CURL_LOCK_ACCESS_SHARED 7.10.3 -CURL_LOCK_ACCESS_SINGLE 7.10.3 -CURL_LOCK_DATA_CONNECT 7.10.3 -CURL_LOCK_DATA_COOKIE 7.10.3 -CURL_LOCK_DATA_DNS 7.10.3 -CURL_LOCK_DATA_NONE 7.10.3 -CURL_LOCK_DATA_SHARE 7.10.4 -CURL_LOCK_DATA_SSL_SESSION 7.10.3 -CURL_LOCK_TYPE_CONNECT 7.10 - 7.10.2 -CURL_LOCK_TYPE_COOKIE 7.10 - 7.10.2 -CURL_LOCK_TYPE_DNS 7.10 - 7.10.2 -CURL_LOCK_TYPE_NONE 7.10 - 7.10.2 -CURL_LOCK_TYPE_SSL_SESSION 7.10 - 7.10.2 -CURL_MAX_HTTP_HEADER 7.19.7 -CURL_MAX_WRITE_SIZE 7.9.7 -CURL_NETRC_IGNORED 7.9.8 -CURL_NETRC_OPTIONAL 7.9.8 -CURL_NETRC_REQUIRED 7.9.8 -CURL_POLL_IN 7.14.0 -CURL_POLL_INOUT 7.14.0 -CURL_POLL_NONE 7.14.0 -CURL_POLL_OUT 7.14.0 -CURL_POLL_REMOVE 7.14.0 -CURL_PROGRESS_BAR 7.1.1 - 7.4.1 -CURL_PROGRESS_STATS 7.1.1 - 7.4.1 -CURL_READFUNC_ABORT 7.12.1 -CURL_READFUNC_PAUSE 7.18.0 -CURL_REDIR_GET_ALL 7.19.1 -CURL_REDIR_POST_301 7.19.1 -CURL_REDIR_POST_302 7.19.1 -CURL_REDIR_POST_303 7.25.1 -CURL_REDIR_POST_ALL 7.19.1 -CURL_RTSPREQ_ANNOUNCE 7.20.0 -CURL_RTSPREQ_DESCRIBE 7.20.0 -CURL_RTSPREQ_GET_PARAMETER 7.20.0 -CURL_RTSPREQ_NONE 7.20.0 -CURL_RTSPREQ_OPTIONS 7.20.0 -CURL_RTSPREQ_PAUSE 7.20.0 -CURL_RTSPREQ_PLAY 7.20.0 -CURL_RTSPREQ_RECEIVE 7.20.0 -CURL_RTSPREQ_RECORD 7.20.0 -CURL_RTSPREQ_SETUP 7.20.0 -CURL_RTSPREQ_SET_PARAMETER 7.20.0 -CURL_RTSPREQ_TEARDOWN 7.20.0 -CURL_SEEKFUNC_CANTSEEK 7.19.5 -CURL_SEEKFUNC_FAIL 7.19.5 -CURL_SEEKFUNC_OK 7.19.5 -CURL_SOCKET_BAD 7.14.0 -CURL_SOCKET_TIMEOUT 7.14.0 -CURL_SOCKOPT_ALREADY_CONNECTED 7.21.5 -CURL_SOCKOPT_ERROR 7.21.5 -CURL_SOCKOPT_OK 7.21.5 -CURL_SSLVERSION_DEFAULT 7.9.2 -CURL_SSLVERSION_SSLv2 7.9.2 -CURL_SSLVERSION_SSLv3 7.9.2 -CURL_SSLVERSION_TLSv1 7.9.2 -CURL_TIMECOND_IFMODSINCE 7.9.7 -CURL_TIMECOND_IFUNMODSINCE 7.9.7 -CURL_TIMECOND_LASTMOD 7.9.7 -CURL_TIMECOND_NONE 7.9.7 -CURL_TLSAUTH_NONE 7.21.4 -CURL_TLSAUTH_SRP 7.21.4 -CURL_VERSION_ASYNCHDNS 7.10.7 -CURL_VERSION_CONV 7.15.4 -CURL_VERSION_CURLDEBUG 7.19.6 -CURL_VERSION_DEBUG 7.10.6 -CURL_VERSION_GSSNEGOTIATE 7.10.6 -CURL_VERSION_IDN 7.12.0 -CURL_VERSION_IPV6 7.10 -CURL_VERSION_KERBEROS4 7.10 -CURL_VERSION_LARGEFILE 7.11.1 -CURL_VERSION_LIBZ 7.10 -CURL_VERSION_NTLM 7.10.6 -CURL_VERSION_NTLM_WB 7.22.0 -CURL_VERSION_SPNEGO 7.10.8 -CURL_VERSION_SSL 7.10 -CURL_VERSION_SSPI 7.13.2 -CURL_VERSION_TLSAUTH_SRP 7.21.4 -CURL_WAIT_POLLIN 7.28.0 -CURL_WAIT_POLLOUT 7.28.0 -CURL_WAIT_POLLPRI 7.28.0 -CURL_WRITEFUNC_PAUSE 7.18.0 diff --git a/plugins/FTPFileYM/curl/docs/libcurl/symbols.pl b/plugins/FTPFileYM/curl/docs/libcurl/symbols.pl deleted file mode 100644 index d1ff7a6562..0000000000 --- a/plugins/FTPFileYM/curl/docs/libcurl/symbols.pl +++ /dev/null @@ -1,100 +0,0 @@ -#!/usr/bin/perl -#*************************************************************************** -# _ _ ____ _ -# Project ___| | | | _ \| | -# / __| | | | |_) | | -# | (__| |_| | _ <| |___ -# \___|\___/|_| \_\_____| -# -# Copyright (C) 2011, Daniel Stenberg, <daniel@haxx.se>, et al. -# -# This software is licensed as described in the file COPYING, which -# you should have received as part of this distribution. The terms -# are also available at http://curl.haxx.se/docs/copyright.html. -# -# You may opt to use, copy, modify, merge, publish, distribute and/or sell -# copies of the Software, and permit persons to whom the Software is -# furnished to do so, under the terms of the COPYING file. -# -# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -# KIND, either express or implied. -# -########################################################################### -# -# Experience has shown that the symbols-in-versions file is very useful to -# applications that want to build with a wide range of libcurl versions. -# It is however easy to get it wrong and the source gets a bit messy with all -# the fixed numerical comparisions. -# -# The point of this script is to provide an easy-to-use macro for libcurl- -# using applications to do preprocessor checks for specific libcurl defines, -# and yet make the code clearly show what the macro is used for. -# -# Run this script and generate libcurl-symbols.h and then use that header in -# a fashion similar to: -# -# #include "libcurl-symbols.h" -# -# #if LIBCURL_HAS(CURLOPT_MUTE) -# has mute -# #else -# no mute -# #endif -# -# -open F, "<symbols-in-versions"; - -sub str2num { - my ($str)=@_; - if($str =~ /([0-9]*)\.([0-9]*)\.*([0-9]*)/) { - return sprintf("0x%06x", $1<<16 | $2 << 8 | $3); - } -} - -print <<EOS - -#include <curl/curl.h> - -#define LIBCURL_HAS(x) \\ - (defined(x ## _FIRST) && (x ## _FIRST <= LIBCURL_VERSION_NUM) && \\ - (!defined(x ## _LAST) || ( x ## _LAST >= LIBCURL_VERSION_NUM))) - -EOS - ; - -while(<F>) { - if(/^(CURL[^ ]*)[ \t]*(.*)/) { - my ($sym, $vers)=($1, $2); - - my $intr; - my $rm; - my $dep; - - # is there removed info? - if($vers =~ /([\d.]+)[ \t-]+([\d.]+)[ \t]+([\d.]+)/) { - ($intr, $dep, $rm)=($1, $2, $3); - } - # is it a dep-only line? - elsif($vers =~ /([\d.]+)[ \t-]+([\d.]+)/) { - ($intr, $dep)=($1, $2); - } - else { - $intr = $vers; - } - - my $inum = str2num($intr); - - print <<EOS -#define ${sym}_FIRST $inum /* Added in $intr */ -EOS -; - my $irm = str2num($rm); - if($rm) { - print <<EOS -#define ${sym}_LAST $irm /* Last featured in $rm */ -EOS -; - } - - } -} diff --git a/plugins/FTPFileYM/curl/docs/mk-ca-bundle.html b/plugins/FTPFileYM/curl/docs/mk-ca-bundle.html index 49f44401c0..fbdd58957a 100644 --- a/plugins/FTPFileYM/curl/docs/mk-ca-bundle.html +++ b/plugins/FTPFileYM/curl/docs/mk-ca-bundle.html @@ -70,8 +70,13 @@ p.roffit { <p class="level1">unlink (remove) certdata.txt after processing <p class="level0"><a name="-v"></a><span class="nroffip">-v</span> <p class="level1">be verbose and print out processed CAs <a name="EXIT"></a><h2 class="nroffsh">EXIT STATUS</h2> -<p class="level0">Returns 0 on success. Returns 1 if it fails to download data. <a name="SEE"></a><h2 class="nroffsh">SEE ALSO</h2> +<p class="level0">Returns 0 on success. Returns 1 if it fails to download data. <a name="CERTDATA"></a><h2 class="nroffsh">CERTDATA FORMAT</h2> +<p class="level0">The file format used by Mozilla for this trust information seems to be documented here: <pre> +<p class="level0"><a href="http://p11-glue.freedesktop.org/doc/storing-trust-policy/storing-trust-existing.html">http://p11-glue.freedesktop.org/doc/storing-trust-policy/storing-trust-existing.html</a> + </pre> + +<p class="level0"><a name="SEE"></a><h2 class="nroffsh">SEE ALSO</h2> <p class="level0"><span Class="manpage">curl (1)</span> <a name="HISTORY"></a><h2 class="nroffsh">HISTORY</h2> -<p class="level0"><span Class="bold">mk-ca-bundle</span> is a command line tool that is shipped as part of every curl and libcurl release (see <a href="http://curl.haxx.se/">http://curl.haxx.se/</a>). It was originally based on the parse-certs script written by Roland Krikava and was later much improved by Guenter Knauf. This manual page was written by Jan Schaumann <jschauma@netmeister.org>. <p class="roffit"> +<p class="level0"><span Class="bold">mk-ca-bundle</span> is a command line tool that is shipped as part of every curl and libcurl release (see <a href="http://curl.haxx.se/">http://curl.haxx.se/</a>). It was originally based on the parse-certs script written by Roland Krikava and was later much improved by Guenter Knauf. This manual page was initially written by Jan Schaumann <jschauma@netmeister.org>. <p class="roffit"> This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>. </body></html> diff --git a/plugins/FTPFileYM/curl/docs/mk-ca-bundle.pdf b/plugins/FTPFileYM/curl/docs/mk-ca-bundle.pdf Binary files differindex f3fb76dd83..aa11a96672 100644 --- a/plugins/FTPFileYM/curl/docs/mk-ca-bundle.pdf +++ b/plugins/FTPFileYM/curl/docs/mk-ca-bundle.pdf diff --git a/plugins/FTPFileYM/curl/lib/asyn-ares.c b/plugins/FTPFileYM/curl/lib/asyn-ares.c index 97b3f79031..0ef36cbbe2 100644 --- a/plugins/FTPFileYM/curl/lib/asyn-ares.c +++ b/plugins/FTPFileYM/curl/lib/asyn-ares.c @@ -315,6 +315,7 @@ CURLcode Curl_resolver_is_resolved(struct connectdata *conn, struct SessionHandle *data = conn->data; struct ResolverResults *res = (struct ResolverResults *) conn->async.os_specific; + CURLcode rc = CURLE_OK; *dns = NULL; @@ -325,19 +326,19 @@ CURLcode Curl_resolver_is_resolved(struct connectdata *conn, /* temp_ai ownership is moved to the connection, so we need not free-up them */ res->temp_ai = NULL; - destroy_async_data(&conn->async); if(!conn->async.dns) { - failf(data, "Could not resolve %s: %s (%s)", - conn->bits.proxy?"proxy":"host", - conn->host.dispname, - ares_strerror(conn->async.status)); - return conn->bits.proxy?CURLE_COULDNT_RESOLVE_PROXY: + failf(data, "Could not resolve: %s (%s)", + conn->async.hostname, ares_strerror(conn->async.status)); + rc = conn->bits.proxy?CURLE_COULDNT_RESOLVE_PROXY: CURLE_COULDNT_RESOLVE_HOST; } - *dns = conn->async.dns; + else + *dns = conn->async.dns; + + destroy_async_data(&conn->async); } - return CURLE_OK; + return rc; } /* @@ -415,37 +416,12 @@ CURLcode Curl_resolver_wait_resolv(struct connectdata *conn, if(entry) *entry = conn->async.dns; - if(!conn->async.dns) { - /* a name was not resolved */ - if((timeout < 0) || (conn->async.status == ARES_ETIMEOUT)) { - if(conn->bits.proxy) { - failf(data, "Resolving proxy timed out: %s", conn->proxy.dispname); - rc = CURLE_COULDNT_RESOLVE_PROXY; - } - else { - failf(data, "Resolving host timed out: %s", conn->host.dispname); - rc = CURLE_COULDNT_RESOLVE_HOST; - } - } - else if(conn->async.done) { - if(conn->bits.proxy) { - failf(data, "Could not resolve proxy: %s (%s)", conn->proxy.dispname, - ares_strerror(conn->async.status)); - rc = CURLE_COULDNT_RESOLVE_PROXY; - } - else { - failf(data, "Could not resolve host: %s (%s)", conn->host.dispname, - ares_strerror(conn->async.status)); - rc = CURLE_COULDNT_RESOLVE_HOST; - } - } - else - rc = CURLE_OPERATION_TIMEDOUT; - + if(rc) /* close the connection, since we can't return failure here without - cleaning up this connection properly */ + cleaning up this connection properly. + TODO: remove this action from here, it is not a name resolver decision. + */ conn->bits.close = TRUE; - } return rc; } @@ -614,8 +590,19 @@ CURLcode Curl_set_dns_servers(struct SessionHandle *data, char *servers) { CURLcode result = CURLE_NOT_BUILT_IN; + int ares_result; + + /* If server is NULL or empty, this would purge all DNS servers + * from ares library, which will cause any and all queries to fail. + * So, just return OK if none are configured and don't actually make + * any changes to c-ares. This lets c-ares use it's defaults, which + * it gets from the OS (for instance from /etc/resolv.conf on Linux). + */ + if(!(servers && servers[0])) + return CURLE_OK; + #if (ARES_VERSION >= 0x010704) - int ares_result = ares_set_servers_csv(data->state.resolver, servers); + ares_result = ares_set_servers_csv(data->state.resolver, servers); switch(ares_result) { case ARES_SUCCESS: result = CURLE_OK; @@ -632,8 +619,76 @@ CURLcode Curl_set_dns_servers(struct SessionHandle *data, } #else /* too old c-ares version! */ (void)data; - (void)servers; + (void)(ares_result); #endif return result; } + +CURLcode Curl_set_dns_interface(struct SessionHandle *data, + const char *interf) +{ +#if (ARES_VERSION >= 0x010704) + if(!interf) + interf = ""; + + ares_set_local_dev((ares_channel)data->state.resolver, interf); + + return CURLE_OK; +#else /* c-ares version too old! */ + (void)data; + (void)interf; + return CURLE_NOT_BUILT_IN; +#endif +} + +CURLcode Curl_set_dns_local_ip4(struct SessionHandle *data, + const char *local_ip4) +{ +#if (ARES_VERSION >= 0x010704) + uint32_t a4; + + if((!local_ip4) || (local_ip4[0] == 0)) { + a4 = 0; /* disabled: do not bind to a specific address */ + } + else { + if(Curl_inet_pton(AF_INET, local_ip4, &a4) != 1) { + return CURLE_BAD_FUNCTION_ARGUMENT; + } + } + + ares_set_local_ip4((ares_channel)data->state.resolver, ntohl(a4)); + + return CURLE_OK; +#else /* c-ares version too old! */ + (void)data; + (void)local_ip4; + return CURLE_NOT_BUILT_IN; +#endif +} + +CURLcode Curl_set_dns_local_ip6(struct SessionHandle *data, + const char *local_ip6) +{ +#if (ARES_VERSION >= 0x010704) + unsigned char a6[INET6_ADDRSTRLEN]; + + if((!local_ip6) || (local_ip6[0] == 0)) { + /* disabled: do not bind to a specific address */ + memset(a6, 0, sizeof(a6)); + } + else { + if(Curl_inet_pton(AF_INET6, local_ip6, a6) != 1) { + return CURLE_BAD_FUNCTION_ARGUMENT; + } + } + + ares_set_local_ip6((ares_channel)data->state.resolver, a6); + + return CURLE_OK; +#else /* c-ares version too old! */ + (void)data; + (void)local_ip6; + return CURLE_NOT_BUILT_IN; +#endif +} #endif /* CURLRES_ARES */ diff --git a/plugins/FTPFileYM/curl/lib/asyn-thread.c b/plugins/FTPFileYM/curl/lib/asyn-thread.c index 7a8294ddf5..4882c37203 100644 --- a/plugins/FTPFileYM/curl/lib/asyn-thread.c +++ b/plugins/FTPFileYM/curl/lib/asyn-thread.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -170,7 +170,7 @@ struct thread_sync_data { struct thread_data { curl_thread_t thread_hnd; unsigned int poll_interval; - int interval_end; + long interval_end; struct thread_sync_data tsd; }; @@ -265,7 +265,7 @@ static int getaddrinfo_complete(struct connectdata *conn) static unsigned int CURL_STDCALL getaddrinfo_thread (void *arg) { struct thread_sync_data *tsd = (struct thread_sync_data*)arg; - char service [NI_MAXSERV]; + char service[12]; int rc; snprintf(service, sizeof(service), "%d", tsd->port); @@ -387,61 +387,27 @@ static bool init_resolve_thread (struct connectdata *conn, return FALSE; } -#if defined(HAVE_GETADDRINFO) && !defined(HAVE_GAI_STRERROR) && !defined(WIN32) -/* NetWare has getaddrinfo but lacks gai_strerror. - Windows has a gai_strerror but it is bad (not thread-safe) and the generic - socket error string function can be used for this pupose. */ -static const char *gai_strerror(int ecode) -{ - switch (ecode) { - case EAI_AGAIN: - return "The name could not be resolved at this time"; - case EAI_BADFLAGS: - return "The flags parameter had an invalid value"; - case EAI_FAIL: - return "A non-recoverable error occurred when attempting to " - "resolve the name"; - case EAI_FAMILY: - return "The address family was not recognized"; - case EAI_MEMORY: - return "Out of memory"; - case EAI_NONAME: - return "The name does not resolve for the supplied parameters"; - case EAI_SERVICE: - return "The service passed was not recognized for the " - "specified socket type" - case EAI_SOCKTYPE: - return "The intended socket type was not recognized" - case EAI_SYSTEM: - return "A system error occurred"; - case EAI_OVERFLOW: - return "An argument buffer overflowed"; - default: - return "Unknown error"; - -/* define this now as this is a private implementation of said function */ -#define HAVE_GAI_STRERROR -} -#endif - - /* * resolver_error() calls failf() with the appropriate message after a resolve * error */ -static void resolver_error(struct connectdata *conn, const char *host_or_proxy) +static CURLcode resolver_error(struct connectdata *conn) { - failf(conn->data, "Could not resolve %s: %s; %s", host_or_proxy, - conn->async.hostname, -#ifdef HAVE_GAI_STRERROR - /* NetWare doesn't have gai_strerror and on Windows it isn't deemed - thread-safe */ - gai_strerror(conn->async.status) -#else - Curl_strerror(conn, conn->async.status) -#endif - ); + const char *host_or_proxy; + CURLcode rc; + if(conn->bits.httpproxy) { + host_or_proxy = "proxy"; + rc = CURLE_COULDNT_RESOLVE_PROXY; + } + else { + host_or_proxy = "host"; + rc = CURLE_COULDNT_RESOLVE_HOST; + } + + failf(conn->data, "Could not resolve %s: %s", host_or_proxy, + conn->async.hostname); + return rc; } /* @@ -473,17 +439,9 @@ CURLcode Curl_resolver_wait_resolv(struct connectdata *conn, if(entry) *entry = conn->async.dns; - if(!conn->async.dns) { - /* a name was not resolved */ - if(conn->bits.httpproxy) { - resolver_error(conn, "proxy"); - rc = CURLE_COULDNT_RESOLVE_PROXY; - } - else { - resolver_error(conn, "host"); - rc = CURLE_COULDNT_RESOLVE_HOST; - } - } + if(!conn->async.dns) + /* a name was not resolved, report error */ + rc = resolver_error(conn); destroy_async_data(&conn->async); @@ -518,17 +476,18 @@ CURLcode Curl_resolver_is_resolved(struct connectdata *conn, if(done) { getaddrinfo_complete(conn); - destroy_async_data(&conn->async); if(!conn->async.dns) { - resolver_error(conn, "host"); - return CURLE_COULDNT_RESOLVE_HOST; + CURLcode rc = resolver_error(conn); + destroy_async_data(&conn->async); + return rc; } + destroy_async_data(&conn->async); *entry = conn->async.dns; } else { /* poll for name lookup done with exponential backoff up to 250ms */ - int elapsed = Curl_tvdiff(Curl_tvnow(), data->progress.t_startsingle); + long elapsed = Curl_tvdiff(Curl_tvnow(), data->progress.t_startsingle); if(elapsed < 0) elapsed = 0; @@ -600,7 +559,7 @@ Curl_addrinfo *Curl_resolver_getaddrinfo(struct connectdata *conn, struct in_addr in; Curl_addrinfo *res; int error; - char sbuf[NI_MAXSERV]; + char sbuf[12]; int pf = PF_INET; #ifdef CURLRES_IPV6 struct in6_addr in6; @@ -676,4 +635,28 @@ CURLcode Curl_set_dns_servers(struct SessionHandle *data, } +CURLcode Curl_set_dns_interface(struct SessionHandle *data, + const char *interf) +{ + (void)data; + (void)interf; + return CURLE_NOT_BUILT_IN; +} + +CURLcode Curl_set_dns_local_ip4(struct SessionHandle *data, + const char *local_ip4) +{ + (void)data; + (void)local_ip4; + return CURLE_NOT_BUILT_IN; +} + +CURLcode Curl_set_dns_local_ip6(struct SessionHandle *data, + const char *local_ip6) +{ + (void)data; + (void)local_ip6; + return CURLE_NOT_BUILT_IN; +} + #endif /* CURLRES_THREADED */ diff --git a/plugins/FTPFileYM/curl/lib/axtls.c b/plugins/FTPFileYM/curl/lib/axtls.c index d512950c2c..44e6b9303c 100644 --- a/plugins/FTPFileYM/curl/lib/axtls.c +++ b/plugins/FTPFileYM/curl/lib/axtls.c @@ -41,26 +41,12 @@ #define _MPRINTF_REPLACE /* use our functions only */ #include <curl/mprintf.h> #include "curl_memory.h" +#include <unistd.h> /* The last #include file should be: */ #include "memdebug.h" #include "hostcheck.h" -/* SSL_read is opied from axTLS compat layer */ -static int SSL_read(SSL *ssl, void *buf, int num) -{ - uint8_t *read_buf; - int ret; - - while((ret = ssl_read(ssl, &read_buf)) == SSL_OK); - - if(ret > SSL_OK) { - memcpy(buf, read_buf, ret > num ? num : ret); - } - - return ret; -} - /* Global axTLS init, called from Curl_ssl_init() */ int Curl_axtls_init(void) { @@ -131,31 +117,40 @@ static CURLcode map_error_to_curl(int axtls_err) static Curl_recv axtls_recv; static Curl_send axtls_send; +static void free_ssl_structs(struct ssl_connect_data *connssl) +{ + if(connssl->ssl) { + ssl_free (connssl->ssl); + connssl->ssl = NULL; + } + if(connssl->ssl_ctx) { + ssl_ctx_free(connssl->ssl_ctx); + connssl->ssl_ctx = NULL; + } +} + /* - * This function is called after the TCP connect has completed. Setup the TLS - * layer and do all necessary magic. + * For both blocking and non-blocking connects, this function sets up the + * ssl context and state. This function is called after the TCP connect + * has completed. */ -CURLcode -Curl_axtls_connect(struct connectdata *conn, - int sockindex) - +static CURLcode connect_prep(struct connectdata *conn, int sockindex) { struct SessionHandle *data = conn->data; SSL_CTX *ssl_ctx; - SSL *ssl; + SSL *ssl = NULL; int cert_types[] = {SSL_OBJ_X509_CERT, SSL_OBJ_PKCS12, 0}; int key_types[] = {SSL_OBJ_RSA_KEY, SSL_OBJ_PKCS8, SSL_OBJ_PKCS12, 0}; int i, ssl_fcn_return; const uint8_t *ssl_sessionid; size_t ssl_idsize; - const char *peer_CN; - uint32_t dns_altname_index; - const char *dns_altname; - int8_t found_subject_alt_names = 0; - int8_t found_subject_alt_name_matching_conn = 0; - /* Assuming users will not compile in custom key/cert to axTLS */ - uint32_t client_option = SSL_NO_DEFAULT_KEY|SSL_SERVER_VERIFY_LATER; + /* Assuming users will not compile in custom key/cert to axTLS. + * Also, even for blocking connects, use axTLS non-blocking feature. + */ + uint32_t client_option = SSL_NO_DEFAULT_KEY | + SSL_SERVER_VERIFY_LATER | + SSL_CONNECT_IN_PARTS; if(conn->ssl[sockindex].state == ssl_connection_complete) /* to make us tolerant against being called more than once for the @@ -184,6 +179,9 @@ Curl_axtls_connect(struct connectdata *conn, return CURLE_SSL_CONNECT_ERROR; } + conn->ssl[sockindex].ssl_ctx = ssl_ctx; + conn->ssl[sockindex].ssl = NULL; + /* Load the trusted CA cert bundle file */ if(data->set.ssl.CAfile) { if(ssl_obj_load(ssl_ctx, SSL_OBJ_X509_CACERT, data->set.ssl.CAfile, NULL) @@ -191,7 +189,6 @@ Curl_axtls_connect(struct connectdata *conn, infof(data, "error reading ca cert file %s \n", data->set.ssl.CAfile); if(data->set.ssl.verifypeer) { - Curl_axtls_close(conn, sockindex); return CURLE_SSL_CACERT_BADFILE; } } @@ -225,7 +222,6 @@ Curl_axtls_connect(struct connectdata *conn, if(cert_types[i] == 0) { failf(data, "%s is not x509 or pkcs12 format", data->set.str[STRING_CERT]); - Curl_axtls_close(conn, sockindex); return CURLE_SSL_CERTPROBLEM; } } @@ -250,7 +246,6 @@ Curl_axtls_connect(struct connectdata *conn, if(key_types[i] == 0) { failf(data, "Failure: %s is not a supported key file", data->set.str[STRING_KEY]); - Curl_axtls_close(conn, sockindex); return CURLE_SSL_CONNECT_ERROR; } } @@ -271,14 +266,25 @@ Curl_axtls_connect(struct connectdata *conn, else ssl = ssl_client_new(ssl_ctx, conn->sock[sockindex], NULL, 0); - /* Check to make sure handshake was ok. */ - ssl_fcn_return = ssl_handshake_status(ssl); - if(ssl_fcn_return != SSL_OK) { - Curl_axtls_close(conn, sockindex); - ssl_display_error(ssl_fcn_return); /* goes to stdout. */ - return map_error_to_curl(ssl_fcn_return); - } - infof (data, "handshake completed successfully\n"); + conn->ssl[sockindex].ssl = ssl; + return CURLE_OK; +} + +/* + * For both blocking and non-blocking connects, this function finalizes the + * SSL connection. + */ +static CURLcode connect_finish(struct connectdata *conn, int sockindex) +{ + struct SessionHandle *data = conn->data; + SSL *ssl = conn->ssl[sockindex].ssl; + const uint8_t *ssl_sessionid; + size_t ssl_idsize; + const char *peer_CN; + uint32_t dns_altname_index; + const char *dns_altname; + int8_t found_subject_alt_names = 0; + int8_t found_subject_alt_name_matching_conn = 0; /* Here, gtls.c gets the peer certificates and fails out depending on * settings in "data." axTLS api doesn't have get cert chain fcn, so omit? @@ -289,7 +295,7 @@ Curl_axtls_connect(struct connectdata *conn, if(ssl_verify_cert(ssl) != SSL_OK) { Curl_axtls_close(conn, sockindex); failf(data, "server cert verify failed"); - return CURLE_SSL_CONNECT_ERROR; + return CURLE_PEER_FAILED_VERIFICATION; } } else @@ -306,7 +312,6 @@ Curl_axtls_connect(struct connectdata *conn, * this, but a couple fields are available. */ - /* There is no (DNS) Altnames count in the version 1.4.8 API. There is a risk of an inifite loop */ for(dns_altname_index = 0; ; dns_altname_index++) { @@ -326,20 +331,29 @@ Curl_axtls_connect(struct connectdata *conn, /* RFC2818 checks */ if(found_subject_alt_names && !found_subject_alt_name_matching_conn) { - /* Break connection ! */ - Curl_axtls_close(conn, sockindex); - failf(data, "\tsubjectAltName(s) do not match %s\n", conn->host.dispname); - return CURLE_PEER_FAILED_VERIFICATION; + if(data->set.ssl.verifyhost) { + /* Break connection ! */ + Curl_axtls_close(conn, sockindex); + failf(data, "\tsubjectAltName(s) do not match %s\n", + conn->host.dispname); + return CURLE_PEER_FAILED_VERIFICATION; + } + else + infof(data, "\tsubjectAltName(s) do not match %s\n", + conn->host.dispname); } else if(found_subject_alt_names == 0) { /* Per RFC2818, when no Subject Alt Names were available, examine the peer CN as a legacy fallback */ peer_CN = ssl_get_cert_dn(ssl, SSL_X509_CERT_COMMON_NAME); if(peer_CN == NULL) { - /* Similar behaviour to the OpenSSL interface */ - Curl_axtls_close(conn, sockindex); - failf(data, "unable to obtain common name from peer certificate"); - return CURLE_PEER_FAILED_VERIFICATION; + if(data->set.ssl.verifyhost) { + Curl_axtls_close(conn, sockindex); + failf(data, "unable to obtain common name from peer certificate"); + return CURLE_PEER_FAILED_VERIFICATION; + } + else + infof(data, "unable to obtain common name from peer certificate"); } else { if(!Curl_cert_hostcheck((const char *)peer_CN, conn->host.name)) { @@ -359,8 +373,6 @@ Curl_axtls_connect(struct connectdata *conn, /* General housekeeping */ conn->ssl[sockindex].state = ssl_connection_complete; - conn->ssl[sockindex].ssl = ssl; - conn->ssl[sockindex].ssl_ctx = ssl_ctx; conn->recv[sockindex] = axtls_recv; conn->send[sockindex] = axtls_send; @@ -374,6 +386,107 @@ Curl_axtls_connect(struct connectdata *conn, return CURLE_OK; } +/* + * Use axTLS's non-blocking connection feature to open an SSL connection. + * This is called after a TCP connection is already established. +*/ +CURLcode Curl_axtls_connect_nonblocking( + struct connectdata *conn, + int sockindex, + bool *done) +{ + CURLcode conn_step; + int ssl_fcn_return; + + *done = FALSE; + /* connectdata is calloc'd and connecting_state is only changed in this + function, so this is safe, as the state is effectively initialized. */ + if(conn->ssl[sockindex].connecting_state == ssl_connect_1) { + conn_step = connect_prep(conn, sockindex); + if(conn_step != CURLE_OK) { + Curl_axtls_close(conn, sockindex); + return conn_step; + } + conn->ssl[sockindex].connecting_state = ssl_connect_2; + } + + if(conn->ssl[sockindex].connecting_state == ssl_connect_2) { + /* Check to make sure handshake was ok. */ + if(ssl_handshake_status(conn->ssl[sockindex].ssl) != SSL_OK) { + ssl_fcn_return = ssl_read(conn->ssl[sockindex].ssl, NULL); + if(ssl_fcn_return < 0) { + Curl_axtls_close(conn, sockindex); + ssl_display_error(ssl_fcn_return); /* goes to stdout. */ + return map_error_to_curl(ssl_fcn_return); + } + else { + return CURLE_OK; /* Return control to caller for retries */ + } + } + infof (conn->data, "handshake completed successfully\n"); + conn->ssl[sockindex].connecting_state = ssl_connect_3; + } + + if(conn->ssl[sockindex].connecting_state == ssl_connect_3) { + conn_step = connect_finish(conn, sockindex); + if(conn_step != CURLE_OK) { + Curl_axtls_close(conn, sockindex); + return conn_step; + } + + /* Reset connect state */ + conn->ssl[sockindex].connecting_state = ssl_connect_1; + + *done = TRUE; + return CURLE_OK; + } + + /* Unrecognized state. Things are very bad. */ + conn->ssl[sockindex].state = ssl_connection_none; + conn->ssl[sockindex].connecting_state = ssl_connect_1; + /* Return value perhaps not strictly correct, but distinguishes the issue.*/ + return CURLE_BAD_FUNCTION_ARGUMENT; +} + + +/* + * This function is called after the TCP connect has completed. Setup the TLS + * layer and do all necessary magic for a blocking connect. + */ +CURLcode +Curl_axtls_connect(struct connectdata *conn, + int sockindex) + +{ + CURLcode conn_step = connect_prep(conn, sockindex); + int ssl_fcn_return; + SSL *ssl = conn->ssl[sockindex].ssl; + + if(conn_step != CURLE_OK) { + Curl_axtls_close(conn, sockindex); + return conn_step; + } + + /* Check to make sure handshake was ok. */ + while(ssl_handshake_status(ssl) != SSL_OK) { + ssl_fcn_return = ssl_read(ssl, NULL); + if(ssl_fcn_return < 0) { + Curl_axtls_close(conn, sockindex); + ssl_display_error(ssl_fcn_return); /* goes to stdout. */ + return map_error_to_curl(ssl_fcn_return); + } + usleep(10000); + } + infof (conn->data, "handshake completed successfully\n"); + + conn_step = connect_finish(conn, sockindex); + if(conn_step != CURLE_OK) { + Curl_axtls_close(conn, sockindex); + return conn_step; + } + + return CURLE_OK; +} /* return number of sent (non-SSL) bytes */ static ssize_t axtls_send(struct connectdata *conn, @@ -407,7 +520,7 @@ void Curl_axtls_close(struct connectdata *conn, int sockindex) struct ssl_connect_data *connssl = &conn->ssl[sockindex]; infof(conn->data, " Curl_axtls_close\n"); - if(connssl->ssl) { + /* line from ssluse.c: (void)SSL_shutdown(connssl->ssl); axTLS compat layer does nothing for SSL_shutdown */ @@ -415,13 +528,7 @@ void Curl_axtls_close(struct connectdata *conn, int sockindex) equivalent. ssl_free and ssl_ctx_free close things. SSL_set_connect_state(connssl->handle); */ - ssl_free (connssl->ssl); - connssl->ssl = NULL; - } - if(connssl->ssl_ctx) { - ssl_ctx_free (connssl->ssl_ctx); - connssl->ssl_ctx = NULL; - } + free_ssl_structs(connssl); } /* @@ -436,8 +543,7 @@ int Curl_axtls_shutdown(struct connectdata *conn, int sockindex) int retval = 0; struct ssl_connect_data *connssl = &conn->ssl[sockindex]; struct SessionHandle *data = conn->data; - char buf[120]; /* We will use this for the OpenSSL error buffer, so it has - to be at least 120 bytes long. */ + uint8_t *buf; ssize_t nread; infof(conn->data, " Curl_axtls_shutdown\n"); @@ -457,9 +563,10 @@ int Curl_axtls_shutdown(struct connectdata *conn, int sockindex) CURL_SOCKET_BAD, SSL_SHUTDOWN_TIMEOUT); if(what > 0) { /* Something to read, let's do it and hope that it is the close - notify alert from the server */ - nread = (ssize_t)SSL_read(conn->ssl[sockindex].ssl, buf, - sizeof(buf)); + notify alert from the server. buf is managed internally by + axTLS and will be released upon calling ssl_free via + free_ssl_structs. */ + nread = (ssize_t)ssl_read(connssl->ssl, &buf); if(nread < SSL_OK) { failf(data, "close notify alert not received during shutdown"); @@ -476,8 +583,7 @@ int Curl_axtls_shutdown(struct connectdata *conn, int sockindex) retval = -1; } - ssl_free (connssl->ssl); - connssl->ssl = NULL; + free_ssl_structs(connssl); } return retval; } @@ -490,26 +596,36 @@ static ssize_t axtls_recv(struct connectdata *conn, /* connection data */ { struct ssl_connect_data *connssl = &conn->ssl[num]; ssize_t ret = 0; + uint8_t *read_buf; infof(conn->data, " axtls_recv\n"); + *err = CURLE_OK; if(connssl) { - ret = (ssize_t)SSL_read(conn->ssl[num].ssl, buf, (int)buffersize); - - /* axTLS isn't terribly generous about error reporting */ - /* With patched axTLS, SSL_CLOSE_NOTIFY=-3. Hard-coding until axTLS - team approves proposed fix. */ - if(ret == -3 ) { + ret = ssl_read(connssl->ssl, &read_buf); + if(ret > SSL_OK) { + /* ssl_read returns SSL_OK if there is more data to read, so if it is + larger, then all data has been read already. */ + memcpy(buf, read_buf, + (size_t)ret > buffersize ? buffersize : (size_t)ret); + } + else if(ret == SSL_OK) { + /* more data to be read, signal caller to call again */ + *err = CURLE_AGAIN; + ret = -1; + } + else if(ret == -3) { + /* With patched axTLS, SSL_CLOSE_NOTIFY=-3. Hard-coding until axTLS + team approves proposed fix. */ Curl_axtls_close(conn, num); } - else if(ret < 0) { - failf(conn->data, "axTLS recv error (%d)", (int)ret); + else { + failf(conn->data, "axTLS recv error (%d)", ret); *err = map_error_to_curl(ret); - return -1; + ret = -1; } } - *err = CURLE_OK; return ret; } diff --git a/plugins/FTPFileYM/curl/lib/axtls.h b/plugins/FTPFileYM/curl/lib/axtls.h index 8d33b1c7a7..db91365976 100644 --- a/plugins/FTPFileYM/curl/lib/axtls.h +++ b/plugins/FTPFileYM/curl/lib/axtls.h @@ -30,6 +30,10 @@ int Curl_axtls_init(void); int Curl_axtls_cleanup(void); CURLcode Curl_axtls_connect(struct connectdata *conn, int sockindex); +CURLcode Curl_axtls_connect_nonblocking( + struct connectdata *conn, + int sockindex, + bool *done); /* tell axTLS to close down all open information regarding connections (and thus session ID caching etc) */ @@ -47,6 +51,7 @@ int Curl_axtls_check_cxn(struct connectdata *conn); #define curlssl_init Curl_axtls_init #define curlssl_cleanup Curl_axtls_cleanup #define curlssl_connect Curl_axtls_connect +#define curlssl_connect_nonblocking Curl_axtls_connect_nonblocking #define curlssl_session_free(x) Curl_axtls_session_free(x) #define curlssl_close_all Curl_axtls_close_all #define curlssl_close Curl_axtls_close diff --git a/plugins/FTPFileYM/curl/lib/config-dos.h b/plugins/FTPFileYM/curl/lib/config-dos.h index 68614e8f45..cce5e81065 100644 --- a/plugins/FTPFileYM/curl/lib/config-dos.h +++ b/plugins/FTPFileYM/curl/lib/config-dos.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -79,7 +79,6 @@ #define HAVE_SYS_SOCKET_H 1 #define HAVE_SYS_STAT_H 1 #define HAVE_SYS_TYPES_H 1 -#define HAVE_TERMIOS_H 1 #define HAVE_TIME_H 1 #define HAVE_UNISTD_H 1 @@ -149,7 +148,7 @@ #if defined(__HIGHC__) || \ (defined(__GNUC__) && (__GNUC__ < 4)) -#define ssize_t int + #define ssize_t int #endif #define CURL_CA_BUNDLE getenv("CURL_CA_BUNDLE") @@ -162,12 +161,9 @@ #define HAVE_SIGACTION 1 #define HAVE_SIGSETJMP 1 #define HAVE_SYS_TIME_H 1 + #define HAVE_TERMIOS_H 1 #define HAVE_VARIADIC_MACROS_GCC 1 - #if (DJGPP_MINOR >= 4) - #define HAVE_STRLCAT 1 - #endif - /* Because djgpp <= 2.03 doesn't have snprintf() etc. */ #if (DJGPP_MINOR < 4) #define _MPRINTF_REPLACE @@ -178,11 +174,11 @@ #elif defined(__HIGHC__) #define HAVE_SYS_TIME_H 1 + #define strerror(e) strerror_s_((e)) #endif #ifdef MSDOS /* Watt-32 */ - #define HAVE_CLOSESOCKET_CAMEL 1 - #define CloseSocket(s) close_s((s)) + #define HAVE_CLOSE_S 1 #endif #undef word diff --git a/plugins/FTPFileYM/curl/lib/config-os400.h b/plugins/FTPFileYM/curl/lib/config-os400.h index 208c029036..a290fe43d7 100644 --- a/plugins/FTPFileYM/curl/lib/config-os400.h +++ b/plugins/FTPFileYM/curl/lib/config-os400.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -277,30 +277,33 @@ /* Define if you have the <stdlib.h> header file. */ #define HAVE_STDLIB_H + +/* The following define is needed on OS400 to enable strcmpi(), stricmp() and + strdup(). */ +#define __cplusplus__strings__ + /* Define if you have the `strcasecmp' function. */ #undef HAVE_STRCASECMP /* Define if you have the `strcmpi' function. */ -#undef HAVE_STRCMPI +#define HAVE_STRCMPI + +/* Define if you have the `stricmp' function. */ +#define HAVE_STRICMP /* Define if you have the `strdup' function. */ -#undef HAVE_STRDUP +#define HAVE_STRDUP + /* Define if you have the `strftime' function. */ #define HAVE_STRFTIME -/* Define if you have the `stricmp' function. */ -#undef HAVE_STRICMP - /* Define if you have the <strings.h> header file. */ #define HAVE_STRINGS_H /* Define if you have the <string.h> header file. */ #define HAVE_STRING_H -/* Define if you have the `strlcat' function. */ -#undef HAVE_STRLCAT - /* Define if you have the `strlcpy' function. */ #undef HAVE_STRLCPY @@ -528,6 +531,9 @@ /* Define to use the QsoSSL package. */ #define USE_QSOSSL +/* Define to use the GSKit package. */ +#undef USE_GSKIT + /* Use the system keyring as the default CA bundle. */ #define CURL_CA_BUNDLE "/QIBM/UserData/ICSS/Cert/Server/DEFAULT.KDB" diff --git a/plugins/FTPFileYM/curl/lib/config-riscos.h b/plugins/FTPFileYM/curl/lib/config-riscos.h index e2af9af6c0..e400577895 100644 --- a/plugins/FTPFileYM/curl/lib/config-riscos.h +++ b/plugins/FTPFileYM/curl/lib/config-riscos.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -305,9 +305,6 @@ /* Define if you have the <string.h> header file. */ #define HAVE_STRING_H -/* Define if you have the `strlcat' function. */ -#undef HAVE_STRLCAT - /* Define if you have the `strlcpy' function. */ #undef HAVE_STRLCPY diff --git a/plugins/FTPFileYM/curl/lib/config-symbian.h b/plugins/FTPFileYM/curl/lib/config-symbian.h index fcfb4058c5..17d92b0619 100644 --- a/plugins/FTPFileYM/curl/lib/config-symbian.h +++ b/plugins/FTPFileYM/curl/lib/config-symbian.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -504,9 +504,6 @@ /* Define to 1 if you have the `strcasecmp' function. */ #define HAVE_STRCASECMP 1 -/* Define to 1 if you have the `strcasestr' function. */ -#define HAVE_STRCASESTR 1 - /* Define to 1 if you have the `strcmpi' function. */ /* #undef HAVE_STRCMPI */ @@ -525,9 +522,6 @@ /* Define to 1 if you have the <string.h> header file. */ #define HAVE_STRING_H 1 -/* Define to 1 if you have the `strlcat' function. */ -#define HAVE_STRLCAT 1 - /* Define to 1 if you have the `strlcpy' function. */ #define HAVE_STRLCPY 1 diff --git a/plugins/FTPFileYM/curl/lib/config-tpf.h b/plugins/FTPFileYM/curl/lib/config-tpf.h index 0208ab835f..ddb8f778c2 100644 --- a/plugins/FTPFileYM/curl/lib/config-tpf.h +++ b/plugins/FTPFileYM/curl/lib/config-tpf.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -471,9 +471,6 @@ /* Define to 1 if you have the <string.h> header file. */ #define HAVE_STRING_H 1 -/* Define to 1 if you have the `strlcat' function. */ -/* #undef HAVE_STRLCAT */ - /* Define to 1 if you have the `strlcpy' function. */ /* #undef HAVE_STRLCPY */ diff --git a/plugins/FTPFileYM/curl/lib/config-vxworks.h b/plugins/FTPFileYM/curl/lib/config-vxworks.h index 5b224c0453..c94534afb8 100644 --- a/plugins/FTPFileYM/curl/lib/config-vxworks.h +++ b/plugins/FTPFileYM/curl/lib/config-vxworks.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -571,9 +571,6 @@ /* Define to 1 if you have the strcasecmp function. */ #define HAVE_STRCASECMP 1 -/* Define to 1 if you have the strcasestr function. */ -/* #undef HAVE_STRCASESTR */ - /* Define to 1 if you have the strcmpi function. */ /* #undef HAVE_STRCMPI */ @@ -592,9 +589,6 @@ /* Define to 1 if you have the <string.h> header file. */ #define HAVE_STRING_H 1 -/* Define to 1 if you have the strlcat function. */ -/* #undef HAVE_STRLCAT */ - /* Define to 1 if you have the `strlcpy' function. */ /* #undef HAVE_STRLCPY */ diff --git a/plugins/FTPFileYM/curl/lib/config-win32.h b/plugins/FTPFileYM/curl/lib/config-win32.h index cfbca9ca38..59ba4e538f 100644 --- a/plugins/FTPFileYM/curl/lib/config-win32.h +++ b/plugins/FTPFileYM/curl/lib/config-win32.h @@ -391,21 +391,6 @@ #endif /* ---------------------------------------------------------------- */ -/* STRUCT RELATED */ -/* ---------------------------------------------------------------- */ - -/* Define if you have struct sockaddr_storage. */ -#if !defined(__SALFORDC__) && !defined(__BORLANDC__) -#define HAVE_STRUCT_SOCKADDR_STORAGE 1 -#endif - -/* Define if you have struct timeval. */ -#define HAVE_STRUCT_TIMEVAL 1 - -/* Define if struct sockaddr_in6 has the sin6_scope_id member. */ -#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1 - -/* ---------------------------------------------------------------- */ /* BSD-style lwIP TCP/IP stack SPECIFIC */ /* ---------------------------------------------------------------- */ @@ -573,6 +558,25 @@ #endif /* ---------------------------------------------------------------- */ +/* STRUCT RELATED */ +/* ---------------------------------------------------------------- */ + +/* Define if you have struct sockaddr_storage. */ +#if !defined(__SALFORDC__) && !defined(__BORLANDC__) +#define HAVE_STRUCT_SOCKADDR_STORAGE 1 +#endif + +/* Define if you have struct timeval. */ +#define HAVE_STRUCT_TIMEVAL 1 + +/* Define if struct sockaddr_in6 has the sin6_scope_id member. */ +#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1 + +#if HAVE_WINSOCK2_H && defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0600) +#define HAVE_STRUCT_POLLFD 1 +#endif + +/* ---------------------------------------------------------------- */ /* LARGE FILE SUPPORT */ /* ---------------------------------------------------------------- */ @@ -611,8 +615,11 @@ /* Define to enable c-ares asynchronous DNS lookups. */ /* #define USE_ARES 1 */ -/* Define to enable threaded asynchronous DNS lookups. */ -#define USE_THREADS_WIN32 1 +/* Default define to enable threaded asynchronous DNS lookups. */ +#if !defined(USE_SYNC_DNS) && !defined(USE_ARES) && \ + !defined(USE_THREADS_WIN32) +# define USE_THREADS_WIN32 1 +#endif #if defined(USE_ARES) && defined(USE_THREADS_WIN32) # error "Only one DNS lookup specialty may be defined at most" diff --git a/plugins/FTPFileYM/curl/lib/conncache.c b/plugins/FTPFileYM/curl/lib/conncache.c index 530cdc2ec3..48271f7510 100644 --- a/plugins/FTPFileYM/curl/lib/conncache.c +++ b/plugins/FTPFileYM/curl/lib/conncache.c @@ -38,8 +38,6 @@ /* The last #include file should be: */ #include "memdebug.h" -#define CONNECTION_HASH_SIZE 97 - static void free_bundle_hash_entry(void *freethis) { struct connectbundle *b = (struct connectbundle *) freethis; @@ -47,7 +45,7 @@ static void free_bundle_hash_entry(void *freethis) Curl_bundle_destroy(b); } -struct conncache *Curl_conncache_init(void) +struct conncache *Curl_conncache_init(int size) { struct conncache *connc; @@ -55,7 +53,7 @@ struct conncache *Curl_conncache_init(void) if(!connc) return NULL; - connc->hash = Curl_hash_alloc(CONNECTION_HASH_SIZE, Curl_hash_str, + connc->hash = Curl_hash_alloc(size, Curl_hash_str, Curl_str_key_compare, free_bundle_hash_entry); if(!connc->hash) { diff --git a/plugins/FTPFileYM/curl/lib/conncache.h b/plugins/FTPFileYM/curl/lib/conncache.h index fad17d8f7a..f5e41f187b 100644 --- a/plugins/FTPFileYM/curl/lib/conncache.h +++ b/plugins/FTPFileYM/curl/lib/conncache.h @@ -27,7 +27,7 @@ struct conncache { size_t num_connections; }; -struct conncache *Curl_conncache_init(void); +struct conncache *Curl_conncache_init(int size); void Curl_conncache_destroy(struct conncache *connc); diff --git a/plugins/FTPFileYM/curl/lib/connect.c b/plugins/FTPFileYM/curl/lib/connect.c index 0afb1ee616..2b5719d123 100644 --- a/plugins/FTPFileYM/curl/lib/connect.c +++ b/plugins/FTPFileYM/curl/lib/connect.c @@ -87,13 +87,23 @@ static bool verifyconnect(curl_socket_t sockfd, int *error); -#ifdef __DragonFly__ -/* DragonFlyBSD uses millisecond as KEEPIDLE and KEEPINTVL units */ +#if defined(__DragonFly__) || defined(HAVE_WINSOCK_H) +/* DragonFlyBSD and Windows use millisecond units */ #define KEEPALIVE_FACTOR(x) (x *= 1000) #else #define KEEPALIVE_FACTOR(x) #endif +#if defined(HAVE_WINSOCK_H) && !defined(SIO_KEEPALIVE_VALS) +#define SIO_KEEPALIVE_VALS _WSAIOW(IOC_VENDOR,4) + +struct tcp_keepalive { + u_long onoff; + u_long keepalivetime; + u_long keepaliveinterval; +}; +#endif + static void tcpkeepalive(struct SessionHandle *data, curl_socket_t sockfd) @@ -106,6 +116,22 @@ tcpkeepalive(struct SessionHandle *data, infof(data, "Failed to set SO_KEEPALIVE on fd %d\n", sockfd); } else { +#if defined(SIO_KEEPALIVE_VALS) + struct tcp_keepalive vals; + DWORD dummy; + vals.onoff = 1; + optval = curlx_sltosi(data->set.tcp_keepidle); + KEEPALIVE_FACTOR(optval); + vals.keepalivetime = optval; + optval = curlx_sltosi(data->set.tcp_keepintvl); + KEEPALIVE_FACTOR(optval); + vals.keepaliveinterval = optval; + if(WSAIoctl(sockfd, SIO_KEEPALIVE_VALS, (LPVOID) &vals, sizeof(vals), + NULL, 0, &dummy, NULL, NULL) != 0) { + infof(data, "Failed to set SIO_KEEPALIVE_VALS on fd %d: %d\n", + (int)sockfd, WSAGetLastError()); + } +#else #ifdef TCP_KEEPIDLE optval = curlx_sltosi(data->set.tcp_keepidle); KEEPALIVE_FACTOR(optval); @@ -122,6 +148,16 @@ tcpkeepalive(struct SessionHandle *data, infof(data, "Failed to set TCP_KEEPINTVL on fd %d\n", sockfd); } #endif +#ifdef TCP_KEEPALIVE + /* Mac OS X style */ + optval = curlx_sltosi(data->set.tcp_keepidle); + KEEPALIVE_FACTOR(optval); + if(setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPALIVE, + (void *)&optval, sizeof(optval)) < 0) { + infof(data, "Failed to set TCP_KEEPALIVE on fd %d\n", sockfd); + } +#endif +#endif } } @@ -283,41 +319,54 @@ static CURLcode bindlocal(struct connectdata *conn, } /* interface */ - if(!is_host && (is_interface || Curl_if_is_interface_name(dev))) { - if(Curl_if2ip(af, dev, myhost, sizeof(myhost)) == NULL) - return CURLE_INTERFACE_FAILED; - - /* - * We now have the numerical IP address in the 'myhost' buffer - */ - infof(data, "Local Interface %s is ip %s using address family %i\n", - dev, myhost, af); - done = 1; + if(!is_host) { + switch(Curl_if2ip(af, conn->scope, dev, myhost, sizeof(myhost))) { + case IF2IP_NOT_FOUND: + if(is_interface) { + /* Do not fall back to treating it as a host name */ + failf(data, "Couldn't bind to interface '%s'", dev); + return CURLE_INTERFACE_FAILED; + } + break; + case IF2IP_AF_NOT_SUPPORTED: + /* Signal the caller to try another address family if available */ + return CURLE_UNSUPPORTED_PROTOCOL; + case IF2IP_FOUND: + is_interface = TRUE; + /* + * We now have the numerical IP address in the 'myhost' buffer + */ + infof(data, "Local Interface %s is ip %s using address family %i\n", + dev, myhost, af); + done = 1; #ifdef SO_BINDTODEVICE - /* I am not sure any other OSs than Linux that provide this feature, and - * at the least I cannot test. --Ben - * - * This feature allows one to tightly bind the local socket to a - * particular interface. This will force even requests to other local - * interfaces to go out the external interface. - * - * - * Only bind to the interface when specified as interface, not just as a - * hostname or ip address. - */ - if(setsockopt(sockfd, SOL_SOCKET, SO_BINDTODEVICE, - dev, (curl_socklen_t)strlen(dev)+1) != 0) { - error = SOCKERRNO; - infof(data, "SO_BINDTODEVICE %s failed with errno %d: %s;" - " will do regular bind\n", - dev, error, Curl_strerror(conn, error)); - /* This is typically "errno 1, error: Operation not permitted" if - you're not running as root or another suitable privileged user */ - } + /* I am not sure any other OSs than Linux that provide this feature, + * and at the least I cannot test. --Ben + * + * This feature allows one to tightly bind the local socket to a + * particular interface. This will force even requests to other + * local interfaces to go out the external interface. + * + * + * Only bind to the interface when specified as interface, not just + * as a hostname or ip address. + */ + if(setsockopt(sockfd, SOL_SOCKET, SO_BINDTODEVICE, + dev, (curl_socklen_t)strlen(dev)+1) != 0) { + error = SOCKERRNO; + infof(data, "SO_BINDTODEVICE %s failed with errno %d: %s;" + " will do regular bind\n", + dev, error, Curl_strerror(conn, error)); + /* This is typically "errno 1, error: Operation not permitted" if + you're not running as root or another suitable privileged + user */ + } #endif + break; + } } - else { + if(!is_interface) { /* * This was not an interface, resolve the name as a host name * or IP number @@ -361,10 +410,24 @@ static CURLcode bindlocal(struct connectdata *conn, if(done > 0) { #ifdef ENABLE_IPV6 /* ipv6 address */ - if((af == AF_INET6) && - (Curl_inet_pton(AF_INET6, myhost, &si6->sin6_addr) > 0)) { - si6->sin6_family = AF_INET6; - si6->sin6_port = htons(port); + if(af == AF_INET6) { +#ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID + char *scope_ptr = strchr(myhost, '%'); + if(scope_ptr) + *(scope_ptr++) = 0; +#endif + if(Curl_inet_pton(AF_INET6, myhost, &si6->sin6_addr) > 0) { + si6->sin6_family = AF_INET6; + si6->sin6_port = htons(port); +#ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID + if(scope_ptr) + /* The "myhost" string either comes from Curl_if2ip or from + Curl_printable_address. The latter returns only numeric scope + IDs and the former returns none at all. So the scope ID, if + present, is known to be numeric */ + si6->sin6_scope_id = atoi(scope_ptr); +#endif + } sizeof_sa = sizeof(struct sockaddr_in6); } else @@ -825,13 +888,35 @@ static void nosigpipe(struct connectdata *conn, Work-around: Make the Socket Send Buffer Size Larger Than the Program Send Buffer Size + The problem described in this knowledge-base is applied only to pre-Vista + Windows. Following function trying to detect OS version and skips + SO_SNDBUF adjustment for Windows Vista and above. */ +#define DETECT_OS_NONE 0 +#define DETECT_OS_PREVISTA 1 +#define DETECT_OS_VISTA_OR_LATER 2 + void Curl_sndbufset(curl_socket_t sockfd) { int val = CURL_MAX_WRITE_SIZE + 32; int curval = 0; int curlen = sizeof(curval); + OSVERSIONINFO osver; + static int detectOsState = DETECT_OS_NONE; + + if(detectOsState == DETECT_OS_NONE) { + memset(&osver, 0, sizeof(osver)); + osver.dwOSVersionInfoSize = sizeof(osver); + detectOsState = DETECT_OS_PREVISTA; + if(GetVersionEx(&osver)) { + if(osver.dwMajorVersion >= 6) + detectOsState = DETECT_OS_VISTA_OR_LATER; + } + } + if(detectOsState == DETECT_OS_VISTA_OR_LATER) + return; + if(getsockopt(sockfd, SOL_SOCKET, SO_SNDBUF, (char *)&curval, &curlen) == 0) if(curval > val) return; @@ -917,6 +1002,11 @@ singleipconnect(struct connectdata *conn, res = bindlocal(conn, sockfd, addr.family); if(res) { Curl_closesocket(conn, sockfd); /* close socket and bail out */ + if(res == CURLE_UNSUPPORTED_PROTOCOL) { + /* The address family is not supported on this interface. + We can continue trying addresses */ + return CURLE_OK; + } return res; } @@ -1054,7 +1144,7 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */ if(sockfd == CURL_SOCKET_BAD) { /* no good connect was made */ - failf(data, "couldn't connect to %s at %s:%d", + failf(data, "couldn't connect to %s at %s:%ld", conn->bits.proxy?"proxy":"host", conn->bits.proxy?conn->proxy.name:conn->host.name, conn->port); return CURLE_COULDNT_CONNECT; @@ -1149,7 +1239,7 @@ curl_socket_t Curl_getconnectinfo(struct SessionHandle *data, * 'conn' can be NULL, beware! */ int Curl_closesocket(struct connectdata *conn, - curl_socket_t sock) + curl_socket_t sock) { if(conn && conn->fclosesocket) { if((sock == conn->sock[SECONDARYSOCKET]) && @@ -1161,7 +1251,13 @@ int Curl_closesocket(struct connectdata *conn, else return conn->fclosesocket(conn->closesocket_client, sock); } - return sclose(sock); + sclose(sock); + + if(conn) + /* tell the multi-socket code about this */ + Curl_multi_closed(conn, sock); + + return 0; } /* diff --git a/plugins/FTPFileYM/curl/lib/cookie.c b/plugins/FTPFileYM/curl/lib/cookie.c index 18b91559ca..9deeb1ac49 100644 --- a/plugins/FTPFileYM/curl/lib/cookie.c +++ b/plugins/FTPFileYM/curl/lib/cookie.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -89,6 +89,7 @@ Example set of cookies: #include "strequal.h" #include "strtok.h" #include "sendf.h" +#include "slist.h" #include "curl_memory.h" #include "share.h" #include "strtoofft.h" @@ -106,6 +107,8 @@ static void freecookie(struct Cookie *co) free(co->domain); if(co->path) free(co->path); + if(co->spath) + free(co->spath); if(co->name) free(co->name); if(co->value) @@ -118,15 +121,139 @@ static void freecookie(struct Cookie *co) free(co); } -static bool tailmatch(const char *little, const char *bigone) +static bool tailmatch(const char *cooke_domain, const char *hostname) { - size_t littlelen = strlen(little); - size_t biglen = strlen(bigone); + size_t cookie_domain_len = strlen(cooke_domain); + size_t hostname_len = strlen(hostname); - if(littlelen > biglen) + if(hostname_len < cookie_domain_len) return FALSE; - return Curl_raw_equal(little, bigone+biglen-littlelen) ? TRUE : FALSE; + if(!Curl_raw_equal(cooke_domain, hostname+hostname_len-cookie_domain_len)) + return FALSE; + + /* A lead char of cookie_domain is not '.'. + RFC6265 4.1.2.3. The Domain Attribute says: + For example, if the value of the Domain attribute is + "example.com", the user agent will include the cookie in the Cookie + header when making HTTP requests to example.com, www.example.com, and + www.corp.example.com. + */ + if(hostname_len == cookie_domain_len) + return TRUE; + if('.' == *(hostname + hostname_len - cookie_domain_len - 1)) + return TRUE; + return FALSE; +} + +/* + * matching cookie path and url path + * RFC6265 5.1.4 Paths and Path-Match + */ +static bool pathmatch(const char* cookie_path, const char* request_uri) +{ + size_t cookie_path_len; + size_t uri_path_len; + char* uri_path = NULL; + char* pos; + bool ret = FALSE; + + /* cookie_path must not have last '/' separator. ex: /sample */ + cookie_path_len = strlen(cookie_path); + if(1 == cookie_path_len) { + /* cookie_path must be '/' */ + return TRUE; + } + + uri_path = strdup(request_uri); + if(!uri_path) + return FALSE; + pos = strchr(uri_path, '?'); + if(pos) + *pos = 0x0; + + /* #-fragments are already cut off! */ + if(0 == strlen(uri_path) || uri_path[0] != '/') { + free(uri_path); + uri_path = strdup("/"); + if(!uri_path) + return FALSE; + } + + /* here, RFC6265 5.1.4 says + 4. Output the characters of the uri-path from the first character up + to, but not including, the right-most %x2F ("/"). + but URL path /hoge?fuga=xxx means /hoge/index.cgi?fuga=xxx in some site + without redirect. + Ignore this algorithm because /hoge is uri path for this case + (uri path is not /). + */ + + uri_path_len = strlen(uri_path); + + if(uri_path_len < cookie_path_len) { + ret = FALSE; + goto pathmatched; + } + + /* not using checkprefix() because matching should be case-sensitive */ + if(strncmp(cookie_path, uri_path, cookie_path_len)) { + ret = FALSE; + goto pathmatched; + } + + /* The cookie-path and the uri-path are identical. */ + if(cookie_path_len == uri_path_len) { + ret = TRUE; + goto pathmatched; + } + + /* here, cookie_path_len < url_path_len */ + if(uri_path[cookie_path_len] == '/') { + ret = TRUE; + goto pathmatched; + } + + ret = FALSE; + +pathmatched: + free(uri_path); + return ret; +} + +/* + * cookie path sanitize + */ +static char *sanitize_cookie_path(const char *cookie_path) +{ + size_t len; + char *new_path = strdup(cookie_path); + if(!new_path) + return NULL; + + /* some stupid site sends path attribute with '"'. */ + if(new_path[0] == '\"') { + memmove((void *)new_path, (const void *)(new_path + 1), strlen(new_path)); + } + if(new_path[strlen(new_path) - 1] == '\"') { + new_path[strlen(new_path) - 1] = 0x0; + } + + /* RFC6265 5.2.4 The Path Attribute */ + if(new_path[0] != '/') { + /* Let cookie-path be the default-path. */ + free(new_path); + new_path = strdup("/"); + return new_path; + } + + /* convert /hoge/ to /hoge */ + len = strlen(new_path); + if(1 < len && new_path[len - 1] == '/') { + new_path[len - 1] = 0x0; + } + + return new_path; } /* @@ -163,6 +290,34 @@ static void strstore(char **str, const char *newstr) *str = strdup(newstr); } +/* + * remove_expired() removes expired cookies. + */ +static void remove_expired(struct CookieInfo *cookies) +{ + struct Cookie *co, *nx, *pv; + curl_off_t now = (curl_off_t)time(NULL); + + co = cookies->cookies; + pv = NULL; + while(co) { + nx = co->next; + if((co->expirestr || co->maxage) && co->expires < now) { + if(co == cookies->cookies) { + cookies->cookies = co->next; + } + else { + pv->next = co->next; + } + cookies->numcookies--; + freecookie(co); + } + else { + pv = co; + } + co = nx; + } +} /**************************************************************************** * @@ -170,6 +325,9 @@ static void strstore(char **str, const char *newstr) * * Add a single cookie line to the cookie keeping object. * + * Be aware that sometimes we get an IP-only host name, and that might also be + * a numerical IPv6 address. + * ***************************************************************************/ struct Cookie * @@ -274,72 +432,39 @@ Curl_cookie_add(struct SessionHandle *data, badcookie = TRUE; /* out of memory bad */ break; } + co->spath = sanitize_cookie_path(co->path); + if(!co->spath) { + badcookie = TRUE; /* out of memory bad */ + break; + } } else if(Curl_raw_equal("domain", name)) { - /* note that this name may or may not have a preceding dot, but - we don't care about that, we treat the names the same anyway */ - - const char *domptr=whatptr; - const char *nextptr; - int dotcount=1; - - /* Count the dots, we need to make sure that there are enough - of them. */ + /* Now, we make sure that our host is within the given domain, + or the given domain is not valid and thus cannot be set. */ if('.' == whatptr[0]) - /* don't count the initial dot, assume it */ - domptr++; - - do { - nextptr = strchr(domptr, '.'); - if(nextptr) { - if(domptr != nextptr) - dotcount++; - domptr = nextptr+1; + whatptr++; /* ignore preceding dot */ + + if(!domain || tailmatch(whatptr, domain)) { + const char *tailptr=whatptr; + if(tailptr[0] == '.') + tailptr++; + strstore(&co->domain, tailptr); /* don't prefix w/dots + internally */ + if(!co->domain) { + badcookie = TRUE; + break; } - } while(nextptr); - - /* The original Netscape cookie spec defined that this domain name - MUST have three dots (or two if one of the seven holy TLDs), - but it seems that these kinds of cookies are in use "out there" - so we cannot be that strict. I've therefore lowered the check - to not allow less than two dots. */ - - if(dotcount < 2) { - /* Received and skipped a cookie with a domain using too few - dots. */ - badcookie=TRUE; /* mark this as a bad cookie */ - infof(data, "skipped cookie with illegal dotcount domain: %s\n", - whatptr); + co->tailmatch=TRUE; /* we always do that if the domain name was + given */ } else { - /* Now, we make sure that our host is within the given domain, - or the given domain is not valid and thus cannot be set. */ - - if('.' == whatptr[0]) - whatptr++; /* ignore preceding dot */ - - if(!domain || tailmatch(whatptr, domain)) { - const char *tailptr=whatptr; - if(tailptr[0] == '.') - tailptr++; - strstore(&co->domain, tailptr); /* don't prefix w/dots - internally */ - if(!co->domain) { - badcookie = TRUE; - break; - } - co->tailmatch=TRUE; /* we always do that if the domain name was - given */ - } - else { - /* we did not get a tailmatch and then the attempted set domain - is not a domain to which the current host belongs. Mark as - bad. */ - badcookie=TRUE; - infof(data, "skipped cookie with bad tailmatch domain: %s\n", - whatptr); - } + /* we did not get a tailmatch and then the attempted set domain + is not a domain to which the current host belongs. Mark as + bad. */ + badcookie=TRUE; + infof(data, "skipped cookie with bad tailmatch domain: %s\n", + whatptr); } } else if(Curl_raw_equal("version", name)) { @@ -447,6 +572,9 @@ Curl_cookie_add(struct SessionHandle *data, if(co->path) { memcpy(co->path, path, pathlen); co->path[pathlen]=0; /* zero terminate */ + co->spath = sanitize_cookie_path(co->path); + if(!co->spath) + badcookie = TRUE; /* out of memory bad */ } else badcookie = TRUE; @@ -498,12 +626,6 @@ Curl_cookie_add(struct SessionHandle *data, firstptr=strtok_r(lineptr, "\t", &tok_buf); /* tokenize it on the TAB */ - /* Here's a quick check to eliminate normal HTTP-headers from this */ - if(!firstptr || strchr(firstptr, ':')) { - free(co); - return NULL; - } - /* Now loop through the fields and init the struct we already have allocated */ for(ptr=firstptr, fields=0; ptr && !badcookie; @@ -538,12 +660,21 @@ Curl_cookie_add(struct SessionHandle *data, co->path = strdup(ptr); if(!co->path) badcookie = TRUE; + else { + co->spath = sanitize_cookie_path(co->path); + if(!co->spath) { + badcookie = TRUE; /* out of memory bad */ + } + } break; } /* this doesn't look like a path, make one up! */ co->path = strdup("/"); if(!co->path) badcookie = TRUE; + co->spath = strdup("/"); + if(!co->spath) + badcookie = TRUE; fields++; /* add a field and fall down to secure */ /* FALLTHROUGH */ case 3: @@ -597,6 +728,9 @@ Curl_cookie_add(struct SessionHandle *data, superceeds an already existing cookie, which it may if the previous have the same domain and path as this */ + /* at first, remove expired cookies */ + remove_expired(c); + clist = c->cookies; replace_old = FALSE; while(clist) { @@ -614,14 +748,14 @@ Curl_cookie_add(struct SessionHandle *data, if(replace_old) { /* the domains were identical */ - if(clist->path && co->path) { - if(Curl_raw_equal(clist->path, co->path)) { + if(clist->spath && co->spath) { + if(Curl_raw_equal(clist->spath, co->spath)) { replace_old = TRUE; } else replace_old = FALSE; } - else if(!clist->path && !co->path) + else if(!clist->spath && !co->spath) replace_old = TRUE; else replace_old = FALSE; @@ -650,6 +784,8 @@ Curl_cookie_add(struct SessionHandle *data, free(clist->domain); if(clist->path) free(clist->path); + if(clist->spath) + free(clist->spath); if(clist->expirestr) free(clist->expirestr); @@ -689,9 +825,9 @@ Curl_cookie_add(struct SessionHandle *data, lastc->next = co; else c->cookies = co; + c->numcookies++; /* one more cookie in the jar */ } - c->numcookies++; /* one more cookie in the jar */ return co; } @@ -777,11 +913,28 @@ static int cookie_sort(const void *p1, const void *p2) { struct Cookie *c1 = *(struct Cookie **)p1; struct Cookie *c2 = *(struct Cookie **)p2; + size_t l1, l2; + + /* 1 - compare cookie path lengths */ + l1 = c1->path ? strlen(c1->path) : 0; + l2 = c2->path ? strlen(c2->path) : 0; + + if(l1 != l2) + return (l2 > l1) ? 1 : -1 ; /* avoid size_t <=> int conversions */ + + /* 2 - compare cookie domain lengths */ + l1 = c1->domain ? strlen(c1->domain) : 0; + l2 = c2->domain ? strlen(c2->domain) : 0; - size_t l1 = c1->path?strlen(c1->path):0; - size_t l2 = c2->path?strlen(c2->path):0; + if(l1 != l2) + return (l2 > l1) ? 1 : -1 ; /* avoid size_t <=> int conversions */ - return (l2 > l1) ? 1 : (l2 < l1) ? -1 : 0 ; + /* 3 - compare cookie names */ + if(c1->name && c2->name) + return strcmp(c1->name, c2->name); + + /* sorry, can't be more deterministic */ + return 0; } /***************************************************************************** @@ -809,6 +962,9 @@ struct Cookie *Curl_cookie_getlist(struct CookieInfo *c, if(!c || !c->cookies) return NULL; /* no cookie struct or no cookies in the struct */ + /* at first, remove expired cookies */ + remove_expired(c); + co = c->cookies; while(co) { @@ -827,10 +983,7 @@ struct Cookie *Curl_cookie_getlist(struct CookieInfo *c, /* now check the left part of the path with the cookies path requirement */ - if(!co->path || - /* not using checkprefix() because matching should be - case-sensitive */ - !strncmp(co->path, path, strlen(co->path)) ) { + if(!co->spath || pathmatch(co->spath, path) ) { /* and now, we know this is a match and we should create an entry for the return-linked-list */ @@ -1054,6 +1207,9 @@ static int cookie_output(struct CookieInfo *c, const char *dumphere) destination file */ return 0; + /* at first, remove expired cookies */ + remove_expired(c); + if(strequal("-", dumphere)) { /* use stdout */ out = stdout; @@ -1114,9 +1270,9 @@ struct curl_slist *Curl_cookie_list(struct SessionHandle *data) curl_slist_free_all(list); return NULL; } - beg = curl_slist_append(list, line); - free(line); + beg = Curl_slist_append_nodup(list, line); if(!beg) { + free(line); curl_slist_free_all(list); return NULL; } diff --git a/plugins/FTPFileYM/curl/lib/cookie.h b/plugins/FTPFileYM/curl/lib/cookie.h index d3b63f780f..bd890827c7 100644 --- a/plugins/FTPFileYM/curl/lib/cookie.h +++ b/plugins/FTPFileYM/curl/lib/cookie.h @@ -29,7 +29,8 @@ struct Cookie { struct Cookie *next; /* next in the chain */ char *name; /* <this> = value */ char *value; /* name = <this> */ - char *path; /* path = <this> */ + char *path; /* path = <this> which is in Set-Cookie: */ + char *spath; /* sanitized cookie path */ char *domain; /* domain = <this> */ curl_off_t expires; /* expires = <this> */ char *expirestr; /* the plain text version */ diff --git a/plugins/FTPFileYM/curl/lib/curl_darwinssl.c b/plugins/FTPFileYM/curl/lib/curl_darwinssl.c index 827c876e0e..43fe053369 100644 --- a/plugins/FTPFileYM/curl/lib/curl_darwinssl.c +++ b/plugins/FTPFileYM/curl/lib/curl_darwinssl.c @@ -38,9 +38,58 @@ #include <Security/SecureTransport.h> #include <CoreFoundation/CoreFoundation.h> #include <CommonCrypto/CommonDigest.h> + +/* The Security framework has changed greatly between iOS and different OS X + versions, and we will try to support as many of them as we can (back to + Leopard and iOS 5) by using macros and weak-linking. + + IMPORTANT: If TLS 1.1 and 1.2 support are important for you on OS X, then + you must build this project against the 10.8 SDK or later. */ #if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) + +#if MAC_OS_X_VERSION_MAX_ALLOWED < 1050 +#error "The darwinssl back-end requires Leopard or later." +#endif /* MAC_OS_X_VERSION_MAX_ALLOWED < 1050 */ + +#define CURL_BUILD_IOS 0 +#define CURL_BUILD_IOS_7 0 +#define CURL_BUILD_MAC 1 +/* This is the maximum API level we are allowed to use when building: */ +#define CURL_BUILD_MAC_10_5 MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 +#define CURL_BUILD_MAC_10_6 MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 +#define CURL_BUILD_MAC_10_7 MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 +#define CURL_BUILD_MAC_10_8 MAC_OS_X_VERSION_MAX_ALLOWED >= 1080 +#define CURL_BUILD_MAC_10_9 MAC_OS_X_VERSION_MAX_ALLOWED >= 1090 +/* These macros mean "the following code is present to allow runtime backward + compatibility with at least this cat or earlier": + (You set this at build-time by setting the MACOSX_DEPLOYMENT_TARGET + environmental variable.) */ +#define CURL_SUPPORT_MAC_10_5 MAC_OS_X_VERSION_MIN_REQUIRED <= 1050 +#define CURL_SUPPORT_MAC_10_6 MAC_OS_X_VERSION_MIN_REQUIRED <= 1060 +#define CURL_SUPPORT_MAC_10_7 MAC_OS_X_VERSION_MIN_REQUIRED <= 1070 +#define CURL_SUPPORT_MAC_10_8 MAC_OS_X_VERSION_MIN_REQUIRED <= 1080 +#define CURL_SUPPORT_MAC_10_9 MAC_OS_X_VERSION_MIN_REQUIRED <= 1090 + +#elif TARGET_OS_EMBEDDED || TARGET_OS_IPHONE +#define CURL_BUILD_IOS 1 +#define CURL_BUILD_IOS_7 __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000 +#define CURL_BUILD_MAC 0 +#define CURL_BUILD_MAC_10_5 0 +#define CURL_BUILD_MAC_10_6 0 +#define CURL_BUILD_MAC_10_7 0 +#define CURL_BUILD_MAC_10_8 0 +#define CURL_SUPPORT_MAC_10_5 0 +#define CURL_SUPPORT_MAC_10_6 0 +#define CURL_SUPPORT_MAC_10_7 0 +#define CURL_SUPPORT_MAC_10_8 0 + +#else +#error "The darwinssl back-end requires iOS or OS X." +#endif /* (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) */ + +#if CURL_BUILD_MAC #include <sys/sysctl.h> -#endif +#endif /* CURL_BUILD_MAC */ #include "urldata.h" #include "sendf.h" @@ -59,16 +108,7 @@ /* From MacTypes.h (which we can't include because it isn't present in iOS: */ #define ioErr -36 - -/* In Mountain Lion and iOS 5, Apple made some changes to the API. They - added TLS 1.1 and 1.2 support, and deprecated and replaced some - functions. You need to build against the Mountain Lion or iOS 5 SDK - or later to get TLS 1.1 or 1.2 support working in cURL. We'll weak-link - to the newer functions and use them if present in the user's OS. - - Builders: If you want TLS 1.1 and 1.2 but still want to retain support - for older cats, don't forget to set the MACOSX_DEPLOYMENT_TARGET - environmental variable prior to building cURL. */ +#define paramErr -50 /* The following two functions were ripped from Apple sample code, * with some modifications: */ @@ -97,8 +137,8 @@ static OSStatus SocketRead(SSLConnectionRef connection, if(rrtn <= 0) { /* this is guesswork... */ theErr = errno; - if((rrtn == 0) && (theErr == 0)) { - /* try fix for iSync */ + if(rrtn == 0) { /* EOF = server hung up */ + /* the framework will turn this into errSSLClosedNoNotify */ rtn = errSSLClosedGraceful; } else /* do the switch */ @@ -360,6 +400,7 @@ CF_INLINE const char *TLSCipherNameForNumber(SSLCipherSuite cipher) { case TLS_DH_anon_WITH_AES_256_CBC_SHA: return "TLS_DH_anon_WITH_AES_256_CBC_SHA"; break; +#if CURL_BUILD_MAC_10_6 || CURL_BUILD_IOS /* TLS 1.0 with ECDSA (RFC 4492) */ case TLS_ECDH_ECDSA_WITH_NULL_SHA: return "TLS_ECDH_ECDSA_WITH_NULL_SHA"; @@ -436,7 +477,8 @@ CF_INLINE const char *TLSCipherNameForNumber(SSLCipherSuite cipher) { case TLS_ECDH_anon_WITH_AES_256_CBC_SHA: return "TLS_ECDH_anon_WITH_AES_256_CBC_SHA"; break; -#if defined(__MAC_10_8) || defined(__IPHONE_5_0) +#endif /* CURL_BUILD_MAC_10_6 || CURL_BUILD_IOS */ +#if CURL_BUILD_MAC_10_8 || CURL_BUILD_IOS /* TLS 1.2 (RFC 5246) */ case TLS_RSA_WITH_NULL_MD5: return "TLS_RSA_WITH_NULL_MD5"; @@ -621,44 +663,330 @@ CF_INLINE const char *TLSCipherNameForNumber(SSLCipherSuite cipher) { case SSL_DH_anon_WITH_3DES_EDE_CBC_SHA: return "TLS_DH_anon_WITH_3DES_EDE_CBC_SHA"; break; -#endif /* defined(__MAC_10_8) || defined(__IPHONE_5_0) */ +#endif /* CURL_BUILD_MAC_10_8 || CURL_BUILD_IOS */ +#if CURL_BUILD_MAC_10_9 || CURL_BUILD_IOS_7 + /* TLS PSK (RFC 4279): */ + case TLS_PSK_WITH_RC4_128_SHA: + return "TLS_PSK_WITH_RC4_128_SHA"; + break; + case TLS_PSK_WITH_3DES_EDE_CBC_SHA: + return "TLS_PSK_WITH_3DES_EDE_CBC_SHA"; + break; + case TLS_PSK_WITH_AES_128_CBC_SHA: + return "TLS_PSK_WITH_AES_128_CBC_SHA"; + break; + case TLS_PSK_WITH_AES_256_CBC_SHA: + return "TLS_PSK_WITH_AES_256_CBC_SHA"; + break; + case TLS_DHE_PSK_WITH_RC4_128_SHA: + return "TLS_DHE_PSK_WITH_RC4_128_SHA"; + break; + case TLS_DHE_PSK_WITH_3DES_EDE_CBC_SHA: + return "TLS_DHE_PSK_WITH_3DES_EDE_CBC_SHA"; + break; + case TLS_DHE_PSK_WITH_AES_128_CBC_SHA: + return "TLS_DHE_PSK_WITH_AES_128_CBC_SHA"; + break; + case TLS_DHE_PSK_WITH_AES_256_CBC_SHA: + return "TLS_DHE_PSK_WITH_AES_256_CBC_SHA"; + break; + case TLS_RSA_PSK_WITH_RC4_128_SHA: + return "TLS_RSA_PSK_WITH_RC4_128_SHA"; + break; + case TLS_RSA_PSK_WITH_3DES_EDE_CBC_SHA: + return "TLS_RSA_PSK_WITH_3DES_EDE_CBC_SHA"; + break; + case TLS_RSA_PSK_WITH_AES_128_CBC_SHA: + return "TLS_RSA_PSK_WITH_AES_128_CBC_SHA"; + break; + case TLS_RSA_PSK_WITH_AES_256_CBC_SHA: + return "TLS_RSA_PSK_WITH_AES_256_CBC_SHA"; + break; + /* More TLS PSK (RFC 4785): */ + case TLS_PSK_WITH_NULL_SHA: + return "TLS_PSK_WITH_NULL_SHA"; + break; + case TLS_DHE_PSK_WITH_NULL_SHA: + return "TLS_DHE_PSK_WITH_NULL_SHA"; + break; + case TLS_RSA_PSK_WITH_NULL_SHA: + return "TLS_RSA_PSK_WITH_NULL_SHA"; + break; + /* Even more TLS PSK (RFC 5487): */ + case TLS_PSK_WITH_AES_128_GCM_SHA256: + return "TLS_PSK_WITH_AES_128_GCM_SHA256"; + break; + case TLS_PSK_WITH_AES_256_GCM_SHA384: + return "TLS_PSK_WITH_AES_256_GCM_SHA384"; + break; + case TLS_DHE_PSK_WITH_AES_128_GCM_SHA256: + return "TLS_DHE_PSK_WITH_AES_128_GCM_SHA256"; + break; + case TLS_DHE_PSK_WITH_AES_256_GCM_SHA384: + return "TLS_DHE_PSK_WITH_AES_256_GCM_SHA384"; + break; + case TLS_RSA_PSK_WITH_AES_128_GCM_SHA256: + return "TLS_RSA_PSK_WITH_AES_128_GCM_SHA256"; + break; + case TLS_RSA_PSK_WITH_AES_256_GCM_SHA384: + return "TLS_PSK_WITH_AES_256_GCM_SHA384"; + break; + case TLS_PSK_WITH_AES_128_CBC_SHA256: + return "TLS_PSK_WITH_AES_128_CBC_SHA256"; + break; + case TLS_PSK_WITH_AES_256_CBC_SHA384: + return "TLS_PSK_WITH_AES_256_CBC_SHA384"; + break; + case TLS_PSK_WITH_NULL_SHA256: + return "TLS_PSK_WITH_NULL_SHA256"; + break; + case TLS_PSK_WITH_NULL_SHA384: + return "TLS_PSK_WITH_NULL_SHA384"; + break; + case TLS_DHE_PSK_WITH_AES_128_CBC_SHA256: + return "TLS_DHE_PSK_WITH_AES_128_CBC_SHA256"; + break; + case TLS_DHE_PSK_WITH_AES_256_CBC_SHA384: + return "TLS_DHE_PSK_WITH_AES_256_CBC_SHA384"; + break; + case TLS_DHE_PSK_WITH_NULL_SHA256: + return "TLS_DHE_PSK_WITH_NULL_SHA256"; + break; + case TLS_DHE_PSK_WITH_NULL_SHA384: + return "TLS_RSA_PSK_WITH_NULL_SHA384"; + break; + case TLS_RSA_PSK_WITH_AES_128_CBC_SHA256: + return "TLS_RSA_PSK_WITH_AES_128_CBC_SHA256"; + break; + case TLS_RSA_PSK_WITH_AES_256_CBC_SHA384: + return "TLS_RSA_PSK_WITH_AES_256_CBC_SHA384"; + break; + case TLS_RSA_PSK_WITH_NULL_SHA256: + return "TLS_RSA_PSK_WITH_NULL_SHA256"; + break; + case TLS_RSA_PSK_WITH_NULL_SHA384: + return "TLS_RSA_PSK_WITH_NULL_SHA384"; + break; +#endif /* CURL_BUILD_MAC_10_9 || CURL_BUILD_IOS_7 */ } return "TLS_NULL_WITH_NULL_NULL"; } -CF_INLINE bool IsRunningMountainLionOrLater(void) +#if CURL_BUILD_MAC +CF_INLINE void GetDarwinVersionNumber(int *major, int *minor) { -#if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) int mib[2]; char *os_version; size_t os_version_len; - char *os_version_major/*, *os_version_minor, *os_version_point*/; - int os_version_major_int; + char *os_version_major, *os_version_minor/*, *os_version_point*/; /* Get the Darwin kernel version from the kernel using sysctl(): */ mib[0] = CTL_KERN; mib[1] = KERN_OSRELEASE; if(sysctl(mib, 2, NULL, &os_version_len, NULL, 0) == -1) - return false; + return; os_version = malloc(os_version_len*sizeof(char)); if(!os_version) - return false; + return; if(sysctl(mib, 2, os_version, &os_version_len, NULL, 0) == -1) { free(os_version); - return false; + return; } - /* Parse the version. If it's version 12.0.0 or later, then this user is - using Mountain Lion. */ + /* Parse the version: */ os_version_major = strtok(os_version, "."); - /*os_version_minor = strtok(NULL, "."); - os_version_point = strtok(NULL, ".");*/ - os_version_major_int = atoi(os_version_major); + os_version_minor = strtok(NULL, "."); + /*os_version_point = strtok(NULL, ".");*/ + *major = atoi(os_version_major); + *minor = atoi(os_version_minor); free(os_version); - return os_version_major_int >= 12; +} +#endif /* CURL_BUILD_MAC */ + +/* Apple provides a myriad of ways of getting information about a certificate + into a string. Some aren't available under iOS or newer cats. So here's + a unified function for getting a string describing the certificate that + ought to work in all cats starting with Leopard. */ +CF_INLINE CFStringRef CopyCertSubject(SecCertificateRef cert) +{ + CFStringRef server_cert_summary = CFSTR("(null)"); + +#if CURL_BUILD_IOS + /* iOS: There's only one way to do this. */ + server_cert_summary = SecCertificateCopySubjectSummary(cert); #else - return true; /* iOS users: this doesn't concern you */ -#endif +#if CURL_BUILD_MAC_10_7 + /* Lion & later: Get the long description if we can. */ + if(SecCertificateCopyLongDescription != NULL) + server_cert_summary = + SecCertificateCopyLongDescription(NULL, cert, NULL); + else +#endif /* CURL_BUILD_MAC_10_7 */ +#if CURL_BUILD_MAC_10_6 + /* Snow Leopard: Get the certificate summary. */ + if(SecCertificateCopySubjectSummary != NULL) + server_cert_summary = SecCertificateCopySubjectSummary(cert); + else +#endif /* CURL_BUILD_MAC_10_6 */ + /* Leopard is as far back as we go... */ + (void)SecCertificateCopyCommonName(cert, &server_cert_summary); +#endif /* CURL_BUILD_IOS */ + return server_cert_summary; +} + +#if CURL_SUPPORT_MAC_10_7 +/* The SecKeychainSearch API was deprecated in Lion, and using it will raise + deprecation warnings, so let's not compile this unless it's necessary: */ +static OSStatus CopyIdentityWithLabelOldSchool(char *label, + SecIdentityRef *out_c_a_k) +{ + OSStatus status = errSecItemNotFound; + SecKeychainAttributeList attr_list; + SecKeychainAttribute attr; + SecKeychainSearchRef search = NULL; + SecCertificateRef cert = NULL; + + /* Set up the attribute list: */ + attr_list.count = 1L; + attr_list.attr = &attr; + + /* Set up our lone search criterion: */ + attr.tag = kSecLabelItemAttr; + attr.data = label; + attr.length = (UInt32)strlen(label); + + /* Start searching: */ + status = SecKeychainSearchCreateFromAttributes(NULL, + kSecCertificateItemClass, + &attr_list, + &search); + if(status == noErr) { + status = SecKeychainSearchCopyNext(search, + (SecKeychainItemRef *)&cert); + if(status == noErr && cert) { + /* If we found a certificate, does it have a private key? */ + status = SecIdentityCreateWithCertificate(NULL, cert, out_c_a_k); + CFRelease(cert); + } + } + + if(search) + CFRelease(search); + return status; +} +#endif /* CURL_SUPPORT_MAC_10_7 */ + +static OSStatus CopyIdentityWithLabel(char *label, + SecIdentityRef *out_cert_and_key) +{ + OSStatus status = errSecItemNotFound; + +#if CURL_BUILD_MAC_10_7 || CURL_BUILD_IOS + /* SecItemCopyMatching() was introduced in iOS and Snow Leopard. + kSecClassIdentity was introduced in Lion. If both exist, let's use them + to find the certificate. */ + if(SecItemCopyMatching != NULL && kSecClassIdentity != NULL) { + CFTypeRef keys[4]; + CFTypeRef values[4]; + CFDictionaryRef query_dict; + CFStringRef label_cf = CFStringCreateWithCString(NULL, label, + kCFStringEncodingUTF8); + + /* Set up our search criteria and expected results: */ + values[0] = kSecClassIdentity; /* we want a certificate and a key */ + keys[0] = kSecClass; + values[1] = kCFBooleanTrue; /* we want a reference */ + keys[1] = kSecReturnRef; + values[2] = kSecMatchLimitOne; /* one is enough, thanks */ + keys[2] = kSecMatchLimit; + /* identity searches need a SecPolicyRef in order to work */ + values[3] = SecPolicyCreateSSL(false, label_cf); + keys[3] = kSecMatchPolicy; + query_dict = CFDictionaryCreate(NULL, (const void **)keys, + (const void **)values, 4L, + &kCFCopyStringDictionaryKeyCallBacks, + &kCFTypeDictionaryValueCallBacks); + CFRelease(values[3]); + CFRelease(label_cf); + + /* Do we have a match? */ + status = SecItemCopyMatching(query_dict, (CFTypeRef *)out_cert_and_key); + CFRelease(query_dict); + } + else { +#if CURL_SUPPORT_MAC_10_7 + /* On Leopard and Snow Leopard, fall back to SecKeychainSearch. */ + status = CopyIdentityWithLabelOldSchool(label, out_cert_and_key); +#endif /* CURL_SUPPORT_MAC_10_7 */ + } +#elif CURL_SUPPORT_MAC_10_7 + /* For developers building on older cats, we have no choice but to fall back + to SecKeychainSearch. */ + status = CopyIdentityWithLabelOldSchool(label, out_cert_and_key); +#endif /* CURL_BUILD_MAC_10_7 || CURL_BUILD_IOS */ + return status; +} + +static OSStatus CopyIdentityFromPKCS12File(const char *cPath, + const char *cPassword, + SecIdentityRef *out_cert_and_key) +{ + OSStatus status = errSecItemNotFound; + CFURLRef pkcs_url = CFURLCreateFromFileSystemRepresentation(NULL, + (const UInt8 *)cPath, strlen(cPath), false); + CFStringRef password = cPassword ? CFStringCreateWithCString(NULL, + cPassword, kCFStringEncodingUTF8) : NULL; + CFDataRef pkcs_data = NULL; + + /* We can import P12 files on iOS or OS X 10.6 or later: */ +#if CURL_BUILD_MAC_10_6 || CURL_BUILD_IOS + if(CFURLCreateDataAndPropertiesFromResource(NULL, pkcs_url, &pkcs_data, + NULL, NULL, &status)) { + const void *cKeys[] = {kSecImportExportPassphrase}; + const void *cValues[] = {password}; + CFDictionaryRef options = CFDictionaryCreate(NULL, cKeys, cValues, + password ? 1L : 0L, NULL, NULL); + CFArrayRef items = NULL; + + /* Here we go: */ + status = SecPKCS12Import(pkcs_data, options, &items); + if(status == noErr) { + CFDictionaryRef identity_and_trust = CFArrayGetValueAtIndex(items, 0L); + const void *temp_identity = CFDictionaryGetValue(identity_and_trust, + kSecImportItemIdentity); + + /* Retain the identity; we don't care about any other data... */ + CFRetain(temp_identity); + *out_cert_and_key = (SecIdentityRef)temp_identity; + CFRelease(items); + } + CFRelease(options); + CFRelease(pkcs_data); + } +#endif /* CURL_BUILD_MAC_10_6 || CURL_BUILD_IOS */ + if(password) + CFRelease(password); + CFRelease(pkcs_url); + return status; +} + +/* This code was borrowed from nss.c, with some modifications: + * Determine whether the nickname passed in is a filename that needs to + * be loaded as a PEM or a regular NSS nickname. + * + * returns 1 for a file + * returns 0 for not a file + */ +CF_INLINE bool is_file(const char *filename) +{ + struct_stat st; + + if(filename == NULL) + return false; + + if(stat(filename, &st) == 0) + return S_ISREG(st.st_mode); + return false; } static CURLcode darwinssl_connect_step1(struct connectdata *conn, @@ -671,11 +999,19 @@ static CURLcode darwinssl_connect_step1(struct connectdata *conn, struct in6_addr addr; #else struct in_addr addr; -#endif - /*SSLConnectionRef ssl_connection;*/ +#endif /* ENABLE_IPV6 */ + size_t all_ciphers_count = 0UL, allowed_ciphers_count = 0UL, i; + SSLCipherSuite *all_ciphers = NULL, *allowed_ciphers = NULL; + char *ssl_sessionid; + size_t ssl_sessionid_len; OSStatus err = noErr; +#if CURL_BUILD_MAC + int darwinver_maj = 0, darwinver_min = 0; + + GetDarwinVersionNumber(&darwinver_maj, &darwinver_min); +#endif /* CURL_BUILD_MAC */ -#if defined(__MAC_10_8) || defined(__IPHONE_5_0) +#if CURL_BUILD_MAC_10_8 || CURL_BUILD_IOS if(SSLCreateContext != NULL) { /* use the newer API if avaialble */ if(connssl->ssl_ctx) CFRelease(connssl->ssl_ctx); @@ -687,7 +1023,7 @@ static CURLcode darwinssl_connect_step1(struct connectdata *conn, } else { /* The old ST API does not exist under iOS, so don't compile it: */ -#if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) +#if CURL_SUPPORT_MAC_10_8 if(connssl->ssl_ctx) (void)SSLDisposeContext(connssl->ssl_ctx); err = SSLNewContext(false, &(connssl->ssl_ctx)); @@ -695,7 +1031,7 @@ static CURLcode darwinssl_connect_step1(struct connectdata *conn, failf(data, "SSL: couldn't create a context: OSStatus %d", err); return CURLE_OUT_OF_MEMORY; } -#endif /* (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) */ +#endif /* CURL_SUPPORT_MAC_10_8 */ } #else if(connssl->ssl_ctx) @@ -705,10 +1041,11 @@ static CURLcode darwinssl_connect_step1(struct connectdata *conn, failf(data, "SSL: couldn't create a context: OSStatus %d", err); return CURLE_OUT_OF_MEMORY; } -#endif /* defined(__MAC_10_8) || defined(__IPHONE_5_0) */ +#endif /* CURL_BUILD_MAC_10_8 || CURL_BUILD_IOS */ + connssl->ssl_write_buffered_length = 0UL; /* reset buffered write length */ /* check to see if we've been told to use an explicit SSL/TLS version */ -#if defined(__MAC_10_8) || defined(__IPHONE_5_0) +#if CURL_BUILD_MAC_10_8 || CURL_BUILD_IOS if(SSLSetProtocolVersionMax != NULL) { switch(data->set.ssl.version) { case CURL_SSLVERSION_DEFAULT: default: @@ -724,12 +1061,16 @@ static CURLcode darwinssl_connect_step1(struct connectdata *conn, (void)SSLSetProtocolVersionMax(connssl->ssl_ctx, kSSLProtocol3); break; case CURL_SSLVERSION_SSLv2: - (void)SSLSetProtocolVersionMin(connssl->ssl_ctx, kSSLProtocol2); + err = SSLSetProtocolVersionMin(connssl->ssl_ctx, kSSLProtocol2); + if(err != noErr) { + failf(data, "Your version of the OS does not support SSLv2"); + return CURLE_SSL_CONNECT_ERROR; + } (void)SSLSetProtocolVersionMax(connssl->ssl_ctx, kSSLProtocol2); } } else { -#if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) +#if CURL_SUPPORT_MAC_10_8 (void)SSLSetProtocolVersionEnabled(connssl->ssl_ctx, kSSLProtocolAll, false); @@ -765,12 +1106,16 @@ static CURLcode darwinssl_connect_step1(struct connectdata *conn, true); break; case CURL_SSLVERSION_SSLv2: - (void)SSLSetProtocolVersionEnabled(connssl->ssl_ctx, + err = SSLSetProtocolVersionEnabled(connssl->ssl_ctx, kSSLProtocol2, true); + if(err != noErr) { + failf(data, "Your version of the OS does not support SSLv2"); + return CURLE_SSL_CONNECT_ERROR; + } break; } -#endif /* (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) */ +#endif /* CURL_SUPPORT_MAC_10_8 */ } #else (void)SSLSetProtocolVersionEnabled(connssl->ssl_ctx, kSSLProtocolAll, false); @@ -790,9 +1135,13 @@ static CURLcode darwinssl_connect_step1(struct connectdata *conn, true); break; case CURL_SSLVERSION_SSLv2: - (void)SSLSetProtocolVersionEnabled(connssl->ssl_ctx, + err = SSLSetProtocolVersionEnabled(connssl->ssl_ctx, kSSLProtocol2, true); + if(err != noErr) { + failf(data, "Your version of the OS does not support SSLv2"); + return CURLE_SSL_CONNECT_ERROR; + } break; case CURL_SSLVERSION_SSLv3: (void)SSLSetProtocolVersionEnabled(connssl->ssl_ctx, @@ -800,16 +1149,104 @@ static CURLcode darwinssl_connect_step1(struct connectdata *conn, true); break; } -#endif /* defined(__MAC_10_8) || defined(__IPHONE_5_0) */ +#endif /* CURL_BUILD_MAC_10_8 || CURL_BUILD_IOS */ - /* No need to load certificates here. SecureTransport uses the Keychain - * (which is also part of the Security framework) to evaluate trust. */ + if(data->set.str[STRING_KEY]) { + infof(data, "WARNING: SSL: CURLOPT_SSLKEY is ignored by Secure " + "Transport. The private key must be in the Keychain.\n"); + } + + if(data->set.str[STRING_CERT]) { + SecIdentityRef cert_and_key = NULL; + bool is_cert_file = is_file(data->set.str[STRING_CERT]); + + /* User wants to authenticate with a client cert. Look for it: + If we detect that this is a file on disk, then let's load it. + Otherwise, assume that the user wants to use an identity loaded + from the Keychain. */ + if(is_cert_file) { + if(!data->set.str[STRING_CERT_TYPE]) + infof(data, "WARNING: SSL: Certificate type not set, assuming " + "PKCS#12 format.\n"); + else if(strncmp(data->set.str[STRING_CERT_TYPE], "P12", + strlen(data->set.str[STRING_CERT_TYPE])) != 0) + infof(data, "WARNING: SSL: The Security framework only supports " + "loading identities that are in PKCS#12 format.\n"); + + err = CopyIdentityFromPKCS12File(data->set.str[STRING_CERT], + data->set.str[STRING_KEY_PASSWD], &cert_and_key); + } + else + err = CopyIdentityWithLabel(data->set.str[STRING_CERT], &cert_and_key); + + if(err == noErr) { + SecCertificateRef cert = NULL; + CFTypeRef certs_c[1]; + CFArrayRef certs; + + /* If we found one, print it out: */ + err = SecIdentityCopyCertificate(cert_and_key, &cert); + if(err == noErr) { + CFStringRef cert_summary = CopyCertSubject(cert); + char cert_summary_c[128]; + + if(cert_summary) { + memset(cert_summary_c, 0, 128); + if(CFStringGetCString(cert_summary, + cert_summary_c, + 128, + kCFStringEncodingUTF8)) { + infof(data, "Client certificate: %s\n", cert_summary_c); + } + CFRelease(cert_summary); + CFRelease(cert); + } + } + certs_c[0] = cert_and_key; + certs = CFArrayCreate(NULL, (const void **)certs_c, 1L, + &kCFTypeArrayCallBacks); + err = SSLSetCertificate(connssl->ssl_ctx, certs); + if(certs) + CFRelease(certs); + if(err != noErr) { + failf(data, "SSL: SSLSetCertificate() failed: OSStatus %d", err); + return CURLE_SSL_CERTPROBLEM; + } + CFRelease(cert_and_key); + } + else { + switch(err) { + case errSecPkcs12VerifyFailure: case errSecAuthFailed: + failf(data, "SSL: Incorrect password for the certificate \"%s\" " + "and its private key.", data->set.str[STRING_CERT]); + break; + case errSecDecode: case errSecUnknownFormat: + failf(data, "SSL: Couldn't make sense of the data in the " + "certificate \"%s\" and its private key.", + data->set.str[STRING_CERT]); + break; + case errSecPassphraseRequired: + failf(data, "SSL The certificate \"%s\" requires a password.", + data->set.str[STRING_CERT]); + break; + case errSecItemNotFound: + failf(data, "SSL: Can't find the certificate \"%s\" and its private " + "key in the Keychain.", data->set.str[STRING_CERT]); + break; + default: + failf(data, "SSL: Can't load the certificate \"%s\" and its private " + "key: OSStatus %d", data->set.str[STRING_CERT], err); + break; + } + return CURLE_SSL_CERTPROBLEM; + } + } /* SSL always tries to verify the peer, this only says whether it should * fail to connect if the verification fails, or if it should continue * anyway. In the latter case the result of the verification is checked with * SSL_get_verify_result() below. */ -#if defined(__MAC_10_6) || defined(__IPHONE_5_0) +#if CURL_BUILD_MAC_10_6 || CURL_BUILD_IOS /* Snow Leopard introduced the SSLSetSessionOption() function, but due to a library bug with the way the kSSLSessionOptionBreakOnServerAuth flag works, it doesn't work as expected under Snow Leopard or Lion. @@ -817,7 +1254,12 @@ static CURLcode darwinssl_connect_step1(struct connectdata *conn, to disable certificate validation if the user turned that off. (SecureTransport will always validate the certificate chain by default.) */ - if(SSLSetSessionOption != NULL && IsRunningMountainLionOrLater()) { + /* (Note: Darwin 12.x.x is Mountain Lion.) */ +#if CURL_BUILD_MAC + if(SSLSetSessionOption != NULL && darwinver_maj >= 12) { +#else + if(SSLSetSessionOption != NULL) { +#endif /* CURL_BUILD_MAC */ err = SSLSetSessionOption(connssl->ssl_ctx, kSSLSessionOptionBreakOnServerAuth, data->set.ssl.verifypeer?false:true); @@ -827,14 +1269,14 @@ static CURLcode darwinssl_connect_step1(struct connectdata *conn, } } else { -#if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) +#if CURL_SUPPORT_MAC_10_8 err = SSLSetEnableCertVerify(connssl->ssl_ctx, data->set.ssl.verifypeer?true:false); if(err != noErr) { failf(data, "SSL: SSLSetEnableCertVerify() failed: OSStatus %d", err); return CURLE_SSL_CONNECT_ERROR; } -#endif /* (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) */ +#endif /* CURL_SUPPORT_MAC_10_8 */ } #else err = SSLSetEnableCertVerify(connssl->ssl_ctx, @@ -843,7 +1285,7 @@ static CURLcode darwinssl_connect_step1(struct connectdata *conn, failf(data, "SSL: SSLSetEnableCertVerify() failed: OSStatus %d", err); return CURLE_SSL_CONNECT_ERROR; } -#endif /* defined(__MAC_10_6) || defined(__IPHONE_5_0) */ +#endif /* CURL_BUILD_MAC_10_6 || CURL_BUILD_IOS */ /* If this is a domain name and not an IP address, then configure SNI. * Also: the verifyhost setting influences SNI usage */ @@ -856,11 +1298,147 @@ static CURLcode darwinssl_connect_step1(struct connectdata *conn, err = SSLSetPeerDomainName(connssl->ssl_ctx, conn->host.name, strlen(conn->host.name)); if(err != noErr) { - infof(data, "WARNING: SSL: SSLSetPeerDomainName() failed: OSStatus %d", + infof(data, "WARNING: SSL: SSLSetPeerDomainName() failed: OSStatus %d\n", err); } } + /* Disable cipher suites that ST supports but are not safe. These ciphers + are unlikely to be used in any case since ST gives other ciphers a much + higher priority, but it's probably better that we not connect at all than + to give the user a false sense of security if the server only supports + insecure ciphers. (Note: We don't care about SSLv2-only ciphers.) */ + (void)SSLGetNumberSupportedCiphers(connssl->ssl_ctx, &all_ciphers_count); + all_ciphers = malloc(all_ciphers_count*sizeof(SSLCipherSuite)); + allowed_ciphers = malloc(all_ciphers_count*sizeof(SSLCipherSuite)); + if(all_ciphers && allowed_ciphers && + SSLGetSupportedCiphers(connssl->ssl_ctx, all_ciphers, + &all_ciphers_count) == noErr) { + for(i = 0UL ; i < all_ciphers_count ; i++) { +#if CURL_BUILD_MAC + /* There's a known bug in early versions of Mountain Lion where ST's ECC + ciphers (cipher suite 0xC001 through 0xC032) simply do not work. + Work around the problem here by disabling those ciphers if we are + running in an affected version of OS X. */ + if(darwinver_maj == 12 && darwinver_min <= 3 && + all_ciphers[i] >= 0xC001 && all_ciphers[i] <= 0xC032) { + continue; + } +#endif /* CURL_BUILD_MAC */ + switch(all_ciphers[i]) { + /* Disable NULL ciphersuites: */ + case SSL_NULL_WITH_NULL_NULL: + case SSL_RSA_WITH_NULL_MD5: + case SSL_RSA_WITH_NULL_SHA: + case 0x003B: /* TLS_RSA_WITH_NULL_SHA256 */ + case SSL_FORTEZZA_DMS_WITH_NULL_SHA: + case 0xC001: /* TLS_ECDH_ECDSA_WITH_NULL_SHA */ + case 0xC006: /* TLS_ECDHE_ECDSA_WITH_NULL_SHA */ + case 0xC00B: /* TLS_ECDH_RSA_WITH_NULL_SHA */ + case 0xC010: /* TLS_ECDHE_RSA_WITH_NULL_SHA */ + case 0x002C: /* TLS_PSK_WITH_NULL_SHA */ + case 0x002D: /* TLS_DHE_PSK_WITH_NULL_SHA */ + case 0x002E: /* TLS_RSA_PSK_WITH_NULL_SHA */ + case 0x00B0: /* TLS_PSK_WITH_NULL_SHA256 */ + case 0x00B1: /* TLS_PSK_WITH_NULL_SHA384 */ + case 0x00B4: /* TLS_DHE_PSK_WITH_NULL_SHA256 */ + case 0x00B5: /* TLS_DHE_PSK_WITH_NULL_SHA384 */ + case 0x00B8: /* TLS_RSA_PSK_WITH_NULL_SHA256 */ + case 0x00B9: /* TLS_RSA_PSK_WITH_NULL_SHA384 */ + /* Disable anonymous ciphersuites: */ + case SSL_DH_anon_EXPORT_WITH_RC4_40_MD5: + case SSL_DH_anon_WITH_RC4_128_MD5: + case SSL_DH_anon_EXPORT_WITH_DES40_CBC_SHA: + case SSL_DH_anon_WITH_DES_CBC_SHA: + case SSL_DH_anon_WITH_3DES_EDE_CBC_SHA: + case TLS_DH_anon_WITH_AES_128_CBC_SHA: + case TLS_DH_anon_WITH_AES_256_CBC_SHA: + case 0xC015: /* TLS_ECDH_anon_WITH_NULL_SHA */ + case 0xC016: /* TLS_ECDH_anon_WITH_RC4_128_SHA */ + case 0xC017: /* TLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA */ + case 0xC018: /* TLS_ECDH_anon_WITH_AES_128_CBC_SHA */ + case 0xC019: /* TLS_ECDH_anon_WITH_AES_256_CBC_SHA */ + case 0x006C: /* TLS_DH_anon_WITH_AES_128_CBC_SHA256 */ + case 0x006D: /* TLS_DH_anon_WITH_AES_256_CBC_SHA256 */ + case 0x00A6: /* TLS_DH_anon_WITH_AES_128_GCM_SHA256 */ + case 0x00A7: /* TLS_DH_anon_WITH_AES_256_GCM_SHA384 */ + /* Disable weak key ciphersuites: */ + case SSL_RSA_EXPORT_WITH_RC4_40_MD5: + case SSL_RSA_EXPORT_WITH_RC2_CBC_40_MD5: + case SSL_RSA_EXPORT_WITH_DES40_CBC_SHA: + case SSL_DH_DSS_EXPORT_WITH_DES40_CBC_SHA: + case SSL_DH_RSA_EXPORT_WITH_DES40_CBC_SHA: + case SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA: + case SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA: + case SSL_RSA_WITH_DES_CBC_SHA: + case SSL_DH_DSS_WITH_DES_CBC_SHA: + case SSL_DH_RSA_WITH_DES_CBC_SHA: + case SSL_DHE_DSS_WITH_DES_CBC_SHA: + case SSL_DHE_RSA_WITH_DES_CBC_SHA: + /* Disable IDEA: */ + case SSL_RSA_WITH_IDEA_CBC_SHA: + case SSL_RSA_WITH_IDEA_CBC_MD5: + break; + default: /* enable everything else */ + allowed_ciphers[allowed_ciphers_count++] = all_ciphers[i]; + break; + } + } + err = SSLSetEnabledCiphers(connssl->ssl_ctx, allowed_ciphers, + allowed_ciphers_count); + if(err != noErr) { + failf(data, "SSL: SSLSetEnabledCiphers() failed: OSStatus %d", err); + return CURLE_SSL_CONNECT_ERROR; + } + } + else { + Curl_safefree(all_ciphers); + Curl_safefree(allowed_ciphers); + failf(data, "SSL: Failed to allocate memory for allowed ciphers"); + return CURLE_OUT_OF_MEMORY; + } + Curl_safefree(all_ciphers); + Curl_safefree(allowed_ciphers); + +#if CURL_BUILD_MAC_10_9 || CURL_BUILD_IOS_7 + /* We want to enable 1/n-1 when using a CBC cipher unless the user + specifically doesn't want us doing that: */ + SSLSetSessionOption(connssl->ssl_ctx, kSSLSessionOptionSendOneByteRecord, + !data->set.ssl_enable_beast); +#endif /* CURL_BUILD_MAC_10_9 || CURL_BUILD_IOS_7 */ + + /* Check if there's a cached ID we can/should use here! */ + if(!Curl_ssl_getsessionid(conn, (void **)&ssl_sessionid, + &ssl_sessionid_len)) { + /* we got a session id, use it! */ + err = SSLSetPeerID(connssl->ssl_ctx, ssl_sessionid, ssl_sessionid_len); + if(err != noErr) { + failf(data, "SSL: SSLSetPeerID() failed: OSStatus %d", err); + return CURLE_SSL_CONNECT_ERROR; + } + /* Informational message */ + infof(data, "SSL re-using session ID\n"); + } + /* If there isn't one, then let's make one up! This has to be done prior + to starting the handshake. */ + else { + CURLcode retcode; + + ssl_sessionid = malloc(256*sizeof(char)); + ssl_sessionid_len = snprintf(ssl_sessionid, 256, "curl:%s:%hu", + conn->host.name, conn->remote_port); + err = SSLSetPeerID(connssl->ssl_ctx, ssl_sessionid, ssl_sessionid_len); + if(err != noErr) { + failf(data, "SSL: SSLSetPeerID() failed: OSStatus %d", err); + return CURLE_SSL_CONNECT_ERROR; + } + retcode = Curl_ssl_addsessionid(conn, ssl_sessionid, ssl_sessionid_len); + if(retcode!= CURLE_OK) { + failf(data, "failed to store ssl session"); + return retcode; + } + } + err = SSLSetIOFuncs(connssl->ssl_ctx, SocketRead, SocketWrite); if(err != noErr) { failf(data, "SSL: SSLSetIOFuncs() failed: OSStatus %d", err); @@ -872,8 +1450,6 @@ static CURLcode darwinssl_connect_step1(struct connectdata *conn, * SSLSetConnection() will not copy that address. I've found that * conn->sock[sockindex] may change on its own. */ connssl->ssl_sockfd = sockfd; - /*ssl_connection = &(connssl->ssl_sockfd); - err = SSLSetConnection(connssl->ssl_ctx, ssl_connection);*/ err = SSLSetConnection(connssl->ssl_ctx, connssl); if(err != noErr) { failf(data, "SSL: SSLSetConnection() failed: %d", err); @@ -907,22 +1483,71 @@ darwinssl_connect_step2(struct connectdata *conn, int sockindex) ssl_connect_2_writing : ssl_connect_2_reading; return CURLE_OK; - case errSSLServerAuthCompleted: + /* The below is errSSLServerAuthCompleted; it's not defined in + Leopard's headers */ + case -9841: /* the documentation says we need to call SSLHandshake() again */ return darwinssl_connect_step2(conn, sockindex); + /* These are all certificate problems with the server: */ case errSSLXCertChainInvalid: + failf(data, "SSL certificate problem: Invalid certificate chain"); + return CURLE_SSL_CACERT; case errSSLUnknownRootCert: + failf(data, "SSL certificate problem: Untrusted root certificate"); + return CURLE_SSL_CACERT; case errSSLNoRootCert: + failf(data, "SSL certificate problem: No root certificate"); + return CURLE_SSL_CACERT; case errSSLCertExpired: - failf(data, "SSL certificate problem: OSStatus %d", err); + failf(data, "SSL certificate problem: Certificate chain had an " + "expired certificate"); return CURLE_SSL_CACERT; + case errSSLBadCert: + failf(data, "SSL certificate problem: Couldn't understand the server " + "certificate format"); + return CURLE_SSL_CONNECT_ERROR; + /* These are all certificate problems with the client: */ + case errSecAuthFailed: + failf(data, "SSL authentication failed"); + return CURLE_SSL_CONNECT_ERROR; + case errSSLPeerHandshakeFail: + failf(data, "SSL peer handshake failed, the server most likely " + "requires a client certificate to connect"); + return CURLE_SSL_CONNECT_ERROR; + case errSSLPeerUnknownCA: + failf(data, "SSL server rejected the client certificate due to " + "the certificate being signed by an unknown certificate " + "authority"); + return CURLE_SSL_CONNECT_ERROR; + + /* This error is raised if the server's cert didn't match the server's + host name: */ case errSSLHostNameMismatch: failf(data, "SSL certificate peer verification failed, the " "certificate did not match \"%s\"\n", conn->host.dispname); return CURLE_PEER_FAILED_VERIFICATION; + /* Generic handshake errors: */ + case errSSLConnectionRefused: + failf(data, "Server dropped the connection during the SSL handshake"); + return CURLE_SSL_CONNECT_ERROR; + case errSSLClosedAbort: + failf(data, "Server aborted the SSL handshake"); + return CURLE_SSL_CONNECT_ERROR; + case errSSLNegotiation: + failf(data, "Could not negotiate an SSL cipher suite with the server"); + return CURLE_SSL_CONNECT_ERROR; + /* Sometimes paramErr happens with buggy ciphers: */ + case paramErr: case errSSLInternal: + failf(data, "Internal SSL engine error encountered during the " + "SSL handshake"); + return CURLE_SSL_CONNECT_ERROR; + case errSSLFatalAlert: + failf(data, "Fatal SSL engine error encountered during the SSL " + "handshake"); + return CURLE_SSL_CONNECT_ERROR; default: failf(data, "Unknown SSL protocol error in connection to %s:%d", conn->host.name, err); @@ -949,7 +1574,7 @@ darwinssl_connect_step2(struct connectdata *conn, int sockindex) infof(data, "TLS 1.0 connection using %s\n", TLSCipherNameForNumber(cipher)); break; -#if defined(__MAC_10_8) || defined(__IPHONE_5_0) +#if CURL_BUILD_MAC_10_8 || CURL_BUILD_IOS case kTLSProtocol11: infof(data, "TLS 1.1 connection using %s\n", TLSCipherNameForNumber(cipher)); @@ -976,24 +1601,26 @@ darwinssl_connect_step3(struct connectdata *conn, struct ssl_connect_data *connssl = &conn->ssl[sockindex]; CFStringRef server_cert_summary; char server_cert_summary_c[128]; - CFArrayRef server_certs; + CFArrayRef server_certs = NULL; SecCertificateRef server_cert; OSStatus err; CFIndex i, count; - SecTrustRef trust; + SecTrustRef trust = NULL; /* There is no step 3! * Well, okay, if verbose mode is on, let's print the details of the * server certificates. */ -#if defined(__MAC_10_7) || defined(__IPHONE_5_0) -#if (TARGET_OS_EMBEDDED || TARGET_OS_IPHONE) +#if CURL_BUILD_MAC_10_7 || CURL_BUILD_IOS +#if CURL_BUILD_IOS #pragma unused(server_certs) err = SSLCopyPeerTrust(connssl->ssl_ctx, &trust); - if(err == noErr) { + /* For some reason, SSLCopyPeerTrust() can return noErr and yet return + a null trust, so be on guard for that: */ + if(err == noErr && trust) { count = SecTrustGetCertificateCount(trust); for(i = 0L ; i < count ; i++) { server_cert = SecTrustGetCertificateAtIndex(trust, i); - server_cert_summary = SecCertificateCopySubjectSummary(server_cert); + server_cert_summary = CopyCertSubject(server_cert); memset(server_cert_summary_c, 0, 128); if(CFStringGetCString(server_cert_summary, server_cert_summary_c, @@ -1015,12 +1642,13 @@ darwinssl_connect_step3(struct connectdata *conn, if(SecTrustEvaluateAsync != NULL) { #pragma unused(server_certs) err = SSLCopyPeerTrust(connssl->ssl_ctx, &trust); - if(err == noErr) { + /* For some reason, SSLCopyPeerTrust() can return noErr and yet return + a null trust, so be on guard for that: */ + if(err == noErr && trust) { count = SecTrustGetCertificateCount(trust); for(i = 0L ; i < count ; i++) { server_cert = SecTrustGetCertificateAtIndex(trust, i); - server_cert_summary = - SecCertificateCopyLongDescription(NULL, server_cert, NULL); + server_cert_summary = CopyCertSubject(server_cert); memset(server_cert_summary_c, 0, 128); if(CFStringGetCString(server_cert_summary, server_cert_summary_c, @@ -1034,14 +1662,16 @@ darwinssl_connect_step3(struct connectdata *conn, } } else { +#if CURL_SUPPORT_MAC_10_8 err = SSLCopyPeerCertificates(connssl->ssl_ctx, &server_certs); - if(err == noErr) { + /* Just in case SSLCopyPeerCertificates() returns null too... */ + if(err == noErr && server_certs) { count = CFArrayGetCount(server_certs); for(i = 0L ; i < count ; i++) { server_cert = (SecCertificateRef)CFArrayGetValueAtIndex(server_certs, i); - server_cert_summary = SecCertificateCopySubjectSummary(server_cert); + server_cert_summary = CopyCertSubject(server_cert); memset(server_cert_summary_c, 0, 128); if(CFStringGetCString(server_cert_summary, server_cert_summary_c, @@ -1053,8 +1683,9 @@ darwinssl_connect_step3(struct connectdata *conn, } CFRelease(server_certs); } +#endif /* CURL_SUPPORT_MAC_10_8 */ } -#endif /* (TARGET_OS_EMBEDDED || TARGET_OS_IPHONE) */ +#endif /* CURL_BUILD_IOS */ #else #pragma unused(trust) err = SSLCopyPeerCertificates(connssl->ssl_ctx, &server_certs); @@ -1062,8 +1693,7 @@ darwinssl_connect_step3(struct connectdata *conn, count = CFArrayGetCount(server_certs); for(i = 0L ; i < count ; i++) { server_cert = (SecCertificateRef)CFArrayGetValueAtIndex(server_certs, i); - - server_cert_summary = SecCertificateCopySubjectSummary(server_cert); + server_cert_summary = CopyCertSubject(server_cert); memset(server_cert_summary_c, 0, 128); if(CFStringGetCString(server_cert_summary, server_cert_summary_c, @@ -1075,7 +1705,7 @@ darwinssl_connect_step3(struct connectdata *conn, } CFRelease(server_certs); } -#endif /* defined(__MAC_10_7) || defined(__IPHONE_5_0) */ +#endif /* CURL_BUILD_MAC_10_7 || CURL_BUILD_IOS */ connssl->connecting_state = ssl_connect_done; return CURLE_OK; @@ -1227,16 +1857,16 @@ void Curl_darwinssl_close(struct connectdata *conn, int sockindex) if(connssl->ssl_ctx) { (void)SSLClose(connssl->ssl_ctx); -#if defined(__MAC_10_8) || defined(__IPHONE_5_0) +#if CURL_BUILD_MAC_10_8 || CURL_BUILD_IOS if(SSLCreateContext != NULL) CFRelease(connssl->ssl_ctx); -#if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) +#if CURL_SUPPORT_MAC_10_8 else (void)SSLDisposeContext(connssl->ssl_ctx); -#endif /* (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) */ +#endif /* CURL_SUPPORT_MAC_10_8 */ #else (void)SSLDisposeContext(connssl->ssl_ctx); -#endif /* defined(__MAC_10_8) || defined(__IPHONE_5_0) */ +#endif /* CURL_BUILD_MAC_10_8 || CURL_BUILD_IOS */ connssl->ssl_ctx = NULL; } connssl->ssl_sockfd = 0; @@ -1302,6 +1932,17 @@ int Curl_darwinssl_shutdown(struct connectdata *conn, int sockindex) return rc; } +void Curl_darwinssl_session_free(void *ptr) +{ + /* ST, as of iOS 5 and Mountain Lion, has no public method of deleting a + cached session ID inside the Security framework. There is a private + function that does this, but I don't want to have to explain to you why I + got your application rejected from the App Store due to the use of a + private API, so the best we can do is free up our own char array that we + created way back in darwinssl_connect_step1... */ + Curl_safefree(ptr); +} + size_t Curl_darwinssl_version(char *buffer, size_t size) { return snprintf(buffer, size, "SecureTransport"); @@ -1384,22 +2025,58 @@ static ssize_t darwinssl_send(struct connectdata *conn, /*struct SessionHandle *data = conn->data;*/ struct ssl_connect_data *connssl = &conn->ssl[sockindex]; size_t processed = 0UL; - OSStatus err = SSLWrite(connssl->ssl_ctx, mem, len, &processed); + OSStatus err; - if(err != noErr) { + /* The SSLWrite() function works a little differently than expected. The + fourth argument (processed) is currently documented in Apple's + documentation as: "On return, the length, in bytes, of the data actually + written." + + Now, one could interpret that as "written to the socket," but actually, + it returns the amount of data that was written to a buffer internal to + the SSLContextRef instead. So it's possible for SSLWrite() to return + errSSLWouldBlock and a number of bytes "written" because those bytes were + encrypted and written to a buffer, not to the socket. + + So if this happens, then we need to keep calling SSLWrite() over and + over again with no new data until it quits returning errSSLWouldBlock. */ + + /* Do we have buffered data to write from the last time we were called? */ + if(connssl->ssl_write_buffered_length) { + /* Write the buffered data: */ + err = SSLWrite(connssl->ssl_ctx, NULL, 0UL, &processed); switch (err) { - case errSSLWouldBlock: /* return how much we sent (if anything) */ - if(processed) - return (ssize_t)processed; - *curlcode = CURLE_AGAIN; - return -1; + case noErr: + /* processed is always going to be 0 because we didn't write to + the buffer, so return how much was written to the socket */ + processed = connssl->ssl_write_buffered_length; + connssl->ssl_write_buffered_length = 0UL; break; - + case errSSLWouldBlock: /* argh, try again */ + *curlcode = CURLE_AGAIN; + return -1L; default: - failf(conn->data, "SSLWrite() return error %d", err); + failf(conn->data, "SSLWrite() returned error %d", err); *curlcode = CURLE_SEND_ERROR; - return -1; - break; + return -1L; + } + } + else { + /* We've got new data to write: */ + err = SSLWrite(connssl->ssl_ctx, mem, len, &processed); + if(err != noErr) { + switch (err) { + case errSSLWouldBlock: + /* Data was buffered but not sent, we have to tell the caller + to try sending again, and remember how much was buffered */ + connssl->ssl_write_buffered_length = len; + *curlcode = CURLE_AGAIN; + return -1L; + default: + failf(conn->data, "SSLWrite() returned error %d", err); + *curlcode = CURLE_SEND_ERROR; + return -1L; + } } } return (ssize_t)processed; @@ -1422,18 +2099,23 @@ static ssize_t darwinssl_recv(struct connectdata *conn, if(processed) return (ssize_t)processed; *curlcode = CURLE_AGAIN; - return -1; + return -1L; break; - case errSSLClosedGraceful: /* they're done; fail gracefully */ + /* errSSLClosedGraceful - server gracefully shut down the SSL session + errSSLClosedNoNotify - server hung up on us instead of sending a + closure alert notice, read() is returning 0 + Either way, inform the caller that the server disconnected. */ + case errSSLClosedGraceful: + case errSSLClosedNoNotify: *curlcode = CURLE_OK; - return -1; + return -1L; break; default: failf(conn->data, "SSLRead() return error %d", err); *curlcode = CURLE_RECV_ERROR; - return -1; + return -1L; break; } } diff --git a/plugins/FTPFileYM/curl/lib/curl_darwinssl.h b/plugins/FTPFileYM/curl/lib/curl_darwinssl.h index 183d9371c7..432d3d7ce4 100644 --- a/plugins/FTPFileYM/curl/lib/curl_darwinssl.h +++ b/plugins/FTPFileYM/curl/lib/curl_darwinssl.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 2012, Nick Zitzmann, <nickzman@gmail.com>. + * Copyright (C) 2012 - 2013, Nick Zitzmann, <nickzman@gmail.com>. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -37,6 +37,7 @@ void Curl_darwinssl_close_all(struct SessionHandle *data); /* close a SSL connection */ void Curl_darwinssl_close(struct connectdata *conn, int sockindex); +void Curl_darwinssl_session_free(void *ptr); size_t Curl_darwinssl_version(char *buffer, size_t size); int Curl_darwinssl_shutdown(struct connectdata *conn, int sockindex); int Curl_darwinssl_check_cxn(struct connectdata *conn); @@ -51,12 +52,16 @@ void Curl_darwinssl_md5sum(unsigned char *tmp, /* input */ unsigned char *md5sum, /* output */ size_t md5len); +/* this backend provides these functions: */ +#define have_curlssl_random 1 +#define have_curlssl_md5sum 1 + /* API setup for SecureTransport */ #define curlssl_init() (1) #define curlssl_cleanup() Curl_nop_stmt #define curlssl_connect Curl_darwinssl_connect #define curlssl_connect_nonblocking Curl_darwinssl_connect_nonblocking -#define curlssl_session_free(x) Curl_nop_stmt +#define curlssl_session_free(x) Curl_darwinssl_session_free(x) #define curlssl_close_all Curl_darwinssl_close_all #define curlssl_close Curl_darwinssl_close #define curlssl_shutdown(x,y) 0 diff --git a/plugins/FTPFileYM/curl/lib/curl_memory.h b/plugins/FTPFileYM/curl/lib/curl_memory.h index e119458234..e3cdc721c4 100644 --- a/plugins/FTPFileYM/curl/lib/curl_memory.h +++ b/plugins/FTPFileYM/curl/lib/curl_memory.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -22,17 +22,86 @@ * ***************************************************************************/ -#include <curl/curl.h> /* for the typedefs */ +/* + * Nasty internal details ahead... + * + * File curl_memory.h must be included by _all_ *.c source files + * that use memory related functions strdup, malloc, calloc, realloc + * or free, and given source file is used to build libcurl library. + * + * There is nearly no exception to above rule. All libcurl source + * files in 'lib' subdirectory as well as those living deep inside + * 'packages' subdirectories and linked together in order to build + * libcurl library shall follow it. + * + * File lib/strdup.c is an exception, given that it provides a strdup + * clone implementation while using malloc. Extra care needed inside + * this one. TODO: revisit this paragraph and related code. + * + * The need for curl_memory.h inclusion is due to libcurl's feature + * of allowing library user to provide memory replacement functions, + * memory callbacks, at runtime with curl_global_init_mem() + * + * Any *.c source file used to build libcurl library that does not + * include curl_memory.h and uses any memory function of the five + * mentioned above will compile without any indication, but it will + * trigger weird memory related issues at runtime. + * + * OTOH some source files from 'lib' subdirectory may additionally be + * used directly as source code when using some curlx_ functions by + * third party programs that don't even use libcurl at all. When using + * these source files in this way it is necessary these are compiled + * with CURLX_NO_MEMORY_CALLBACKS defined, in order to ensure that no + * attempt of calling libcurl's memory callbacks is done from code + * which can not use this machinery. + * + * Notice that libcurl's 'memory tracking' system works chaining into + * the memory callback machinery. This implies that when compiling + * 'lib' source files with CURLX_NO_MEMORY_CALLBACKS defined this file + * disengages usage of libcurl's 'memory tracking' system, defining + * MEMDEBUG_NODEFINES and overriding CURLDEBUG purpose. + * + * CURLX_NO_MEMORY_CALLBACKS takes precedence over CURLDEBUG. This is + * done in order to allow building a 'memory tracking' enabled libcurl + * and at the same time allow building programs which do not use it. + * + * Programs and libraries in 'tests' subdirectories have specific + * purposes and needs, and as such each one will use whatever fits + * best, depending additionally wether it links with libcurl or not. + * + * Caveat emptor. Proper curlx_* separation is a work in progress + * the same as CURLX_NO_MEMORY_CALLBACKS usage, some adjustments may + * still be required. IOW don't use them yet, there are sharp edges. + */ + +#ifdef HEADER_CURL_MEMDEBUG_H +#error "Header memdebug.h shall not be included before curl_memory.h" +#endif + +#ifndef CURLX_NO_MEMORY_CALLBACKS + +#include <curl/curl.h> /* for the callback typedefs */ extern curl_malloc_callback Curl_cmalloc; extern curl_free_callback Curl_cfree; extern curl_realloc_callback Curl_crealloc; extern curl_strdup_callback Curl_cstrdup; extern curl_calloc_callback Curl_ccalloc; +#if defined(WIN32) && defined(UNICODE) +extern curl_wcsdup_callback Curl_cwcsdup; +#endif #ifndef CURLDEBUG -/* Only do this define-mania if we're not using the memdebug system, as that - has preference on this magic. */ + +/* + * libcurl's 'memory tracking' system defines strdup, malloc, calloc, + * realloc and free, along with others, in memdebug.h in a different + * way although still using memory callbacks forward declared above. + * When using the 'memory tracking' system (CURLDEBUG defined) we do + * not define here the five memory functions given that definitions + * from memdebug.h are the ones that shall be used. + */ + #undef strdup #define strdup(ptr) Curl_cstrdup(ptr) #undef malloc @@ -44,6 +113,28 @@ extern curl_calloc_callback Curl_ccalloc; #undef free #define free(ptr) Curl_cfree(ptr) +#ifdef WIN32 +# ifdef UNICODE +# undef wcsdup +# define wcsdup(ptr) Curl_cwcsdup(ptr) +# undef _wcsdup +# define _wcsdup(ptr) Curl_cwcsdup(ptr) +# undef _tcsdup +# define _tcsdup(ptr) Curl_cwcsdup(ptr) +# else +# undef _tcsdup +# define _tcsdup(ptr) Curl_cstrdup(ptr) +# endif #endif +#endif /* CURLDEBUG */ + +#else /* CURLX_NO_MEMORY_CALLBACKS */ + +#ifndef MEMDEBUG_NODEFINES +#define MEMDEBUG_NODEFINES +#endif + +#endif /* CURLX_NO_MEMORY_CALLBACKS */ + #endif /* HEADER_CURL_MEMORY_H */ diff --git a/plugins/FTPFileYM/curl/lib/curl_ntlm.c b/plugins/FTPFileYM/curl/lib/curl_ntlm.c index 72e446c8fd..4d126a573e 100644 --- a/plugins/FTPFileYM/curl/lib/curl_ntlm.c +++ b/plugins/FTPFileYM/curl/lib/curl_ntlm.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -181,7 +181,6 @@ CURLcode Curl_output_ntlm(struct connectdata *conn, /* Create a type-1 message */ error = Curl_ntlm_create_type1_message(userp, passwdp, ntlm, &base64, &len); - if(error) return error; @@ -190,8 +189,10 @@ CURLcode Curl_output_ntlm(struct connectdata *conn, *allocuserpwd = aprintf("%sAuthorization: NTLM %s\r\n", proxy ? "Proxy-" : "", base64); - DEBUG_OUT(fprintf(stderr, "**** Header %s\n ", *allocuserpwd)); free(base64); + if(!*allocuserpwd) + return CURLE_OUT_OF_MEMORY; + DEBUG_OUT(fprintf(stderr, "**** Header %s\n ", *allocuserpwd)); } break; @@ -207,8 +208,10 @@ CURLcode Curl_output_ntlm(struct connectdata *conn, *allocuserpwd = aprintf("%sAuthorization: NTLM %s\r\n", proxy ? "Proxy-" : "", base64); - DEBUG_OUT(fprintf(stderr, "**** %s\n ", *allocuserpwd)); free(base64); + if(!*allocuserpwd) + return CURLE_OUT_OF_MEMORY; + DEBUG_OUT(fprintf(stderr, "**** %s\n ", *allocuserpwd)); ntlm->state = NTLMSTATE_TYPE3; /* we send a type-3 */ authp->done = TRUE; @@ -218,10 +221,7 @@ CURLcode Curl_output_ntlm(struct connectdata *conn, case NTLMSTATE_TYPE3: /* connection is already authenticated, * don't send a header in future requests */ - if(*allocuserpwd) { - free(*allocuserpwd); - *allocuserpwd = NULL; - } + Curl_safefree(*allocuserpwd); authp->done = TRUE; break; } diff --git a/plugins/FTPFileYM/curl/lib/curl_ntlm_core.c b/plugins/FTPFileYM/curl/lib/curl_ntlm_core.c index 8f3c00d645..79aeb08b3f 100644 --- a/plugins/FTPFileYM/curl/lib/curl_ntlm_core.c +++ b/plugins/FTPFileYM/curl/lib/curl_ntlm_core.c @@ -421,7 +421,7 @@ CURLcode Curl_ntlm_core_mk_nt_hash(struct SessionHandle *data, #elif defined(USE_NSS) Curl_md4it(ntbuffer, pw, 2 * len); #elif defined(USE_DARWINSSL) - (void)CC_MD4(pw, 2 * len, ntbuffer); + (void)CC_MD4(pw, (CC_LONG)(2 * len), ntbuffer); #endif memset(ntbuffer + 16, 0, 21 - 16); diff --git a/plugins/FTPFileYM/curl/lib/curl_ntlm_msgs.c b/plugins/FTPFileYM/curl/lib/curl_ntlm_msgs.c index 93334c6012..125ce6e496 100644 --- a/plugins/FTPFileYM/curl/lib/curl_ntlm_msgs.c +++ b/plugins/FTPFileYM/curl/lib/curl_ntlm_msgs.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -179,10 +179,11 @@ static unsigned int readint_le(unsigned char *buf) /* * Curl_ntlm_decode_type2_message() * - * This is used to decode a ntlm type-2 message received from a: HTTP, SMTP - * or POP3 server. The message is first decoded from a base64 string into a - * raw ntlm message and checked for validity before the appropriate data for - * creating a type-3 message is written to the given ntlm data structure. + * This is used to decode a ntlm type-2 message received from a HTTP or SASL + * based (such as SMTP, POP3 or IMAP) server. The message is first decoded + * from a base64 string into a raw ntlm message and checked for validity + * before the appropriate data for creating a type-3 message is written to + * the given ntlm data structure. * * Parameters: * @@ -305,9 +306,9 @@ static void unicodecpy(unsigned char *dest, /* * Curl_ntlm_create_type1_message() * - * This is used to generate an already encoded NTLM type-1 message ready - * for sending to the recipient, be it a: HTTP, SMTP or POP3 server, - * using the appropriate compile time crypo API. + * This is used to generate an already encoded NTLM type-1 message ready for + * sending to the recipient, be it a HTTP or SASL based (such as SMTP, POP3 + * or IMAP) server, using the appropriate compile time crypo API. * * Parameters: * @@ -552,9 +553,9 @@ CURLcode Curl_ntlm_create_type1_message(const char *userp, /* * Curl_ntlm_create_type3_message() * - * This is used to generate an already encoded NTLM type-3 message ready - * for sending to the recipient, be it a: HTTP, SMTP or POP3 server, - * using the appropriate compile time crypo API. + * This is used to generate an already encoded NTLM type-3 message ready for + * sending to the recipient, be it a HTTP or SASL based (such as SMTP, POP3 + * or IMAP) server, using the appropriate compile time crypo API. * * Parameters: * diff --git a/plugins/FTPFileYM/curl/lib/curl_sasl.c b/plugins/FTPFileYM/curl/lib/curl_sasl.c index d07387d471..b3ffc66156 100644 --- a/plugins/FTPFileYM/curl/lib/curl_sasl.c +++ b/plugins/FTPFileYM/curl/lib/curl_sasl.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 2012-2013, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 2012 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -22,6 +22,7 @@ * RFC2831 DIGEST-MD5 authentication * RFC4422 Simple Authentication and Security Layer (SASL) * RFC4616 PLAIN authentication + * RFC6749 OAuth 2.0 Authorization Framework * ***************************************************************************/ @@ -32,7 +33,7 @@ #include "curl_base64.h" #include "curl_md5.h" -#include "curl_rand.h" +#include "sslgen.h" #include "curl_hmac.h" #include "curl_ntlm_msgs.h" #include "curl_sasl.h" @@ -90,22 +91,22 @@ static bool sasl_digest_get_key_value(const unsigned char *chlg, * Returns CURLE_OK on success. */ CURLcode Curl_sasl_create_plain_message(struct SessionHandle *data, - const char* userp, - const char* passwdp, + const char *userp, + const char *passwdp, char **outptr, size_t *outlen) { - char plainauth[2 * MAX_CURL_USER_LENGTH + MAX_CURL_PASSWORD_LENGTH]; + CURLcode result; + char *plainauth; size_t ulen; size_t plen; ulen = strlen(userp); plen = strlen(passwdp); - if(2 * ulen + plen + 2 > sizeof(plainauth)) { + plainauth = malloc(2 * ulen + plen + 2); + if(!plainauth) { *outlen = 0; *outptr = NULL; - - /* Plainauth too small */ return CURLE_OUT_OF_MEMORY; } @@ -117,8 +118,10 @@ CURLcode Curl_sasl_create_plain_message(struct SessionHandle *data, memcpy(plainauth + 2 * ulen + 2, passwdp, plen); /* Base64 encode the reply */ - return Curl_base64_encode(data, plainauth, 2 * ulen + plen + 2, outptr, - outlen); + result = Curl_base64_encode(data, plainauth, 2 * ulen + plen + 2, outptr, + outlen); + Curl_safefree(plainauth); + return result; } /* @@ -138,7 +141,7 @@ CURLcode Curl_sasl_create_plain_message(struct SessionHandle *data, * Returns CURLE_OK on success. */ CURLcode Curl_sasl_create_login_message(struct SessionHandle *data, - const char* valuep, char **outptr, + const char *valuep, char **outptr, size_t *outlen) { size_t vlen = strlen(valuep); @@ -179,9 +182,9 @@ CURLcode Curl_sasl_create_login_message(struct SessionHandle *data, * Returns CURLE_OK on success. */ CURLcode Curl_sasl_create_cram_md5_message(struct SessionHandle *data, - const char* chlg64, - const char* userp, - const char* passwdp, + const char *chlg64, + const char *userp, + const char *passwdp, char **outptr, size_t *outlen) { CURLcode result = CURLE_OK; @@ -190,7 +193,7 @@ CURLcode Curl_sasl_create_cram_md5_message(struct SessionHandle *data, size_t chlglen = 0; HMAC_context *ctxt; unsigned char digest[MD5_DIGEST_LEN]; - char response[MAX_CURL_USER_LENGTH + 2 * MD5_DIGEST_LEN + 1]; + char *response; /* Decode the challenge if necessary */ if(chlg64len && *chlg64 != '=') { @@ -220,14 +223,19 @@ CURLcode Curl_sasl_create_cram_md5_message(struct SessionHandle *data, Curl_HMAC_final(ctxt, digest); /* Prepare the response */ - snprintf(response, sizeof(response), + response = aprintf( "%s %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", userp, digest[0], digest[1], digest[2], digest[3], digest[4], digest[5], digest[6], digest[7], digest[8], digest[9], digest[10], digest[11], digest[12], digest[13], digest[14], digest[15]); + if(!response) + return CURLE_OUT_OF_MEMORY; /* Base64 encode the reply */ - return Curl_base64_encode(data, response, 0, outptr, outlen); + result = Curl_base64_encode(data, response, 0, outptr, outlen); + + Curl_safefree(response); + return result; } /* @@ -250,10 +258,10 @@ CURLcode Curl_sasl_create_cram_md5_message(struct SessionHandle *data, * Returns CURLE_OK on success. */ CURLcode Curl_sasl_create_digest_md5_message(struct SessionHandle *data, - const char* chlg64, - const char* userp, - const char* passwdp, - const char* service, + const char *chlg64, + const char *userp, + const char *passwdp, + const char *service, char **outptr, size_t *outlen) { static const char table16[] = "0123456789abcdef"; @@ -283,6 +291,9 @@ CURLcode Curl_sasl_create_digest_md5_message(struct SessionHandle *data, if(result) return result; + if(!chlg) + return CURLE_LOGIN_DENIED; + /* Retrieve nonce string from the challenge */ if(!sasl_digest_get_key_value(chlg, "nonce=\"", nonce, sizeof(nonce), '\"')) { @@ -311,7 +322,7 @@ CURLcode Curl_sasl_create_digest_md5_message(struct SessionHandle *data, /* Generate 64 bits of random data */ for(i = 0; i < 8; i++) - cnonce[i] = table16[Curl_rand()%16]; + cnonce[i] = table16[Curl_rand(data)%16]; /* So far so good, now calculate A1 and H(A1) according to RFC 2831 */ ctxt = Curl_MD5_init(Curl_DIGEST_MD5); @@ -468,6 +479,40 @@ CURLcode Curl_sasl_create_ntlm_type3_message(struct SessionHandle *data, #endif /* USE_NTLM */ /* + * Curl_sasl_create_xoauth2_message() + * + * This is used to generate an already encoded XOAUTH2 message ready + * for sending to the recipient. + * + * Parameters: + * + * data [in] - The session handle. + * user [in] - The user name. + * bearer [in] - The XOAUTH Bearer token. + * outptr [in/out] - The address where a pointer to newly allocated memory + * holding the result will be stored upon completion. + * outlen [out] - The length of the output message. + * + * Returns CURLE_OK on success. + */ +CURLcode Curl_sasl_create_xoauth2_message(struct SessionHandle *data, + const char *user, + const char *bearer, + char **outptr, size_t *outlen) +{ + char *xoauth; + + xoauth = aprintf("user=%s\1auth=Bearer %s\1\1", user, bearer); + + if(!xoauth) + return CURLE_OUT_OF_MEMORY; + + /* Base64 encode the reply */ + return Curl_base64_encode(data, xoauth, strlen(xoauth), outptr, + outlen); +} + +/* * Curl_sasl_cleanup() * * This is used to cleanup any libraries or curl modules used by the sasl diff --git a/plugins/FTPFileYM/curl/lib/curl_sasl.h b/plugins/FTPFileYM/curl/lib/curl_sasl.h index 469c9a1e44..2b6a5a26aa 100644 --- a/plugins/FTPFileYM/curl/lib/curl_sasl.h +++ b/plugins/FTPFileYM/curl/lib/curl_sasl.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 2012 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -24,41 +24,61 @@ #include "pingpong.h" +/* Authentication mechanism values */ +#define SASL_AUTH_NONE 0 +#define SASL_AUTH_ANY ~0U + /* Authentication mechanism flags */ -#define SASL_MECH_LOGIN 0x0001 -#define SASL_MECH_PLAIN 0x0002 -#define SASL_MECH_CRAM_MD5 0x0004 -#define SASL_MECH_DIGEST_MD5 0x0008 -#define SASL_MECH_GSSAPI 0x0010 -#define SASL_MECH_EXTERNAL 0x0020 -#define SASL_MECH_NTLM 0x0040 +#define SASL_MECH_LOGIN (1 << 0) +#define SASL_MECH_PLAIN (1 << 1) +#define SASL_MECH_CRAM_MD5 (1 << 2) +#define SASL_MECH_DIGEST_MD5 (1 << 3) +#define SASL_MECH_GSSAPI (1 << 4) +#define SASL_MECH_EXTERNAL (1 << 5) +#define SASL_MECH_NTLM (1 << 6) +#define SASL_MECH_XOAUTH2 (1 << 7) + +/* Authentication mechanism strings */ +#define SASL_MECH_STRING_LOGIN "LOGIN" +#define SASL_MECH_STRING_PLAIN "PLAIN" +#define SASL_MECH_STRING_CRAM_MD5 "CRAM-MD5" +#define SASL_MECH_STRING_DIGEST_MD5 "DIGEST-MD5" +#define SASL_MECH_STRING_GSSAPI "GSSAPI" +#define SASL_MECH_STRING_EXTERNAL "EXTERNAL" +#define SASL_MECH_STRING_NTLM "NTLM" +#define SASL_MECH_STRING_XOAUTH2 "XOAUTH2" + +/* This is used to test whether the line starts with the given mechanism */ +#define sasl_mech_equal(line, wordlen, mech) \ + (wordlen == (sizeof(mech) - 1) / sizeof(char) && \ + !memcmp(line, mech, wordlen)) /* This is used to generate a base64 encoded PLAIN authentication message */ CURLcode Curl_sasl_create_plain_message(struct SessionHandle *data, - const char* userp, - const char* passwdp, + const char *userp, + const char *passwdp, char **outptr, size_t *outlen); /* This is used to generate a base64 encoded LOGIN authentication message containing either the user name or password details */ CURLcode Curl_sasl_create_login_message(struct SessionHandle *data, - const char* valuep, char **outptr, + const char *valuep, char **outptr, size_t *outlen); #ifndef CURL_DISABLE_CRYPTO_AUTH /* This is used to generate a base64 encoded CRAM-MD5 response message */ CURLcode Curl_sasl_create_cram_md5_message(struct SessionHandle *data, - const char* chlg64, - const char* user, - const char* passwdp, + const char *chlg64, + const char *user, + const char *passwdp, char **outptr, size_t *outlen); /* This is used to generate a base64 encoded DIGEST-MD5 response message */ CURLcode Curl_sasl_create_digest_md5_message(struct SessionHandle *data, - const char* chlg64, - const char* user, - const char* passwdp, - const char* service, + const char *chlg64, + const char *user, + const char *passwdp, + const char *service, char **outptr, size_t *outlen); #endif @@ -81,6 +101,13 @@ CURLcode Curl_sasl_create_ntlm_type3_message(struct SessionHandle *data, #endif /* USE_NTLM */ +/* This is used to generate a base64 encoded XOAUTH2 authentication message + containing the user name and bearer token */ +CURLcode Curl_sasl_create_xoauth2_message(struct SessionHandle *data, + const char *user, + const char *bearer, + char **outptr, size_t *outlen); + /* This is used to cleanup any libraries or curl modules used by the sasl functions */ void Curl_sasl_cleanup(struct connectdata *conn, unsigned int authused); diff --git a/plugins/FTPFileYM/curl/lib/curl_schannel.c b/plugins/FTPFileYM/curl/lib/curl_schannel.c index a615f57681..68139db586 100644 --- a/plugins/FTPFileYM/curl/lib/curl_schannel.c +++ b/plugins/FTPFileYM/curl/lib/curl_schannel.c @@ -534,6 +534,7 @@ schannel_connect_step3(struct connectdata *conn, int sockindex) return retcode; } else { + connssl->cred->cached = TRUE; infof(data, "schannel: stored credential handle in session cache\n"); } } @@ -1126,15 +1127,26 @@ int Curl_schannel_shutdown(struct connectdata *conn, int sockindex) /* free SSPI Schannel API security context handle */ if(connssl->ctxt) { + infof(data, "schannel: clear security context handle\n"); s_pSecFn->DeleteSecurityContext(&connssl->ctxt->ctxt_handle); Curl_safefree(connssl->ctxt); } - /* decrement the reference counter of the credential/session handle */ - if(connssl->cred && connssl->cred->refcount > 0) { - connssl->cred->refcount--; - infof(data, "schannel: decremented credential handle refcount = %d\n", - connssl->cred->refcount); + /* free SSPI Schannel API credential handle */ + if(connssl->cred) { + /* decrement the reference counter of the credential/session handle */ + if(connssl->cred->refcount > 0) { + connssl->cred->refcount--; + infof(data, "schannel: decremented credential handle refcount = %d\n", + connssl->cred->refcount); + } + + /* if the handle was not cached and the refcount is zero */ + if(!connssl->cred->cached && connssl->cred->refcount == 0) { + infof(data, "schannel: clear credential handle\n"); + s_pSecFn->FreeCredentialsHandle(&connssl->cred->cred_handle); + Curl_safefree(connssl->cred); + } } } @@ -1159,7 +1171,7 @@ void Curl_schannel_session_free(void *ptr) { struct curl_schannel_cred *cred = ptr; - if(cred && cred->refcount == 0) { + if(cred && cred->cached && cred->refcount == 0) { s_pSecFn->FreeCredentialsHandle(&cred->cred_handle); Curl_safefree(cred); } diff --git a/plugins/FTPFileYM/curl/docs/examples/resolve.c b/plugins/FTPFileYM/curl/lib/curl_sec.h index 7b3e5656e0..82151e9c78 100644 --- a/plugins/FTPFileYM/curl/docs/examples/resolve.c +++ b/plugins/FTPFileYM/curl/lib/curl_sec.h @@ -1,3 +1,5 @@ +#ifndef HEADER_CURL_SECURITY_H +#define HEADER_CURL_SECURITY_H /*************************************************************************** * _ _ ____ _ * Project ___| | | | _ \| | @@ -5,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -19,33 +21,31 @@ * KIND, either express or implied. * ***************************************************************************/ -#include <stdio.h> -#include <curl/curl.h> -int main(void) -{ - CURL *curl; - CURLcode res = CURLE_OK; - struct curl_slist *host = NULL; +struct Curl_sec_client_mech { + const char *name; + size_t size; + int (*init)(void *); + int (*auth)(void *, struct connectdata *); + void (*end)(void *); + int (*check_prot)(void *, int); + int (*overhead)(void *, int, int); + int (*encode)(void *, const void*, int, int, void**, struct connectdata *); + int (*decode)(void *, void*, int, int, struct connectdata *); +}; - /* Each single name resolve string should be written using the format - HOST:PORT:ADDRESS where HOST is the name libcurl will try to resolve, - PORT is the port number of the service where libcurl wants to connect to - the HOST and ADDRESS is the numerical IP address - */ - host = curl_slist_append(NULL, "example.com:80:127.0.0.1"); +#define AUTH_OK 0 +#define AUTH_CONTINUE 1 +#define AUTH_ERROR 2 - curl = curl_easy_init(); - if(curl) { - curl_easy_setopt(curl, CURLOPT_RESOLVE, host); - curl_easy_setopt(curl, CURLOPT_URL, "http://example.com"); - res = curl_easy_perform(curl); +#ifdef HAVE_GSSAPI +int Curl_sec_read_msg (struct connectdata *conn, char *, + enum protection_level); +void Curl_sec_end (struct connectdata *); +CURLcode Curl_sec_login (struct connectdata *); +int Curl_sec_request_prot (struct connectdata *conn, const char *level); - /* always cleanup */ - curl_easy_cleanup(curl); - } +extern struct Curl_sec_client_mech Curl_krb5_client_mech; +#endif - curl_slist_free_all(host); - - return (int)res; -} +#endif /* HEADER_CURL_SECURITY_H */ diff --git a/plugins/FTPFileYM/curl/lib/curl_setup.h b/plugins/FTPFileYM/curl/lib/curl_setup.h index ad83fec5fa..7edeca2123 100644 --- a/plugins/FTPFileYM/curl/lib/curl_setup.h +++ b/plugins/FTPFileYM/curl/lib/curl_setup.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -270,6 +270,9 @@ # endif # endif # include <tchar.h> +# ifdef UNICODE + typedef wchar_t *(*curl_wcsdup_callback)(const wchar_t *str); +# endif #endif /* @@ -368,7 +371,9 @@ # include <sys/stat.h> # undef lseek # define lseek(fdes,offset,whence) _lseeki64(fdes, offset, whence) +# undef fstat # define fstat(fdes,stp) _fstati64(fdes, stp) +# undef stat # define stat(fname,stp) _stati64(fname, stp) # define struct_stat struct _stati64 # define LSEEK_ERROR (__int64)-1 @@ -615,7 +620,7 @@ int netware_init(void); #if defined(USE_GNUTLS) || defined(USE_SSLEAY) || defined(USE_NSS) || \ defined(USE_QSOSSL) || defined(USE_POLARSSL) || defined(USE_AXTLS) || \ defined(USE_CYASSL) || defined(USE_SCHANNEL) || \ - defined(USE_DARWINSSL) + defined(USE_DARWINSSL) || defined(USE_GSKIT) #define USE_SSL /* SSL support has been enabled */ #endif @@ -694,4 +699,9 @@ int netware_init(void); #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) #endif +/* Define S_ISDIR if not defined by system headers, f.e. MSVC */ +#if !defined(S_ISDIR) && defined(S_IFMT) && defined(S_IFDIR) +#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) +#endif + #endif /* HEADER_CURL_SETUP_H */ diff --git a/plugins/FTPFileYM/curl/lib/curl_setup_once.h b/plugins/FTPFileYM/curl/lib/curl_setup_once.h index 8c7f41ff87..69d6d47902 100644 --- a/plugins/FTPFileYM/curl/lib/curl_setup_once.h +++ b/plugins/FTPFileYM/curl/lib/curl_setup_once.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -257,6 +257,8 @@ struct timeval { # define sclose(x) closesocket((x)) #elif defined(HAVE_CLOSESOCKET_CAMEL) # define sclose(x) CloseSocket((x)) +#elif defined(HAVE_CLOSE_S) +# define sclose(x) close_s((x)) #elif defined(USE_LWIPSOCK) # define sclose(x) lwip_close((x)) #else @@ -438,7 +440,7 @@ typedef int sig_atomic_t; * (or equivalent) on this platform to hide platform details to code using it. */ -#ifdef WIN32 +#if defined(WIN32) && !defined(USE_LWIPSOCK) #define ERRNO ((int)GetLastError()) #define SET_ERRNO(x) (SetLastError((DWORD)(x))) #else diff --git a/plugins/FTPFileYM/curl/lib/dotdot.c b/plugins/FTPFileYM/curl/lib/dotdot.c new file mode 100644 index 0000000000..41b73bef41 --- /dev/null +++ b/plugins/FTPFileYM/curl/lib/dotdot.c @@ -0,0 +1,170 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "curl_setup.h" + +#include "dotdot.h" + +#include "curl_memory.h" +/* The last #include file should be: */ +#include "memdebug.h" + +/* + * "Remove Dot Segments" + * http://tools.ietf.org/html/rfc3986#section-5.2.4 + */ + +/* + * Curl_dedotdotify() + * + * This function gets a zero-terminated path with dot and dotdot sequences + * passed in and strips them off according to the rules in RFC 3986 section + * 5.2.4. + * + * The function handles a query part ('?' + stuff) appended but it expects + * that fragments ('#' + stuff) have already been cut off. + * + * RETURNS + * + * an allocated dedotdotified output string + */ +char *Curl_dedotdotify(char *input) +{ + size_t inlen = strlen(input); + char *clone; + size_t clen = inlen; /* the length of the cloned input */ + char *out = malloc(inlen+1); + char *outptr; + char *orgclone; + char *queryp; + if(!out) + return NULL; /* out of memory */ + + /* get a cloned copy of the input */ + clone = strdup(input); + if(!clone) { + free(out); + return NULL; + } + orgclone = clone; + outptr = out; + + /* + * To handle query-parts properly, we must find it and remove it during the + * dotdot-operation and then append it again at the end to the output + * string. + */ + queryp = strchr(clone, '?'); + if(queryp) + *queryp = 0; + + do { + + /* A. If the input buffer begins with a prefix of "../" or "./", then + remove that prefix from the input buffer; otherwise, */ + + if(!strncmp("./", clone, 2)) { + clone+=2; + clen-=2; + } + else if(!strncmp("../", clone, 3)) { + clone+=3; + clen-=3; + } + + /* B. if the input buffer begins with a prefix of "/./" or "/.", where + "." is a complete path segment, then replace that prefix with "/" in + the input buffer; otherwise, */ + else if(!strncmp("/./", clone, 3)) { + clone+=2; + clen-=2; + } + else if(!strcmp("/.", clone)) { + clone[1]='/'; + clone++; + clen-=1; + } + + /* C. if the input buffer begins with a prefix of "/../" or "/..", where + ".." is a complete path segment, then replace that prefix with "/" in + the input buffer and remove the last segment and its preceding "/" (if + any) from the output buffer; otherwise, */ + + else if(!strncmp("/../", clone, 4)) { + clone+=3; + clen-=3; + /* remove the last segment from the output buffer */ + while(outptr > out) { + outptr--; + if(*outptr == '/') + break; + } + *outptr = 0; /* zero-terminate where it stops */ + } + else if(!strcmp("/..", clone)) { + clone[2]='/'; + clone+=2; + clen-=2; + /* remove the last segment from the output buffer */ + while(outptr > out) { + outptr--; + if(*outptr == '/') + break; + } + *outptr = 0; /* zero-terminate where it stops */ + } + + /* D. if the input buffer consists only of "." or "..", then remove + that from the input buffer; otherwise, */ + + else if(!strcmp(".", clone) || !strcmp("..", clone)) { + *clone=0; + } + + else { + /* E. move the first path segment in the input buffer to the end of + the output buffer, including the initial "/" character (if any) and + any subsequent characters up to, but not including, the next "/" + character or the end of the input buffer. */ + + do { + *outptr++ = *clone++; + clen--; + } while(*clone && (*clone != '/')); + *outptr = 0; + } + + } while(*clone); + + if(queryp) { + size_t qlen; + /* There was a query part, append that to the output. The 'clone' string + may now have been altered so we copy from the original input string + from the correct index. */ + size_t oindex = queryp - orgclone; + qlen = strlen(&input[oindex]); + memcpy(outptr, &input[oindex], qlen+1); /* include the ending zero byte */ + } + + free(orgclone); + return out; +} diff --git a/plugins/FTPFileYM/curl/docs/examples/simple.c b/plugins/FTPFileYM/curl/lib/dotdot.h index 1912ce66e9..c3487c137b 100644 --- a/plugins/FTPFileYM/curl/docs/examples/simple.c +++ b/plugins/FTPFileYM/curl/lib/dotdot.h @@ -1,3 +1,5 @@ +#ifndef HEADER_CURL_DOTDOT_H +#define HEADER_CURL_DOTDOT_H /*************************************************************************** * _ _ ____ _ * Project ___| | | | _ \| | @@ -19,29 +21,5 @@ * KIND, either express or implied. * ***************************************************************************/ -#include <stdio.h> -#include <curl/curl.h> - -int main(void) -{ - CURL *curl; - CURLcode res; - - curl = curl_easy_init(); - if(curl) { - curl_easy_setopt(curl, CURLOPT_URL, "http://example.com"); - /* example.com is redirected, so we tell libcurl to follow redirection */ - curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); - - /* Perform the request, res will get the return code */ - res = curl_easy_perform(curl); - /* Check for errors */ - if(res != CURLE_OK) - fprintf(stderr, "curl_easy_perform() failed: %s\n", - curl_easy_strerror(res)); - - /* always cleanup */ - curl_easy_cleanup(curl); - } - return 0; -} +char *Curl_dedotdotify(char *input); +#endif diff --git a/plugins/FTPFileYM/curl/lib/easy.c b/plugins/FTPFileYM/curl/lib/easy.c index c27deffdae..1e718abcba 100644 --- a/plugins/FTPFileYM/curl/lib/easy.c +++ b/plugins/FTPFileYM/curl/lib/easy.c @@ -22,6 +22,14 @@ #include "curl_setup.h" +/* + * See comment in curl_memory.h for the explanation of this sanity check. + */ + +#ifdef CURLX_NO_MEMORY_CALLBACKS +#error "libcurl shall not ever be built with CURLX_NO_MEMORY_CALLBACKS defined" +#endif + #ifdef HAVE_NETINET_IN_H #include <netinet/in.h> #endif @@ -42,6 +50,11 @@ #include <sys/param.h> #endif +#if defined(HAVE_SIGNAL_H) && defined(HAVE_SIGACTION) && defined(USE_OPENSSL) +#define SIGPIPE_IGNORE 1 +#include <signal.h> +#endif + #include "strequal.h" #include "urldata.h" #include <curl/curl.h> @@ -61,10 +74,10 @@ #include "connect.h" /* for Curl_getconnectinfo */ #include "slist.h" #include "amigaos.h" -#include "curl_rand.h" #include "non-ascii.h" #include "warnless.h" #include "conncache.h" +#include "multiif.h" #define _MPRINTF_REPLACE /* use our functions only */ #include <curl/mprintf.h> @@ -72,6 +85,56 @@ /* The last #include file should be: */ #include "memdebug.h" +#ifdef SIGPIPE_IGNORE +struct sigpipe_ignore { + struct sigaction old_pipe_act; + bool no_signal; +}; + +#define SIGPIPE_VARIABLE(x) struct sigpipe_ignore x + +/* + * sigpipe_ignore() makes sure we ignore SIGPIPE while running libcurl + * internals, and then sigpipe_restore() will restore the situation when we + * return from libcurl again. + */ +static void sigpipe_ignore(struct SessionHandle *data, + struct sigpipe_ignore *ig) +{ + /* get a local copy of no_signal because the SessionHandle might not be + around when we restore */ + ig->no_signal = data->set.no_signal; + if(!data->set.no_signal) { + struct sigaction action; + /* first, extract the existing situation */ + memset(&ig->old_pipe_act, 0, sizeof(struct sigaction)); + sigaction(SIGPIPE, NULL, &ig->old_pipe_act); + action = ig->old_pipe_act; + /* ignore this signal */ + action.sa_handler = SIG_IGN; + sigaction(SIGPIPE, &action, NULL); + } +} + +/* + * sigpipe_restore() puts back the outside world's opinion of signal handler + * and SIGPIPE handling. It MUST only be called after a corresponding + * sigpipe_ignore() was used. + */ +static void sigpipe_restore(struct sigpipe_ignore *ig) +{ + if(!ig->no_signal) + /* restore the outside state */ + sigaction(SIGPIPE, &ig->old_pipe_act, NULL); +} + +#else +/* for systems without sigaction */ +#define sigpipe_ignore(x,y) Curl_nop_stmt +#define sigpipe_restore(x) Curl_nop_stmt +#define SIGPIPE_VARIABLE(x) +#endif + /* win32_cleanup() is for win32 socket cleanup functionality, the opposite of win32_init() */ static void win32_cleanup(void) @@ -189,6 +252,9 @@ curl_free_callback Curl_cfree = (curl_free_callback)free; curl_realloc_callback Curl_crealloc = (curl_realloc_callback)realloc; curl_strdup_callback Curl_cstrdup = (curl_strdup_callback)system_strdup; curl_calloc_callback Curl_ccalloc = (curl_calloc_callback)calloc; +#if defined(WIN32) && defined(UNICODE) +curl_wcsdup_callback Curl_cwcsdup = (curl_wcsdup_callback)_wcsdup; +#endif #else /* * Symbian OS doesn't support initialization to code in writeable static data. @@ -220,6 +286,9 @@ CURLcode curl_global_init(long flags) Curl_crealloc = (curl_realloc_callback)realloc; Curl_cstrdup = (curl_strdup_callback)system_strdup; Curl_ccalloc = (curl_calloc_callback)calloc; +#if defined(WIN32) && defined(UNICODE) + Curl_cwcsdup = (curl_wcsdup_callback)_wcsdup; +#endif if(flags & CURL_GLOBAL_SSL) if(!Curl_ssl_init()) { @@ -262,11 +331,10 @@ CURLcode curl_global_init(long flags) } #endif - init_flags = flags; - - /* Preset pseudo-random number sequence. */ + if(flags & CURL_GLOBAL_ACK_EINTR) + Curl_ack_eintr = 1; - Curl_srand(); + init_flags = flags; return CURLE_OK; } @@ -385,8 +453,328 @@ CURLcode curl_easy_setopt(CURL *curl, CURLoption tag, ...) return ret; } +#ifdef CURLDEBUG + +struct socketmonitor { + struct socketmonitor *next; /* the next node in the list or NULL */ + struct pollfd socket; /* socket info of what to monitor */ +}; + +struct events { + long ms; /* timeout, run the timeout function when reached */ + bool msbump; /* set TRUE when timeout is set by callback */ + int num_sockets; /* number of nodes in the monitor list */ + struct socketmonitor *list; /* list of sockets to monitor */ + int running_handles; /* store the returned number */ +}; + +/* events_timer + * + * Callback that gets called with a new value when the timeout should be + * updated. + */ + +static int events_timer(CURLM *multi, /* multi handle */ + long timeout_ms, /* see above */ + void *userp) /* private callback pointer */ +{ + struct events *ev = userp; + (void)multi; + if(timeout_ms == -1) + /* timeout removed */ + timeout_ms = 0; + else if(timeout_ms == 0) + /* timeout is already reached! */ + timeout_ms = 1; /* trigger asap */ + + ev->ms = timeout_ms; + ev->msbump = TRUE; + return 0; +} + + +/* poll2cselect + * + * convert from poll() bit definitions to libcurl's CURL_CSELECT_* ones + */ +static int poll2cselect(int pollmask) +{ + int omask=0; + if(pollmask & POLLIN) + omask |= CURL_CSELECT_IN; + if(pollmask & POLLOUT) + omask |= CURL_CSELECT_OUT; + if(pollmask & POLLERR) + omask |= CURL_CSELECT_ERR; + return omask; +} + + +/* socketcb2poll + * + * convert from libcurl' CURL_POLL_* bit definitions to poll()'s + */ +static short socketcb2poll(int pollmask) +{ + short omask=0; + if(pollmask & CURL_POLL_IN) + omask |= POLLIN; + if(pollmask & CURL_POLL_OUT) + omask |= POLLOUT; + return omask; +} + +/* events_socket + * + * Callback that gets called with information about socket activity to + * monitor. + */ +static int events_socket(CURL *easy, /* easy handle */ + curl_socket_t s, /* socket */ + int what, /* see above */ + void *userp, /* private callback + pointer */ + void *socketp) /* private socket + pointer */ +{ + struct events *ev = userp; + struct socketmonitor *m; + struct socketmonitor *prev=NULL; + (void)socketp; + + m = ev->list; + while(m) { + if(m->socket.fd == s) { + + if(what == CURL_POLL_REMOVE) { + struct socketmonitor *nxt = m->next; + /* remove this node from the list of monitored sockets */ + if(prev) + prev->next = nxt; + else + ev->list = nxt; + free(m); + m = nxt; + infof(easy, "socket cb: socket %d REMOVED\n", s); + } + else { + /* The socket 's' is already being monitored, update the activity + mask. Convert from libcurl bitmask to the poll one. */ + m->socket.events = socketcb2poll(what); + infof(easy, "socket cb: socket %d UPDATED as %s%s\n", s, + what&CURL_POLL_IN?"IN":"", + what&CURL_POLL_OUT?"OUT":""); + } + break; + } + prev = m; + m = m->next; /* move to next node */ + } + if(!m) { + if(what == CURL_POLL_REMOVE) { + /* this happens a bit too often, libcurl fix perhaps? */ + /* fprintf(stderr, + "%s: socket %d asked to be REMOVED but not present!\n", + __func__, s); */ + } + else { + m = malloc(sizeof(struct socketmonitor)); + m->next = ev->list; + m->socket.fd = s; + m->socket.events = socketcb2poll(what); + m->socket.revents = 0; + ev->list = m; + infof(easy, "socket cb: socket %d ADDED as %s%s\n", s, + what&CURL_POLL_IN?"IN":"", + what&CURL_POLL_OUT?"OUT":""); + } + } + + return 0; +} + + /* - * curl_easy_perform() is the external interface that performs a blocking + * events_setup() + * + * Do the multi handle setups that only event-based transfers need. + */ +static void events_setup(CURLM *multi, struct events *ev) +{ + /* timer callback */ + curl_multi_setopt(multi, CURLMOPT_TIMERFUNCTION, events_timer); + curl_multi_setopt(multi, CURLMOPT_TIMERDATA, ev); + + /* socket callback */ + curl_multi_setopt(multi, CURLMOPT_SOCKETFUNCTION, events_socket); + curl_multi_setopt(multi, CURLMOPT_SOCKETDATA, ev); +} + + +/* wait_or_timeout() + * + * waits for activity on any of the given sockets, or the timeout to trigger. + */ + +static CURLcode wait_or_timeout(struct Curl_multi *multi, struct events *ev) +{ + bool done = FALSE; + CURLMcode mcode; + CURLcode rc = CURLE_OK; + + while(!done) { + CURLMsg *msg; + struct socketmonitor *m; + struct pollfd *f; + struct pollfd fds[4]; + int numfds=0; + int pollrc; + int i; + struct timeval before; + struct timeval after; + + /* populate the fds[] array */ + for(m = ev->list, f=&fds[0]; m; m = m->next) { + f->fd = m->socket.fd; + f->events = m->socket.events; + f->revents = 0; + /* fprintf(stderr, "poll() %d check socket %d\n", numfds, f->fd); */ + f++; + numfds++; + } + + /* get the time stamp to use to figure out how long poll takes */ + before = curlx_tvnow(); + + /* wait for activity or timeout */ + pollrc = Curl_poll(fds, numfds, (int)ev->ms); + + after = curlx_tvnow(); + + ev->msbump = FALSE; /* reset here */ + + if(0 == pollrc) { + /* timeout! */ + ev->ms = 0; + /* fprintf(stderr, "call curl_multi_socket_action( TIMEOUT )\n"); */ + mcode = curl_multi_socket_action(multi, CURL_SOCKET_TIMEOUT, 0, + &ev->running_handles); + } + else if(pollrc > 0) { + /* loop over the monitored sockets to see which ones had activity */ + for(i = 0; i< numfds; i++) { + if(fds[i].revents) { + /* socket activity, tell libcurl */ + int act = poll2cselect(fds[i].revents); /* convert */ + infof(multi->easyp, "call curl_multi_socket_action( socket %d )\n", + fds[i].fd); + mcode = curl_multi_socket_action(multi, fds[i].fd, act, + &ev->running_handles); + } + } + + if(!ev->msbump) + /* If nothing updated the timeout, we decrease it by the spent time. + * If it was updated, it has the new timeout time stored already. + */ + ev->ms += curlx_tvdiff(after, before); + + } + if(mcode) + return CURLE_URL_MALFORMAT; /* TODO: return a proper error! */ + + /* we don't really care about the "msgs_in_queue" value returned in the + second argument */ + msg = curl_multi_info_read(multi, &pollrc); + if(msg) { + rc = msg->data.result; + done = TRUE; + } + } + + return rc; +} + + +/* easy_events() + * + * Runs a transfer in a blocking manner using the events-based API + */ +static CURLcode easy_events(CURLM *multi) +{ + struct events evs= {2, FALSE, 0, NULL, 0}; + + /* if running event-based, do some further multi inits */ + events_setup(multi, &evs); + + return wait_or_timeout(multi, &evs); +} +#else /* CURLDEBUG */ +/* when not built with debug, this function doesn't exist */ +#define easy_events(x) CURLE_NOT_BUILT_IN +#endif + +static CURLcode easy_transfer(CURLM *multi) +{ + bool done = FALSE; + CURLMcode mcode = CURLM_OK; + CURLcode code = CURLE_OK; + struct timeval before; + int without_fds = 0; /* count number of consecutive returns from + curl_multi_wait() without any filedescriptors */ + + while(!done && !mcode) { + int still_running; + int ret; + + before = curlx_tvnow(); + mcode = curl_multi_wait(multi, NULL, 0, 1000, &ret); + + if(mcode == CURLM_OK) { + if(ret == -1) { + /* poll() failed not on EINTR, indicate a network problem */ + code = CURLE_RECV_ERROR; + break; + } + else if(ret == 0) { + struct timeval after = curlx_tvnow(); + /* If it returns without any filedescriptor instantly, we need to + avoid busy-looping during periods where it has nothing particular + to wait for */ + if(curlx_tvdiff(after, before) <= 10) { + without_fds++; + if(without_fds > 2) { + int sleep_ms = without_fds < 10 ? (1 << (without_fds-1)): 1000; + Curl_wait_ms(sleep_ms); + } + } + else + /* it wasn't "instant", restart counter */ + without_fds = 0; + } + else + /* got file descriptor, restart counter */ + without_fds = 0; + + mcode = curl_multi_perform(multi, &still_running); + } + + /* only read 'still_running' if curl_multi_perform() return OK */ + if((mcode == CURLM_OK) && !still_running) { + int rc; + CURLMsg *msg = curl_multi_info_read(multi, &rc); + if(msg) { + code = msg->data.result; + done = TRUE; + } + } + } + return code; +} + + +/* + * easy_perform() is the external interface that performs a blocking * transfer as previously setup. * * CONCEPT: This function creates a multi handle, adds the easy handle to it, @@ -398,18 +786,18 @@ CURLcode curl_easy_setopt(CURL *curl, CURLoption tag, ...) * needs to keep it around since if this easy handle is used again by this * function, the same multi handle must be re-used so that the same pools and * caches can be used. + * + * DEBUG: if 'events' is set TRUE, this function will use a replacement engine + * instead of curl_multi_perform() and use curl_multi_socket_action(). */ -CURLcode curl_easy_perform(CURL *easy) +static CURLcode easy_perform(struct SessionHandle *data, bool events) { CURLM *multi; CURLMcode mcode; CURLcode code = CURLE_OK; - CURLMsg *msg; - bool done = FALSE; - int rc; - struct SessionHandle *data = easy; + SIGPIPE_VARIABLE(pipe_st); - if(!easy) + if(!data) return CURLE_BAD_FUNCTION_ARGUMENT; if(data->multi) { @@ -420,13 +808,18 @@ CURLcode curl_easy_perform(CURL *easy) if(data->multi_easy) multi = data->multi_easy; else { - multi = curl_multi_init(); + /* this multi handle will only ever have a single easy handled attached + to it, so make it use minimal hashes */ + multi = Curl_multi_handle(1, 3); if(!multi) return CURLE_OUT_OF_MEMORY; data->multi_easy = multi; } - mcode = curl_multi_add_handle(multi, easy); + /* Copy the MAXCONNECTS option to the multi handle */ + curl_multi_setopt(multi, CURLMOPT_MAXCONNECTS, data->set.maxconnects); + + mcode = curl_multi_add_handle(multi, data); if(mcode) { curl_multi_cleanup(multi); if(mcode == CURLM_OUT_OF_MEMORY) @@ -435,64 +828,62 @@ CURLcode curl_easy_perform(CURL *easy) return CURLE_FAILED_INIT; } + sigpipe_ignore(data, &pipe_st); + /* assign this after curl_multi_add_handle() since that function checks for it and rejects this handle otherwise */ data->multi = multi; - while(!done && !mcode) { - int still_running; - - mcode = curl_multi_wait(multi, NULL, 0, 1000, NULL); - - if(mcode == CURLM_OK) - mcode = curl_multi_perform(multi, &still_running); - - /* only read 'still_running' if curl_multi_perform() return OK */ - if((mcode == CURLM_OK) && !still_running) { - msg = curl_multi_info_read(multi, &rc); - if(msg) { - code = msg->data.result; - done = TRUE; - } - } - } + /* run the transfer */ + code = events ? easy_events(multi) : easy_transfer(multi); /* ignoring the return code isn't nice, but atm we can't really handle a failure here, room for future improvement! */ - (void)curl_multi_remove_handle(multi, easy); + (void)curl_multi_remove_handle(multi, data); + + sigpipe_restore(&pipe_st); /* The multi handle is kept alive, owned by the easy handle */ return code; } + /* - * curl_easy_cleanup() is the external interface to cleaning/freeing the given - * easy handle. + * curl_easy_perform() is the external interface that performs a blocking + * transfer as previously setup. */ -void curl_easy_cleanup(CURL *curl) +CURLcode curl_easy_perform(CURL *easy) { - struct SessionHandle *data = (struct SessionHandle *)curl; - - if(!data) - return; - - Curl_close(data); + return easy_perform(easy, FALSE); } +#ifdef CURLDEBUG /* - * Store a pointed to the multi handle within the easy handle's data struct. + * curl_easy_perform_ev() is the external interface that performs a blocking + * transfer using the event-based API internally. */ -void Curl_easy_addmulti(struct SessionHandle *data, - void *multi) +CURLcode curl_easy_perform_ev(CURL *easy) { - data->multi = multi; + return easy_perform(easy, TRUE); } -void Curl_easy_initHandleData(struct SessionHandle *data) +#endif + +/* + * curl_easy_cleanup() is the external interface to cleaning/freeing the given + * easy handle. + */ +void curl_easy_cleanup(CURL *curl) { - memset(&data->req, 0, sizeof(struct SingleRequest)); + struct SessionHandle *data = (struct SessionHandle *)curl; + SIGPIPE_VARIABLE(pipe_st); - data->req.maxdownload = -1; + if(!data) + return; + + sigpipe_ignore(data, &pipe_st); + Curl_close(data); + sigpipe_restore(&pipe_st); } /* @@ -504,12 +895,16 @@ CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...) { va_list arg; void *paramp; + CURLcode ret; struct SessionHandle *data = (struct SessionHandle *)curl; va_start(arg, info); paramp = va_arg(arg, void *); - return Curl_getinfo(data, info, paramp); + ret = Curl_getinfo(data, info, paramp); + + va_end(arg); + return ret; } /* @@ -587,8 +982,6 @@ CURL *curl_easy_duphandle(CURL *incurl) Curl_convert_setup(outcurl); - Curl_easy_initHandleData(outcurl); - outcurl->magic = CURLEASY_MAGIC_NUMBER; /* we reach this point and thus we are OK */ @@ -622,7 +1015,7 @@ void curl_easy_reset(CURL *curl) data->state.path = NULL; - Curl_safefree(data->state.proto.generic); + Curl_free_request_state(data); /* zero out UserDefined data: */ Curl_freeset(data); @@ -632,9 +1025,6 @@ void curl_easy_reset(CURL *curl) /* zero out Progress data: */ memset(&data->progress, 0, sizeof(struct Progress)); - /* init Handle data */ - Curl_easy_initHandleData(data); - data->progress.flags |= PGRS_HIDE; data->state.current_speed = -1; /* init to negative == impossible */ } @@ -696,7 +1086,7 @@ CURLcode curl_easy_pause(CURL *curl, int action) do { chunklen = (tempsize > CURL_MAX_WRITE_SIZE)?CURL_MAX_WRITE_SIZE:tempsize; - result = Curl_client_write(data->state.current_conn, + result = Curl_client_write(data->easy_conn, temptype, tempwrite, chunklen); if(result) /* failures abort the loop at once */ @@ -738,6 +1128,13 @@ CURLcode curl_easy_pause(CURL *curl, int action) free(freewrite); /* this is unconditionally no longer used */ } + /* if there's no error and we're not pausing both directions, we want + to have this handle checked soon */ + if(!result && + ((newstate&(KEEP_RECV_PAUSE|KEEP_SEND_PAUSE)) != + (KEEP_RECV_PAUSE|KEEP_SEND_PAUSE)) ) + Curl_expire(data, 1); /* get this handle going again */ + return result; } diff --git a/plugins/FTPFileYM/curl/lib/easyif.h b/plugins/FTPFileYM/curl/lib/easyif.h index 1f521689f6..043ff437d4 100644 --- a/plugins/FTPFileYM/curl/lib/easyif.h +++ b/plugins/FTPFileYM/curl/lib/easyif.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -25,9 +25,9 @@ /* * Prototypes for library-wide functions provided by easy.c */ -void Curl_easy_addmulti(struct SessionHandle *data, void *multi); - -void Curl_easy_initHandleData(struct SessionHandle *data); +#ifdef CURLDEBUG +CURL_EXTERN CURLcode curl_easy_perform_ev(CURL *easy); +#endif #endif /* HEADER_CURL_EASYIF_H */ diff --git a/plugins/FTPFileYM/curl/lib/escape.c b/plugins/FTPFileYM/curl/lib/escape.c index 6a26cf8ef9..aa7db2c5b9 100644 --- a/plugins/FTPFileYM/curl/lib/escape.c +++ b/plugins/FTPFileYM/curl/lib/escape.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -159,7 +159,8 @@ CURLcode Curl_urldecode(struct SessionHandle *data, while(--alloc > 0) { in = *string; - if(('%' == in) && ISXDIGIT(string[1]) && ISXDIGIT(string[2])) { + if(('%' == in) && (alloc > 2) && + ISXDIGIT(string[1]) && ISXDIGIT(string[2])) { /* this is two hexadecimal digits following a '%' */ char hexstr[3]; char *ptr; diff --git a/plugins/FTPFileYM/curl/lib/file.c b/plugins/FTPFileYM/curl/lib/file.c index 038bf42e17..e658ada0aa 100644 --- a/plugins/FTPFileYM/curl/lib/file.c +++ b/plugins/FTPFileYM/curl/lib/file.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -90,7 +90,7 @@ static CURLcode file_done(struct connectdata *conn, static CURLcode file_connect(struct connectdata *conn, bool *done); static CURLcode file_disconnect(struct connectdata *conn, bool dead_connection); - +static CURLcode file_setup_connection(struct connectdata *conn); /* * FILE scheme handler. @@ -98,7 +98,7 @@ static CURLcode file_disconnect(struct connectdata *conn, const struct Curl_handler Curl_handler_file = { "FILE", /* scheme */ - ZERO_NULL, /* setup_connection */ + file_setup_connection, /* setup_connection */ file_do, /* do_it */ file_done, /* done */ ZERO_NULL, /* do_more */ @@ -117,6 +117,16 @@ const struct Curl_handler Curl_handler_file = { }; +static CURLcode file_setup_connection(struct connectdata *conn) +{ + /* allocate the FILE specific struct */ + conn->data->req.protop = calloc(1, sizeof(struct FILEPROTO)); + if(!conn->data->req.protop) + return CURLE_OUT_OF_MEMORY; + + return CURLE_OK; +} + /* Check if this is a range download, and if so, set the internal variables properly. This code is copied from the FTP implementation and might as @@ -179,39 +189,17 @@ static CURLcode file_connect(struct connectdata *conn, bool *done) { struct SessionHandle *data = conn->data; char *real_path; - struct FILEPROTO *file; + struct FILEPROTO *file = data->req.protop; int fd; #ifdef DOS_FILESYSTEM int i; char *actual_path; #endif - /* If there already is a protocol-specific struct allocated for this - sessionhandle, deal with it */ - Curl_reset_reqproto(conn); - real_path = curl_easy_unescape(data, data->state.path, 0, NULL); if(!real_path) return CURLE_OUT_OF_MEMORY; - if(!data->state.proto.file) { - file = calloc(1, sizeof(struct FILEPROTO)); - if(!file) { - free(real_path); - return CURLE_OUT_OF_MEMORY; - } - data->state.proto.file = file; - } - else { - /* file is not a protocol that can deal with "persistancy" */ - file = data->state.proto.file; - Curl_safefree(file->freepath); - file->path = NULL; - if(file->fd != -1) - close(file->fd); - file->fd = -1; - } - #ifdef DOS_FILESYSTEM /* If the first character is a slash, and there's something that looks like a drive at the beginning of @@ -262,7 +250,7 @@ static CURLcode file_connect(struct connectdata *conn, bool *done) static CURLcode file_done(struct connectdata *conn, CURLcode status, bool premature) { - struct FILEPROTO *file = conn->data->state.proto.file; + struct FILEPROTO *file = conn->data->req.protop; (void)status; /* not used */ (void)premature; /* not used */ @@ -280,7 +268,7 @@ static CURLcode file_done(struct connectdata *conn, static CURLcode file_disconnect(struct connectdata *conn, bool dead_connection) { - struct FILEPROTO *file = conn->data->state.proto.file; + struct FILEPROTO *file = conn->data->req.protop; (void)dead_connection; /* not used */ if(file) { @@ -302,7 +290,7 @@ static CURLcode file_disconnect(struct connectdata *conn, static CURLcode file_upload(struct connectdata *conn) { - struct FILEPROTO *file = conn->data->state.proto.file; + struct FILEPROTO *file = conn->data->req.protop; const char *dir = strchr(file->path, DIRSEP); int fd; int mode; @@ -440,6 +428,7 @@ static CURLcode file_do(struct connectdata *conn, bool *done) curl_off_t bytecount = 0; int fd; struct timeval now = Curl_tvnow(); + struct FILEPROTO *file; *done = TRUE; /* unconditionally */ @@ -449,8 +438,10 @@ static CURLcode file_do(struct connectdata *conn, bool *done) if(data->set.upload) return file_upload(conn); + file = conn->data->req.protop; + /* get the fd from the connection phase */ - fd = conn->data->state.proto.file->fd; + fd = file->fd; /* VMS: This only works reliable for STREAMLF files */ if(-1 != fstat(fd, &statbuf)) { diff --git a/plugins/FTPFileYM/curl/lib/formdata.c b/plugins/FTPFileYM/curl/lib/formdata.c index 2ba58dda1c..f718a3e4e9 100644 --- a/plugins/FTPFileYM/curl/lib/formdata.c +++ b/plugins/FTPFileYM/curl/lib/formdata.c @@ -24,9 +24,6 @@ #include <curl/curl.h> -/* Length of the random boundary string. */ -#define BOUNDARY_LENGTH 40 - #if !defined(CURL_DISABLE_HTTP) || defined(USE_SSLEAY) #if defined(HAVE_LIBGEN_H) && defined(HAVE_BASENAME) @@ -35,7 +32,7 @@ #include "urldata.h" /* for struct SessionHandle */ #include "formdata.h" -#include "curl_rand.h" +#include "sslgen.h" #include "strequal.h" #include "curl_memory.h" #include "sendf.h" @@ -56,6 +53,7 @@ static char *Curl_basename(char *path); #endif static size_t readfromfile(struct Form *form, char *buffer, size_t size); +static char *formboundary(struct SessionHandle *data); /* What kind of Content-Type to use on un-specified files with unrecognized extensions. */ @@ -170,8 +168,8 @@ static FormInfo * AddFormInfo(char *value, * Returns some valid contenttype for filename. * ***************************************************************************/ -static const char * ContentTypeForFilename (const char *filename, - const char *prevtype) +static const char *ContentTypeForFilename(const char *filename, + const char *prevtype) { const char *contenttype = NULL; unsigned int i; @@ -180,7 +178,7 @@ static const char * ContentTypeForFilename (const char *filename, * extensions and pick the first we match! */ struct ContentType { - char extension[6]; + const char *extension; const char *type; }; static const struct ContentType ctts[]={ @@ -428,7 +426,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost, /* Get contents from a given file name */ case CURLFORM_FILECONTENT: - if(current_form->flags != 0) + if(current_form->flags & (HTTPPOST_PTRCONTENTS|HTTPPOST_READFILE)) return_value = CURL_FORMADD_OPTION_TWICE; else { const char *filename = array_state? @@ -669,9 +667,11 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost, if(((form->flags & HTTPPOST_FILENAME) || (form->flags & HTTPPOST_BUFFER)) && !form->contenttype ) { + char *f = form->flags & HTTPPOST_BUFFER? + form->showfilename : form->value; + /* our contenttype is missing */ - form->contenttype - = strdup(ContentTypeForFilename(form->value, prevtype)); + form->contenttype = strdup(ContentTypeForFilename(f, prevtype)); if(!form->contenttype) { return_value = CURL_FORMADD_MEMORY; break; @@ -776,6 +776,70 @@ CURLFORMcode curl_formadd(struct curl_httppost **httppost, return result; } +#ifdef __VMS +#include <fabdef.h> +/* + * get_vms_file_size does what it takes to get the real size of the file + * + * For fixed files, find out the size of the EOF block and adjust. + * + * For all others, have to read the entire file in, discarding the contents. + * Most posted text files will be small, and binary files like zlib archives + * and CD/DVD images should be either a STREAM_LF format or a fixed format. + * + */ +curl_off_t VmsRealFileSize(const char * name, + const struct_stat * stat_buf) +{ + char buffer[8192]; + curl_off_t count; + int ret_stat; + FILE * file; + + file = fopen(name, "r"); + if(file == NULL) + return 0; + + count = 0; + ret_stat = 1; + while(ret_stat > 0) { + ret_stat = fread(buffer, 1, sizeof(buffer), file); + if(ret_stat != 0) + count += ret_stat; + } + fclose(file); + + return count; +} + +/* + * + * VmsSpecialSize checks to see if the stat st_size can be trusted and + * if not to call a routine to get the correct size. + * + */ +static curl_off_t VmsSpecialSize(const char * name, + const struct_stat * stat_buf) +{ + switch(stat_buf->st_fab_rfm) { + case FAB$C_VAR: + case FAB$C_VFC: + return VmsRealFileSize(name, stat_buf); + break; + default: + return stat_buf->st_size; + } +} + +#endif + +#ifndef __VMS +#define filesize(name, stat_data) (stat_data.st_size) +#else + /* Getting the expected file size needs help on VMS */ +#define filesize(name, stat_data) VmsSpecialSize(name, &stat_data) +#endif + /* * AddFormData() adds a chunk of data to the FormData linked list. * @@ -830,8 +894,8 @@ static CURLcode AddFormData(struct FormData **formp, file */ if(!strequal("-", newform->line)) { struct_stat file; - if(!stat(newform->line, &file) && S_ISREG(file.st_mode)) - *size += file.st_size; + if(!stat(newform->line, &file) && !S_ISDIR(file.st_mode)) + *size += filesize(newform->line, file); else return CURLE_BAD_FUNCTION_ARGUMENT; } @@ -1100,7 +1164,7 @@ CURLcode Curl_getformdata(struct SessionHandle *data, if(!post) return result; /* no input => no output! */ - boundary = Curl_FormBoundary(); + boundary = formboundary(data); if(!boundary) return CURLE_OUT_OF_MEMORY; @@ -1156,7 +1220,7 @@ CURLcode Curl_getformdata(struct SessionHandle *data, the magic to include several files with the same field name */ Curl_safefree(fileboundary); - fileboundary = Curl_FormBoundary(); + fileboundary = formboundary(data); if(!fileboundary) { result = CURLE_OUT_OF_MEMORY; break; @@ -1342,6 +1406,36 @@ int Curl_FormInit(struct Form *form, struct FormData *formdata ) return 0; } +#ifndef __VMS +# define fopen_read fopen +#else + /* + * vmsfopenread + * + * For upload to work as expected on VMS, different optional + * parameters must be added to the fopen command based on + * record format of the file. + * + */ +# define fopen_read vmsfopenread +static FILE * vmsfopenread(const char *file, const char *mode) { + struct_stat statbuf; + int result; + + result = stat(file, &statbuf); + + switch (statbuf.st_fab_rfm) { + case FAB$C_VAR: + case FAB$C_VFC: + case FAB$C_STMCR: + return fopen(file, "r"); + break; + default: + return fopen(file, "r", "rfm=stmlf", "ctx=stm"); + } +} +#endif + /* * readfromfile() * @@ -1364,7 +1458,7 @@ static size_t readfromfile(struct Form *form, char *buffer, else { if(!form->fp) { /* this file hasn't yet been opened */ - form->fp = fopen(form->data->line, "rb"); /* b is for binary */ + form->fp = fopen_read(form->data->line, "rb"); /* b is for binary */ if(!form->fp) return (size_t)-1; /* failure */ } @@ -1459,6 +1553,18 @@ char *Curl_formpostheader(void *formp, size_t *len) return header; } +/* + * formboundary() creates a suitable boundary string and returns an allocated + * one. + */ +static char *formboundary(struct SessionHandle *data) +{ + /* 24 dashes and 16 hexadecimal digits makes 64 bit (18446744073709551615) + combinations */ + return aprintf("------------------------%08x%08x", + Curl_rand(data), Curl_rand(data)); +} + #else /* CURL_DISABLE_HTTP */ CURLFORMcode curl_formadd(struct curl_httppost **httppost, struct curl_httppost **last_post, @@ -1484,37 +1590,5 @@ void curl_formfree(struct curl_httppost *form) /* does nothing HTTP is disabled */ } -#endif /* CURL_DISABLE_HTTP */ -#if !defined(CURL_DISABLE_HTTP) || defined(USE_SSLEAY) - -/* - * Curl_FormBoundary() creates a suitable boundary string and returns an - * allocated one. This is also used by SSL-code so it must be present even - * if HTTP is disabled! - */ -char *Curl_FormBoundary(void) -{ - char *retstring; - size_t i; - - static const char table16[]="0123456789abcdef"; - - retstring = malloc(BOUNDARY_LENGTH+1); - - if(!retstring) - return NULL; /* failed */ - - strcpy(retstring, "----------------------------"); - - for(i=strlen(retstring); i<BOUNDARY_LENGTH; i++) - retstring[i] = table16[Curl_rand()%16]; - - /* 28 dashes and 12 hexadecimal digits makes 12^16 (184884258895036416) - combinations */ - retstring[BOUNDARY_LENGTH]=0; /* zero terminate */ - - return retstring; -} - -#endif /* !defined(CURL_DISABLE_HTTP) || defined(USE_SSLEAY) */ +#endif /* !defined(CURL_DISABLE_HTTP) */ diff --git a/plugins/FTPFileYM/curl/lib/ftp.c b/plugins/FTPFileYM/curl/lib/ftp.c index 469b887496..e818af6c58 100644 --- a/plugins/FTPFileYM/curl/lib/ftp.c +++ b/plugins/FTPFileYM/curl/lib/ftp.c @@ -59,11 +59,7 @@ #include "ftp.h" #include "fileinfo.h" #include "ftplistparser.h" - -#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI) -#include "krb4.h" -#endif - +#include "curl_sec.h" #include "strtoofft.h" #include "strequal.h" #include "sslgen.h" @@ -123,8 +119,8 @@ static void ftp_pasv_verbose(struct connectdata *conn, char *newhost, /* ascii version */ int port); #endif -static CURLcode ftp_state_post_rest(struct connectdata *conn); -static CURLcode ftp_state_post_cwd(struct connectdata *conn); +static CURLcode ftp_state_prepare_transfer(struct connectdata *conn); +static CURLcode ftp_state_mdtm(struct connectdata *conn); static CURLcode ftp_state_quote(struct connectdata *conn, bool init, ftpstate instate); static CURLcode ftp_nb_type(struct connectdata *conn, @@ -136,7 +132,7 @@ static CURLcode ftp_done(struct connectdata *conn, CURLcode, bool premature); static CURLcode ftp_connect(struct connectdata *conn, bool *done); static CURLcode ftp_disconnect(struct connectdata *conn, bool dead_connection); -static CURLcode ftp_do_more(struct connectdata *conn, bool *completed); +static CURLcode ftp_do_more(struct connectdata *conn, int *completed); static CURLcode ftp_multi_statemach(struct connectdata *conn, bool *done); static int ftp_getsock(struct connectdata *conn, curl_socket_t *socks, int numsocks); @@ -151,8 +147,7 @@ static CURLcode wc_statemach(struct connectdata *conn); static void wc_data_dtor(void *ptr); -static CURLcode ftp_state_post_retr_size(struct connectdata *conn, - curl_off_t filesize); +static CURLcode ftp_state_retr(struct connectdata *conn, curl_off_t filesize); static CURLcode ftp_readresp(curl_socket_t sockfd, struct pingpong *pp, @@ -162,8 +157,6 @@ static CURLcode ftp_dophase_done(struct connectdata *conn, bool connected); /* easy-to-use macro: */ -#define FTPSENDF(x,y,z) if((result = Curl_ftpsendf(x,y,z)) != CURLE_OK) \ - return result #define PPSENDF(x,y,z) if((result = Curl_pp_sendf(x,y,z)) != CURLE_OK) \ return result @@ -228,7 +221,7 @@ const struct Curl_handler Curl_handler_ftps = { static const struct Curl_handler Curl_handler_ftp_proxy = { "FTP", /* scheme */ - ZERO_NULL, /* setup_connection */ + Curl_http_setup_conn, /* setup_connection */ Curl_http, /* do_it */ Curl_http_done, /* done */ ZERO_NULL, /* do_more */ @@ -254,7 +247,7 @@ static const struct Curl_handler Curl_handler_ftp_proxy = { static const struct Curl_handler Curl_handler_ftps_proxy = { "FTPS", /* scheme */ - ZERO_NULL, /* setup_connection */ + Curl_http_setup_conn, /* setup_connection */ Curl_http, /* do_it */ Curl_http_done, /* done */ ZERO_NULL, /* do_more */ @@ -496,7 +489,7 @@ static CURLcode ReceivedServerConnect(struct connectdata *conn, bool *received) static CURLcode InitiateTransfer(struct connectdata *conn) { struct SessionHandle *data = conn->data; - struct FTP *ftp = data->state.proto.ftp; + struct FTP *ftp = data->req.protop; CURLcode result = CURLE_OK; if(conn->ssl[SECONDARYSOCKET].use) { @@ -598,17 +591,17 @@ static CURLcode AllowServerConnect(struct connectdata *conn, bool *connected) /* macro to check for the last line in an FTP server response */ #define LASTLINE(line) (STATUSCODE(line) && (' ' == line[3])) -static int ftp_endofresp(struct pingpong *pp, - int *code) +static bool ftp_endofresp(struct connectdata *conn, char *line, size_t len, + int *code) { - char *line = pp->linestart_resp; - size_t len = pp->nread_resp; + (void)conn; if((len > 3) && LASTLINE(line)) { *code = curlx_sltosi(strtol(line, NULL, 10)); - return 1; + return TRUE; } - return 0; + + return FALSE; } static CURLcode ftp_readresp(curl_socket_t sockfd, @@ -618,7 +611,7 @@ static CURLcode ftp_readresp(curl_socket_t sockfd, { struct connectdata *conn = pp->conn; struct SessionHandle *data = conn->data; -#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI) +#ifdef HAVE_GSSAPI char * const buf = data->state.buffer; #endif CURLcode result = CURLE_OK; @@ -626,7 +619,7 @@ static CURLcode ftp_readresp(curl_socket_t sockfd, result = Curl_pp_readresp(sockfd, pp, &code, size); -#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI) +#if defined(HAVE_GSSAPI) /* handle the security-oriented responses 6xx ***/ /* FIXME: some errorchecking perhaps... ***/ switch(code) { @@ -778,6 +771,47 @@ CURLcode Curl_GetFTPResponse(ssize_t *nreadp, /* return number of bytes read */ return result; } +#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS) + /* for debug purposes */ +static const char * const ftp_state_names[]={ + "STOP", + "WAIT220", + "AUTH", + "USER", + "PASS", + "ACCT", + "PBSZ", + "PROT", + "CCC", + "PWD", + "SYST", + "NAMEFMT", + "QUOTE", + "RETR_PREQUOTE", + "STOR_PREQUOTE", + "POSTQUOTE", + "CWD", + "MKD", + "MDTM", + "TYPE", + "LIST_TYPE", + "RETR_TYPE", + "STOR_TYPE", + "SIZE", + "RETR_SIZE", + "STOR_SIZE", + "REST", + "RETR_REST", + "PORT", + "PRET", + "PASV", + "LIST", + "RETR", + "STOR", + "QUIT" +}; +#endif + /* This is the ONLY way to change FTP state! */ static void _state(struct connectdata *conn, ftpstate newstate @@ -786,51 +820,12 @@ static void _state(struct connectdata *conn, #endif ) { -#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS) - /* for debug purposes */ - static const char * const names[]={ - "STOP", - "WAIT220", - "AUTH", - "USER", - "PASS", - "ACCT", - "PBSZ", - "PROT", - "CCC", - "PWD", - "SYST", - "NAMEFMT", - "QUOTE", - "RETR_PREQUOTE", - "STOR_PREQUOTE", - "POSTQUOTE", - "CWD", - "MKD", - "MDTM", - "TYPE", - "LIST_TYPE", - "RETR_TYPE", - "STOR_TYPE", - "SIZE", - "RETR_SIZE", - "STOR_SIZE", - "REST", - "RETR_REST", - "PORT", - "PRET", - "PASV", - "LIST", - "RETR", - "STOR", - "QUIT" - }; -#endif struct ftp_conn *ftpc = &conn->proto.ftpc; #if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS) if(ftpc->state != newstate) infof(conn->data, "FTP %p (line %d) state change from %s to %s\n", - ftpc, lineno, names[ftpc->state], names[newstate]); + (void *)ftpc, lineno, ftp_state_names[ftpc->state], + ftp_state_names[newstate]); #endif ftpc->state = newstate; } @@ -838,7 +833,7 @@ static void _state(struct connectdata *conn, static CURLcode ftp_state_user(struct connectdata *conn) { CURLcode result; - struct FTP *ftp = conn->data->state.proto.ftp; + struct FTP *ftp = conn->data->req.protop; /* send USER */ PPSENDF(&conn->proto.ftpc.pp, "USER %s", ftp->user?ftp->user:""); @@ -853,7 +848,7 @@ static CURLcode ftp_state_pwd(struct connectdata *conn) CURLcode result; /* send PWD to discover our entry point */ - PPSENDF(&conn->proto.ftpc.pp, "PWD", NULL); + PPSENDF(&conn->proto.ftpc.pp, "%s", "PWD"); state(conn, FTP_PWD); return CURLE_OK; @@ -877,29 +872,21 @@ static int ftp_domore_getsock(struct connectdata *conn, curl_socket_t *socks, return GETSOCK_BLANK; /* When in DO_MORE state, we could be either waiting for us to connect to a - remote site, or we could wait for that site to connect to us. Or just - handle ordinary commands. - - When waiting for a connect, we will be in FTP_STOP state and then we wait - for the secondary socket to become writeable. If we're in another state, - we're still handling commands on the control (primary) connection. + * remote site, or we could wait for that site to connect to us. Or just + * handle ordinary commands. + */ - */ + if(FTP_STOP == ftpc->state) { + /* if stopped and still in this state, then we're also waiting for a + connect on the secondary connection */ + socks[0] = conn->sock[FIRSTSOCKET]; + socks[1] = conn->sock[SECONDARYSOCKET]; - switch(ftpc->state) { - case FTP_STOP: - break; - default: - return Curl_pp_getsock(&conn->proto.ftpc.pp, socks, numsocks); - } - - socks[0] = conn->sock[SECONDARYSOCKET]; - if(ftpc->wait_data_conn) { - socks[1] = conn->sock[FIRSTSOCKET]; - return GETSOCK_READSOCK(0) | GETSOCK_READSOCK(1); + return GETSOCK_READSOCK(FIRSTSOCKET) | + GETSOCK_WRITESOCK(SECONDARYSOCKET); } - - return GETSOCK_READSOCK(0); + else + return Curl_pp_getsock(&conn->proto.ftpc.pp, socks, numsocks); } /* This is called after the FTP_QUOTE state is passed. @@ -915,7 +902,7 @@ static CURLcode ftp_state_cwd(struct connectdata *conn) if(ftpc->cwddone) /* already done and fine */ - result = ftp_state_post_cwd(conn); + result = ftp_state_mdtm(conn); else { ftpc->count2 = 0; /* count2 counts failed CWDs */ @@ -943,7 +930,7 @@ static CURLcode ftp_state_cwd(struct connectdata *conn) } else { /* No CWD necessary */ - result = ftp_state_post_cwd(conn); + result = ftp_state_mdtm(conn); } } } @@ -1068,12 +1055,17 @@ static CURLcode ftp_state_use_port(struct connectdata *conn, if(*addr != '\0') { /* attempt to get the address of the given interface name */ - if(!Curl_if2ip(conn->ip_addr->ai_family, addr, - hbuf, sizeof(hbuf))) - /* not an interface, use the given string as host name instead */ - host = addr; - else - host = hbuf; /* use the hbuf for host name */ + switch(Curl_if2ip(conn->ip_addr->ai_family, conn->scope, addr, + hbuf, sizeof(hbuf))) { + case IF2IP_NOT_FOUND: + /* not an interface, use the given string as host name instead */ + host = addr; + break; + case IF2IP_AF_NOT_SUPPORTED: + return CURLE_FTP_PORT_FAILED; + case IF2IP_FOUND: + host = hbuf; /* use the hbuf for host name */ + } } else /* there was only a port(-range) given, default the host */ @@ -1368,13 +1360,17 @@ static CURLcode ftp_state_use_pasv(struct connectdata *conn) return result; } -/* REST is the last command in the chain of commands when a "head"-like - request is made. Thus, if an actual transfer is to be made this is where - we take off for real. */ -static CURLcode ftp_state_post_rest(struct connectdata *conn) +/* + * ftp_state_prepare_transfer() starts PORT, PASV or PRET etc. + * + * REST is the last command in the chain of commands when a "head"-like + * request is made. Thus, if an actual transfer is to be made this is where we + * take off for real. + */ +static CURLcode ftp_state_prepare_transfer(struct connectdata *conn) { CURLcode result = CURLE_OK; - struct FTP *ftp = conn->data->state.proto.ftp; + struct FTP *ftp = conn->data->req.protop; struct SessionHandle *data = conn->data; if(ftp->transfer != FTPTRANSFER_BODY) { @@ -1414,10 +1410,10 @@ static CURLcode ftp_state_post_rest(struct connectdata *conn) return result; } -static CURLcode ftp_state_post_size(struct connectdata *conn) +static CURLcode ftp_state_rest(struct connectdata *conn) { CURLcode result = CURLE_OK; - struct FTP *ftp = conn->data->state.proto.ftp; + struct FTP *ftp = conn->data->req.protop; struct ftp_conn *ftpc = &conn->proto.ftpc; if((ftp->transfer != FTPTRANSFER_BODY) && ftpc->file) { @@ -1430,15 +1426,15 @@ static CURLcode ftp_state_post_size(struct connectdata *conn) state(conn, FTP_REST); } else - result = ftp_state_post_rest(conn); + result = ftp_state_prepare_transfer(conn); return result; } -static CURLcode ftp_state_post_type(struct connectdata *conn) +static CURLcode ftp_state_size(struct connectdata *conn) { CURLcode result = CURLE_OK; - struct FTP *ftp = conn->data->state.proto.ftp; + struct FTP *ftp = conn->data->req.protop; struct ftp_conn *ftpc = &conn->proto.ftpc; if((ftp->transfer == FTPTRANSFER_INFO) && ftpc->file) { @@ -1450,12 +1446,12 @@ static CURLcode ftp_state_post_type(struct connectdata *conn) state(conn, FTP_SIZE); } else - result = ftp_state_post_size(conn); + result = ftp_state_rest(conn); return result; } -static CURLcode ftp_state_post_listtype(struct connectdata *conn) +static CURLcode ftp_state_list(struct connectdata *conn) { CURLcode result = CURLE_OK; struct SessionHandle *data = conn->data; @@ -1524,7 +1520,7 @@ static CURLcode ftp_state_post_listtype(struct connectdata *conn) return result; } -static CURLcode ftp_state_post_retrtype(struct connectdata *conn) +static CURLcode ftp_state_retr_prequote(struct connectdata *conn) { CURLcode result = CURLE_OK; @@ -1535,7 +1531,7 @@ static CURLcode ftp_state_post_retrtype(struct connectdata *conn) return result; } -static CURLcode ftp_state_post_stortype(struct connectdata *conn) +static CURLcode ftp_state_stor_prequote(struct connectdata *conn) { CURLcode result = CURLE_OK; @@ -1546,10 +1542,10 @@ static CURLcode ftp_state_post_stortype(struct connectdata *conn) return result; } -static CURLcode ftp_state_post_mdtm(struct connectdata *conn) +static CURLcode ftp_state_type(struct connectdata *conn) { CURLcode result = CURLE_OK; - struct FTP *ftp = conn->data->state.proto.ftp; + struct FTP *ftp = conn->data->req.protop; struct SessionHandle *data = conn->data; struct ftp_conn *ftpc = &conn->proto.ftpc; @@ -1572,14 +1568,14 @@ static CURLcode ftp_state_post_mdtm(struct connectdata *conn) return result; } else - result = ftp_state_post_type(conn); + result = ftp_state_size(conn); return result; } /* This is called after the CWD commands have been done in the beginning of the DO phase */ -static CURLcode ftp_state_post_cwd(struct connectdata *conn) +static CURLcode ftp_state_mdtm(struct connectdata *conn) { CURLcode result = CURLE_OK; struct SessionHandle *data = conn->data; @@ -1595,7 +1591,7 @@ static CURLcode ftp_state_post_cwd(struct connectdata *conn) state(conn, FTP_MDTM); } else - result = ftp_state_post_mdtm(conn); + result = ftp_state_type(conn); return result; } @@ -1606,7 +1602,7 @@ static CURLcode ftp_state_ul_setup(struct connectdata *conn, bool sizechecked) { CURLcode result = CURLE_OK; - struct FTP *ftp = conn->data->state.proto.ftp; + struct FTP *ftp = conn->data->req.protop; struct SessionHandle *data = conn->data; struct ftp_conn *ftpc = &conn->proto.ftpc; int seekerr = CURL_SEEKFUNC_OK; @@ -1704,7 +1700,7 @@ static CURLcode ftp_state_quote(struct connectdata *conn, { CURLcode result = CURLE_OK; struct SessionHandle *data = conn->data; - struct FTP *ftp = data->state.proto.ftp; + struct FTP *ftp = data->req.protop; struct ftp_conn *ftpc = &conn->proto.ftpc; bool quote=FALSE; struct curl_slist *item; @@ -1770,7 +1766,7 @@ static CURLcode ftp_state_quote(struct connectdata *conn, else { if(ftpc->known_filesize != -1) { Curl_pgrsSetDownloadSize(data, ftpc->known_filesize); - result = ftp_state_post_retr_size(conn, ftpc->known_filesize); + result = ftp_state_retr(conn, ftpc->known_filesize); } else { PPSENDF(&ftpc->pp, "SIZE %s", ftpc->file); @@ -1794,15 +1790,15 @@ static CURLcode ftp_state_quote(struct connectdata *conn, static CURLcode ftp_epsv_disable(struct connectdata *conn) { CURLcode result = CURLE_OK; - infof(conn->data, "got positive EPSV response, but can't connect. " - "Disabling EPSV\n"); + infof(conn->data, "Failed EPSV attempt. Disabling EPSV\n"); /* disable it for next transfer */ conn->bits.ftp_use_epsv = FALSE; conn->data->state.errorbuf = FALSE; /* allow error message to get rewritten */ - PPSENDF(&conn->proto.ftpc.pp, "PASV", NULL); + PPSENDF(&conn->proto.ftpc.pp, "%s", "PASV"); conn->proto.ftpc.count1++; - /* remain in the FTP_PASV state */ + /* remain in/go to the FTP_PASV state */ + state(conn, FTP_PASV); return result; } @@ -1931,28 +1927,18 @@ static CURLcode ftp_state_pasv_resp(struct connectdata *conn, } else if(ftpc->count1 == 0) { /* EPSV failed, move on to PASV */ - - /* disable it for next transfer */ - conn->bits.ftp_use_epsv = FALSE; - infof(data, "disabling EPSV usage\n"); - - PPSENDF(&ftpc->pp, "PASV", NULL); - ftpc->count1++; - /* remain in the FTP_PASV state */ - return result; + return ftp_epsv_disable(conn); } else { failf(data, "Bad PASV/EPSV response: %03d", ftpcode); return CURLE_FTP_WEIRD_PASV_REPLY; } - if(data->set.str[STRING_PROXY] && *data->set.str[STRING_PROXY]) { + if(conn->bits.proxy) { /* - * This is a tunnel through a http proxy and we need to connect to the - * proxy again here. - * - * We don't want to rely on a former host lookup that might've expired - * now, instead we remake the lookup here and now! + * This connection uses a proxy and we need to connect to the proxy again + * here. We don't want to rely on a former host lookup that might've + * expired now, instead we remake the lookup here and now! */ rc = Curl_resolv(conn, conn->proxy.name, (int)conn->port, &addr); if(rc == CURLRESOLV_PENDING) @@ -2018,14 +2004,17 @@ static CURLcode ftp_state_pasv_resp(struct connectdata *conn, case CURLPROXY_SOCKS5_HOSTNAME: result = Curl_SOCKS5(conn->proxyuser, conn->proxypasswd, newhost, newport, SECONDARYSOCKET, conn); + connected = TRUE; break; case CURLPROXY_SOCKS4: result = Curl_SOCKS4(conn->proxyuser, newhost, newport, SECONDARYSOCKET, conn, FALSE); + connected = TRUE; break; case CURLPROXY_SOCKS4A: result = Curl_SOCKS4(conn->proxyuser, newhost, newport, SECONDARYSOCKET, conn, TRUE); + connected = TRUE; break; case CURLPROXY_HTTP: case CURLPROXY_HTTP_1_0: @@ -2057,13 +2046,13 @@ static CURLcode ftp_state_pasv_resp(struct connectdata *conn, * FTP pointer */ struct HTTP http_proxy; - struct FTP *ftp_save = data->state.proto.ftp; + struct FTP *ftp_save = data->req.protop; memset(&http_proxy, 0, sizeof(http_proxy)); - data->state.proto.http = &http_proxy; + data->req.protop = &http_proxy; result = Curl_proxyCONNECT(conn, SECONDARYSOCKET, newhost, newport); - data->state.proto.ftp = ftp_save; + data->req.protop = ftp_save; if(result) return result; @@ -2077,8 +2066,7 @@ static CURLcode ftp_state_pasv_resp(struct connectdata *conn, } } - conn->bits.tcpconnect[SECONDARYSOCKET] = TRUE; - + conn->bits.tcpconnect[SECONDARYSOCKET] = connected; conn->bits.do_more = TRUE; state(conn, FTP_STOP); /* this phase is completed */ @@ -2124,7 +2112,7 @@ static CURLcode ftp_state_mdtm_resp(struct connectdata *conn, { CURLcode result = CURLE_OK; struct SessionHandle *data=conn->data; - struct FTP *ftp = data->state.proto.ftp; + struct FTP *ftp = data->req.protop; struct ftp_conn *ftpc = &conn->proto.ftpc; switch(ftpcode) { @@ -2218,7 +2206,7 @@ static CURLcode ftp_state_mdtm_resp(struct connectdata *conn, } if(!result) - result = ftp_state_post_mdtm(conn); + result = ftp_state_type(conn); return result; } @@ -2242,23 +2230,23 @@ static CURLcode ftp_state_type_resp(struct connectdata *conn, ftpcode); if(instate == FTP_TYPE) - result = ftp_state_post_type(conn); + result = ftp_state_size(conn); else if(instate == FTP_LIST_TYPE) - result = ftp_state_post_listtype(conn); + result = ftp_state_list(conn); else if(instate == FTP_RETR_TYPE) - result = ftp_state_post_retrtype(conn); + result = ftp_state_retr_prequote(conn); else if(instate == FTP_STOR_TYPE) - result = ftp_state_post_stortype(conn); + result = ftp_state_stor_prequote(conn); return result; } -static CURLcode ftp_state_post_retr_size(struct connectdata *conn, +static CURLcode ftp_state_retr(struct connectdata *conn, curl_off_t filesize) { CURLcode result = CURLE_OK; struct SessionHandle *data=conn->data; - struct FTP *ftp = data->state.proto.ftp; + struct FTP *ftp = data->req.protop; struct ftp_conn *ftpc = &conn->proto.ftpc; if(data->set.max_filesize && (filesize > data->set.max_filesize)) { @@ -2358,11 +2346,11 @@ static CURLcode ftp_state_size_resp(struct connectdata *conn, } #endif Curl_pgrsSetDownloadSize(data, filesize); - result = ftp_state_post_size(conn); + result = ftp_state_rest(conn); } else if(instate == FTP_RETR_SIZE) { Curl_pgrsSetDownloadSize(data, filesize); - result = ftp_state_post_retr_size(conn, filesize); + result = ftp_state_retr(conn, filesize); } else if(instate == FTP_STOR_SIZE) { data->state.resume_from = filesize; @@ -2390,7 +2378,7 @@ static CURLcode ftp_state_rest_resp(struct connectdata *conn, return result; } #endif - result = ftp_state_post_rest(conn); + result = ftp_state_prepare_transfer(conn); break; case FTP_RETR_REST: @@ -2427,6 +2415,8 @@ static CURLcode ftp_state_stor_resp(struct connectdata *conn, if(data->set.ftp_use_port) { bool connected; + state(conn, FTP_STOP); /* no longer in STOR state */ + result = AllowServerConnect(conn, &connected); if(result) return result; @@ -2450,7 +2440,7 @@ static CURLcode ftp_state_get_resp(struct connectdata *conn, { CURLcode result = CURLE_OK; struct SessionHandle *data = conn->data; - struct FTP *ftp = data->state.proto.ftp; + struct FTP *ftp = data->req.protop; char *buf = data->state.buffer; if((ftpcode == 150) || (ftpcode == 125)) { @@ -2574,19 +2564,6 @@ static CURLcode ftp_state_loggedin(struct connectdata *conn) { CURLcode result = CURLE_OK; -#ifdef HAVE_KRB4 - if(conn->data->set.krb) { - /* We may need to issue a KAUTH here to have access to the files - * do it if user supplied a password - */ - if(conn->passwd && *conn->passwd) { - /* BLOCKING */ - result = Curl_krb_kauth(conn); - if(result) - return result; - } - } -#endif if(conn->ssl[FIRSTSOCKET].use) { /* PBSZ = PROTECTION BUFFER SIZE. @@ -2618,7 +2595,7 @@ static CURLcode ftp_state_user_resp(struct connectdata *conn, { CURLcode result = CURLE_OK; struct SessionHandle *data = conn->data; - struct FTP *ftp = data->state.proto.ftp; + struct FTP *ftp = data->req.protop; struct ftp_conn *ftpc = &conn->proto.ftpc; (void)instate; /* no use for this yet */ @@ -2706,14 +2683,17 @@ static CURLcode ftp_statemach_act(struct connectdata *conn) /* we have now received a full FTP server response */ switch(ftpc->state) { case FTP_WAIT220: - if(ftpcode != 220) { + if(ftpcode == 230) + /* 230 User logged in - already! */ + return ftp_state_user_resp(conn, ftpcode, ftpc->state); + else if(ftpcode != 220) { failf(data, "Got a %03d ftp-server response when 220 was expected", ftpcode); return CURLE_FTP_WEIRD_SERVER_REPLY; } /* We have received a 220 response fine, now we proceed. */ -#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI) +#ifdef HAVE_GSSAPI if(data->set.krb) { /* If not anonymous login, try a secure login. Note that this procedure is still BLOCKING. */ @@ -2828,7 +2808,7 @@ static CURLcode ftp_statemach_act(struct connectdata *conn) if(data->set.ftp_ccc) { /* CCC - Clear Command Channel */ - PPSENDF(&ftpc->pp, "CCC", NULL); + PPSENDF(&ftpc->pp, "%s", "CCC"); state(conn, FTP_CCC); } else { @@ -2866,13 +2846,19 @@ static CURLcode ftp_statemach_act(struct connectdata *conn) return CURLE_OUT_OF_MEMORY; /* Reply format is like - 257<space>"<directory-name>"<space><commentary> and the RFC959 - says + 257<space>[rubbish]"<directory-name>"<space><commentary> and the + RFC959 says The directory name can contain any character; embedded double-quotes should be escaped by double-quotes (the "quote-doubling" convention). */ + + /* scan for the first double-quote for non-standard responses */ + while(ptr < &data->state.buffer[sizeof(data->state.buffer)] + && *ptr != '\n' && *ptr != '\0' && *ptr != '"') + ptr++; + if('\"' == *ptr) { /* it started good */ ptr++; @@ -2909,7 +2895,7 @@ static CURLcode ftp_statemach_act(struct connectdata *conn) if(!ftpc->server_os && dir[0] != '/') { - result = Curl_pp_sendf(&ftpc->pp, "SYST", NULL); + result = Curl_pp_sendf(&ftpc->pp, "%s", "SYST"); if(result != CURLE_OK) { free(dir); return result; @@ -2962,7 +2948,7 @@ static CURLcode ftp_statemach_act(struct connectdata *conn) if(strequal(os, "OS/400")) { /* Force OS400 name format 1. */ - result = Curl_pp_sendf(&ftpc->pp, "SITE NAMEFMT 1", NULL); + result = Curl_pp_sendf(&ftpc->pp, "%s", "SITE NAMEFMT 1"); if(result != CURLE_OK) { free(os); return result; @@ -3040,7 +3026,7 @@ static CURLcode ftp_statemach_act(struct connectdata *conn) PPSENDF(&ftpc->pp, "CWD %s", ftpc->dirs[ftpc->count1 - 1]); } else { - result = ftp_state_post_cwd(conn); + result = ftp_state_mdtm(conn); if(result) return result; } @@ -3124,7 +3110,7 @@ static CURLcode ftp_multi_statemach(struct connectdata *conn, bool *done) { struct ftp_conn *ftpc = &conn->proto.ftpc; - CURLcode result = Curl_pp_multi_statemach(&ftpc->pp); + CURLcode result = Curl_pp_statemach(&ftpc->pp, FALSE); /* Check for the state outside of the Curl_socket_ready() return code checks since at times we are in fact already in this state when this function @@ -3134,14 +3120,14 @@ static CURLcode ftp_multi_statemach(struct connectdata *conn, return result; } -static CURLcode ftp_easy_statemach(struct connectdata *conn) +static CURLcode ftp_block_statemach(struct connectdata *conn) { struct ftp_conn *ftpc = &conn->proto.ftpc; struct pingpong *pp = &ftpc->pp; CURLcode result = CURLE_OK; while(ftpc->state != FTP_STOP) { - result = Curl_pp_easy_statemach(pp); + result = Curl_pp_statemach(pp, TRUE); if(result) break; } @@ -3150,62 +3136,12 @@ static CURLcode ftp_easy_statemach(struct connectdata *conn) } /* - * Allocate and initialize the struct FTP for the current SessionHandle. If - * need be. - */ - -#if defined(__INTEL_COMPILER) && (__INTEL_COMPILER == 910) && \ - defined(__OPTIMIZE__) && defined(__unix__) && defined(__i386__) - /* workaround icc 9.1 optimizer issue */ -#pragma optimize("", off) -#endif - -static CURLcode ftp_init(struct connectdata *conn) -{ - struct FTP *ftp; - - if(NULL == conn->data->state.proto.ftp) { - conn->data->state.proto.ftp = malloc(sizeof(struct FTP)); - if(NULL == conn->data->state.proto.ftp) - return CURLE_OUT_OF_MEMORY; - } - - ftp = conn->data->state.proto.ftp; - - /* get some initial data into the ftp struct */ - ftp->bytecountp = &conn->data->req.bytecount; - ftp->transfer = FTPTRANSFER_BODY; - ftp->downloadsize = 0; - - /* No need to duplicate user+password, the connectdata struct won't change - during a session, but we re-init them here since on subsequent inits - since the conn struct may have changed or been replaced. - */ - ftp->user = conn->user; - ftp->passwd = conn->passwd; - if(isBadFtpString(ftp->user)) - return CURLE_URL_MALFORMAT; - if(isBadFtpString(ftp->passwd)) - return CURLE_URL_MALFORMAT; - - conn->proto.ftpc.known_filesize = -1; /* unknown size for now */ - - return CURLE_OK; -} - -#if defined(__INTEL_COMPILER) && (__INTEL_COMPILER == 910) && \ - defined(__OPTIMIZE__) && defined(__unix__) && defined(__i386__) - /* workaround icc 9.1 optimizer issue */ -#pragma optimize("", on) -#endif - -/* * ftp_connect() should do everything that is to be considered a part of * the connection phase. * * The variable 'done' points to will be TRUE if the protocol-layer connect - * phase is done when this function returns, or FALSE is not. When called as - * a part of the easy interface, it will always be TRUE. + * phase is done when this function returns, or FALSE if not. + * */ static CURLcode ftp_connect(struct connectdata *conn, bool *done) /* see description above */ @@ -3216,14 +3152,6 @@ static CURLcode ftp_connect(struct connectdata *conn, *done = FALSE; /* default to not done yet */ - /* If there already is a protocol-specific struct allocated for this - sessionhandle, deal with it */ - Curl_reset_reqproto(conn); - - result = ftp_init(conn); - if(CURLE_OK != result) - return result; - /* We always support persistent connections on ftp */ conn->bits.close = FALSE; @@ -3263,7 +3191,7 @@ static CURLcode ftp_done(struct connectdata *conn, CURLcode status, bool premature) { struct SessionHandle *data = conn->data; - struct FTP *ftp = data->state.proto.ftp; + struct FTP *ftp = data->req.protop; struct ftp_conn *ftpc = &conn->proto.ftpc; struct pingpong *pp = &ftpc->pp; ssize_t nread; @@ -3369,15 +3297,16 @@ static CURLcode ftp_done(struct connectdata *conn, CURLcode status, #endif if(conn->sock[SECONDARYSOCKET] != CURL_SOCKET_BAD) { - if(!result && ftpc->dont_check && data->req.maxdownload > 0) + if(!result && ftpc->dont_check && data->req.maxdownload > 0) { /* partial download completed */ - result = Curl_pp_sendf(pp, "ABOR"); + result = Curl_pp_sendf(pp, "%s", "ABOR"); if(result) { failf(data, "Failure sending ABOR command: %s", curl_easy_strerror(result)); ftpc->ctl_valid = FALSE; /* mark control connection as bad */ conn->bits.close = TRUE; /* mark for connection closure */ } + } if(conn->ssl[SECONDARYSOCKET].use) { /* The secondary socket is using SSL so we must close down that part @@ -3523,7 +3452,7 @@ CURLcode ftp_sendquote(struct connectdata *conn, struct curl_slist *quote) acceptfail = TRUE; } - FTPSENDF(conn, "%s", cmd); + PPSENDF(&conn->proto.ftpc.pp, "%s", cmd); pp->response = Curl_tvnow(); /* timeout relative now */ @@ -3664,19 +3593,22 @@ static CURLcode ftp_range(struct connectdata *conn) * * This function shall be called when the second FTP (data) connection is * connected. + * + * 'complete' can return 0 for incomplete, 1 for done and -1 for go back + * (which basically is only for when PASV is being sent to retry a failed + * EPSV). */ -static CURLcode ftp_do_more(struct connectdata *conn, bool *complete) +static CURLcode ftp_do_more(struct connectdata *conn, int *completep) { struct SessionHandle *data=conn->data; struct ftp_conn *ftpc = &conn->proto.ftpc; CURLcode result = CURLE_OK; bool connected = FALSE; + bool complete = FALSE; /* the ftp struct is inited in ftp_connect() */ - struct FTP *ftp = data->state.proto.ftp; - - *complete = FALSE; + struct FTP *ftp = data->req.protop; /* if the second connection isn't done yet, wait for it */ if(!conn->bits.tcpconnect[SECONDARYSOCKET]) { @@ -3694,14 +3626,22 @@ static CURLcode ftp_do_more(struct connectdata *conn, bool *complete) if(connected) { DEBUGF(infof(data, "DO-MORE connected phase starts\n")); } - else + else { + if(result && (ftpc->count1 == 0)) { + *completep = -1; /* go back to DOING please */ + /* this is a EPSV connect failing, try PASV instead */ + return ftp_epsv_disable(conn); + } return result; + } } if(ftpc->state) { /* already in a state so skip the intial commands. They are only done to kickstart the do_more state */ - result = ftp_multi_statemach(conn, complete); + result = ftp_multi_statemach(conn, &complete); + + *completep = (int)complete; /* if we got an error or if we don't wait for a data connection return immediately */ @@ -3712,7 +3652,7 @@ static CURLcode ftp_do_more(struct connectdata *conn, bool *complete) /* if we reach the end of the FTP state machine here, *complete will be TRUE but so is ftpc->wait_data_conn, which says we need to wait for the data connection and therefore we're not actually complete */ - *complete = FALSE; + *completep = 0; } if(ftp->transfer <= FTPTRANSFER_INFO) { @@ -3735,6 +3675,9 @@ static CURLcode ftp_do_more(struct connectdata *conn, bool *complete) if(result) return result; + + *completep = 1; /* this state is now complete when the server has + connected back to us */ } } else if(data->set.upload) { @@ -3742,7 +3685,8 @@ static CURLcode ftp_do_more(struct connectdata *conn, bool *complete) if(result) return result; - result = ftp_multi_statemach(conn, complete); + result = ftp_multi_statemach(conn, &complete); + *completep = (int)complete; } else { /* download */ @@ -3770,7 +3714,8 @@ static CURLcode ftp_do_more(struct connectdata *conn, bool *complete) return result; } - result = ftp_multi_statemach(conn, complete); + result = ftp_multi_statemach(conn, &complete); + *completep = (int)complete; } return result; } @@ -3782,7 +3727,7 @@ static CURLcode ftp_do_more(struct connectdata *conn, bool *complete) if(!ftpc->wait_data_conn) { /* no waiting for the data connection so this is now complete */ - *complete = TRUE; + *completep = 1; DEBUGF(infof(data, "DO-MORE phase ends with %d\n", (int)result)); } @@ -3811,7 +3756,7 @@ CURLcode ftp_perform(struct connectdata *conn, if(conn->data->set.opt_no_body) { /* requested no body means no transfer... */ - struct FTP *ftp = conn->data->state.proto.ftp; + struct FTP *ftp = conn->data->req.protop; ftp->transfer = FTPTRANSFER_INFO; } @@ -3825,7 +3770,9 @@ CURLcode ftp_perform(struct connectdata *conn, /* run the state-machine */ result = ftp_multi_statemach(conn, dophase_done); - *connected = conn->bits.tcpconnect[FIRSTSOCKET]; + *connected = conn->bits.tcpconnect[SECONDARYSOCKET]; + + infof(conn->data, "ftp_perform ends with SECONDARY: %d\n", *connected); if(*dophase_done) DEBUGF(infof(conn->data, "DO phase is complete1\n")); @@ -3978,16 +3925,11 @@ static CURLcode wc_statemach(struct connectdata *conn) /* filelist has at least one file, lets get first one */ struct ftp_conn *ftpc = &conn->proto.ftpc; struct curl_fileinfo *finfo = wildcard->filelist->head->ptr; - char *tmp_path = malloc(strlen(conn->data->state.path) + - strlen(finfo->filename) + 1); - if(!tmp_path) { + + char *tmp_path = aprintf("%s%s", wildcard->path, finfo->filename); + if(!tmp_path) return CURLE_OUT_OF_MEMORY; - } - tmp_path[0] = 0; - /* make full path to matched file */ - strcat(tmp_path, wildcard->path); - strcat(tmp_path, finfo->filename); /* switch default "state.pathbuffer" and tmp_path, good to see ftp_parse_url_path function to understand this trick */ Curl_safefree(conn->data->state.pathbuffer); @@ -4076,17 +4018,6 @@ static CURLcode ftp_do(struct connectdata *conn, bool *done) *done = FALSE; /* default to false */ ftpc->wait_data_conn = FALSE; /* default to no such wait */ - /* - Since connections can be re-used between SessionHandles, this might be a - connection already existing but on a fresh SessionHandle struct so we must - make sure we have a good 'struct FTP' to play with. For new connections, - the struct FTP is allocated and setup in the ftp_connect() function. - */ - Curl_reset_reqproto(conn); - retcode = ftp_init(conn); - if(retcode) - return retcode; - if(conn->data->set.wildcardmatch) { retcode = wc_statemach(conn); if(conn->data->wildcard.state == CURLWC_SKIP || @@ -4118,19 +4049,19 @@ CURLcode Curl_ftpsendf(struct connectdata *conn, size_t write_len; char *sptr=s; CURLcode res = CURLE_OK; -#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI) +#ifdef HAVE_GSSAPI enum protection_level data_sec = conn->data_prot; #endif va_list ap; va_start(ap, fmt); - vsnprintf(s, SBUF_SIZE-3, fmt, ap); + write_len = vsnprintf(s, SBUF_SIZE-3, fmt, ap); va_end(ap); - strcat(s, "\r\n"); /* append a trailing CRLF */ + strcpy(&s[write_len], "\r\n"); /* append a trailing CRLF */ + write_len +=2; bytes_written=0; - write_len = strlen(s); res = Curl_convert_to_network(conn->data, s, write_len); /* Curl_convert_to_network calls failf if unsuccessful */ @@ -4138,12 +4069,12 @@ CURLcode Curl_ftpsendf(struct connectdata *conn, return(res); for(;;) { -#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI) +#ifdef HAVE_GSSAPI conn->data_prot = PROT_CMD; #endif res = Curl_write(conn, conn->sock[FIRSTSOCKET], sptr, write_len, &bytes_written); -#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI) +#ifdef HAVE_GSSAPI DEBUGASSERT(data_sec > PROT_NONE && data_sec < PROT_LAST); conn->data_prot = data_sec; #endif @@ -4181,7 +4112,7 @@ static CURLcode ftp_quit(struct connectdata *conn) CURLcode result = CURLE_OK; if(conn->proto.ftpc.ctl_valid) { - result = Curl_pp_sendf(&conn->proto.ftpc.pp, "QUIT", NULL); + result = Curl_pp_sendf(&conn->proto.ftpc.pp, "%s", "QUIT"); if(result) { failf(conn->data, "Failure sending QUIT command: %s", curl_easy_strerror(result)); @@ -4193,7 +4124,7 @@ static CURLcode ftp_quit(struct connectdata *conn) state(conn, FTP_QUIT); - result = ftp_easy_statemach(conn); + result = ftp_block_statemach(conn); } return result; @@ -4245,7 +4176,7 @@ static CURLcode ftp_disconnect(struct connectdata *conn, bool dead_connection) Curl_pp_disconnect(pp); -#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI) +#ifdef HAVE_GSSAPI Curl_sec_end(conn); #endif @@ -4264,7 +4195,7 @@ CURLcode ftp_parse_url_path(struct connectdata *conn) { struct SessionHandle *data = conn->data; /* the ftp struct is already inited in ftp_connect() */ - struct FTP *ftp = data->state.proto.ftp; + struct FTP *ftp = data->req.protop; struct ftp_conn *ftpc = &conn->proto.ftpc; const char *slash_pos; /* position of the first '/' char in curpos */ const char *path_to_use = data->state.path; @@ -4309,13 +4240,17 @@ CURLcode ftp_parse_url_path(struct connectdata *conn) } slash_pos=strrchr(cur_pos, '/'); if(slash_pos || !*cur_pos) { + size_t dirlen = slash_pos-cur_pos; + ftpc->dirs = calloc(1, sizeof(ftpc->dirs[0])); if(!ftpc->dirs) return CURLE_OUT_OF_MEMORY; + if(!dirlen) + dirlen++; + ftpc->dirs[0] = curl_easy_unescape(conn->data, slash_pos ? cur_pos : "/", - slash_pos ? - curlx_sztosi(slash_pos-cur_pos) : 1, + slash_pos ? curlx_uztosi(dirlen) : 1, NULL); if(!ftpc->dirs[0]) { freedirs(ftpc); @@ -4370,6 +4305,15 @@ CURLcode ftp_parse_url_path(struct connectdata *conn) } else { cur_pos = slash_pos + 1; /* jump to the rest of the string */ + if(!ftpc->dirdepth) { + /* path starts with a slash, add that as a directory */ + ftpc->dirs[ftpc->dirdepth] = strdup("/"); + if(!ftpc->dirs[ftpc->dirdepth++]) { /* run out of memory ... */ + failf(data, "no memory"); + freedirs(ftpc); + return CURLE_OUT_OF_MEMORY; + } + } continue; } @@ -4441,11 +4385,11 @@ CURLcode ftp_parse_url_path(struct connectdata *conn) static CURLcode ftp_dophase_done(struct connectdata *conn, bool connected) { - struct FTP *ftp = conn->data->state.proto.ftp; + struct FTP *ftp = conn->data->req.protop; struct ftp_conn *ftpc = &conn->proto.ftpc; if(connected) { - bool completed; + int completed; CURLcode result = ftp_do_more(conn, &completed); if(result) { @@ -4536,11 +4480,12 @@ CURLcode ftp_regular_transfer(struct connectdata *conn, return result; } -static CURLcode ftp_setup_connection(struct connectdata * conn) +static CURLcode ftp_setup_connection(struct connectdata *conn) { struct SessionHandle *data = conn->data; - char * type; + char *type; char command; + struct FTP *ftp; if(conn->bits.httpproxy && !data->set.tunnel_thru_httpproxy) { /* Unless we have asked to tunnel ftp operations through the proxy, we @@ -4556,18 +4501,18 @@ static CURLcode ftp_setup_connection(struct connectdata * conn) return CURLE_UNSUPPORTED_PROTOCOL; #endif } - /* - * We explicitly mark this connection as persistent here as we're doing - * FTP over HTTP and thus we accidentally avoid setting this value - * otherwise. - */ - conn->bits.close = FALSE; + /* set it up as a HTTP connection instead */ + return conn->handler->setup_connection(conn); #else failf(data, "FTP over http proxy requires HTTP support built-in!"); return CURLE_UNSUPPORTED_PROTOCOL; #endif } + conn->data->req.protop = ftp = malloc(sizeof(struct FTP)); + if(NULL == ftp) + return CURLE_OUT_OF_MEMORY; + data->state.path++; /* don't include the initial slash */ data->state.slash_removed = TRUE; /* we've skipped the slash */ @@ -4600,6 +4545,24 @@ static CURLcode ftp_setup_connection(struct connectdata * conn) } } + /* get some initial data into the ftp struct */ + ftp->bytecountp = &conn->data->req.bytecount; + ftp->transfer = FTPTRANSFER_BODY; + ftp->downloadsize = 0; + + /* No need to duplicate user+password, the connectdata struct won't change + during a session, but we re-init them here since on subsequent inits + since the conn struct may have changed or been replaced. + */ + ftp->user = conn->user; + ftp->passwd = conn->passwd; + if(isBadFtpString(ftp->user)) + return CURLE_URL_MALFORMAT; + if(isBadFtpString(ftp->passwd)) + return CURLE_URL_MALFORMAT; + + conn->proto.ftpc.known_filesize = -1; /* unknown size for now */ + return CURLE_OK; } diff --git a/plugins/FTPFileYM/curl/lib/ftp.h b/plugins/FTPFileYM/curl/lib/ftp.h index d359f28f35..bdd59c93da 100644 --- a/plugins/FTPFileYM/curl/lib/ftp.h +++ b/plugins/FTPFileYM/curl/lib/ftp.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -97,13 +97,6 @@ typedef enum { file */ } curl_ftpfile; -typedef enum { - FTPTRANSFER_BODY, /* yes do transfer a body */ - FTPTRANSFER_INFO, /* do still go through to get info/headers */ - FTPTRANSFER_NONE, /* don't get anything and don't get info */ - FTPTRANSFER_LAST /* end of list marker, never used */ -} curl_ftptransfer; - /* This FTP struct is used in the SessionHandle. All FTP data that is connection-oriented must be in FTP_conn to properly deal with the fact that perhaps the SessionHandle is changed between the times the connection is @@ -115,7 +108,7 @@ struct FTP { /* transfer a file/body or not, done as a typedefed enum just to make debuggers display the full symbol and not just the numerical value */ - curl_ftptransfer transfer; + curl_pp_transfer transfer; curl_off_t downloadsize; }; diff --git a/plugins/FTPFileYM/curl/lib/getinfo.c b/plugins/FTPFileYM/curl/lib/getinfo.c index 74e5b0893d..3d09dc6846 100644 --- a/plugins/FTPFileYM/curl/lib/getinfo.c +++ b/plugins/FTPFileYM/curl/lib/getinfo.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -53,8 +53,9 @@ CURLcode Curl_initinfo(struct SessionHandle *data) pro->t_redirect = 0; info->httpcode = 0; - info->httpversion=0; - info->filetime=-1; /* -1 is an illegal time and thus means unknown */ + info->httpversion = 0; + info->filetime = -1; /* -1 is an illegal time and thus means unknown */ + info->timecond = FALSE; if(info->contenttype) free(info->contenttype); @@ -185,7 +186,7 @@ static CURLcode getinfo_long(struct SessionHandle *data, CURLINFO info, break; case CURLINFO_CONDITION_UNMET: /* return if the condition prevented the document to get transferred */ - *param_longp = data->info.timecond; + *param_longp = data->info.timecond ? 1L : 0L; break; case CURLINFO_RTSP_CLIENT_CSEQ: *param_longp = data->state.rtsp_next_client_CSeq; diff --git a/plugins/FTPFileYM/curl/lib/gskit.c b/plugins/FTPFileYM/curl/lib/gskit.c new file mode 100644 index 0000000000..5cda85b9b8 --- /dev/null +++ b/plugins/FTPFileYM/curl/lib/gskit.c @@ -0,0 +1,906 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "curl_setup.h" + +#ifdef USE_GSKIT + +#include <gskssl.h> +#include <qsoasync.h> + +/* Some symbols are undefined/unsupported on OS400 versions < V7R1. */ +#ifndef GSK_SSL_EXTN_SERVERNAME_REQUEST +#define GSK_SSL_EXTN_SERVERNAME_REQUEST 230 +#endif + +#ifdef HAVE_LIMITS_H +# include <limits.h> +#endif + +#include <curl/curl.h> +#include "urldata.h" +#include "sendf.h" +#include "gskit.h" +#include "sslgen.h" +#include "connect.h" /* for the connect timeout */ +#include "select.h" +#include "strequal.h" +#include "x509asn1.h" + +#define _MPRINTF_REPLACE /* use our functions only */ +#include <curl/mprintf.h> + +#include "curl_memory.h" +/* The last #include file should be: */ +#include "memdebug.h" + + +/* Supported ciphers. */ +typedef struct { + const char * name; /* Cipher name. */ + const char * gsktoken; /* Corresponding token for GSKit String. */ + int sslver; /* SSL version. */ +} gskit_cipher; + +static const gskit_cipher ciphertable[] = { + { "null-md5", "01", CURL_SSLVERSION_SSLv3 }, + { "null-sha", "02", CURL_SSLVERSION_SSLv3 }, + { "exp-rc4-md5", "03", CURL_SSLVERSION_SSLv3 }, + { "rc4-md5", "04", CURL_SSLVERSION_SSLv3 }, + { "rc4-sha", "05", CURL_SSLVERSION_SSLv3 }, + { "exp-rc2-cbc-md5", "06", CURL_SSLVERSION_SSLv3 }, + { "exp-des-cbc-sha", "09", CURL_SSLVERSION_SSLv3 }, + { "des-cbc3-sha", "0A", CURL_SSLVERSION_SSLv3 }, + { "aes128-sha", "2F", CURL_SSLVERSION_TLSv1 }, + { "aes256-sha", "35", CURL_SSLVERSION_TLSv1 }, + { "rc4-md5", "1", CURL_SSLVERSION_SSLv2 }, + { "exp-rc4-md5", "2", CURL_SSLVERSION_SSLv2 }, + { "rc2-md5", "3", CURL_SSLVERSION_SSLv2 }, + { "exp-rc2-md5", "4", CURL_SSLVERSION_SSLv2 }, + { "des-cbc-md5", "6", CURL_SSLVERSION_SSLv2 }, + { "des-cbc3-md5", "7", CURL_SSLVERSION_SSLv2 }, + { (const char *) NULL, (const char *) NULL, 0 } +}; + + +static bool is_separator(char c) +{ + /* Return whether character is a cipher list separator. */ + switch (c) { + case ' ': + case '\t': + case ':': + case ',': + case ';': + return true; + } + return false; +} + + +static CURLcode gskit_status(struct SessionHandle * data, int rc, + const char * procname, CURLcode defcode) +{ + CURLcode cc; + + /* Process GSKit status and map it to a CURLcode. */ + switch (rc) { + case GSK_OK: + case GSK_OS400_ASYNCHRONOUS_SOC_INIT: + return CURLE_OK; + case GSK_KEYRING_OPEN_ERROR: + case GSK_OS400_ERROR_NO_ACCESS: + return CURLE_SSL_CACERT_BADFILE; + case GSK_INSUFFICIENT_STORAGE: + return CURLE_OUT_OF_MEMORY; + case GSK_ERROR_BAD_V2_CIPHER: + case GSK_ERROR_BAD_V3_CIPHER: + case GSK_ERROR_NO_CIPHERS: + return CURLE_SSL_CIPHER; + case GSK_OS400_ERROR_NOT_TRUSTED_ROOT: + case GSK_ERROR_CERT_VALIDATION: + return CURLE_PEER_FAILED_VERIFICATION; + case GSK_OS400_ERROR_TIMED_OUT: + return CURLE_OPERATION_TIMEDOUT; + case GSK_WOULD_BLOCK: + return CURLE_AGAIN; + case GSK_OS400_ERROR_NOT_REGISTERED: + break; + case GSK_ERROR_IO: + switch (errno) { + case ENOMEM: + return CURLE_OUT_OF_MEMORY; + default: + failf(data, "%s I/O error: %s", procname, strerror(errno)); + break; + } + break; + default: + failf(data, "%s: %s", procname, gsk_strerror(rc)); + break; + } + return defcode; +} + + +static CURLcode set_enum(struct SessionHandle * data, + gsk_handle h, GSK_ENUM_ID id, GSK_ENUM_VALUE value) +{ + int rc = gsk_attribute_set_enum(h, id, value); + + switch (rc) { + case GSK_OK: + return CURLE_OK; + case GSK_ERROR_IO: + failf(data, "gsk_attribute_set_enum() I/O error: %s", strerror(errno)); + break; + default: + failf(data, "gsk_attribute_set_enum(): %s", gsk_strerror(rc)); + break; + } + return CURLE_SSL_CONNECT_ERROR; +} + + +static CURLcode set_buffer(struct SessionHandle * data, + gsk_handle h, GSK_BUF_ID id, const char * buffer) +{ + int rc = gsk_attribute_set_buffer(h, id, buffer, 0); + + switch (rc) { + case GSK_OK: + return CURLE_OK; + case GSK_ERROR_IO: + failf(data, "gsk_attribute_set_buffer() I/O error: %s", strerror(errno)); + break; + default: + failf(data, "gsk_attribute_set_buffer(): %s", gsk_strerror(rc)); + break; + } + return CURLE_SSL_CONNECT_ERROR; +} + + +static CURLcode set_numeric(struct SessionHandle * data, + gsk_handle h, GSK_NUM_ID id, int value) +{ + int rc = gsk_attribute_set_numeric_value(h, id, value); + + switch (rc) { + case GSK_OK: + return CURLE_OK; + case GSK_ERROR_IO: + failf(data, "gsk_attribute_set_numeric_value() I/O error: %s", + strerror(errno)); + break; + default: + failf(data, "gsk_attribute_set_numeric_value(): %s", gsk_strerror(rc)); + break; + } + return CURLE_SSL_CONNECT_ERROR; +} + + +static CURLcode set_callback(struct SessionHandle * data, + gsk_handle h, GSK_CALLBACK_ID id, void * info) +{ + int rc = gsk_attribute_set_callback(h, id, info); + + switch (rc) { + case GSK_OK: + return CURLE_OK; + case GSK_ERROR_IO: + failf(data, "gsk_attribute_set_callback() I/O error: %s", strerror(errno)); + break; + default: + failf(data, "gsk_attribute_set_callback(): %s", gsk_strerror(rc)); + break; + } + return CURLE_SSL_CONNECT_ERROR; +} + + +static CURLcode set_ciphers(struct SessionHandle * data, gsk_handle h) +{ + const char * cipherlist = data->set.str[STRING_SSL_CIPHER_LIST]; + char * sslv2ciphers; + char * sslv3ciphers; + const char * clp; + const gskit_cipher * ctp; + char * v2p; + char * v3p; + int i; + CURLcode cc; + + /* Compile cipher list into GSKit-compatible cipher lists. */ + + if(!cipherlist) + return CURLE_OK; + while(is_separator(*cipherlist)) /* Skip initial separators. */ + cipherlist++; + if(!*cipherlist) + return CURLE_OK; + + /* We allocate GSKit buffers of the same size as the input string: since + GSKit tokens are always shorter than their cipher names, allocated buffers + will always be large enough to accomodate the result. */ + i = strlen(cipherlist) + 1; + v2p = malloc(i); + if(!v2p) + return CURLE_OUT_OF_MEMORY; + v3p = malloc(i); + if(!v3p) { + free(v2p); + return CURLE_OUT_OF_MEMORY; + } + sslv2ciphers = v2p; + sslv3ciphers = v3p; + + /* Process each cipher in input string. */ + for(;;) { + for(clp = cipherlist; *cipherlist && !is_separator(*cipherlist);) + cipherlist++; + i = cipherlist - clp; + if(!i) + break; + /* Search the cipher in our table. */ + for(ctp = ciphertable; ctp->name; ctp++) + if(strnequal(ctp->name, clp, i) && !ctp->name[i]) + break; + if(!ctp->name) + failf(data, "Unknown cipher %.*s: ignored", i, clp); + else { + switch (ctp->sslver) { + case CURL_SSLVERSION_SSLv2: + strcpy(v2p, ctp->gsktoken); + v2p += strlen(v2p); + break; + default: + /* GSKit wants TLSv1 ciphers with SSLv3 ciphers. */ + strcpy(v3p, ctp->gsktoken); + v3p += strlen(v3p); + break; + } + } + + /* Advance to next cipher name or end of string. */ + while(is_separator(*cipherlist)) + cipherlist++; + } + *v2p = '\0'; + *v3p = '\0'; + cc = set_buffer(data, h, GSK_V2_CIPHER_SPECS, sslv2ciphers); + if(cc == CURLE_OK) + cc = set_buffer(data, h, GSK_V3_CIPHER_SPECS, sslv3ciphers); + free(sslv2ciphers); + free(sslv3ciphers); + return cc; +} + + +int Curl_gskit_init(void) +{ + /* No initialisation needed. */ + + return 1; +} + + +void Curl_gskit_cleanup(void) +{ + /* Nothing to do. */ +} + + +static CURLcode init_environment(struct SessionHandle * data, + gsk_handle * envir, const char * appid, + const char * file, const char * label, + const char * password) +{ + int rc; + CURLcode c; + gsk_handle h; + + /* Creates the GSKit environment. */ + + rc = gsk_environment_open(&h); + switch (rc) { + case GSK_OK: + break; + case GSK_INSUFFICIENT_STORAGE: + return CURLE_OUT_OF_MEMORY; + default: + failf(data, "gsk_environment_open(): %s", gsk_strerror(rc)); + return CURLE_SSL_CONNECT_ERROR; + } + + c = set_enum(data, h, GSK_SESSION_TYPE, GSK_CLIENT_SESSION); + if(c == CURLE_OK && appid) + c = set_buffer(data, h, GSK_OS400_APPLICATION_ID, appid); + if(c == CURLE_OK && file) + c = set_buffer(data, h, GSK_KEYRING_FILE, file); + if(c == CURLE_OK && label) + c = set_buffer(data, h, GSK_KEYRING_LABEL, label); + if(c == CURLE_OK && password) + c = set_buffer(data, h, GSK_KEYRING_PW, password); + + if(c == CURLE_OK) { + /* Locate CAs, Client certificate and key according to our settings. + Note: this call may be blocking for some tenths of seconds. */ + c = gskit_status(data, gsk_environment_init(h), + "gsk_environment_init()", CURLE_SSL_CERTPROBLEM); + if(c == CURLE_OK) { + *envir = h; + return c; + } + } + /* Error: rollback. */ + gsk_environment_close(&h); + return c; +} + + +static void cancel_async_handshake(struct connectdata * conn, int sockindex) +{ + struct ssl_connect_data * connssl = &conn->ssl[sockindex]; + Qso_OverlappedIO_t cstat; + + if(QsoCancelOperation(conn->sock[sockindex], 0) > 0) + QsoWaitForIOCompletion(connssl->iocport, &cstat, (struct timeval *) NULL); +} + + +static void close_async_handshake(struct ssl_connect_data * connssl) +{ + QsoDestroyIOCompletionPort(connssl->iocport); + connssl->iocport = -1; +} + + +static void close_one(struct ssl_connect_data * conn, + struct SessionHandle * data) +{ + if(conn->handle) { + gskit_status(data, gsk_secure_soc_close(&conn->handle), + "gsk_secure_soc_close()", 0); + conn->handle = (gsk_handle) NULL; + } + if(conn->iocport >= 0) + close_async_handshake(conn); +} + + +static ssize_t gskit_send(struct connectdata * conn, int sockindex, + const void * mem, size_t len, CURLcode * curlcode) +{ + struct SessionHandle * data = conn->data; + CURLcode cc; + int written; + + cc = gskit_status(data, + gsk_secure_soc_write(conn->ssl[sockindex].handle, + (char *) mem, (int) len, &written), + "gsk_secure_soc_write()", CURLE_SEND_ERROR); + if(cc != CURLE_OK) { + *curlcode = cc; + written = -1; + } + return (ssize_t) written; /* number of bytes */ +} + + +static ssize_t gskit_recv(struct connectdata * conn, int num, char * buf, + size_t buffersize, CURLcode * curlcode) +{ + struct SessionHandle * data = conn->data; + int buffsize; + int nread; + CURLcode cc; + + buffsize = buffersize > (size_t) INT_MAX? INT_MAX: (int) buffersize; + cc = gskit_status(data, gsk_secure_soc_read(conn->ssl[num].handle, + buf, buffsize, &nread), + "gsk_secure_soc_read()", CURLE_RECV_ERROR); + if(cc != CURLE_OK) { + *curlcode = cc; + nread = -1; + } + return (ssize_t) nread; +} + + +static CURLcode gskit_connect_step1(struct connectdata * conn, int sockindex) +{ + struct SessionHandle * data = conn->data; + struct ssl_connect_data * connssl = &conn->ssl[sockindex]; + gsk_handle envir; + CURLcode cc; + int rc; + char * keyringfile; + char * keyringpwd; + char * keyringlabel; + char * v2ciphers; + char * v3ciphers; + char * sni; + bool sslv2enable, sslv3enable, tlsv1enable; + long timeout; + Qso_OverlappedIO_t commarea; + + /* Create SSL environment, start (preferably asynchronous) handshake. */ + + connssl->handle = (gsk_handle) NULL; + connssl->iocport = -1; + + /* GSKit supports two ways of specifying an SSL context: either by + * application identifier (that should have been defined at the system + * level) or by keyring file, password and certificate label. + * Local certificate name (CURLOPT_SSLCERT) is used to hold either the + * application identifier of the certificate label. + * Key password (CURLOPT_KEYPASSWD) holds the keyring password. + * It is not possible to have different keyrings for the CAs and the + * local certificate. We thus use the CA file (CURLOPT_CAINFO) to identify + * the keyring file. + * If no key password is given and the keyring is the system keyring, + * application identifier mode is tried first, as recommended in IBM doc. + */ + + keyringfile = data->set.str[STRING_SSL_CAFILE]; + keyringpwd = data->set.str[STRING_KEY_PASSWD]; + keyringlabel = data->set.str[STRING_CERT]; + envir = (gsk_handle) NULL; + + if(keyringlabel && *keyringlabel && !keyringpwd && + !strcmp(keyringfile, CURL_CA_BUNDLE)) { + /* Try application identifier mode. */ + init_environment(data, &envir, keyringlabel, (const char *) NULL, + (const char *) NULL, (const char *) NULL); + } + + if(!envir) { + /* Use keyring mode. */ + cc = init_environment(data, &envir, (const char *) NULL, + keyringfile, keyringlabel, keyringpwd); + if(cc != CURLE_OK) + return cc; + } + + /* Create secure session. */ + cc = gskit_status(data, gsk_secure_soc_open(envir, &connssl->handle), + "gsk_secure_soc_open()", CURLE_SSL_CONNECT_ERROR); + gsk_environment_close(&envir); + if(cc != CURLE_OK) + return cc; + + /* Determine which SSL/TLS version should be enabled. */ + sslv2enable = sslv3enable = tlsv1enable = false; + sni = conn->host.name; + switch (data->set.ssl.version) { + case CURL_SSLVERSION_SSLv2: + sslv2enable = true; + sni = (char *) NULL; + break; + case CURL_SSLVERSION_SSLv3: + sslv3enable = true; + sni = (char *) NULL; + break; + case CURL_SSLVERSION_TLSv1: + tlsv1enable = true; + break; + default: /* CURL_SSLVERSION_DEFAULT. */ + sslv3enable = true; + tlsv1enable = true; + break; + } + + /* Process SNI. Ignore if not supported (on OS400 < V7R1). */ + if(sni) { + rc = gsk_attribute_set_buffer(connssl->handle, + GSK_SSL_EXTN_SERVERNAME_REQUEST, sni, 0); + switch (rc) { + case GSK_OK: + case GSK_ATTRIBUTE_INVALID_ID: + break; + case GSK_ERROR_IO: + failf(data, "gsk_attribute_set_buffer() I/O error: %s", strerror(errno)); + cc = CURLE_SSL_CONNECT_ERROR; + break; + default: + failf(data, "gsk_attribute_set_buffer(): %s", gsk_strerror(rc)); + cc = CURLE_SSL_CONNECT_ERROR; + break; + } + } + + /* Set session parameters. */ + if(cc == CURLE_OK) { + /* Compute the handshake timeout. Since GSKit granularity is 1 second, + we round up the required value. */ + timeout = Curl_timeleft(data, NULL, TRUE); + if(timeout < 0) + cc = CURLE_OPERATION_TIMEDOUT; + else + cc = set_numeric(data, connssl->handle, GSK_HANDSHAKE_TIMEOUT, + (timeout + 999) / 1000); + } + if(cc == CURLE_OK) + cc = set_numeric(data, connssl->handle, GSK_FD, conn->sock[sockindex]); + if(cc == CURLE_OK) + cc = set_ciphers(data, connssl->handle); + if(cc == CURLE_OK) + cc = set_enum(data, connssl->handle, GSK_PROTOCOL_SSLV2, + sslv2enable? GSK_PROTOCOL_SSLV2_ON: + GSK_PROTOCOL_SSLV2_OFF); + if(cc == CURLE_OK) + cc = set_enum(data, connssl->handle, GSK_PROTOCOL_SSLV3, + sslv3enable? GSK_PROTOCOL_SSLV3_ON: + GSK_PROTOCOL_SSLV3_OFF); + if(cc == CURLE_OK) + cc = set_enum(data, connssl->handle, GSK_PROTOCOL_TLSV1, + sslv3enable? GSK_PROTOCOL_TLSV1_ON: + GSK_PROTOCOL_TLSV1_OFF); + if(cc == CURLE_OK) + cc = set_enum(data, connssl->handle, GSK_SERVER_AUTH_TYPE, + data->set.ssl.verifypeer? GSK_SERVER_AUTH_FULL: + GSK_SERVER_AUTH_PASSTHRU); + + if(cc == CURLE_OK) { + /* Start handshake. Try asynchronous first. */ + memset(&commarea, 0, sizeof commarea); + connssl->iocport = QsoCreateIOCompletionPort(); + if(connssl->iocport != -1) { + cc = gskit_status(data, gsk_secure_soc_startInit(connssl->handle, + connssl->iocport, &commarea), + "gsk_secure_soc_startInit()", CURLE_SSL_CONNECT_ERROR); + if(cc == CURLE_OK) { + connssl->connecting_state = ssl_connect_2; + return CURLE_OK; + } + else + close_async_handshake(connssl); + } + else if(errno != ENOBUFS) + cc = gskit_status(data, GSK_ERROR_IO, "QsoCreateIOCompletionPort()", 0); + else { + /* No more completion port available. Use synchronous IO. */ + cc = gskit_status(data, gsk_secure_soc_init(connssl->handle), + "gsk_secure_soc_init()", CURLE_SSL_CONNECT_ERROR); + if(cc == CURLE_OK) { + connssl->connecting_state = ssl_connect_3; + return CURLE_OK; + } + } + } + + /* Error: rollback. */ + close_one(connssl, data); + return cc; +} + + +static CURLcode gskit_connect_step2(struct connectdata * conn, int sockindex, + bool nonblocking) +{ + struct SessionHandle * data = conn->data; + struct ssl_connect_data * connssl = &conn->ssl[sockindex]; + Qso_OverlappedIO_t cstat; + long timeout_ms; + struct timeval stmv; + CURLcode cc; + + /* Poll or wait for end of SSL asynchronous handshake. */ + + for(;;) { + timeout_ms = nonblocking? 0: Curl_timeleft(data, NULL, TRUE); + if(timeout_ms < 0) + timeout_ms = 0; + stmv.tv_sec = timeout_ms / 1000; + stmv.tv_usec = (timeout_ms - stmv.tv_sec * 1000) * 1000; + switch (QsoWaitForIOCompletion(connssl->iocport, &cstat, &stmv)) { + case 1: /* Operation complete. */ + break; + case -1: /* An error occurred: handshake still in progress. */ + if(errno == EINTR) { + if(nonblocking) + return CURLE_OK; + continue; /* Retry. */ + } + if(errno != ETIME) { + failf(data, "QsoWaitForIOCompletion() I/O error: %s", strerror(errno)); + cancel_async_handshake(conn, sockindex); + close_async_handshake(connssl); + return CURLE_SSL_CONNECT_ERROR; + } + /* FALL INTO... */ + case 0: /* Handshake in progress, timeout occurred. */ + if(nonblocking) + return CURLE_OK; + cancel_async_handshake(conn, sockindex); + close_async_handshake(connssl); + return CURLE_OPERATION_TIMEDOUT; + } + break; + } + cc = gskit_status(data, cstat.returnValue, "SSL handshake", + CURLE_SSL_CONNECT_ERROR); + if(cc == CURLE_OK) + connssl->connecting_state = ssl_connect_3; + close_async_handshake(connssl); + return cc; +} + + +static CURLcode gskit_connect_step3(struct connectdata * conn, int sockindex) +{ + struct SessionHandle * data = conn->data; + struct ssl_connect_data * connssl = &conn->ssl[sockindex]; + const gsk_cert_data_elem * cdev; + int cdec; + const gsk_cert_data_elem * p; + const char * cert = (const char *) NULL; + const char * certend; + int i; + CURLcode cc; + + /* SSL handshake done: gather certificate info and verify host. */ + + if(gskit_status(data, gsk_attribute_get_cert_info(connssl->handle, + GSK_PARTNER_CERT_INFO, + &cdev, &cdec), + "gsk_attribute_get_cert_info()", CURLE_SSL_CONNECT_ERROR) == + CURLE_OK) { + infof(data, "Server certificate:\n"); + p = cdev; + for(i = 0; i++ < cdec; p++) + switch (p->cert_data_id) { + case CERT_BODY_DER: + cert = p->cert_data_p; + certend = cert + cdev->cert_data_l; + break; + case CERT_DN_PRINTABLE: + infof(data, "\t subject: %.*s\n", p->cert_data_l, p->cert_data_p); + break; + case CERT_ISSUER_DN_PRINTABLE: + infof(data, "\t issuer: %.*s\n", p->cert_data_l, p->cert_data_p); + break; + case CERT_VALID_FROM: + infof(data, "\t start date: %.*s\n", p->cert_data_l, p->cert_data_p); + break; + case CERT_VALID_TO: + infof(data, "\t expire date: %.*s\n", p->cert_data_l, p->cert_data_p); + break; + } + } + + /* Verify host. */ + cc = Curl_verifyhost(conn, cert, certend); + if(cc != CURLE_OK) + return cc; + + /* The only place GSKit can get the whole CA chain is a validation + callback where no user data pointer is available. Therefore it's not + possible to copy this chain into our structures for CAINFO. + However the server certificate may be available, thus we can return + info about it. */ + if(data->set.ssl.certinfo) { + if(Curl_ssl_init_certinfo(data, 1)) + return CURLE_OUT_OF_MEMORY; + if(cert) { + cc = Curl_extract_certinfo(conn, 0, cert, certend); + if(cc != CURLE_OK) + return cc; + } + } + + connssl->connecting_state = ssl_connect_done; + return CURLE_OK; +} + + +static CURLcode gskit_connect_common(struct connectdata * conn, int sockindex, + bool nonblocking, bool * done) +{ + struct SessionHandle * data = conn->data; + struct ssl_connect_data * connssl = &conn->ssl[sockindex]; + long timeout_ms; + Qso_OverlappedIO_t cstat; + CURLcode cc = CURLE_OK; + + *done = connssl->state == ssl_connection_complete; + if(*done) + return CURLE_OK; + + /* Step 1: create session, start handshake. */ + if(connssl->connecting_state == ssl_connect_1) { + /* check allowed time left */ + timeout_ms = Curl_timeleft(data, NULL, TRUE); + + if(timeout_ms < 0) { + /* no need to continue if time already is up */ + failf(data, "SSL connection timeout"); + cc = CURLE_OPERATION_TIMEDOUT; + } + else + cc = gskit_connect_step1(conn, sockindex); + } + + /* Step 2: check if handshake is over. */ + if(cc == CURLE_OK && connssl->connecting_state == ssl_connect_2) { + /* check allowed time left */ + timeout_ms = Curl_timeleft(data, NULL, TRUE); + + if(timeout_ms < 0) { + /* no need to continue if time already is up */ + failf(data, "SSL connection timeout"); + cc = CURLE_OPERATION_TIMEDOUT; + } + else + cc = gskit_connect_step2(conn, sockindex, nonblocking); + } + + /* Step 3: gather certificate info, verify host. */ + if(cc == CURLE_OK && connssl->connecting_state == ssl_connect_3) + cc = gskit_connect_step3(conn, sockindex); + + if(cc != CURLE_OK) + close_one(connssl, data); + else if(connssl->connecting_state == ssl_connect_done) { + connssl->state = ssl_connection_complete; + connssl->connecting_state = ssl_connect_1; + conn->recv[sockindex] = gskit_recv; + conn->send[sockindex] = gskit_send; + *done = TRUE; + } + + return cc; +} + + +CURLcode Curl_gskit_connect_nonblocking(struct connectdata * conn, + int sockindex, + bool * done) +{ + CURLcode cc; + + cc = gskit_connect_common(conn, sockindex, TRUE, done); + if(*done || cc != CURLE_OK) + conn->ssl[sockindex].connecting_state = ssl_connect_1; + return cc; +} + + +CURLcode Curl_gskit_connect(struct connectdata * conn, int sockindex) +{ + CURLcode retcode; + bool done; + + conn->ssl[sockindex].connecting_state = ssl_connect_1; + retcode = gskit_connect_common(conn, sockindex, FALSE, &done); + if(retcode) + return retcode; + + DEBUGASSERT(done); + + return CURLE_OK; +} + + +void Curl_gskit_close(struct connectdata * conn, int sockindex) +{ + struct SessionHandle * data = conn->data; + struct ssl_connect_data * connssl = &conn->ssl[sockindex]; + + if(connssl->use) + close_one(connssl, data); +} + + +int Curl_gskit_close_all(struct SessionHandle * data) +{ + /* Unimplemented. */ + (void) data; + return 0; +} + + +int Curl_gskit_shutdown(struct connectdata * conn, int sockindex) +{ + struct ssl_connect_data * connssl = &conn->ssl[sockindex]; + struct SessionHandle * data = conn->data; + ssize_t nread; + int what; + int rc; + char buf[120]; + + if(!connssl->handle) + return 0; + + if(data->set.ftp_ccc != CURLFTPSSL_CCC_ACTIVE) + return 0; + + close_one(connssl, data); + rc = 0; + what = Curl_socket_ready(conn->sock[sockindex], + CURL_SOCKET_BAD, SSL_SHUTDOWN_TIMEOUT); + + for(;;) { + if(what < 0) { + /* anything that gets here is fatally bad */ + failf(data, "select/poll on SSL socket, errno: %d", SOCKERRNO); + rc = -1; + break; + } + + if(!what) { /* timeout */ + failf(data, "SSL shutdown timeout"); + break; + } + + /* Something to read, let's do it and hope that it is the close + notify alert from the server. No way to gsk_secure_soc_read() now, so + use read(). */ + + nread = read(conn->sock[sockindex], buf, sizeof(buf)); + + if(nread < 0) { + failf(data, "read: %s", strerror(errno)); + rc = -1; + } + + if(nread <= 0) + break; + + what = Curl_socket_ready(conn->sock[sockindex], CURL_SOCKET_BAD, 0); + } + + return rc; +} + + +size_t Curl_gskit_version(char * buffer, size_t size) +{ + strncpy(buffer, "GSKit", size); + return strlen(buffer); +} + + +int Curl_gskit_check_cxn(struct connectdata * cxn) +{ + int err; + int errlen; + + /* The only thing that can be tested here is at the socket level. */ + + if(!cxn->ssl[FIRSTSOCKET].handle) + return 0; /* connection has been closed */ + + err = 0; + errlen = sizeof err; + + if(getsockopt(cxn->sock[FIRSTSOCKET], SOL_SOCKET, SO_ERROR, + (unsigned char *) &err, &errlen) || + errlen != sizeof err || err) + return 0; /* connection has been closed */ + + return -1; /* connection status unknown */ +} + +#endif /* USE_GSKIT */ diff --git a/plugins/FTPFileYM/curl/lib/gskit.h b/plugins/FTPFileYM/curl/lib/gskit.h new file mode 100644 index 0000000000..0d59aa7096 --- /dev/null +++ b/plugins/FTPFileYM/curl/lib/gskit.h @@ -0,0 +1,64 @@ +#ifndef HEADER_CURL_GSKIT_H +#define HEADER_CURL_GSKIT_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +#include "curl_setup.h" + +/* + * This header should only be needed to get included by sslgen.c and gskit.c + */ + +#include "urldata.h" + +#ifdef USE_GSKIT +int Curl_gskit_init(void); +void Curl_gskit_cleanup(void); +CURLcode Curl_gskit_connect(struct connectdata * conn, int sockindex); +CURLcode Curl_gskit_connect_nonblocking(struct connectdata * conn, + int sockindex, bool * done); +void Curl_gskit_close(struct connectdata *conn, int sockindex); +int Curl_gskit_close_all(struct SessionHandle * data); +int Curl_gskit_shutdown(struct connectdata * conn, int sockindex); + +size_t Curl_gskit_version(char * buffer, size_t size); +int Curl_gskit_check_cxn(struct connectdata * cxn); + +/* API setup for GSKit */ +#define curlssl_init Curl_gskit_init +#define curlssl_cleanup Curl_gskit_cleanup +#define curlssl_connect Curl_gskit_connect +#define curlssl_connect_nonblocking Curl_gskit_connect_nonblocking + +/* No session handling for GSKit */ +#define curlssl_session_free(x) Curl_nop_stmt +#define curlssl_close_all Curl_gskit_close_all +#define curlssl_close Curl_gskit_close +#define curlssl_shutdown(x,y) Curl_gskit_shutdown(x,y) +#define curlssl_set_engine(x,y) CURLE_NOT_BUILT_IN +#define curlssl_set_engine_default(x) CURLE_NOT_BUILT_IN +#define curlssl_engines_list(x) NULL +#define curlssl_version Curl_gskit_version +#define curlssl_check_cxn(x) Curl_gskit_check_cxn(x) +#define curlssl_data_pending(x,y) 0 +#endif /* USE_GSKIT */ + +#endif /* HEADER_CURL_GSKIT_H */ diff --git a/plugins/FTPFileYM/curl/lib/gtls.h b/plugins/FTPFileYM/curl/lib/gtls.h index 84e1396b56..453542e1ec 100644 --- a/plugins/FTPFileYM/curl/lib/gtls.h +++ b/plugins/FTPFileYM/curl/lib/gtls.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -55,6 +55,10 @@ void Curl_gtls_md5sum(unsigned char *tmp, /* input */ unsigned char *md5sum, /* output */ size_t md5len); +/* this backend provides these functions: */ +#define have_curlssl_random 1 +#define have_curlssl_md5sum 1 + /* API setup for GnuTLS */ #define curlssl_init Curl_gtls_init #define curlssl_cleanup Curl_gtls_cleanup diff --git a/plugins/FTPFileYM/curl/lib/hash.c b/plugins/FTPFileYM/curl/lib/hash.c index 0a8e99ab20..4a12e1a7b9 100644 --- a/plugins/FTPFileYM/curl/lib/hash.c +++ b/plugins/FTPFileYM/curl/lib/hash.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -391,7 +391,7 @@ void Curl_hash_print(struct curl_hash *h, if(func) func(he->ptr); else - fprintf(stderr, " [%p]", he->ptr); + fprintf(stderr, " [%p]", (void *)he->ptr); he = Curl_hash_next_element(&iter); } diff --git a/plugins/FTPFileYM/curl/lib/hash.h b/plugins/FTPFileYM/curl/lib/hash.h index 99a627405b..aa935d4eb9 100644 --- a/plugins/FTPFileYM/curl/lib/hash.h +++ b/plugins/FTPFileYM/curl/lib/hash.h @@ -104,4 +104,3 @@ void Curl_hash_print(struct curl_hash *h, #endif /* HEADER_CURL_HASH_H */ - diff --git a/plugins/FTPFileYM/curl/lib/hostcheck.c b/plugins/FTPFileYM/curl/lib/hostcheck.c index 44ad822f07..abd1fa0c3c 100644 --- a/plugins/FTPFileYM/curl/lib/hostcheck.c +++ b/plugins/FTPFileYM/curl/lib/hostcheck.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -22,8 +22,9 @@ #include "curl_setup.h" -#if defined(USE_SSLEAY) || defined(USE_AXTLS) -/* these two backends use functions from this file */ +#if defined(USE_SSLEAY) || defined(USE_AXTLS) || defined(USE_QSOSSL) || \ + defined(USE_GSKIT) +/* these backends use functions from this file */ #include "hostcheck.h" #include "rawstr.h" @@ -93,4 +94,4 @@ int Curl_cert_hostcheck(const char *match_pattern, const char *hostname) return 0; } -#endif /* SSLEAY or AXTLS */ +#endif /* SSLEAY or AXTLS or QSOSSL or GSKIT */ diff --git a/plugins/FTPFileYM/curl/lib/hostip.c b/plugins/FTPFileYM/curl/lib/hostip.c index 3765ca1cde..f37b4925bb 100644 --- a/plugins/FTPFileYM/curl/lib/hostip.c +++ b/plugins/FTPFileYM/curl/lib/hostip.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -140,6 +140,10 @@ struct curl_hash *Curl_global_host_cache_init(void) void Curl_global_host_cache_dtor(void) { if(host_cache_initialized) { + /* first make sure that any custom "CURLOPT_RESOLVE" names are + cleared off */ + Curl_hostcache_clean(NULL, &hostname_cache); + /* then free the remaining hash completely */ Curl_hash_clean(&hostname_cache); host_cache_initialized = 0; } @@ -681,12 +685,14 @@ clean_up: * Curl_resolv_unlock() unlocks the given cached DNS entry. When this has been * made, the struct may be destroyed due to pruning. It is important that only * one unlock is made for each Curl_resolv() call. + * + * May be called with 'data' == NULL for global cache. */ void Curl_resolv_unlock(struct SessionHandle *data, struct Curl_dns_entry *dns) { DEBUGASSERT(dns && (dns->inuse>0)); - if(data->share) + if(data && data->share) Curl_share_lock(data, CURL_LOCK_DATA_DNS, CURL_LOCK_ACCESS_SINGLE); dns->inuse--; @@ -697,7 +703,7 @@ void Curl_resolv_unlock(struct SessionHandle *data, struct Curl_dns_entry *dns) free(dns); } - if(data->share) + if(data && data->share) Curl_share_unlock(data, CURL_LOCK_DATA_DNS); } @@ -734,22 +740,23 @@ static int hostcache_inuse(void *data, void *hc) return 1; /* free all entries */ } -void Curl_hostcache_clean(struct SessionHandle *data) +/* + * Curl_hostcache_clean() + * + * This _can_ be called with 'data' == NULL but then of course no locking + * can be done! + */ + +void Curl_hostcache_clean(struct SessionHandle *data, + struct curl_hash *hash) { /* Entries added to the hostcache with the CURLOPT_RESOLVE function are * still present in the cache with the inuse counter set to 1. Detect them * and cleanup! */ - Curl_hash_clean_with_criterium(data->dns.hostcache, data, hostcache_inuse); + Curl_hash_clean_with_criterium(hash, data, hostcache_inuse); } -void Curl_hostcache_destroy(struct SessionHandle *data) -{ - Curl_hostcache_clean(data); - Curl_hash_destroy(data->dns.hostcache); - data->dns.hostcachetype = HCACHE_NONE; - data->dns.hostcache = NULL; -} CURLcode Curl_loadhostpairs(struct SessionHandle *data) { diff --git a/plugins/FTPFileYM/curl/lib/hostip.h b/plugins/FTPFileYM/curl/lib/hostip.h index 9dd47baa66..42ed7d3208 100644 --- a/plugins/FTPFileYM/curl/lib/hostip.h +++ b/plugins/FTPFileYM/curl/lib/hostip.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -201,9 +201,30 @@ extern sigjmp_buf curl_jmpenv; CURLcode Curl_set_dns_servers(struct SessionHandle *data, char *servers); /* + * Function provided by the resolver backend to set + * outgoing interface to use for DNS requests + */ +CURLcode Curl_set_dns_interface(struct SessionHandle *data, + const char *interf); + +/* + * Function provided by the resolver backend to set + * local IPv4 address to use as source address for DNS requests + */ +CURLcode Curl_set_dns_local_ip4(struct SessionHandle *data, + const char *local_ip4); + +/* + * Function provided by the resolver backend to set + * local IPv6 address to use as source address for DNS requests + */ +CURLcode Curl_set_dns_local_ip6(struct SessionHandle *data, + const char *local_ip6); + +/* * Clean off entries from the cache */ -void Curl_hostcache_clean(struct SessionHandle *data); +void Curl_hostcache_clean(struct SessionHandle *data, struct curl_hash *hash); /* * Destroy the hostcache of this handle. diff --git a/plugins/FTPFileYM/curl/lib/hostip4.c b/plugins/FTPFileYM/curl/lib/hostip4.c index 3a38b321f4..1e39f4a987 100644 --- a/plugins/FTPFileYM/curl/lib/hostip4.c +++ b/plugins/FTPFileYM/curl/lib/hostip4.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -140,7 +140,7 @@ Curl_addrinfo *Curl_ipv4_resolve_r(const char *hostname, #if defined(HAVE_GETADDRINFO_THREADSAFE) else { struct addrinfo hints; - char sbuf[NI_MAXSERV]; + char sbuf[12]; char *sbufptr = NULL; memset(&hints, 0, sizeof(hints)); diff --git a/plugins/FTPFileYM/curl/lib/hostip6.c b/plugins/FTPFileYM/curl/lib/hostip6.c index c42760a640..8327004cd3 100644 --- a/plugins/FTPFileYM/curl/lib/hostip6.c +++ b/plugins/FTPFileYM/curl/lib/hostip6.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -168,7 +168,7 @@ Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn, struct addrinfo hints; Curl_addrinfo *res; int error; - char sbuf[NI_MAXSERV]; + char sbuf[12]; char *sbufptr = NULL; char addrbuf[128]; int pf; diff --git a/plugins/FTPFileYM/curl/lib/hostsyn.c b/plugins/FTPFileYM/curl/lib/hostsyn.c index 65a403545a..4ad3c63da4 100644 --- a/plugins/FTPFileYM/curl/lib/hostsyn.c +++ b/plugins/FTPFileYM/curl/lib/hostsyn.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -72,4 +72,40 @@ CURLcode Curl_set_dns_servers(struct SessionHandle *data, } +/* + * Function provided by the resolver backend to set + * outgoing interface to use for DNS requests + */ +CURLcode Curl_set_dns_interface(struct SessionHandle *data, + const char *interf) +{ + (void)data; + (void)interf; + return CURLE_NOT_BUILT_IN; +} + +/* + * Function provided by the resolver backend to set + * local IPv4 address to use as source address for DNS requests + */ +CURLcode Curl_set_dns_local_ip4(struct SessionHandle *data, + const char *local_ip4) +{ + (void)data; + (void)local_ip4; + return CURLE_NOT_BUILT_IN; +} + +/* + * Function provided by the resolver backend to set + * local IPv6 address to use as source address for DNS requests + */ +CURLcode Curl_set_dns_local_ip6(struct SessionHandle *data, + const char *local_ip6) +{ + (void)data; + (void)local_ip6; + return CURLE_NOT_BUILT_IN; +} + #endif /* truly sync */ diff --git a/plugins/FTPFileYM/curl/lib/http.c b/plugins/FTPFileYM/curl/lib/http.c index daaafe317e..3b18c63115 100644 --- a/plugins/FTPFileYM/curl/lib/http.c +++ b/plugins/FTPFileYM/curl/lib/http.c @@ -73,6 +73,9 @@ #include "http_proxy.h" #include "warnless.h" #include "non-ascii.h" +#include "bundles.h" +#include "pipeline.h" +#include "http2.h" #define _MPRINTF_REPLACE /* use our functions only */ #include <curl/mprintf.h> @@ -103,7 +106,7 @@ static int https_getsock(struct connectdata *conn, */ const struct Curl_handler Curl_handler_http = { "HTTP", /* scheme */ - ZERO_NULL, /* setup_connection */ + Curl_http_setup_conn, /* setup_connection */ Curl_http, /* do_it */ Curl_http_done, /* done */ ZERO_NULL, /* do_more */ @@ -127,7 +130,7 @@ const struct Curl_handler Curl_handler_http = { */ const struct Curl_handler Curl_handler_https = { "HTTPS", /* scheme */ - ZERO_NULL, /* setup_connection */ + Curl_http_setup_conn, /* setup_connection */ Curl_http, /* do_it */ Curl_http_done, /* done */ ZERO_NULL, /* do_more */ @@ -147,6 +150,19 @@ const struct Curl_handler Curl_handler_https = { #endif +CURLcode Curl_http_setup_conn(struct connectdata *conn) +{ + /* allocate the HTTP-specific struct for the SessionHandle, only to survive + during this request */ + DEBUGASSERT(conn->data->req.protop == NULL); + + conn->data->req.protop = calloc(1, sizeof(struct HTTP)); + if(!conn->data->req.protop) + return CURLE_OUT_OF_MEMORY; + + return CURLE_OK; +} + /* * checkheaders() checks the linked list of custom HTTP headers for a * particular header (prefix). @@ -328,7 +344,7 @@ static bool pickoneauth(struct auth *pick) static CURLcode http_perhapsrewind(struct connectdata *conn) { struct SessionHandle *data = conn->data; - struct HTTP *http = data->state.proto.http; + struct HTTP *http = data->req.protop; curl_off_t bytessent; curl_off_t expectsend = -1; /* default is unknown */ @@ -946,7 +962,7 @@ static size_t readmoredata(char *buffer, void *userp) { struct connectdata *conn = (struct connectdata *)userp; - struct HTTP *http = conn->data->state.proto.http; + struct HTTP *http = conn->data->req.protop; size_t fullsize = size * nitems; if(0 == http->postsize) @@ -1017,7 +1033,7 @@ CURLcode Curl_add_buffer_send(Curl_send_buffer *in, CURLcode res; char *ptr; size_t size; - struct HTTP *http = conn->data->state.proto.http; + struct HTTP *http = conn->data->req.protop; size_t sendsize; curl_socket_t sockfd; size_t headersize; @@ -1400,7 +1416,7 @@ CURLcode Curl_http_done(struct connectdata *conn, CURLcode status, bool premature) { struct SessionHandle *data = conn->data; - struct HTTP *http =data->state.proto.http; + struct HTTP *http =data->req.protop; Curl_unencode_cleanup(conn); @@ -1440,6 +1456,7 @@ CURLcode Curl_http_done(struct connectdata *conn, if(!premature && /* this check is pointless when DONE is called before the entire operation is complete */ !conn->bits.retry && + !data->set.connect_only && ((http->readbytecount + data->req.headerbytecount - data->req.deductheadercount)) <= 0) { @@ -1454,14 +1471,19 @@ CURLcode Curl_http_done(struct connectdata *conn, } -/* Determine if we should use HTTP 1.1 for this request. Reasons to avoid it - are if the user specifically requested HTTP 1.0, if the server we are - connected to only supports 1.0, or if any server previously contacted to - handle this request only supports 1.0. */ -static bool use_http_1_1(const struct SessionHandle *data, - const struct connectdata *conn) +/* + * Determine if we should use HTTP 1.1 (OR BETTER) for this request. Reasons + * to avoid it include: + * + * - if the user specifically requested HTTP 1.0 + * - if the server we are connected to only supports 1.0 + * - if any server previously contacted to handle this request only supports + * 1.0. + */ +static bool use_http_1_1plus(const struct SessionHandle *data, + const struct connectdata *conn) { - return ((data->set.httpversion == CURL_HTTP_VERSION_1_1) || + return ((data->set.httpversion >= CURL_HTTP_VERSION_1_1) || ((data->set.httpversion != CURL_HTTP_VERSION_1_0) && ((conn->httpversion == 11) || ((conn->httpversion != 10) && @@ -1477,7 +1499,7 @@ static CURLcode expect100(struct SessionHandle *data, const char *ptr; data->state.expect100header = FALSE; /* default to false unless it is set to TRUE below */ - if(use_http_1_1(data, conn)) { + if(use_http_1_1plus(data, conn)) { /* if not doing HTTP 1.0 or disabled explicitly, we add a Expect: 100-continue to the headers which actually speeds up post operations (as there is one packet coming back from the web server) */ @@ -1653,20 +1675,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done) the rest of the request in the PERFORM phase. */ *done = TRUE; - /* If there already is a protocol-specific struct allocated for this - sessionhandle, deal with it */ - Curl_reset_reqproto(conn); - - if(!data->state.proto.http) { - /* Only allocate this struct if we don't already have it! */ - - http = calloc(1, sizeof(struct HTTP)); - if(!http) - return CURLE_OUT_OF_MEMORY; - data->state.proto.http = http; - } - else - http = data->state.proto.http; + http = data->req.protop; if(!data->state.this_is_a_follow) { /* this is not a followed location, get the original host name */ @@ -1737,8 +1746,11 @@ CURLcode Curl_http(struct connectdata *conn, bool *done) conn->bits.authneg = FALSE; Curl_safefree(conn->allocptr.ref); - if(data->change.referer && !Curl_checkheaders(data, "Referer:")) + if(data->change.referer && !Curl_checkheaders(data, "Referer:")) { conn->allocptr.ref = aprintf("Referer: %s\r\n", data->change.referer); + if(!conn->allocptr.ref) + return CURLE_OUT_OF_MEMORY; + } else conn->allocptr.ref = NULL; @@ -1790,7 +1802,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done) if(conn->bits.authneg) /* don't enable chunked during auth neg */ ; - else if(use_http_1_1(data, conn)) { + else if(use_http_1_1plus(data, conn)) { /* HTTP, upload, unknown file size and not HTTP 1.0 */ data->req.upload_chunky = TRUE; } @@ -2090,7 +2102,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done) /* Use 1.1 unless the user specifically asked for 1.0 or the server only supports 1.0 */ - httpstring= use_http_1_1(data, conn)?"1.1":"1.0"; + httpstring= use_http_1_1plus(data, conn)?"1.1":"1.0"; /* initialize a dynamic send-buffer */ req_buffer = Curl_add_buffer_init(); @@ -2168,6 +2180,15 @@ CURLcode Curl_http(struct connectdata *conn, bool *done) if(result) return result; + if(!(conn->handler->flags&PROTOPT_SSL) && + (data->set.httpversion == CURL_HTTP_VERSION_2_0)) { + /* append HTTP2 updrade magic stuff to the HTTP request if it isn't done + over SSL */ + result = Curl_http2_request(req_buffer, conn); + if(result) + return result; + } + #if !defined(CURL_DISABLE_COOKIES) if(data->cookies || addcookies) { struct Cookie *co=NULL; /* no cookies from start */ @@ -3148,13 +3169,19 @@ CURLcode Curl_http_readwrite_headers(struct SessionHandle *data, } else if(conn->httpversion >= 11 && !conn->bits.close) { + struct connectbundle *cb_ptr; /* If HTTP version is >= 1.1 and connection is persistent server supports pipelining. */ DEBUGF(infof(data, "HTTP 1.1 or later with persistent connection, " "pipelining supported\n")); - conn->server_supports_pipelining = TRUE; + /* Activate pipelining if needed */ + cb_ptr = conn->bundle; + if(cb_ptr) { + if(!Curl_pipeline_site_blacklisted(data, conn)) + cb_ptr->server_supports_pipelining = TRUE; + } } switch(k->httpcode) { @@ -3231,6 +3258,16 @@ CURLcode Curl_http_readwrite_headers(struct SessionHandle *data, data->info.contenttype = contenttype; } } + else if(checkprefix("Server:", k->p)) { + char *server_name = copy_header_value(k->p); + + /* Turn off pipelining if the server version is blacklisted */ + if(conn->bundle && conn->bundle->server_supports_pipelining) { + if(Curl_pipeline_server_blacklisted(data, server_name)) + conn->bundle->server_supports_pipelining = FALSE; + } + Curl_safefree(server_name); + } else if((conn->httpversion == 10) && conn->bits.httpproxy && Curl_compareheader(k->p, diff --git a/plugins/FTPFileYM/curl/lib/http.h b/plugins/FTPFileYM/curl/lib/http.h index 7236dd88ca..a506238a66 100644 --- a/plugins/FTPFileYM/curl/lib/http.h +++ b/plugins/FTPFileYM/curl/lib/http.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -21,8 +21,14 @@ * KIND, either express or implied. * ***************************************************************************/ +#include "curl_setup.h" + #ifndef CURL_DISABLE_HTTP +#ifdef USE_NGHTTP2 +#include <nghttp2/nghttp2.h> +#endif + extern const struct Curl_handler Curl_handler_http; #ifdef USE_SSL @@ -66,6 +72,7 @@ CURLcode Curl_add_custom_headers(struct connectdata *conn, CURLcode Curl_http(struct connectdata *conn, bool *done); CURLcode Curl_http_done(struct connectdata *, CURLcode, bool premature); CURLcode Curl_http_connect(struct connectdata *conn, bool *done); +CURLcode Curl_http_setup_conn(struct connectdata *conn); /* The following functions are defined in http_chunks.c */ void Curl_httpchunk_init(struct connectdata *conn); @@ -141,6 +148,14 @@ struct HTTP { points to an allocated send_buffer struct */ }; +struct http_conn { +#ifdef USE_NGHTTP2 + nghttp2_session *h2; +#else + int unused; /* prevent a compiler warning */ +#endif +}; + CURLcode Curl_http_readwrite_headers(struct SessionHandle *data, struct connectdata *conn, ssize_t *nread, diff --git a/plugins/FTPFileYM/curl/lib/http2.c b/plugins/FTPFileYM/curl/lib/http2.c new file mode 100644 index 0000000000..b876436e1a --- /dev/null +++ b/plugins/FTPFileYM/curl/lib/http2.c @@ -0,0 +1,182 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "curl_setup.h" + +#ifdef USE_NGHTTP2 +#define _MPRINTF_REPLACE +#include <curl/mprintf.h> + +#include <nghttp2/nghttp2.h> +#include "urldata.h" +#include "http2.h" +#include "http.h" +#include "sendf.h" +#include "curl_base64.h" +#include "curl_memory.h" + +/* include memdebug.h last */ +#include "memdebug.h" + +/* + * Store nghttp2 version info in this buffer, Prefix with a space. Return + * total length written. + */ +int Curl_http2_ver(char *p, size_t len) +{ + nghttp2_info *h2 = nghttp2_version(0); + return snprintf(p, len, " nghttp2/%s", h2->version_str); +} + +/* + * The implementation of nghttp2_send_callback type. Here we write |data| with + * size |length| to the network and return the number of bytes actually + * written. See the documentation of nghttp2_send_callback for the details. + */ +static ssize_t send_callback(nghttp2_session *h2, + const uint8_t *data, size_t length, int flags, + void *userp) +{ + struct connectdata *conn = (struct connectdata *)userp; + ssize_t written; + CURLcode rc = + Curl_write(conn, conn->sock[0], data, length, &written); + (void)h2; + (void)flags; + + if(rc) { + failf(conn->data, "Failed sending HTTP2 data"); + return NGHTTP2_ERR_CALLBACK_FAILURE; + } + else if(!written) + return NGHTTP2_ERR_WOULDBLOCK; + + return written; +} + +/* + * The implementation of nghttp2_recv_callback type. Here we read data from + * the network and write them in |buf|. The capacity of |buf| is |length| + * bytes. Returns the number of bytes stored in |buf|. See the documentation + * of nghttp2_recv_callback for the details. + */ +static ssize_t recv_callback(nghttp2_session *h2, + uint8_t *buf, size_t length, int flags, + void *userp) +{ + struct connectdata *conn = (struct connectdata *)userp; + ssize_t nread; + CURLcode rc = Curl_read(conn, conn->sock[0], (char *)buf, length, &nread); + (void)h2; + (void)flags; + + if(rc) { + failf(conn->data, "Failed recving HTTP2 data"); + return NGHTTP2_ERR_CALLBACK_FAILURE; + } + if(!nread) + return NGHTTP2_ERR_WOULDBLOCK; + + return nread; +} + +/* + * This is all callbacks nghttp2 calls + */ +static const nghttp2_session_callbacks callbacks = { + send_callback, + recv_callback, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL +}; + +/* + * The HTTP2 settings we send in the Upgrade request + */ +static nghttp2_settings_entry settings[] = { + { NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS, 100 }, + { NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE, NGHTTP2_INITIAL_WINDOW_SIZE }, +}; + +/* + * Append headers to ask for a HTTP1.1 to HTTP2 upgrade. + */ +CURLcode Curl_http2_request(Curl_send_buffer *req, + struct connectdata *conn) +{ + uint8_t binsettings[80]; + CURLcode result; + ssize_t binlen; + char *base64; + size_t blen; + + if(!conn->proto.httpc.h2) { + /* The nghttp2 session is not yet setup, do it */ + int rc = nghttp2_session_client_new(&conn->proto.httpc.h2, + &callbacks, &conn); + if(rc) { + failf(conn->data, "Couldn't initialize nghttp2!"); + return CURLE_OUT_OF_MEMORY; /* most likely at least */ + } + } + + /* As long as we have a fixed set of settings, we don't have to dynamically + * figure out the base64 strings since it'll always be the same. However, + * the settings will likely not be fixed every time in the future. + */ + + /* this returns number of bytes it wrote */ + binlen = nghttp2_pack_settings_payload(binsettings, + sizeof(binsettings), + settings, + sizeof(settings)/sizeof(settings[0])); + if(!binlen) { + failf(conn->data, "nghttp2 unexpectedly failed on pack_settings_payload"); + return CURLE_FAILED_INIT; + } + + result = Curl_base64_encode(conn->data, (const char *)binsettings, binlen, + &base64, &blen); + if(result) + return result; + + result = Curl_add_bufferf(req, + "Connection: Upgrade, HTTP2-Settings\r\n" + "Upgrade: %s\r\n" + "HTTP2-Settings: %s\r\n", + NGHTTP2_PROTO_VERSION_ID, base64); + free(base64); + + return result; +} + +#endif diff --git a/plugins/FTPFileYM/curl/docs/examples/imap.c b/plugins/FTPFileYM/curl/lib/http2.h index ba07f022aa..09b91d1122 100644 --- a/plugins/FTPFileYM/curl/docs/examples/imap.c +++ b/plugins/FTPFileYM/curl/lib/http2.h @@ -1,3 +1,5 @@ +#ifndef HEADER_CURL_HTTP2_H +#define HEADER_CURL_HTTP2_H /*************************************************************************** * _ _ ____ _ * Project ___| | | | _ \| | @@ -5,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -19,26 +21,22 @@ * KIND, either express or implied. * ***************************************************************************/ -#include <stdio.h> -#include <curl/curl.h> -int main(void) -{ - CURL *curl; - CURLcode res = CURLE_OK; +#include "curl_setup.h" - curl = curl_easy_init(); - if(curl) { - /* Set username and password */ - curl_easy_setopt(curl, CURLOPT_USERPWD, "user:password"); +#ifdef USE_NGHTTP2 +#include "http.h" +/* + * Store nghttp2 version info in this buffer, Prefix with a space. Return + * total length written. + */ +int Curl_http2_ver(char *p, size_t len); - /* This will fetch the mailbox named "foobar" */ - curl_easy_setopt(curl, CURLOPT_URL, "imap://imap.example.com/foobar"); +CURLcode Curl_http2_request(Curl_send_buffer *req, + struct connectdata *conn); +#else /* USE_NGHTTP2 */ +#define Curl_http2_request(x,y) CURLE_OK +#endif - res = curl_easy_perform(curl); +#endif /* HEADER_CURL_HTTP2_H */ - /* always cleanup */ - curl_easy_cleanup(curl); - } - return (int)res; -} diff --git a/plugins/FTPFileYM/curl/lib/http_digest.c b/plugins/FTPFileYM/curl/lib/http_digest.c index f9f20d487f..f50f8033f9 100644 --- a/plugins/FTPFileYM/curl/lib/http_digest.c +++ b/plugins/FTPFileYM/curl/lib/http_digest.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -25,14 +25,13 @@ #if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_CRYPTO_AUTH) #include "urldata.h" -#include "sendf.h" #include "rawstr.h" #include "curl_base64.h" #include "curl_md5.h" #include "http_digest.h" #include "strtok.h" -#include "url.h" /* for Curl_safefree() */ #include "curl_memory.h" +#include "sslgen.h" /* for Curl_rand() */ #include "non-ascii.h" /* included for Curl_convert_... prototypes */ #include "warnless.h" @@ -267,6 +266,38 @@ static void md5_to_ascii(unsigned char *source, /* 16 bytes */ snprintf((char *)&dest[i*2], 3, "%02x", source[i]); } +/* Perform quoted-string escaping as described in RFC2616 and its errata */ +static char *string_quoted(const char *source) +{ + char *dest, *d; + const char *s = source; + size_t n = 1; /* null terminator */ + + /* Calculate size needed */ + while(*s) { + ++n; + if(*s == '"' || *s == '\\') { + ++n; + } + ++s; + } + + dest = malloc(n); + if(dest) { + s = source; + d = dest; + while(*s) { + if(*s == '"' || *s == '\\') { + *d++ = '\\'; + } + *d++ = *s++; + } + *d = 0; + } + + return dest; +} + CURLcode Curl_output_digest(struct connectdata *conn, bool proxy, const unsigned char *request, @@ -278,16 +309,16 @@ CURLcode Curl_output_digest(struct connectdata *conn, unsigned char md5buf[16]; /* 16 bytes/128 bits */ unsigned char request_digest[33]; unsigned char *md5this; - unsigned char *ha1; + unsigned char ha1[33];/* 32 digits and 1 zero byte */ unsigned char ha2[33];/* 32 digits and 1 zero byte */ char cnoncebuf[33]; char *cnonce = NULL; size_t cnonce_sz = 0; char *tmp = NULL; - struct timeval now; - char **allocuserpwd; + size_t userlen; const char *userp; + char *userp_quoted; const char *passwdp; struct auth *authp; @@ -320,10 +351,7 @@ CURLcode Curl_output_digest(struct connectdata *conn, authp = &data->state.authhost; } - if(*allocuserpwd) { - Curl_safefree(*allocuserpwd); - *allocuserpwd = NULL; - } + Curl_safefree(*allocuserpwd); /* not set means empty */ if(!userp) @@ -342,10 +370,11 @@ CURLcode Curl_output_digest(struct connectdata *conn, d->nc = 1; if(!d->cnonce) { - /* Generate a cnonce */ - now = Curl_tvnow(); - snprintf(cnoncebuf, sizeof(cnoncebuf), "%32ld", - (long)now.tv_sec + now.tv_usec); + struct timeval now = Curl_tvnow(); + snprintf(cnoncebuf, sizeof(cnoncebuf), "%08x%08x%08x%08x", + Curl_rand(data), Curl_rand(data), + (unsigned int)now.tv_sec, + (unsigned int)now.tv_usec); rc = Curl_base64_encode(data, cnoncebuf, strlen(cnoncebuf), &cnonce, &cnonce_sz); @@ -372,12 +401,7 @@ CURLcode Curl_output_digest(struct connectdata *conn, CURL_OUTPUT_DIGEST_CONV(data, md5this); /* convert on non-ASCII machines */ Curl_md5it(md5buf, md5this); - free(md5this); /* free this again */ - - ha1 = malloc(33); /* 32 digits and 1 zero byte */ - if(!ha1) - return CURLE_OUT_OF_MEMORY; - + Curl_safefree(md5this); md5_to_ascii(md5buf, ha1); if(d->algo == CURLDIGESTALGO_MD5SESS) { @@ -387,7 +411,7 @@ CURLcode Curl_output_digest(struct connectdata *conn, return CURLE_OUT_OF_MEMORY; CURL_OUTPUT_DIGEST_CONV(data, tmp); /* convert on non-ASCII machines */ Curl_md5it(md5buf, (unsigned char *)tmp); - free(tmp); /* free this again */ + Curl_safefree(tmp); md5_to_ascii(md5buf, ha1); } @@ -424,19 +448,21 @@ CURLcode Curl_output_digest(struct connectdata *conn, else md5this = (unsigned char *)aprintf("%s:%s", request, uripath); - if(!md5this) { - free(ha1); - return CURLE_OUT_OF_MEMORY; - } - if(d->qop && Curl_raw_equal(d->qop, "auth-int")) { - /* We don't support auth-int at the moment. I can't see a easy way to get - entity-body here */ - /* TODO: Append H(entity-body)*/ + /* We don't support auth-int for PUT or POST at the moment. + TODO: replace md5 of empty string with entity-body for PUT/POST */ + unsigned char *md5this2 = (unsigned char *) + aprintf("%s:%s", md5this, "d41d8cd98f00b204e9800998ecf8427e"); + Curl_safefree(md5this); + md5this = md5this2; } + + if(!md5this) + return CURLE_OUT_OF_MEMORY; + CURL_OUTPUT_DIGEST_CONV(data, md5this); /* convert on non-ASCII machines */ Curl_md5it(md5buf, md5this); - free(md5this); /* free this again */ + Curl_safefree(md5this); md5_to_ascii(md5buf, ha2); if(d->qop) { @@ -454,20 +480,30 @@ CURLcode Curl_output_digest(struct connectdata *conn, d->nonce, ha2); } - free(ha1); if(!md5this) return CURLE_OUT_OF_MEMORY; CURL_OUTPUT_DIGEST_CONV(data, md5this); /* convert on non-ASCII machines */ Curl_md5it(md5buf, md5this); - free(md5this); /* free this again */ + Curl_safefree(md5this); md5_to_ascii(md5buf, request_digest); /* for test case 64 (snooped from a Mozilla 1.3a request) Authorization: Digest username="testuser", realm="testrealm", \ nonce="1053604145", uri="/64", response="c55f7f30d83d774a3d2dcacf725abaca" + + Digest parameters are all quoted strings. Username which is provided by + the user will need double quotes and backslashes within it escaped. For + the other fields, this shouldn't be an issue. realm, nonce, and opaque + are copied as is from the server, escapes and all. cnonce is generated + with web-safe characters. uri is already percent encoded. nc is 8 hex + characters. algorithm and qop with standard values only contain web-safe + chracters. */ + userp_quoted = string_quoted(userp); + if(!userp_quoted) + return CURLE_OUT_OF_MEMORY; if(d->qop) { *allocuserpwd = @@ -481,7 +517,7 @@ CURLcode Curl_output_digest(struct connectdata *conn, "qop=%s, " "response=\"%s\"", proxy?"Proxy-":"", - userp, + userp_quoted, d->realm, d->nonce, uripath, /* this is the PATH part of the URL */ @@ -504,12 +540,13 @@ CURLcode Curl_output_digest(struct connectdata *conn, "uri=\"%s\", " "response=\"%s\"", proxy?"Proxy-":"", - userp, + userp_quoted, d->realm, d->nonce, uripath, /* this is the PATH part of the URL */ request_digest); } + Curl_safefree(userp_quoted); if(!*allocuserpwd) return CURLE_OUT_OF_MEMORY; @@ -533,10 +570,11 @@ CURLcode Curl_output_digest(struct connectdata *conn, } /* append CRLF + zero (3 bytes) to the userpwd header */ - tmp = realloc(*allocuserpwd, strlen(*allocuserpwd) + 3); + userlen = strlen(*allocuserpwd); + tmp = realloc(*allocuserpwd, userlen + 3); if(!tmp) return CURLE_OUT_OF_MEMORY; - strcat(tmp, "\r\n"); + strcpy(&tmp[userlen], "\r\n"); /* append the data */ *allocuserpwd = tmp; return CURLE_OK; @@ -544,29 +582,12 @@ CURLcode Curl_output_digest(struct connectdata *conn, static void digest_cleanup_one(struct digestdata *d) { - if(d->nonce) - free(d->nonce); - d->nonce = NULL; - - if(d->cnonce) - free(d->cnonce); - d->cnonce = NULL; - - if(d->realm) - free(d->realm); - d->realm = NULL; - - if(d->opaque) - free(d->opaque); - d->opaque = NULL; - - if(d->qop) - free(d->qop); - d->qop = NULL; - - if(d->algorithm) - free(d->algorithm); - d->algorithm = NULL; + Curl_safefree(d->nonce); + Curl_safefree(d->cnonce); + Curl_safefree(d->realm); + Curl_safefree(d->opaque); + Curl_safefree(d->qop); + Curl_safefree(d->algorithm); d->nc = 0; d->algo = CURLDIGESTALGO_MD5; /* default algorithm */ diff --git a/plugins/FTPFileYM/curl/lib/http_negotiate.c b/plugins/FTPFileYM/curl/lib/http_negotiate.c index 535a4279e2..9b981b3327 100644 --- a/plugins/FTPFileYM/curl/lib/http_negotiate.c +++ b/plugins/FTPFileYM/curl/lib/http_negotiate.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -135,7 +135,7 @@ int Curl_input_negotiate(struct connectdata *conn, bool proxy, struct SessionHandle *data = conn->data; struct negotiatedata *neg_ctx = proxy?&data->state.proxyneg: &data->state.negotiate; - OM_uint32 major_status, minor_status, minor_status2; + OM_uint32 major_status, minor_status, discard_st; gss_buffer_desc input_token = GSS_C_EMPTY_BUFFER; gss_buffer_desc output_token = GSS_C_EMPTY_BUFFER; int ret; @@ -192,46 +192,50 @@ int Curl_input_negotiate(struct connectdata *conn, bool proxy, return -1; input_token.length = rawlen; + DEBUGASSERT(input_token.value != NULL); + #ifdef HAVE_SPNEGO /* Handle SPNEGO */ if(checkprefix("Negotiate", header)) { - ASN1_OBJECT * object = NULL; - unsigned char * spnegoToken = NULL; + unsigned char *spnegoToken = NULL; size_t spnegoTokenLength = 0; - unsigned char * mechToken = NULL; - size_t mechTokenLength = 0; - - if(input_token.value == NULL) - return CURLE_OUT_OF_MEMORY; + gss_buffer_desc mechToken = GSS_C_EMPTY_BUFFER; spnegoToken = malloc(input_token.length); - if(spnegoToken == NULL) + if(spnegoToken == NULL) { + Curl_safefree(input_token.value); return CURLE_OUT_OF_MEMORY; - + } + memcpy(spnegoToken, input_token.value, input_token.length); spnegoTokenLength = input_token.length; - object = OBJ_txt2obj ("1.2.840.113554.1.2.2", 1); if(!parseSpnegoTargetToken(spnegoToken, spnegoTokenLength, NULL, NULL, - &mechToken, - &mechTokenLength, + (unsigned char**)&mechToken.value, + &mechToken.length, NULL, NULL)) { - free(spnegoToken); - spnegoToken = NULL; + Curl_safefree(spnegoToken); infof(data, "Parse SPNEGO Target Token failed\n"); } + else if(!mechToken.value || !mechToken.length) { + Curl_safefree(spnegoToken); + if(mechToken.value) + gss_release_buffer(&discard_st, &mechToken); + infof(data, "Parse SPNEGO Target Token succeeded (NULL token)\n"); + } else { - free(input_token.value); - input_token.value = malloc(mechTokenLength); - if(input_token.value == NULL) + Curl_safefree(spnegoToken); + Curl_safefree(input_token.value); + input_token.value = malloc(mechToken.length); + if(input_token.value == NULL) { + gss_release_buffer(&discard_st, &mechToken); return CURLE_OUT_OF_MEMORY; - - memcpy(input_token.value, mechToken,mechTokenLength); - input_token.length = mechTokenLength; - free(mechToken); - mechToken = NULL; + } + memcpy(input_token.value, mechToken.value, mechToken.length); + input_token.length = mechToken.length; + gss_release_buffer(&discard_st, &mechToken); infof(data, "Parse SPNEGO Target Token succeeded\n"); } } @@ -246,23 +250,23 @@ int Curl_input_negotiate(struct connectdata *conn, bool proxy, &input_token, &output_token, NULL); - if(input_token.length > 0) - gss_release_buffer(&minor_status2, &input_token); + Curl_safefree(input_token.value); + neg_ctx->status = major_status; if(GSS_ERROR(major_status)) { - /* Curl_cleanup_negotiate(data) ??? */ - log_gss_error(conn, minor_status, - "gss_init_sec_context() failed: "); + if(output_token.value) + gss_release_buffer(&discard_st, &output_token); + log_gss_error(conn, minor_status, "gss_init_sec_context() failed: "); return -1; } - if(output_token.length == 0) { + if(!output_token.value || !output_token.length) { + if(output_token.value) + gss_release_buffer(&discard_st, &output_token); return -1; } neg_ctx->output_token = output_token; - /* conn->bits.close = FALSE; */ - return 0; } @@ -275,14 +279,14 @@ CURLcode Curl_output_negotiate(struct connectdata *conn, bool proxy) size_t len = 0; char *userp; CURLcode error; + OM_uint32 discard_st; #ifdef HAVE_SPNEGO /* Handle SPNEGO */ if(checkprefix("Negotiate", neg_ctx->protocol)) { - ASN1_OBJECT * object = NULL; - unsigned char * spnegoToken = NULL; - size_t spnegoTokenLength = 0; - unsigned char * responseToken = NULL; + ASN1_OBJECT *object = NULL; + unsigned char *responseToken = NULL; size_t responseTokenLength = 0; + gss_buffer_desc spnegoToken = GSS_C_EMPTY_BUFFER; responseToken = malloc(neg_ctx->output_token.length); if(responseToken == NULL) @@ -291,30 +295,34 @@ CURLcode Curl_output_negotiate(struct connectdata *conn, bool proxy) neg_ctx->output_token.length); responseTokenLength = neg_ctx->output_token.length; - object=OBJ_txt2obj ("1.2.840.113554.1.2.2", 1); - if(!makeSpnegoInitialToken (object, - responseToken, - responseTokenLength, - &spnegoToken, - &spnegoTokenLength)) { - free(responseToken); - responseToken = NULL; + object = OBJ_txt2obj("1.2.840.113554.1.2.2", 1); + if(!object) { + Curl_safefree(responseToken); + return CURLE_OUT_OF_MEMORY; + } + + if(!makeSpnegoInitialToken(object, + responseToken, + responseTokenLength, + (unsigned char**)&spnegoToken.value, + &spnegoToken.length)) { + Curl_safefree(responseToken); + ASN1_OBJECT_free(object); infof(conn->data, "Make SPNEGO Initial Token failed\n"); } + else if(!spnegoToken.value || !spnegoToken.length) { + Curl_safefree(responseToken); + ASN1_OBJECT_free(object); + if(spnegoToken.value) + gss_release_buffer(&discard_st, &spnegoToken); + infof(conn->data, "Make SPNEGO Initial Token succeeded (NULL token)\n"); + } else { - free(responseToken); - responseToken = NULL; - free(neg_ctx->output_token.value); - neg_ctx->output_token.value = malloc(spnegoTokenLength); - if(neg_ctx->output_token.value == NULL) { - free(spnegoToken); - spnegoToken = NULL; - return CURLE_OUT_OF_MEMORY; - } - memcpy(neg_ctx->output_token.value, spnegoToken,spnegoTokenLength); - neg_ctx->output_token.length = spnegoTokenLength; - free(spnegoToken); - spnegoToken = NULL; + Curl_safefree(responseToken); + ASN1_OBJECT_free(object); + gss_release_buffer(&discard_st, &neg_ctx->output_token); + neg_ctx->output_token.value = spnegoToken.value; + neg_ctx->output_token.length = spnegoToken.length; infof(conn->data, "Make SPNEGO Initial Token succeeded\n"); } } @@ -324,26 +332,33 @@ CURLcode Curl_output_negotiate(struct connectdata *conn, bool proxy) neg_ctx->output_token.length, &encoded, &len); if(error) { - Curl_safefree(neg_ctx->output_token.value); + gss_release_buffer(&discard_st, &neg_ctx->output_token); neg_ctx->output_token.value = NULL; + neg_ctx->output_token.length = 0; return error; } - if(len == 0) { - Curl_safefree(neg_ctx->output_token.value); + if(!encoded || !len) { + gss_release_buffer(&discard_st, &neg_ctx->output_token); neg_ctx->output_token.value = NULL; + neg_ctx->output_token.length = 0; return CURLE_REMOTE_ACCESS_DENIED; } userp = aprintf("%sAuthorization: %s %s\r\n", proxy ? "Proxy-" : "", neg_ctx->protocol, encoded); - - if(proxy) + if(proxy) { + Curl_safefree(conn->allocptr.proxyuserpwd); conn->allocptr.proxyuserpwd = userp; - else + } + else { + Curl_safefree(conn->allocptr.userpwd); conn->allocptr.userpwd = userp; - free(encoded); - Curl_cleanup_negotiate (conn->data); + } + + Curl_safefree(encoded); + Curl_cleanup_negotiate(conn->data); + return (userp == NULL) ? CURLE_OUT_OF_MEMORY : CURLE_OK; } @@ -353,7 +368,7 @@ static void cleanup(struct negotiatedata *neg_ctx) if(neg_ctx->context != GSS_C_NO_CONTEXT) gss_delete_sec_context(&minor_status, &neg_ctx->context, GSS_C_NO_BUFFER); - if(neg_ctx->output_token.length != 0) + if(neg_ctx->output_token.value) gss_release_buffer(&minor_status, &neg_ctx->output_token); if(neg_ctx->server_name != GSS_C_NO_NAME) diff --git a/plugins/FTPFileYM/curl/lib/http_proxy.c b/plugins/FTPFileYM/curl/lib/http_proxy.c index 4f17ce2f60..6a555525d1 100644 --- a/plugins/FTPFileYM/curl/lib/http_proxy.c +++ b/plugins/FTPFileYM/curl/lib/http_proxy.c @@ -66,13 +66,13 @@ CURLcode Curl_proxy_connect(struct connectdata *conn) * This function might be called several times in the multi interface case * if the proxy's CONNTECT response is not instant. */ - prot_save = conn->data->state.proto.generic; + prot_save = conn->data->req.protop; memset(&http_proxy, 0, sizeof(http_proxy)); - conn->data->state.proto.http = &http_proxy; + conn->data->req.protop = &http_proxy; conn->bits.close = FALSE; result = Curl_proxyCONNECT(conn, FIRSTSOCKET, conn->host.name, conn->remote_port); - conn->data->state.proto.generic = prot_save; + conn->data->req.protop = prot_save; if(CURLE_OK != result) return result; #else @@ -356,6 +356,10 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn, result = Curl_client_write(conn, writetype, line_start, perline); + + data->info.header_size += (long)perline; + data->req.headerbytecount += (long)perline; + if(result) return result; @@ -560,6 +564,8 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn, infof (data, "Proxy replied OK to CONNECT request\n"); data->req.ignorebody = FALSE; /* put it (back) to non-ignore state */ + conn->bits.rewindaftersend = FALSE; /* make sure this isn't set for the + document request */ return CURLE_OK; } #endif /* CURL_DISABLE_PROXY */ diff --git a/plugins/FTPFileYM/curl/lib/if2ip.c b/plugins/FTPFileYM/curl/lib/if2ip.c index 558e30f15f..05ae7d6f87 100644 --- a/plugins/FTPFileYM/curl/lib/if2ip.c +++ b/plugins/FTPFileYM/curl/lib/if2ip.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -83,40 +83,63 @@ bool Curl_if_is_interface_name(const char *interf) return result; } -char *Curl_if2ip(int af, const char *interf, char *buf, int buf_size) +if2ip_result_t Curl_if2ip(int af, unsigned int remote_scope, + const char *interf, char *buf, int buf_size) { struct ifaddrs *iface, *head; - char *ip = NULL; + if2ip_result_t res = IF2IP_NOT_FOUND; + +#ifndef ENABLE_IPV6 + (void) remote_scope; +#endif if(getifaddrs(&head) >= 0) { for(iface=head; iface != NULL; iface=iface->ifa_next) { - if((iface->ifa_addr != NULL) && - (iface->ifa_addr->sa_family == af) && - curl_strequal(iface->ifa_name, interf)) { - void *addr; - char scope[12]=""; + if(iface->ifa_addr != NULL) { + if(iface->ifa_addr->sa_family == af) { + if(curl_strequal(iface->ifa_name, interf)) { + void *addr; + char *ip; + char scope[12]=""; + char ipstr[64]; #ifdef ENABLE_IPV6 - if(af == AF_INET6) { - unsigned int scopeid = 0; - addr = &((struct sockaddr_in6 *)iface->ifa_addr)->sin6_addr; + if(af == AF_INET6) { + unsigned int scopeid = 0; + addr = &((struct sockaddr_in6 *)iface->ifa_addr)->sin6_addr; #ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID - /* Include the scope of this interface as part of the address */ - scopeid = ((struct sockaddr_in6 *)iface->ifa_addr)->sin6_scope_id; + /* Include the scope of this interface as part of the address */ + scopeid = + ((struct sockaddr_in6 *)iface->ifa_addr)->sin6_scope_id; #endif - if(scopeid) - snprintf(scope, sizeof(scope), "%%%u", scopeid); - } - else + if(scopeid != remote_scope) { + /* We are interested only in interface addresses whose + scope ID matches the remote address we want to + connect to: global (0) for global, link-local for + link-local, etc... */ + if(res == IF2IP_NOT_FOUND) res = IF2IP_AF_NOT_SUPPORTED; + continue; + } + if(scopeid) + snprintf(scope, sizeof(scope), "%%%u", scopeid); + } + else #endif - addr = &((struct sockaddr_in *)iface->ifa_addr)->sin_addr; - ip = (char *) Curl_inet_ntop(af, addr, buf, buf_size); - strlcat(buf, scope, buf_size); - break; + addr = &((struct sockaddr_in *)iface->ifa_addr)->sin_addr; + res = IF2IP_FOUND; + ip = (char *) Curl_inet_ntop(af, addr, ipstr, sizeof(ipstr)); + snprintf(buf, buf_size, "%s%s", ip, scope); + break; + } + } + else if((res == IF2IP_NOT_FOUND) && + curl_strequal(iface->ifa_name, interf)) { + res = IF2IP_AF_NOT_SUPPORTED; + } } } freeifaddrs(head); } - return ip; + return res; } #elif defined(HAVE_IOCTL_SIOCGIFADDR) @@ -126,30 +149,31 @@ bool Curl_if_is_interface_name(const char *interf) /* This is here just to support the old interfaces */ char buf[256]; - char *ip = Curl_if2ip(AF_INET, interf, buf, sizeof(buf)); - - return (ip != NULL) ? TRUE : FALSE; + return (Curl_if2ip(AF_INET, 0, interf, buf, sizeof(buf)) == + IF2IP_NOT_FOUND) ? FALSE : TRUE; } -char *Curl_if2ip(int af, const char *interf, char *buf, int buf_size) +if2ip_result_t Curl_if2ip(int af, unsigned int remote_scope, + const char *interf, char *buf, int buf_size) { struct ifreq req; struct in_addr in; struct sockaddr_in *s; curl_socket_t dummy; size_t len; - char *ip; + + (void)remote_scope; if(!interf || (af != AF_INET)) - return NULL; + return IF2IP_NOT_FOUND; len = strlen(interf); if(len >= sizeof(req.ifr_name)) - return NULL; + return IF2IP_NOT_FOUND; dummy = socket(AF_INET, SOCK_STREAM, 0); if(CURL_SOCKET_BAD == dummy) - return NULL; + return IF2IP_NOT_FOUND; memset(&req, 0, sizeof(req)); memcpy(req.ifr_name, interf, len+1); @@ -157,15 +181,18 @@ char *Curl_if2ip(int af, const char *interf, char *buf, int buf_size) if(ioctl(dummy, SIOCGIFADDR, &req) < 0) { sclose(dummy); - return NULL; + /* With SIOCGIFADDR, we cannot tell the difference between an interface + that does not exist and an interface that has no address of the + correct family. Assume the interface does not exist */ + return IF2IP_NOT_FOUND; } s = (struct sockaddr_in *)&req.ifr_addr; memcpy(&in, &s->sin_addr, sizeof(in)); - ip = (char *) Curl_inet_ntop(s->sin_family, &in, buf, buf_size); + Curl_inet_ntop(s->sin_family, &in, buf, buf_size); sclose(dummy); - return ip; + return IF2IP_FOUND; } #else @@ -177,13 +204,15 @@ bool Curl_if_is_interface_name(const char *interf) return FALSE; } -char *Curl_if2ip(int af, const char *interf, char *buf, int buf_size) +if2ip_result_t Curl_if2ip(int af, unsigned int remote_scope, + const char *interf, char *buf, int buf_size) { (void) af; + (void) remote_scope; (void) interf; (void) buf; (void) buf_size; - return NULL; + return IF2IP_NOT_FOUND; } #endif diff --git a/plugins/FTPFileYM/curl/lib/if2ip.h b/plugins/FTPFileYM/curl/lib/if2ip.h index 858ec2f5b3..ac58752378 100644 --- a/plugins/FTPFileYM/curl/lib/if2ip.h +++ b/plugins/FTPFileYM/curl/lib/if2ip.h @@ -24,7 +24,15 @@ #include "curl_setup.h" bool Curl_if_is_interface_name(const char *interf); -char *Curl_if2ip(int af, const char *interf, char *buf, int buf_size); + +typedef enum { + IF2IP_NOT_FOUND = 0, /* Interface not found */ + IF2IP_AF_NOT_SUPPORTED = 1, /* Int. exists but has no address for this af */ + IF2IP_FOUND = 2 /* The address has been stored in "buf" */ +} if2ip_result_t; + +if2ip_result_t Curl_if2ip(int af, unsigned int remote_scope, + const char *interf, char *buf, int buf_size); #ifdef __INTERIX diff --git a/plugins/FTPFileYM/curl/lib/imap.c b/plugins/FTPFileYM/curl/lib/imap.c index 72ec871f92..9a845102ad 100644 --- a/plugins/FTPFileYM/curl/lib/imap.c +++ b/plugins/FTPFileYM/curl/lib/imap.c @@ -24,7 +24,9 @@ * RFC3501 IMAPv4 protocol * RFC4422 Simple Authentication and Security Layer (SASL) * RFC4616 PLAIN authentication + * RFC4959 IMAP Extension for SASL Initial Client Response * RFC5092 IMAP URL Scheme + * RFC6749 OAuth 2.0 Authorization Framework * ***************************************************************************/ @@ -76,6 +78,7 @@ #include "url.h" #include "rawstr.h" #include "curl_sasl.h" +#include "warnless.h" #define _MPRINTF_REPLACE /* use our functions only */ #include <curl/mprintf.h> @@ -85,7 +88,6 @@ #include "memdebug.h" /* Local API functions */ -static CURLcode imap_parse_url_path(struct connectdata *conn); static CURLcode imap_regular_transfer(struct connectdata *conn, bool *done); static CURLcode imap_do(struct connectdata *conn, bool *done); static CURLcode imap_done(struct connectdata *conn, CURLcode status, @@ -97,7 +99,11 @@ static int imap_getsock(struct connectdata *conn, curl_socket_t *socks, int numsocks); static CURLcode imap_doing(struct connectdata *conn, bool *dophase_done); static CURLcode imap_setup_connection(struct connectdata *conn); -static CURLcode imap_state_upgrade_tls(struct connectdata *conn); +static char *imap_atom(const char *str); +static CURLcode imap_sendf(struct connectdata *conn, const char *fmt, ...); +static CURLcode imap_parse_url_options(struct connectdata *conn); +static CURLcode imap_parse_url_path(struct connectdata *conn); +static CURLcode imap_parse_custom_request(struct connectdata *conn); /* * IMAP protocol handler. @@ -158,7 +164,7 @@ const struct Curl_handler Curl_handler_imaps = { static const struct Curl_handler Curl_handler_imap_proxy = { "IMAP", /* scheme */ - ZERO_NULL, /* setup_connection */ + Curl_http_setup_conn, /* setup_connection */ Curl_http, /* do_it */ Curl_http_done, /* done */ ZERO_NULL, /* do_more */ @@ -183,7 +189,7 @@ static const struct Curl_handler Curl_handler_imap_proxy = { static const struct Curl_handler Curl_handler_imaps_proxy = { "IMAPS", /* scheme */ - ZERO_NULL, /* setup_connection */ + Curl_http_setup_conn, /* setup_connection */ Curl_http, /* do_it */ Curl_http_done, /* done */ ZERO_NULL, /* do_more */ @@ -203,227 +209,173 @@ static const struct Curl_handler Curl_handler_imaps_proxy = { #endif #endif +#ifdef USE_SSL +static void imap_to_imaps(struct connectdata *conn) +{ + conn->handler = &Curl_handler_imaps; +} +#else +#define imap_to_imaps(x) Curl_nop_stmt +#endif + /*********************************************************************** * - * imap_sendf() + * imap_matchresp() * - * Sends the formated string as an IMAP command to the server. + * Determines whether the untagged response is related to the specified + * command by checking if it is in format "* <command-name> ..." or + * "* <number> <command-name> ...". * - * Designed to never block. + * The "* " marker is assumed to have already been checked by the caller. */ -static CURLcode imap_sendf(struct connectdata *conn, - const char *idstr, /* command id to wait for */ - const char *fmt, ...) +static bool imap_matchresp(const char *line, size_t len, const char *cmd) { - CURLcode res; - struct imap_conn *imapc = &conn->proto.imapc; - va_list ap; - va_start(ap, fmt); - - imapc->idstr = idstr; + const char *end = line + len; + size_t cmd_len = strlen(cmd); - res = Curl_pp_vsendf(&imapc->pp, fmt, ap); + /* Skip the untagged response marker */ + line += 2; - va_end(ap); - - return res; -} + /* Do we have a number after the marker? */ + if(line < end && ISDIGIT(*line)) { + /* Skip the number */ + do + line++; + while(line < end && ISDIGIT(*line)); -static const char *getcmdid(struct connectdata *conn) -{ - static const char * const ids[]= { - "A", - "B", - "C", - "D" - }; + /* Do we have the space character? */ + if(line == end || *line != ' ') + return FALSE; - struct imap_conn *imapc = &conn->proto.imapc; + line++; + } - /* Get the next id, but wrap at end of table */ - imapc->cmdid = (int)((imapc->cmdid + 1) % (sizeof(ids) / sizeof(ids[0]))); + /* Does the command name match and is it followed by a space character or at + the end of line? */ + if(line + cmd_len <= end && Curl_raw_nequal(line, cmd, cmd_len) && + (line[cmd_len] == ' ' || line + cmd_len == end)) + return TRUE; - return ids[imapc->cmdid]; + return FALSE; } /*********************************************************************** * - * imap_atom() - * - * Checks the input string for characters that need escaping and returns an - * atom ready for sending to the server. - * - * The returned string needs to be freed. + * imap_endofresp() * + * Checks whether the given string is a valid tagged, untagged or continuation + * response which can be processed by the response handler. */ -static char* imap_atom(const char* str) +static bool imap_endofresp(struct connectdata *conn, char *line, size_t len, + int *resp) { - const char *p1; - char *p2; - size_t backsp_count = 0; - size_t quote_count = 0; - bool space_exists = FALSE; - size_t newlen = 0; - char *newstr = NULL; - - if(!str) - return NULL; + struct IMAP *imap = conn->data->req.protop; + struct imap_conn *imapc = &conn->proto.imapc; + const char *id = imapc->resptag; + size_t id_len = strlen(id); - /* Count any unescapped characters */ - p1 = str; - while(*p1) { - if(*p1 == '\\') - backsp_count++; - else if(*p1 == '"') - quote_count++; - else if(*p1 == ' ') - space_exists = TRUE; + /* Do we have a tagged command response? */ + if(len >= id_len + 1 && !memcmp(id, line, id_len) && line[id_len] == ' ') { + line += id_len + 1; + len -= id_len + 1; + + if(len >= 2 && !memcmp(line, "OK", 2)) + *resp = 'O'; + else if(len >= 2 && !memcmp(line, "NO", 2)) + *resp = 'N'; + else if(len >= 3 && !memcmp(line, "BAD", 3)) + *resp = 'B'; + else { + failf(conn->data, "Bad tagged response"); + *resp = -1; + } - p1++; + return TRUE; } - /* Does the input contain any unescapped characters? */ - if(!backsp_count && !quote_count && !space_exists) - return strdup(str); + /* Do we have an untagged command response? */ + if(len >= 2 && !memcmp("* ", line, 2)) { + switch(imapc->state) { + /* States which are interested in untagged responses */ + case IMAP_CAPABILITY: + if(!imap_matchresp(line, len, "CAPABILITY")) + return FALSE; + break; - /* Calculate the new string length */ - newlen = strlen(str) + backsp_count + quote_count + (space_exists ? 2 : 0); + case IMAP_LIST: + if((!imap->custom && !imap_matchresp(line, len, "LIST")) || + (imap->custom && !imap_matchresp(line, len, imap->custom) && + (strcmp(imap->custom, "STORE") || + !imap_matchresp(line, len, "FETCH")) && + strcmp(imap->custom, "SELECT") && + strcmp(imap->custom, "EXAMINE") && + strcmp(imap->custom, "SEARCH") && + strcmp(imap->custom, "EXPUNGE") && + strcmp(imap->custom, "LSUB") && + strcmp(imap->custom, "UID") && + strcmp(imap->custom, "NOOP"))) + return FALSE; + break; - /* Allocate the new string */ - newstr = (char *) malloc((newlen + 1) * sizeof(char)); - if(!newstr) - return NULL; + case IMAP_SELECT: + /* SELECT is special in that its untagged responses do not have a + common prefix so accept anything! */ + break; - /* Surround the string in quotes if necessary */ - p2 = newstr; - if(space_exists) { - newstr[0] = '"'; - newstr[newlen - 1] = '"'; - p2++; - } + case IMAP_FETCH: + if(!imap_matchresp(line, len, "FETCH")) + return FALSE; + break; - /* Copy the string, escaping backslash and quote characters along the way */ - p1 = str; - while(*p1) { - if(*p1 == '\\' || *p1 == '"') { - *p2 = '\\'; - p2++; + /* Ignore other untagged responses */ + default: + return FALSE; } - *p2 = *p1; - - p1++; - p2++; - } - - /* Terminate the string */ - newstr[newlen] = '\0'; - - return newstr; -} - -/* Function that checks for an ending imap status code at the start of the - given string but also detects the supported authentication mechanisms from - the CAPABILITY response. */ -static int imap_endofresp(struct pingpong *pp, int *resp) -{ - char *line = pp->linestart_resp; - size_t len = pp->nread_resp; - struct imap_conn *imapc = &pp->conn->proto.imapc; - const char *id = imapc->idstr; - size_t id_len = strlen(id); - size_t wordlen; - - /* Do we have a generic command response? */ - if(len >= id_len + 3) { - if(!memcmp(id, line, id_len) && line[id_len] == ' ') { - *resp = line[id_len + 1]; /* O, N or B */ - return TRUE; - } + *resp = '*'; + return TRUE; } - /* Do we have a generic continuation response? */ + /* Do we have a continuation response? This should be a + symbol followed by + a space and optionally some text as per RFC-3501 for the AUTHENTICATE and + APPEND commands and as outlined in Section 4. Examples of RFC-4959 but + some e-mail servers ignore this and only send a single + instead. */ if((len == 3 && !memcmp("+", line, 1)) || (len >= 2 && !memcmp("+ ", line, 2))) { - *resp = '+'; - return TRUE; - } + switch(imapc->state) { + /* States which are interested in continuation responses */ + case IMAP_AUTHENTICATE_PLAIN: + case IMAP_AUTHENTICATE_LOGIN: + case IMAP_AUTHENTICATE_LOGIN_PASSWD: + case IMAP_AUTHENTICATE_CRAMMD5: + case IMAP_AUTHENTICATE_DIGESTMD5: + case IMAP_AUTHENTICATE_DIGESTMD5_RESP: + case IMAP_AUTHENTICATE_NTLM: + case IMAP_AUTHENTICATE_NTLM_TYPE2MSG: + case IMAP_AUTHENTICATE_XOAUTH2: + case IMAP_AUTHENTICATE_FINAL: + case IMAP_APPEND: + *resp = '+'; + break; - /* Are we processing CAPABILITY command responses? */ - if(imapc->state == IMAP_CAPABILITY) { - /* Do we have a valid response? */ - if(len >= 2 && !memcmp("* ", line, 2)) { - line += 2; - len -= 2; - - /* Loop through the data line */ - for(;;) { - while(len && - (*line == ' ' || *line == '\t' || - *line == '\r' || *line == '\n')) { - - if(*line == '\n') - return FALSE; - - line++; - len--; - } - - if(!len) - break; - - /* Extract the word */ - for(wordlen = 0; wordlen < len && line[wordlen] != ' ' && - line[wordlen] != '\t' && line[wordlen] != '\r' && - line[wordlen] != '\n';) - wordlen++; - - /* Has the server explicitly disabled clear text authentication? */ - if(wordlen == 13 && !memcmp(line, "LOGINDISABLED", 13)) - imapc->login_disabled = TRUE; - - /* Do we have a SASL based authentication mechanism? */ - else if(wordlen > 5 && !memcmp(line, "AUTH=", 5)) { - line += 5; - len -= 5; - wordlen -= 5; - - /* Test the word for a matching authentication mechanism */ - if(wordlen == 5 && !memcmp(line, "LOGIN", 5)) - imapc->authmechs |= SASL_MECH_LOGIN; - if(wordlen == 5 && !memcmp(line, "PLAIN", 5)) - imapc->authmechs |= SASL_MECH_PLAIN; - else if(wordlen == 8 && !memcmp(line, "CRAM-MD5", 8)) - imapc->authmechs |= SASL_MECH_CRAM_MD5; - else if(wordlen == 10 && !memcmp(line, "DIGEST-MD5", 10)) - imapc->authmechs |= SASL_MECH_DIGEST_MD5; - else if(wordlen == 6 && !memcmp(line, "GSSAPI", 6)) - imapc->authmechs |= SASL_MECH_GSSAPI; - else if(wordlen == 8 && !memcmp(line, "EXTERNAL", 8)) - imapc->authmechs |= SASL_MECH_EXTERNAL; - else if(wordlen == 4 && !memcmp(line, "NTLM", 4)) - imapc->authmechs |= SASL_MECH_NTLM; - } - - line += wordlen; - len -= wordlen; - } + default: + failf(conn->data, "Unexpected continuation response"); + *resp = -1; + break; } - } - /* Are we processing FETCH command responses? */ - if(imapc->state == IMAP_FETCH) { - /* Do we have a valid response? */ - if(len >= 2 && !memcmp("* ", line, 2)) { - *resp = '*'; - return TRUE; - } + return TRUE; } return FALSE; /* Nothing for us */ } -/* This is the ONLY way to change IMAP state! */ +/*********************************************************************** + * + * state() + * + * This is the ONLY way to change IMAP state! + */ static void state(struct connectdata *conn, imapstate newstate) { struct imap_conn *imapc = &conn->proto.imapc; @@ -432,9 +384,9 @@ static void state(struct connectdata *conn, imapstate newstate) static const char * const names[]={ "STOP", "SERVERGREET", + "CAPABILITY", "STARTTLS", "UPGRADETLS", - "CAPABILITY", "AUTHENTICATE_PLAIN", "AUTHENTICATE_LOGIN", "AUTHENTICATE_LOGIN_PASSWD", @@ -443,152 +395,425 @@ static void state(struct connectdata *conn, imapstate newstate) "AUTHENTICATE_DIGESTMD5_RESP", "AUTHENTICATE_NTLM", "AUTHENTICATE_NTLM_TYPE2MSG", - "AUTHENTICATE", + "AUTHENTICATE_XOAUTH2", + "AUTHENTICATE_FINAL", "LOGIN", + "LIST", "SELECT", "FETCH", + "FETCH_FINAL", + "APPEND", + "APPEND_FINAL", "LOGOUT", /* LAST */ }; if(imapc->state != newstate) infof(conn->data, "IMAP %p state change from %s to %s\n", - imapc, names[imapc->state], names[newstate]); + (void *)imapc, names[imapc->state], names[newstate]); #endif imapc->state = newstate; } -static CURLcode imap_state_capability(struct connectdata *conn) +/*********************************************************************** + * + * imap_perform_capability() + * + * Sends the CAPABILITY command in order to obtain a list of server side + * supported capabilities. + */ +static CURLcode imap_perform_capability(struct connectdata *conn) { CURLcode result = CURLE_OK; struct imap_conn *imapc = &conn->proto.imapc; - const char *str; imapc->authmechs = 0; /* No known authentication mechanisms yet */ imapc->authused = 0; /* Clear the authentication mechanism used */ + imapc->tls_supported = FALSE; /* Clear the TLS capability */ - /* Check we have a username and password to authenticate with and end the - connect phase if we don't */ - if(!conn->bits.user_passwd) { - state(conn, IMAP_STOP); + /* Send the CAPABILITY command */ + result = imap_sendf(conn, "CAPABILITY"); - return result; - } + if(!result) + state(conn, IMAP_CAPABILITY); - str = getcmdid(conn); + return result; +} - /* Send the CAPABILITY command */ - result = imap_sendf(conn, str, "%s CAPABILITY", str); +/*********************************************************************** + * + * imap_perform_starttls() + * + * Sends the STARTTLS command to start the upgrade to TLS. + */ +static CURLcode imap_perform_starttls(struct connectdata *conn) +{ + CURLcode result = CURLE_OK; - if(result) - return result; + /* Send the STARTTLS command */ + result = imap_sendf(conn, "STARTTLS"); - state(conn, IMAP_CAPABILITY); + if(!result) + state(conn, IMAP_STARTTLS); - return CURLE_OK; + return result; +} + +/*********************************************************************** + * + * imap_perform_upgrade_tls() + * + * Performs the upgrade to TLS. + */ +static CURLcode imap_perform_upgrade_tls(struct connectdata *conn) +{ + CURLcode result = CURLE_OK; + struct imap_conn *imapc = &conn->proto.imapc; + + /* Start the SSL connection */ + result = Curl_ssl_connect_nonblocking(conn, FIRSTSOCKET, &imapc->ssldone); + + if(!result) { + if(imapc->state != IMAP_UPGRADETLS) + state(conn, IMAP_UPGRADETLS); + + if(imapc->ssldone) { + imap_to_imaps(conn); + result = imap_perform_capability(conn); + } + } + + return result; } -static CURLcode imap_state_login(struct connectdata *conn) +/*********************************************************************** + * + * imap_perform_login() + * + * Sends a clear text LOGIN command to authenticate with. + */ +static CURLcode imap_perform_login(struct connectdata *conn) { - CURLcode result; - struct FTP *imap = conn->data->state.proto.imap; - const char *str = getcmdid(conn); - char *user = imap_atom(imap->user); - char *passwd = imap_atom(imap->passwd); + CURLcode result = CURLE_OK; + char *user; + char *passwd; - /* send USER and password */ - result = imap_sendf(conn, str, "%s LOGIN %s %s", str, - user ? user : "", passwd ? passwd : ""); + /* Check we have a username and password to authenticate with and end the + connect phase if we don't */ + if(!conn->bits.user_passwd) { + state(conn, IMAP_STOP); + + return result; + } + + /* Make sure the username and password are in the correct atom format */ + user = imap_atom(conn->user); + passwd = imap_atom(conn->passwd); + + /* Send the LOGIN command */ + result = imap_sendf(conn, "LOGIN %s %s", user ? user : "", + passwd ? passwd : ""); Curl_safefree(user); Curl_safefree(passwd); - if(result) - return result; - - state(conn, IMAP_LOGIN); + if(!result) + state(conn, IMAP_LOGIN); - return CURLE_OK; + return result; } -static CURLcode imap_authenticate(struct connectdata *conn) +/*********************************************************************** + * + * imap_perform_authenticate() + * + * Sends an AUTHENTICATE command allowing the client to login with the + * appropriate SASL authentication mechanism. + * + * Additionally, the function will perform fallback to the LOGIN command + * should a common mechanism not be available between the client and server. + */ +static CURLcode imap_perform_authenticate(struct connectdata *conn) { CURLcode result = CURLE_OK; + struct SessionHandle *data = conn->data; struct imap_conn *imapc = &conn->proto.imapc; const char *mech = NULL; - imapstate authstate = IMAP_STOP; + char *initresp = NULL; + size_t len = 0; + imapstate state1 = IMAP_STOP; + imapstate state2 = IMAP_STOP; + + /* Check we have a username and password to authenticate with and end the + connect phase if we don't */ + if(!conn->bits.user_passwd) { + state(conn, IMAP_STOP); + + return result; + } /* Calculate the supported authentication mechanism by decreasing order of security */ #ifndef CURL_DISABLE_CRYPTO_AUTH - if(imapc->authmechs & SASL_MECH_DIGEST_MD5) { - mech = "DIGEST-MD5"; - authstate = IMAP_AUTHENTICATE_DIGESTMD5; + if((imapc->authmechs & SASL_MECH_DIGEST_MD5) && + (imapc->prefmech & SASL_MECH_DIGEST_MD5)) { + mech = SASL_MECH_STRING_DIGEST_MD5; + state1 = IMAP_AUTHENTICATE_DIGESTMD5; imapc->authused = SASL_MECH_DIGEST_MD5; } - else if(imapc->authmechs & SASL_MECH_CRAM_MD5) { - mech = "CRAM-MD5"; - authstate = IMAP_AUTHENTICATE_CRAMMD5; + else if((imapc->authmechs & SASL_MECH_CRAM_MD5) && + (imapc->prefmech & SASL_MECH_CRAM_MD5)) { + mech = SASL_MECH_STRING_CRAM_MD5; + state1 = IMAP_AUTHENTICATE_CRAMMD5; imapc->authused = SASL_MECH_CRAM_MD5; } else #endif #ifdef USE_NTLM - if(imapc->authmechs & SASL_MECH_NTLM) { - mech = "NTLM"; - authstate = IMAP_AUTHENTICATE_NTLM; + if((imapc->authmechs & SASL_MECH_NTLM) && + (imapc->prefmech & SASL_MECH_NTLM)) { + mech = SASL_MECH_STRING_NTLM; + state1 = IMAP_AUTHENTICATE_NTLM; + state2 = IMAP_AUTHENTICATE_NTLM_TYPE2MSG; imapc->authused = SASL_MECH_NTLM; + + if(imapc->ir_supported || data->set.sasl_ir) + result = Curl_sasl_create_ntlm_type1_message(conn->user, conn->passwd, + &conn->ntlm, + &initresp, &len); } else #endif - if(imapc->authmechs & SASL_MECH_LOGIN) { - mech = "LOGIN"; - authstate = IMAP_AUTHENTICATE_LOGIN; + if(((imapc->authmechs & SASL_MECH_XOAUTH2) && + (imapc->prefmech & SASL_MECH_XOAUTH2) && + (imapc->prefmech != SASL_AUTH_ANY)) || conn->xoauth2_bearer) { + mech = SASL_MECH_STRING_XOAUTH2; + state1 = IMAP_AUTHENTICATE_XOAUTH2; + state2 = IMAP_AUTHENTICATE_FINAL; + imapc->authused = SASL_MECH_XOAUTH2; + + if(imapc->ir_supported || data->set.sasl_ir) + result = Curl_sasl_create_xoauth2_message(conn->data, conn->user, + conn->xoauth2_bearer, + &initresp, &len); + } + else if((imapc->authmechs & SASL_MECH_LOGIN) && + (imapc->prefmech & SASL_MECH_LOGIN)) { + mech = SASL_MECH_STRING_LOGIN; + state1 = IMAP_AUTHENTICATE_LOGIN; + state2 = IMAP_AUTHENTICATE_LOGIN_PASSWD; imapc->authused = SASL_MECH_LOGIN; + + if(imapc->ir_supported || data->set.sasl_ir) + result = Curl_sasl_create_login_message(conn->data, conn->user, + &initresp, &len); } - else if(imapc->authmechs & SASL_MECH_PLAIN) { - mech = "PLAIN"; - authstate = IMAP_AUTHENTICATE_PLAIN; + else if((imapc->authmechs & SASL_MECH_PLAIN) && + (imapc->prefmech & SASL_MECH_PLAIN)) { + mech = SASL_MECH_STRING_PLAIN; + state1 = IMAP_AUTHENTICATE_PLAIN; + state2 = IMAP_AUTHENTICATE_FINAL; imapc->authused = SASL_MECH_PLAIN; + + if(imapc->ir_supported || data->set.sasl_ir) + result = Curl_sasl_create_plain_message(conn->data, conn->user, + conn->passwd, &initresp, &len); } - if(mech) { - /* Perform SASL based authentication */ - const char *str = getcmdid(conn); + if(!result) { + if(mech) { + /* Perform SASL based authentication */ + if(initresp) { + result = imap_sendf(conn, "AUTHENTICATE %s %s", mech, initresp); + + if(!result) + state(conn, state2); + } + else { + result = imap_sendf(conn, "AUTHENTICATE %s", mech); - result = imap_sendf(conn, str, "%s AUTHENTICATE %s", str, mech); + if(!result) + state(conn, state1); + } - if(!result) - state(conn, authstate); + Curl_safefree(initresp); + } + else if(!imapc->login_disabled) + /* Perform clear text authentication */ + result = imap_perform_login(conn); + else { + /* Other mechanisms not supported */ + infof(conn->data, "No known authentication mechanisms supported!\n"); + result = CURLE_LOGIN_DENIED; + } } - else if(!imapc->login_disabled) - /* Perform clear text authentication */ - result = imap_state_login(conn); + + return result; +} + +/*********************************************************************** + * + * imap_perform_list() + * + * Sends a LIST command or an alternative custom request. + */ +static CURLcode imap_perform_list(struct connectdata *conn) +{ + CURLcode result = CURLE_OK; + struct SessionHandle *data = conn->data; + struct IMAP *imap = data->req.protop; + char *mailbox; + + if(imap->custom) + /* Send the custom request */ + result = imap_sendf(conn, "%s%s", imap->custom, + imap->custom_params ? imap->custom_params : ""); else { - /* Other mechanisms not supported */ - infof(conn->data, "No known authentication mechanisms supported!\n"); - result = CURLE_LOGIN_DENIED; + /* Make sure the mailbox is in the correct atom format */ + mailbox = imap_atom(imap->mailbox ? imap->mailbox : ""); + if(!mailbox) + return CURLE_OUT_OF_MEMORY; + + /* Send the LIST command */ + result = imap_sendf(conn, "LIST \"%s\" *", mailbox); + + Curl_safefree(mailbox); } + if(!result) + state(conn, IMAP_LIST); + return result; } -/* For the IMAP "protocol connect" and "doing" phases only */ -static int imap_getsock(struct connectdata *conn, curl_socket_t *socks, - int numsocks) +/*********************************************************************** + * + * imap_perform_select() + * + * Sends a SELECT command to ask the server to change the selected mailbox. + */ +static CURLcode imap_perform_select(struct connectdata *conn) { - return Curl_pp_getsock(&conn->proto.imapc.pp, socks, numsocks); + CURLcode result = CURLE_OK; + struct SessionHandle *data = conn->data; + struct IMAP *imap = data->req.protop; + struct imap_conn *imapc = &conn->proto.imapc; + char *mailbox; + + /* Invalidate old information as we are switching mailboxes */ + Curl_safefree(imapc->mailbox); + Curl_safefree(imapc->mailbox_uidvalidity); + + /* Check we have a mailbox */ + if(!imap->mailbox) { + failf(conn->data, "Cannot SELECT without a mailbox."); + return CURLE_URL_MALFORMAT; + } + + /* Make sure the mailbox is in the correct atom format */ + mailbox = imap_atom(imap->mailbox); + if(!mailbox) + return CURLE_OUT_OF_MEMORY; + + /* Send the SELECT command */ + result = imap_sendf(conn, "SELECT %s", mailbox); + + Curl_safefree(mailbox); + + if(!result) + state(conn, IMAP_SELECT); + + return result; } -#ifdef USE_SSL -static void imap_to_imaps(struct connectdata *conn) +/*********************************************************************** + * + * imap_perform_fetch() + * + * Sends a FETCH command to initiate the download of a message. + */ +static CURLcode imap_perform_fetch(struct connectdata *conn) { - conn->handler = &Curl_handler_imaps; + CURLcode result = CURLE_OK; + struct IMAP *imap = conn->data->req.protop; + + /* Check we have a UID */ + if(!imap->uid) { + failf(conn->data, "Cannot FETCH without a UID."); + return CURLE_URL_MALFORMAT; + } + + /* Send the FETCH command */ + result = imap_sendf(conn, "FETCH %s BODY[%s]", + imap->uid, + imap->section ? imap->section : ""); + + if(!result) + state(conn, IMAP_FETCH); + + return result; +} + +/*********************************************************************** + * + * imap_perform_append() + * + * Sends an APPEND command to initiate the upload of a message. + */ +static CURLcode imap_perform_append(struct connectdata *conn) +{ + CURLcode result = CURLE_OK; + struct IMAP *imap = conn->data->req.protop; + char *mailbox; + + /* Check we have a mailbox */ + if(!imap->mailbox) { + failf(conn->data, "Cannot APPEND without a mailbox."); + return CURLE_URL_MALFORMAT; + } + + /* Check we know the size of the upload */ + if(conn->data->set.infilesize < 0) { + failf(conn->data, "Cannot APPEND with unknown input file size\n"); + return CURLE_UPLOAD_FAILED; + } + + /* Make sure the mailbox is in the correct atom format */ + mailbox = imap_atom(imap->mailbox); + if(!mailbox) + return CURLE_OUT_OF_MEMORY; + + /* Send the APPEND command */ + result = imap_sendf(conn, "APPEND %s (\\Seen) {%" FORMAT_OFF_T "}", + mailbox, conn->data->set.infilesize); + + Curl_safefree(mailbox); + + if(!result) + state(conn, IMAP_APPEND); + + return result; +} + +/*********************************************************************** + * + * imap_perform_logout() + * + * Performs the logout action prior to sclose() being called. + */ +static CURLcode imap_perform_logout(struct connectdata *conn) +{ + CURLcode result = CURLE_OK; + + /* Send the LOGOUT command */ + result = imap_sendf(conn, "LOGOUT"); + + if(!result) + state(conn, IMAP_LOGOUT); + + return result; } -#else -#define imap_to_imaps(x) Curl_nop_stmt -#endif /* For the initial server greeting */ static CURLcode imap_state_servergreet_resp(struct connectdata *conn, @@ -602,85 +827,136 @@ static CURLcode imap_state_servergreet_resp(struct connectdata *conn, if(imapcode != 'O') { failf(data, "Got unexpected imap-server response"); - return CURLE_FTP_WEIRD_SERVER_REPLY; - } - - if(data->set.use_ssl && !conn->ssl[FIRSTSOCKET].use) { - /* We don't have a SSL/TLS connection yet, but SSL is requested. Switch - to TLS connection now */ - const char *str = getcmdid(conn); - result = imap_sendf(conn, str, "%s STARTTLS", str); - if(!result) - state(conn, IMAP_STARTTLS); + result = CURLE_FTP_WEIRD_SERVER_REPLY; /* TODO: fix this code */ } else - result = imap_state_capability(conn); + result = imap_perform_capability(conn); return result; } -/* For STARTTLS responses */ -static CURLcode imap_state_starttls_resp(struct connectdata *conn, - int imapcode, - imapstate instate) +/* For CAPABILITY responses */ +static CURLcode imap_state_capability_resp(struct connectdata *conn, + int imapcode, + imapstate instate) { CURLcode result = CURLE_OK; struct SessionHandle *data = conn->data; + struct imap_conn *imapc = &conn->proto.imapc; + const char *line = data->state.buffer; + size_t wordlen; (void)instate; /* no use for this yet */ - if(imapcode != 'O') { - if(data->set.use_ssl != CURLUSESSL_TRY) { - failf(data, "STARTTLS denied. %c", imapcode); - result = CURLE_USE_SSL_FAILED; - } - else - result = imap_state_capability(conn); - } - else - result = imap_state_upgrade_tls(conn); + /* Do we have a untagged response? */ + if(imapcode == '*') { + line += 2; - return result; -} + /* Loop through the data line */ + for(;;) { + while(*line && + (*line == ' ' || *line == '\t' || + *line == '\r' || *line == '\n')) { -static CURLcode imap_state_upgrade_tls(struct connectdata *conn) -{ - struct imap_conn *imapc = &conn->proto.imapc; - CURLcode result; + line++; + } - result = Curl_ssl_connect_nonblocking(conn, FIRSTSOCKET, &imapc->ssldone); + if(!*line) + break; - if(!result) { - if(imapc->state != IMAP_UPGRADETLS) - state(conn, IMAP_UPGRADETLS); + /* Extract the word */ + for(wordlen = 0; line[wordlen] && line[wordlen] != ' ' && + line[wordlen] != '\t' && line[wordlen] != '\r' && + line[wordlen] != '\n';) + wordlen++; + + /* Does the server support the STARTTLS capability? */ + if(wordlen == 8 && !memcmp(line, "STARTTLS", 8)) + imapc->tls_supported = TRUE; + + /* Has the server explicitly disabled clear text authentication? */ + else if(wordlen == 13 && !memcmp(line, "LOGINDISABLED", 13)) + imapc->login_disabled = TRUE; + + /* Does the server support the SASL-IR capability? */ + else if(wordlen == 7 && !memcmp(line, "SASL-IR", 7)) + imapc->ir_supported = TRUE; + + /* Do we have a SASL based authentication mechanism? */ + else if(wordlen > 5 && !memcmp(line, "AUTH=", 5)) { + line += 5; + wordlen -= 5; + + /* Test the word for a matching authentication mechanism */ + if(sasl_mech_equal(line, wordlen, SASL_MECH_STRING_LOGIN)) + imapc->authmechs |= SASL_MECH_LOGIN; + else if(sasl_mech_equal(line, wordlen, SASL_MECH_STRING_PLAIN)) + imapc->authmechs |= SASL_MECH_PLAIN; + else if(sasl_mech_equal(line, wordlen, SASL_MECH_STRING_CRAM_MD5)) + imapc->authmechs |= SASL_MECH_CRAM_MD5; + else if(sasl_mech_equal(line, wordlen, SASL_MECH_STRING_DIGEST_MD5)) + imapc->authmechs |= SASL_MECH_DIGEST_MD5; + else if(sasl_mech_equal(line, wordlen, SASL_MECH_STRING_GSSAPI)) + imapc->authmechs |= SASL_MECH_GSSAPI; + else if(sasl_mech_equal(line, wordlen, SASL_MECH_STRING_EXTERNAL)) + imapc->authmechs |= SASL_MECH_EXTERNAL; + else if(sasl_mech_equal(line, wordlen, SASL_MECH_STRING_NTLM)) + imapc->authmechs |= SASL_MECH_NTLM; + else if(sasl_mech_equal(line, wordlen, SASL_MECH_STRING_XOAUTH2)) + imapc->authmechs |= SASL_MECH_XOAUTH2; + } - if(imapc->ssldone) { - imap_to_imaps(conn); - result = imap_state_capability(conn); + line += wordlen; } } + else if(imapcode == 'O') { + if(data->set.use_ssl && !conn->ssl[FIRSTSOCKET].use) { + /* We don't have a SSL/TLS connection yet, but SSL is requested */ + if(imapc->tls_supported) + /* Switch to TLS connection now */ + result = imap_perform_starttls(conn); + else if(data->set.use_ssl == CURLUSESSL_TRY) + /* Fallback and carry on with authentication */ + result = imap_perform_authenticate(conn); + else { + failf(data, "STARTTLS not supported."); + result = CURLE_USE_SSL_FAILED; + } + } + else + result = imap_perform_authenticate(conn); + } + else + result = imap_perform_login(conn); return result; } -/* For CAPABILITY responses */ -static CURLcode imap_state_capability_resp(struct connectdata *conn, - int imapcode, - imapstate instate) +/* For STARTTLS responses */ +static CURLcode imap_state_starttls_resp(struct connectdata *conn, + int imapcode, + imapstate instate) { CURLcode result = CURLE_OK; + struct SessionHandle *data = conn->data; (void)instate; /* no use for this yet */ - if(imapcode == 'O') - result = imap_authenticate(conn); + if(imapcode != 'O') { + if(data->set.use_ssl != CURLUSESSL_TRY) { + failf(data, "STARTTLS denied. %c", imapcode); + result = CURLE_USE_SSL_FAILED; + } + else + result = imap_perform_authenticate(conn); + } else - result = imap_state_login(conn); + result = imap_perform_upgrade_tls(conn); return result; } -/* For AUTHENTICATE PLAIN responses */ +/* For AUTHENTICATE PLAIN (without initial response) responses */ static CURLcode imap_state_auth_plain_resp(struct connectdata *conn, int imapcode, imapstate instate) @@ -707,7 +983,7 @@ static CURLcode imap_state_auth_plain_resp(struct connectdata *conn, result = Curl_pp_sendf(&conn->proto.imapc.pp, "%s", plainauth); if(!result) - state(conn, IMAP_AUTHENTICATE); + state(conn, IMAP_AUTHENTICATE_FINAL); } Curl_safefree(plainauth); @@ -717,7 +993,7 @@ static CURLcode imap_state_auth_plain_resp(struct connectdata *conn, return result; } -/* For AUTHENTICATE LOGIN responses */ +/* For AUTHENTICATE LOGIN (without initial response) responses */ static CURLcode imap_state_auth_login_resp(struct connectdata *conn, int imapcode, imapstate instate) @@ -781,7 +1057,7 @@ static CURLcode imap_state_auth_login_password_resp(struct connectdata *conn, result = Curl_pp_sendf(&conn->proto.imapc.pp, "%s", authpasswd); if(!result) - state(conn, IMAP_AUTHENTICATE); + state(conn, IMAP_AUTHENTICATE_FINAL); } Curl_safefree(authpasswd); @@ -836,7 +1112,7 @@ static CURLcode imap_state_auth_cram_resp(struct connectdata *conn, result = Curl_pp_sendf(&conn->proto.imapc.pp, "%s", rplyb64); if(!result) - state(conn, IMAP_AUTHENTICATE); + state(conn, IMAP_AUTHENTICATE_FINAL); } Curl_safefree(rplyb64); @@ -903,10 +1179,10 @@ static CURLcode imap_state_auth_digest_resp_resp(struct connectdata *conn, } else { /* Send an empty response */ - result = Curl_pp_sendf(&conn->proto.imapc.pp, ""); + result = Curl_pp_sendf(&conn->proto.imapc.pp, "%s", ""); if(!result) - state(conn, IMAP_AUTHENTICATE); + state(conn, IMAP_AUTHENTICATE_FINAL); } return result; @@ -914,7 +1190,7 @@ static CURLcode imap_state_auth_digest_resp_resp(struct connectdata *conn, #endif #ifdef USE_NTLM -/* For AUTHENTICATE NTLM responses */ +/* For AUTHENTICATE NTLM (without initial response) responses */ static CURLcode imap_state_auth_ntlm_resp(struct connectdata *conn, int imapcode, imapstate instate) @@ -982,7 +1258,7 @@ static CURLcode imap_state_auth_ntlm_type2msg_resp(struct connectdata *conn, result = Curl_pp_sendf(&conn->proto.imapc.pp, "%s", type3msg); if(!result) - state(conn, IMAP_AUTHENTICATE); + state(conn, IMAP_AUTHENTICATE_FINAL); } Curl_safefree(type3msg); @@ -993,6 +1269,44 @@ static CURLcode imap_state_auth_ntlm_type2msg_resp(struct connectdata *conn, } #endif +/* For AUTH XOAUTH2 (without initial response) responses */ +static CURLcode imap_state_auth_xoauth2_resp(struct connectdata *conn, + int imapcode, + imapstate instate) +{ + CURLcode result = CURLE_OK; + struct SessionHandle *data = conn->data; + size_t len = 0; + char *xoauth = NULL; + + (void)instate; /* no use for this yet */ + + if(imapcode != '+') { + failf(data, "Access denied: %d", imapcode); + result = CURLE_LOGIN_DENIED; + } + else { + /* Create the authorisation message */ + result = Curl_sasl_create_xoauth2_message(conn->data, conn->user, + conn->xoauth2_bearer, + &xoauth, &len); + + /* Send the message */ + if(!result) { + if(xoauth) { + result = Curl_pp_sendf(&conn->proto.imapc.pp, "%s", xoauth); + + if(!result) + state(conn, IMAP_AUTHENTICATE_FINAL); + } + + Curl_safefree(xoauth); + } + } + + return result; +} + /* For final responses to the AUTHENTICATE sequence */ static CURLcode imap_state_auth_final_resp(struct connectdata *conn, int imapcode, @@ -1007,9 +1321,9 @@ static CURLcode imap_state_auth_final_resp(struct connectdata *conn, failf(data, "Authentication failed: %d", imapcode); result = CURLE_LOGIN_DENIED; } - - /* End of connect phase */ - state(conn, IMAP_STOP); + else + /* End of connect phase */ + state(conn, IMAP_STOP); return result; } @@ -1035,97 +1349,112 @@ static CURLcode imap_state_login_resp(struct connectdata *conn, return result; } -/* Start the DO phase */ -static CURLcode imap_select(struct connectdata *conn) -{ - CURLcode result = CURLE_OK; - struct imap_conn *imapc = &conn->proto.imapc; - const char *str = getcmdid(conn); - - result = imap_sendf(conn, str, "%s SELECT %s", str, - imapc->mailbox?imapc->mailbox:""); - if(result) - return result; - - state(conn, IMAP_SELECT); - - return result; -} - -static CURLcode imap_fetch(struct connectdata *conn) +/* For LIST responses */ +static CURLcode imap_state_list_resp(struct connectdata *conn, int imapcode, + imapstate instate) { CURLcode result = CURLE_OK; - const char *str = getcmdid(conn); - - /* TODO: make this select the correct mail - * Use "1 body[text]" to get the full mail body of mail 1 - */ - result = imap_sendf(conn, str, "%s FETCH 1 BODY[TEXT]", str); - if(result) - return result; + char *line = conn->data->state.buffer; + size_t len = strlen(line); - /* - * When issued, the server will respond with a single line similar to - * '* 1 FETCH (BODY[TEXT] {2021}' - * - * Identifying the fetch and how many bytes of contents we can expect. We - * must extract that number before continuing to "download as usual". - */ + (void)instate; /* No use for this yet */ - state(conn, IMAP_FETCH); + if(imapcode == '*') { + /* Temporarily add the LF character back and send as body to the client */ + line[len] = '\n'; + result = Curl_client_write(conn, CLIENTWRITE_BODY, line, len + 1); + line[len] = '\0'; + } + else if(imapcode != 'O') + result = CURLE_QUOTE_ERROR; /* TODO: Fix error code */ + else + /* End of DO phase */ + state(conn, IMAP_STOP); return result; } /* For SELECT responses */ -static CURLcode imap_state_select_resp(struct connectdata *conn, - int imapcode, +static CURLcode imap_state_select_resp(struct connectdata *conn, int imapcode, imapstate instate) { CURLcode result = CURLE_OK; struct SessionHandle *data = conn->data; + struct IMAP *imap = conn->data->req.protop; + struct imap_conn *imapc = &conn->proto.imapc; + const char *line = data->state.buffer; + char tmp[20]; (void)instate; /* no use for this yet */ - if(imapcode != 'O') { + if(imapcode == '*') { + /* See if this is an UIDVALIDITY response */ + if(sscanf(line + 2, "OK [UIDVALIDITY %19[0123456789]]", tmp) == 1) { + Curl_safefree(imapc->mailbox_uidvalidity); + imapc->mailbox_uidvalidity = strdup(tmp); + } + } + else if(imapcode == 'O') { + /* Check if the UIDVALIDITY has been specified and matches */ + if(imap->uidvalidity && imapc->mailbox_uidvalidity && + strcmp(imap->uidvalidity, imapc->mailbox_uidvalidity)) { + failf(conn->data, "Mailbox UIDVALIDITY has changed"); + result = CURLE_REMOTE_FILE_NOT_FOUND; + } + else { + /* Note the currently opened mailbox on this connection */ + imapc->mailbox = strdup(imap->mailbox); + + if(imap->custom) + result = imap_perform_list(conn); + else + result = imap_perform_fetch(conn); + } + } + else { failf(data, "Select failed"); result = CURLE_LOGIN_DENIED; } - else - result = imap_fetch(conn); return result; } -/* For the (first line of) FETCH BODY[TEXT] response */ +/* For the (first line of the) FETCH responses */ static CURLcode imap_state_fetch_resp(struct connectdata *conn, int imapcode, imapstate instate) { CURLcode result = CURLE_OK; struct SessionHandle *data = conn->data; struct imap_conn *imapc = &conn->proto.imapc; - struct FTP *imap = data->state.proto.imap; struct pingpong *pp = &imapc->pp; const char *ptr = data->state.buffer; + bool parsed = FALSE; + curl_off_t size; (void)instate; /* no use for this yet */ - if('*' != imapcode) { + if(imapcode != '*') { Curl_pgrsSetDownloadSize(data, 0); state(conn, IMAP_STOP); - return CURLE_OK; + return CURLE_REMOTE_FILE_NOT_FOUND; /* TODO: Fix error code */ } - /* Something like this comes "* 1 FETCH (BODY[TEXT] {2021}\r" */ + /* Something like this is received "* 1 FETCH (BODY[TEXT] {2021}\r" so parse + the continuation data contained within the curly brackets */ while(*ptr && (*ptr != '{')) ptr++; if(*ptr == '{') { - curl_off_t filesize = curlx_strtoofft(ptr + 1, NULL, 10); - if(filesize) - Curl_pgrsSetDownloadSize(data, filesize); + char *endptr; + size = curlx_strtoofft(ptr + 1, &endptr, 10); + if(endptr - ptr > 1 && endptr[0] == '}' && + endptr[1] == '\r' && endptr[2] == '\0') + parsed = TRUE; + } - infof(data, "Found %" FORMAT_OFF_TU " bytes to download\n", filesize); + if(parsed) { + infof(data, "Found %" FORMAT_OFF_TU " bytes to download\n", size); + Curl_pgrsSetDownloadSize(data, size); if(pp->cache) { /* At this point there is a bunch of data in the header "cache" that is @@ -1133,56 +1462,121 @@ static CURLcode imap_state_fetch_resp(struct connectdata *conn, int imapcode, that there may even be additional "headers" after the body. */ size_t chunk = pp->cache_size; - if(chunk > (size_t)filesize) - /* the conversion from curl_off_t to size_t is always fine here */ - chunk = (size_t)filesize; + if(chunk > (size_t)size) + /* The conversion from curl_off_t to size_t is always fine here */ + chunk = (size_t)size; result = Curl_client_write(conn, CLIENTWRITE_BODY, pp->cache, chunk); if(result) return result; - filesize -= chunk; + data->req.bytecount += chunk; + + infof(data, "Written %" FORMAT_OFF_TU " bytes, %" FORMAT_OFF_TU + " bytes are left for transfer\n", (curl_off_t)chunk, + size - chunk); - /* we've now used parts of or the entire cache */ + /* Have we used the entire cache or just part of it?*/ if(pp->cache_size > chunk) { - /* part of, move the trailing data to the start and reduce the size */ - memmove(pp->cache, pp->cache+chunk, - pp->cache_size - chunk); + /* Only part of it so shrink the cache to fit the trailing data */ + memmove(pp->cache, pp->cache + chunk, pp->cache_size - chunk); pp->cache_size -= chunk; } else { - /* cache is drained */ + /* Free the cache */ Curl_safefree(pp->cache); - pp->cache = NULL; + + /* Reset the cache size */ pp->cache_size = 0; } } - infof(data, "Filesize left: %" FORMAT_OFF_T "\n", filesize); - - if(!filesize) - /* the entire data is already transferred! */ + if(data->req.bytecount == size) + /* The entire data is already transferred! */ Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL); - else + else { /* IMAP download */ - Curl_setup_transfer(conn, FIRSTSOCKET, filesize, FALSE, - imap->bytecountp, -1, NULL); /* no upload here */ - - data->req.maxdownload = filesize; + data->req.maxdownload = size; + Curl_setup_transfer(conn, FIRSTSOCKET, size, FALSE, NULL, -1, NULL); + } } - else + else { /* We don't know how to parse this line */ + failf(pp->conn->data, "Failed to parse FETCH response."); result = CURLE_FTP_WEIRD_SERVER_REPLY; /* TODO: fix this code */ + } - /* End of do phase */ + /* End of DO phase */ state(conn, IMAP_STOP); return result; } +/* For final FETCH responses performed after the download */ +static CURLcode imap_state_fetch_final_resp(struct connectdata *conn, + int imapcode, + imapstate instate) +{ + CURLcode result = CURLE_OK; + + (void)instate; /* No use for this yet */ + + if(imapcode != 'O') + result = CURLE_FTP_WEIRD_SERVER_REPLY; /* TODO: Fix error code */ + else + /* End of DONE phase */ + state(conn, IMAP_STOP); + + return result; +} + +/* For APPEND responses */ +static CURLcode imap_state_append_resp(struct connectdata *conn, int imapcode, + imapstate instate) +{ + CURLcode result = CURLE_OK; + struct SessionHandle *data = conn->data; + + (void)instate; /* No use for this yet */ + + if(imapcode != '+') { + result = CURLE_UPLOAD_FAILED; + } + else { + /* Set the progress upload size */ + Curl_pgrsSetUploadSize(data, data->set.infilesize); + + /* IMAP upload */ + Curl_setup_transfer(conn, -1, -1, FALSE, NULL, FIRSTSOCKET, NULL); + + /* End of DO phase */ + state(conn, IMAP_STOP); + } + + return result; +} + +/* For final APPEND responses performed after the upload */ +static CURLcode imap_state_append_final_resp(struct connectdata *conn, + int imapcode, + imapstate instate) +{ + CURLcode result = CURLE_OK; + + (void)instate; /* No use for this yet */ + + if(imapcode != 'O') + result = CURLE_UPLOAD_FAILED; + else + /* End of DONE phase */ + state(conn, IMAP_STOP); + + return result; +} + static CURLcode imap_statemach_act(struct connectdata *conn) { - CURLcode result; + CURLcode result = CURLE_OK; curl_socket_t sock = conn->sock[FIRSTSOCKET]; int imapcode; struct imap_conn *imapc = &conn->proto.imapc; @@ -1191,32 +1585,39 @@ static CURLcode imap_statemach_act(struct connectdata *conn) /* Busy upgrading the connection; right now all I/O is SSL/TLS, not IMAP */ if(imapc->state == IMAP_UPGRADETLS) - return imap_state_upgrade_tls(conn); + return imap_perform_upgrade_tls(conn); /* Flush any data that needs to be sent */ if(pp->sendleft) return Curl_pp_flushsend(pp); - /* Read the response from the server */ - result = Curl_pp_readresp(sock, pp, &imapcode, &nread); - if(result) - return result; + do { + /* Read the response from the server */ + result = Curl_pp_readresp(sock, pp, &imapcode, &nread); + if(result) + return result; + + /* Was there an error parsing the response line? */ + if(imapcode == -1) + return CURLE_FTP_WEIRD_SERVER_REPLY; + + if(!imapcode) + break; - if(imapcode) { /* We have now received a full IMAP server response */ switch(imapc->state) { case IMAP_SERVERGREET: result = imap_state_servergreet_resp(conn, imapcode, imapc->state); break; - case IMAP_STARTTLS: - result = imap_state_starttls_resp(conn, imapcode, imapc->state); - break; - case IMAP_CAPABILITY: result = imap_state_capability_resp(conn, imapcode, imapc->state); break; + case IMAP_STARTTLS: + result = imap_state_starttls_resp(conn, imapcode, imapc->state); + break; + case IMAP_AUTHENTICATE_PLAIN: result = imap_state_auth_plain_resp(conn, imapcode, imapc->state); break; @@ -1255,7 +1656,11 @@ static CURLcode imap_statemach_act(struct connectdata *conn) break; #endif - case IMAP_AUTHENTICATE: + case IMAP_AUTHENTICATE_XOAUTH2: + result = imap_state_auth_xoauth2_resp(conn, imapcode, imapc->state); + break; + + case IMAP_AUTHENTICATE_FINAL: result = imap_state_auth_final_resp(conn, imapcode, imapc->state); break; @@ -1263,14 +1668,30 @@ static CURLcode imap_statemach_act(struct connectdata *conn) result = imap_state_login_resp(conn, imapcode, imapc->state); break; - case IMAP_FETCH: - result = imap_state_fetch_resp(conn, imapcode, imapc->state); + case IMAP_LIST: + result = imap_state_list_resp(conn, imapcode, imapc->state); break; case IMAP_SELECT: result = imap_state_select_resp(conn, imapcode, imapc->state); break; + case IMAP_FETCH: + result = imap_state_fetch_resp(conn, imapcode, imapc->state); + break; + + case IMAP_FETCH_FINAL: + result = imap_state_fetch_final_resp(conn, imapcode, imapc->state); + break; + + case IMAP_APPEND: + result = imap_state_append_resp(conn, imapcode, imapc->state); + break; + + case IMAP_APPEND_FINAL: + result = imap_state_append_final_resp(conn, imapcode, imapc->state); + break; + case IMAP_LOGOUT: /* fallthrough, just stop! */ default: @@ -1278,7 +1699,7 @@ static CURLcode imap_statemach_act(struct connectdata *conn) state(conn, IMAP_STOP); break; } - } + } while(!result && imapc->state != IMAP_STOP && Curl_pp_moredata(pp)); return result; } @@ -1286,30 +1707,28 @@ static CURLcode imap_statemach_act(struct connectdata *conn) /* Called repeatedly until done from multi.c */ static CURLcode imap_multi_statemach(struct connectdata *conn, bool *done) { + CURLcode result = CURLE_OK; struct imap_conn *imapc = &conn->proto.imapc; - CURLcode result; - if((conn->handler->flags & PROTOPT_SSL) && !imapc->ssldone) + if((conn->handler->flags & PROTOPT_SSL) && !imapc->ssldone) { result = Curl_ssl_connect_nonblocking(conn, FIRSTSOCKET, &imapc->ssldone); - else - result = Curl_pp_multi_statemach(&imapc->pp); + if(result || !imapc->ssldone) + return result; + } + result = Curl_pp_statemach(&imapc->pp, FALSE); *done = (imapc->state == IMAP_STOP) ? TRUE : FALSE; return result; } -static CURLcode imap_easy_statemach(struct connectdata *conn) +static CURLcode imap_block_statemach(struct connectdata *conn) { - struct imap_conn *imapc = &conn->proto.imapc; - struct pingpong *pp = &imapc->pp; CURLcode result = CURLE_OK; + struct imap_conn *imapc = &conn->proto.imapc; - while(imapc->state != IMAP_STOP) { - result = Curl_pp_easy_statemach(pp); - if(result) - break; - } + while(imapc->state != IMAP_STOP && !result) + result = Curl_pp_statemach(&imapc->pp, TRUE); return result; } @@ -1318,68 +1737,67 @@ static CURLcode imap_easy_statemach(struct connectdata *conn) required */ static CURLcode imap_init(struct connectdata *conn) { + CURLcode result = CURLE_OK; struct SessionHandle *data = conn->data; - struct FTP *imap = data->state.proto.imap; - - if(!imap) { - imap = data->state.proto.imap = calloc(sizeof(struct FTP), 1); - if(!imap) - return CURLE_OUT_OF_MEMORY; - } + struct IMAP *imap; - /* Get some initial data into the imap struct */ - imap->bytecountp = &data->req.bytecount; + imap = data->req.protop = calloc(sizeof(struct IMAP), 1); + if(!imap) + result = CURLE_OUT_OF_MEMORY; - /* No need to duplicate user+password, the connectdata struct won't change - during a session, but we re-init them here since on subsequent inits - since the conn struct may have changed or been replaced. - */ - imap->user = conn->user; - imap->passwd = conn->passwd; + return result; +} - return CURLE_OK; +/* For the IMAP "protocol connect" and "doing" phases only */ +static int imap_getsock(struct connectdata *conn, curl_socket_t *socks, + int numsocks) +{ + return Curl_pp_getsock(&conn->proto.imapc.pp, socks, numsocks); } /*********************************************************************** * - * imap_connect() should do everything that is to be considered a part of - * the connection phase. + * imap_connect() + * + * This function should do everything that is to be considered a part of the + * connection phase. * * The variable 'done' points to will be TRUE if the protocol-layer connect - * phase is done when this function returns, or FALSE is not. When called as - * a part of the easy interface, it will always be TRUE. + * phase is done when this function returns, or FALSE if not. */ static CURLcode imap_connect(struct connectdata *conn, bool *done) { - CURLcode result; + CURLcode result = CURLE_OK; struct imap_conn *imapc = &conn->proto.imapc; struct pingpong *pp = &imapc->pp; *done = FALSE; /* default to not done yet */ - /* If there already is a protocol-specific struct allocated for this - sessionhandle, deal with it */ - Curl_reset_reqproto(conn); - - result = imap_init(conn); - if(CURLE_OK != result) - return result; - - /* We always support persistent connections on imap */ + /* We always support persistent connections in IMAP */ conn->bits.close = FALSE; - pp->response_time = RESP_TIMEOUT; /* set default response time-out */ + /* Set the default response time-out */ + pp->response_time = RESP_TIMEOUT; pp->statemach_act = imap_statemach_act; pp->endofresp = imap_endofresp; pp->conn = conn; - Curl_pp_init(pp); /* init generic pingpong data */ + /* Set the default preferred authentication mechanism */ + imapc->prefmech = SASL_AUTH_ANY; + + /* Initialise the pingpong layer */ + Curl_pp_init(pp); + + /* Parse the URL options */ + result = imap_parse_url_options(conn); + if(result) + return result; /* Start off waiting for the server greeting response */ state(conn, IMAP_SERVERGREET); - /* Start off with an id of '*' */ - imapc->idstr = "*"; + /* Start off with an response id of '*' */ + strcpy(imapc->resptag, "*"); result = imap_multi_statemach(conn, done); @@ -1398,26 +1816,55 @@ static CURLcode imap_connect(struct connectdata *conn, bool *done) static CURLcode imap_done(struct connectdata *conn, CURLcode status, bool premature) { + CURLcode result = CURLE_OK; struct SessionHandle *data = conn->data; - struct FTP *imap = data->state.proto.imap; - CURLcode result=CURLE_OK; + struct IMAP *imap = data->req.protop; (void)premature; if(!imap) - /* When the easy handle is removed from the multi while libcurl is still - * trying to resolve the host name, it seems that the imap struct is not - * yet initialized, but the removal action calls Curl_done() which calls - * this function. So we simply return success if no imap pointer is set. - */ + /* When the easy handle is removed from the multi interface while libcurl + is still trying to resolve the host name, the IMAP struct is not yet + initialized. However, the removal action calls Curl_done() which in + turn calls this function, so we simply return success. */ return CURLE_OK; if(status) { conn->bits.close = TRUE; /* marked for closure */ result = status; /* use the already set error code */ } + else if(!data->set.connect_only && !imap->custom && + (imap->uid || data->set.upload)) { + /* Handle responses after FETCH or APPEND transfer has finished */ + if(!data->set.upload) + state(conn, IMAP_FETCH_FINAL); + else { + /* End the APPEND command first by sending an empty line */ + result = Curl_pp_sendf(&conn->proto.imapc.pp, "%s", ""); + if(!result) + state(conn, IMAP_APPEND_FINAL); + } + + /* Run the state-machine + + TODO: when the multi interface is used, this _really_ should be using + the imap_multi_statemach function but we have no general support for + non-blocking DONE operations, not in the multi state machine and with + Curl_done() invokes on several places in the code! + */ + if(!result) + result = imap_block_statemach(conn); + } - /* Clear the transfer mode for the next connection */ + /* Cleanup our per-request based variables */ + Curl_safefree(imap->mailbox); + Curl_safefree(imap->uidvalidity); + Curl_safefree(imap->uid); + Curl_safefree(imap->section); + Curl_safefree(imap->custom); + Curl_safefree(imap->custom_params); + + /* Clear the transfer mode for the next request */ imap->transfer = FTPTRANSFER_BODY; return result; @@ -1427,31 +1874,57 @@ static CURLcode imap_done(struct connectdata *conn, CURLcode status, * * imap_perform() * - * This is the actual DO function for IMAP. Get a file/directory according to - * the options previously setup. + * This is the actual DO function for IMAP. Fetch or append a message, or do + * other things according to the options previously setup. */ static CURLcode imap_perform(struct connectdata *conn, bool *connected, bool *dophase_done) { /* This is IMAP and no proxy */ CURLcode result = CURLE_OK; + struct SessionHandle *data = conn->data; + struct IMAP *imap = data->req.protop; + struct imap_conn *imapc = &conn->proto.imapc; + bool selected = FALSE; DEBUGF(infof(conn->data, "DO phase starts\n")); if(conn->data->set.opt_no_body) { /* Requested no body means no transfer */ - struct FTP *imap = conn->data->state.proto.imap; imap->transfer = FTPTRANSFER_INFO; } *dophase_done = FALSE; /* not done yet */ + /* Determine if the requested mailbox (with the same UIDVALIDITY if set) + has already been selected on this connection */ + if(imap->mailbox && imapc->mailbox && + !strcmp(imap->mailbox, imapc->mailbox) && + (!imap->uidvalidity || !imapc->mailbox_uidvalidity || + !strcmp(imap->uidvalidity, imapc->mailbox_uidvalidity))) + selected = TRUE; + /* Start the first command in the DO phase */ - result = imap_select(conn); + if(conn->data->set.upload) + /* APPEND can be executed directly */ + result = imap_perform_append(conn); + else if(imap->custom && (selected || !imap->mailbox)) + /* Custom command using the same mailbox or no mailbox */ + result = imap_perform_list(conn); + else if(!imap->custom && selected && imap->uid) + /* FETCH from the same mailbox */ + result = imap_perform_fetch(conn); + else if(imap->mailbox && !selected && (imap->custom || imap->uid)) + /* SELECT the mailbox */ + result = imap_perform_select(conn); + else + /* LIST */ + result = imap_perform_list(conn); + if(result) return result; - /* run the state-machine */ + /* Run the state-machine */ result = imap_multi_statemach(conn, dophase_done); *connected = conn->bits.tcpconnect[FIRSTSOCKET]; @@ -1473,52 +1946,21 @@ static CURLcode imap_perform(struct connectdata *conn, bool *connected, */ static CURLcode imap_do(struct connectdata *conn, bool *done) { - CURLcode retcode = CURLE_OK; + CURLcode result = CURLE_OK; *done = FALSE; /* default to false */ - /* - Since connections can be re-used between SessionHandles, this might be a - connection already existing but on a fresh SessionHandle struct so we must - make sure we have a good 'struct IMAP' to play with. For new connections, - the struct IMAP is allocated and setup in the imap_connect() function. - */ - Curl_reset_reqproto(conn); - retcode = imap_init(conn); - if(retcode) - return retcode; - /* Parse the URL path */ - retcode = imap_parse_url_path(conn); - if(retcode) - return retcode; - - retcode = imap_regular_transfer(conn, done); - - return retcode; -} - -/*********************************************************************** - * - * imap_logout() - * - * This should be called before calling sclose(). We should then wait for the - * response from the server before returning. The calling code should then try - * to close the connection. - * - */ -static CURLcode imap_logout(struct connectdata *conn) -{ - CURLcode result = CURLE_OK; - const char *str = getcmdid(conn); - - result = imap_sendf(conn, str, "%s LOGOUT", str, NULL); + result = imap_parse_url_path(conn); if(result) return result; - state(conn, IMAP_LOGOUT); + /* Parse the custom request */ + result = imap_parse_custom_request(conn); + if(result) + return result; - result = imap_easy_statemach(conn); + result = imap_regular_transfer(conn, done); return result; } @@ -1532,16 +1974,17 @@ static CURLcode imap_logout(struct connectdata *conn) */ static CURLcode imap_disconnect(struct connectdata *conn, bool dead_connection) { - struct imap_conn *imapc= &conn->proto.imapc; + struct imap_conn *imapc = &conn->proto.imapc; /* We cannot send quit unconditionally. If this connection is stale or bad in any way, sending quit and waiting around here will make the - disconnect wait in vain and cause more problems than we need to */ + disconnect wait in vain and cause more problems than we need to. */ /* The IMAP session may or may not have been allocated/setup at this point! */ if(!dead_connection && imapc->pp.conn) - (void)imap_logout(conn); /* ignore errors on the LOGOUT */ + if(!imap_perform_logout(conn)) + (void)imap_block_statemach(conn); /* ignore errors on LOGOUT */ /* Disconnect from the server */ Curl_pp_disconnect(&imapc->pp); @@ -1551,35 +1994,15 @@ static CURLcode imap_disconnect(struct connectdata *conn, bool dead_connection) /* Cleanup our connection based variables */ Curl_safefree(imapc->mailbox); + Curl_safefree(imapc->mailbox_uidvalidity); return CURLE_OK; } -/*********************************************************************** - * - * imap_parse_url_path() - * - * Parse the URL path into separate path components. - * - */ -static CURLcode imap_parse_url_path(struct connectdata *conn) -{ - /* The imap struct is already inited in imap_connect() */ - struct imap_conn *imapc = &conn->proto.imapc; - struct SessionHandle *data = conn->data; - const char *path = data->state.path; - - if(!*path) - path = "INBOX"; - - /* URL decode the path and use this mailbox */ - return Curl_urldecode(data, path, 0, &imapc->mailbox, NULL, TRUE); -} - /* Call this when the DO phase has completed */ static CURLcode imap_dophase_done(struct connectdata *conn, bool connected) { - struct FTP *imap = conn->data->state.proto.imap; + struct IMAP *imap = conn->data->req.protop; (void)connected; @@ -1597,12 +2020,10 @@ static CURLcode imap_doing(struct connectdata *conn, bool *dophase_done) if(result) DEBUGF(infof(conn->data, "DO phase failed\n")); - else { - if(*dophase_done) { - result = imap_dophase_done(conn, FALSE /* not connected */); + else if(*dophase_done) { + result = imap_dophase_done(conn, FALSE /* not connected */); - DEBUGF(infof(conn->data, "DO phase is complete\n")); - } + DEBUGF(infof(conn->data, "DO phase is complete\n")); } return result; @@ -1627,30 +2048,33 @@ static CURLcode imap_regular_transfer(struct connectdata *conn, /* Make sure size is unknown at this point */ data->req.size = -1; + /* Set the progress data */ Curl_pgrsSetUploadCounter(data, 0); Curl_pgrsSetDownloadCounter(data, 0); Curl_pgrsSetUploadSize(data, 0); Curl_pgrsSetDownloadSize(data, 0); + /* Carry out the perform */ result = imap_perform(conn, &connected, dophase_done); - if(CURLE_OK == result) { - if(!*dophase_done) - /* The DO phase has not completed yet */ - return CURLE_OK; - + /* Perform post DO phase operations if necessary */ + if(!result && *dophase_done) result = imap_dophase_done(conn, connected); - } return result; } -static CURLcode imap_setup_connection(struct connectdata * conn) +static CURLcode imap_setup_connection(struct connectdata *conn) { struct SessionHandle *data = conn->data; + /* Initialise the IMAP layer */ + CURLcode result = imap_init(conn); + if(result) + return result; + if(conn->bits.httpproxy && !data->set.tunnel_thru_httpproxy) { - /* Unless we have asked to tunnel imap operations through the proxy, we + /* Unless we have asked to tunnel IMAP operations through the proxy, we switch and use HTTP operations only */ #ifndef CURL_DISABLE_HTTP if(conn->handler == &Curl_handler_imap) @@ -1664,10 +2088,8 @@ static CURLcode imap_setup_connection(struct connectdata * conn) #endif } - /* We explicitly mark this connection as persistent here as we're doing - IMAP over HTTP and thus we accidentally avoid setting this value - otherwise */ - conn->bits.close = FALSE; + /* set it up as an HTTP connection instead */ + return conn->handler->setup_connection(conn); #else failf(data, "IMAP over http proxy requires HTTP support built-in!"); return CURLE_UNSUPPORTED_PROTOCOL; @@ -1679,4 +2101,352 @@ static CURLcode imap_setup_connection(struct connectdata * conn) return CURLE_OK; } +/*********************************************************************** + * + * imap_sendf() + * + * Sends the formated string as an IMAP command to the server. + * + * Designed to never block. + */ +static CURLcode imap_sendf(struct connectdata *conn, const char *fmt, ...) +{ + CURLcode result = CURLE_OK; + struct imap_conn *imapc = &conn->proto.imapc; + char *taggedfmt; + va_list ap; + + DEBUGASSERT(fmt); + + /* Calculate the next command ID wrapping at 3 digits */ + imapc->cmdid = (imapc->cmdid + 1) % 1000; + + /* Calculate the tag based on the connection ID and command ID */ + snprintf(imapc->resptag, sizeof(imapc->resptag), "%c%03d", + 'A' + curlx_sltosi(conn->connection_id % 26), imapc->cmdid); + + /* Prefix the format with the tag */ + taggedfmt = aprintf("%s %s", imapc->resptag, fmt); + if(!taggedfmt) + return CURLE_OUT_OF_MEMORY; + + /* Send the data with the tag */ + va_start(ap, fmt); + result = Curl_pp_vsendf(&imapc->pp, taggedfmt, ap); + va_end(ap); + + Curl_safefree(taggedfmt); + + return result; +} + +/*********************************************************************** + * + * imap_atom() + * + * Checks the input string for characters that need escaping and returns an + * atom ready for sending to the server. + * + * The returned string needs to be freed. + * + */ +static char *imap_atom(const char *str) +{ + const char *p1; + char *p2; + size_t backsp_count = 0; + size_t quote_count = 0; + bool space_exists = FALSE; + size_t newlen = 0; + char *newstr = NULL; + + if(!str) + return NULL; + + /* Count any unescapped characters */ + p1 = str; + while(*p1) { + if(*p1 == '\\') + backsp_count++; + else if(*p1 == '"') + quote_count++; + else if(*p1 == ' ') + space_exists = TRUE; + + p1++; + } + + /* Does the input contain any unescapped characters? */ + if(!backsp_count && !quote_count && !space_exists) + return strdup(str); + + /* Calculate the new string length */ + newlen = strlen(str) + backsp_count + quote_count + (space_exists ? 2 : 0); + + /* Allocate the new string */ + newstr = (char *) malloc((newlen + 1) * sizeof(char)); + if(!newstr) + return NULL; + + /* Surround the string in quotes if necessary */ + p2 = newstr; + if(space_exists) { + newstr[0] = '"'; + newstr[newlen - 1] = '"'; + p2++; + } + + /* Copy the string, escaping backslash and quote characters along the way */ + p1 = str; + while(*p1) { + if(*p1 == '\\' || *p1 == '"') { + *p2 = '\\'; + p2++; + } + + *p2 = *p1; + + p1++; + p2++; + } + + /* Terminate the string */ + newstr[newlen] = '\0'; + + return newstr; +} + +/*********************************************************************** + * + * imap_is_bchar() + * + * Portable test of whether the specified char is a "bchar" as defined in the + * grammar of RFC-5092. + */ +static bool imap_is_bchar(char ch) +{ + switch(ch) { + /* bchar */ + case ':': case '@': case '/': + /* bchar -> achar */ + case '&': case '=': + /* bchar -> achar -> uchar -> unreserved */ + case '0': case '1': case '2': case '3': case '4': case '5': case '6': + case '7': case '8': case '9': + case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': case 'G': + case 'H': case 'I': case 'J': case 'K': case 'L': case 'M': case 'N': + case 'O': case 'P': case 'Q': case 'R': case 'S': case 'T': case 'U': + case 'V': case 'W': case 'X': case 'Y': case 'Z': + case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': case 'g': + case 'h': case 'i': case 'j': case 'k': case 'l': case 'm': case 'n': + case 'o': case 'p': case 'q': case 'r': case 's': case 't': case 'u': + case 'v': case 'w': case 'x': case 'y': case 'z': + case '-': case '.': case '_': case '~': + /* bchar -> achar -> uchar -> sub-delims-sh */ + case '!': case '$': case '\'': case '(': case ')': case '*': + case '+': case ',': + /* bchar -> achar -> uchar -> pct-encoded */ + case '%': /* HEXDIG chars are already included above */ + return true; + + default: + return false; + } +} + +/*********************************************************************** + * + * imap_parse_url_options() + * + * Parse the URL login options. + */ +static CURLcode imap_parse_url_options(struct connectdata *conn) +{ + CURLcode result = CURLE_OK; + struct imap_conn *imapc = &conn->proto.imapc; + const char *options = conn->options; + const char *ptr = options; + + if(options) { + const char *key = ptr; + + while(*ptr && *ptr != '=') + ptr++; + + if(strnequal(key, "AUTH", 4)) { + const char *value = ptr + 1; + + if(strequal(value, "*")) + imapc->prefmech = SASL_AUTH_ANY; + else if(strequal(value, SASL_MECH_STRING_LOGIN)) + imapc->prefmech = SASL_MECH_LOGIN; + else if(strequal(value, SASL_MECH_STRING_PLAIN)) + imapc->prefmech = SASL_MECH_PLAIN; + else if(strequal(value, SASL_MECH_STRING_CRAM_MD5)) + imapc->prefmech = SASL_MECH_CRAM_MD5; + else if(strequal(value, SASL_MECH_STRING_DIGEST_MD5)) + imapc->prefmech = SASL_MECH_DIGEST_MD5; + else if(strequal(value, SASL_MECH_STRING_GSSAPI)) + imapc->prefmech = SASL_MECH_GSSAPI; + else if(strequal(value, SASL_MECH_STRING_NTLM)) + imapc->prefmech = SASL_MECH_NTLM; + else if(strequal(value, SASL_MECH_STRING_XOAUTH2)) + imapc->prefmech = SASL_MECH_XOAUTH2; + else + imapc->prefmech = SASL_AUTH_NONE; + } + else + result = CURLE_URL_MALFORMAT; + } + + return result; +} + +/*********************************************************************** + * + * imap_parse_url_path() + * + * Parse the URL path into separate path components. + * + */ +static CURLcode imap_parse_url_path(struct connectdata *conn) +{ + /* The imap struct is already initialised in imap_connect() */ + CURLcode result = CURLE_OK; + struct SessionHandle *data = conn->data; + struct IMAP *imap = data->req.protop; + const char *begin = data->state.path; + const char *ptr = begin; + + /* See how much of the URL is a valid path and decode it */ + while(imap_is_bchar(*ptr)) + ptr++; + + if(ptr != begin) { + /* Remove the trailing slash if present */ + const char *end = ptr; + if(end > begin && end[-1] == '/') + end--; + + result = Curl_urldecode(data, begin, end - begin, &imap->mailbox, NULL, + TRUE); + if(result) + return result; + } + else + imap->mailbox = NULL; + + /* There can be any number of parameters in the form ";NAME=VALUE" */ + while(*ptr == ';') { + char *name; + char *value; + size_t valuelen; + + /* Find the length of the name parameter */ + begin = ++ptr; + while(*ptr && *ptr != '=') + ptr++; + + if(!*ptr) + return CURLE_URL_MALFORMAT; + + /* Decode the name parameter */ + result = Curl_urldecode(data, begin, ptr - begin, &name, NULL, TRUE); + if(result) + return result; + + /* Find the length of the value parameter */ + begin = ++ptr; + while(imap_is_bchar(*ptr)) + ptr++; + + /* Decode the value parameter */ + result = Curl_urldecode(data, begin, ptr - begin, &value, &valuelen, TRUE); + if(result) { + Curl_safefree(name); + return result; + } + + DEBUGF(infof(conn->data, "IMAP URL parameter '%s' = '%s'\n", name, value)); + + /* Process the known hierarchical parameters (UIDVALIDITY, UID and SECTION) + stripping of the trailing slash character if it is present. + + Note: Unknown parameters trigger a URL_MALFORMAT error. */ + if(Curl_raw_equal(name, "UIDVALIDITY") && !imap->uidvalidity) { + if(valuelen > 0 && value[valuelen - 1] == '/') + value[valuelen - 1] = '\0'; + + imap->uidvalidity = value; + value = NULL; + } + else if(Curl_raw_equal(name, "UID") && !imap->uid) { + if(valuelen > 0 && value[valuelen - 1] == '/') + value[valuelen - 1] = '\0'; + + imap->uid = value; + value = NULL; + } + else if(Curl_raw_equal(name, "SECTION") && !imap->section) { + if(valuelen > 0 && value[valuelen - 1] == '/') + value[valuelen - 1] = '\0'; + + imap->section = value; + value = NULL; + } + else { + Curl_safefree(name); + Curl_safefree(value); + + return CURLE_URL_MALFORMAT; + } + + Curl_safefree(name); + Curl_safefree(value); + } + + /* Any extra stuff at the end of the URL is an error */ + if(*ptr) + return CURLE_URL_MALFORMAT; + + return CURLE_OK; +} + +/*********************************************************************** + * + * imap_parse_custom_request() + * + * Parse the custom request. + */ +static CURLcode imap_parse_custom_request(struct connectdata *conn) +{ + CURLcode result = CURLE_OK; + struct SessionHandle *data = conn->data; + struct IMAP *imap = data->req.protop; + const char *custom = data->set.str[STRING_CUSTOMREQUEST]; + + if(custom) { + /* URL decode the custom request */ + result = Curl_urldecode(data, custom, 0, &imap->custom, NULL, TRUE); + + /* Extract the parameters if specified */ + if(!result) { + const char *params = imap->custom; + + while(*params && *params != ' ') + params++; + + if(*params) { + imap->custom_params = strdup(params); + imap->custom[params - imap->custom] = '\0'; + + if(!imap->custom_params) + result = CURLE_OUT_OF_MEMORY; + } + } + } + + return result; +} + #endif /* CURL_DISABLE_IMAP */ diff --git a/plugins/FTPFileYM/curl/lib/imap.h b/plugins/FTPFileYM/curl/lib/imap.h index b37cdab839..1d4faabd70 100644 --- a/plugins/FTPFileYM/curl/lib/imap.h +++ b/plugins/FTPFileYM/curl/lib/imap.h @@ -31,10 +31,10 @@ typedef enum { IMAP_STOP, /* do nothing state, stops the state machine */ IMAP_SERVERGREET, /* waiting for the initial greeting immediately after a connect */ + IMAP_CAPABILITY, IMAP_STARTTLS, IMAP_UPGRADETLS, /* asynchronously upgrade the connection to SSL/TLS (multi mode only) */ - IMAP_CAPABILITY, IMAP_AUTHENTICATE_PLAIN, IMAP_AUTHENTICATE_LOGIN, IMAP_AUTHENTICATE_LOGIN_PASSWD, @@ -43,26 +43,49 @@ typedef enum { IMAP_AUTHENTICATE_DIGESTMD5_RESP, IMAP_AUTHENTICATE_NTLM, IMAP_AUTHENTICATE_NTLM_TYPE2MSG, - IMAP_AUTHENTICATE, + IMAP_AUTHENTICATE_XOAUTH2, + IMAP_AUTHENTICATE_FINAL, IMAP_LOGIN, + IMAP_LIST, IMAP_SELECT, IMAP_FETCH, + IMAP_FETCH_FINAL, + IMAP_APPEND, + IMAP_APPEND_FINAL, IMAP_LOGOUT, IMAP_LAST /* never used */ } imapstate; +/* This IMAP struct is used in the SessionHandle. All IMAP data that is + connection-oriented must be in imap_conn to properly deal with the fact that + perhaps the SessionHandle is changed between the times the connection is + used. */ +struct IMAP { + curl_pp_transfer transfer; + char *mailbox; /* Mailbox to select */ + char *uidvalidity; /* UIDVALIDITY to check in select */ + char *uid; /* Message UID to fetch */ + char *section; /* Message SECTION to fetch */ + char *custom; /* Custom request */ + char *custom_params; /* Parameters for the custom request */ +}; + /* imap_conn is used for struct connection-oriented data in the connectdata struct */ struct imap_conn { struct pingpong pp; - char *mailbox; /* Mailbox to select */ - unsigned int authmechs; /* Accepted authentication mechanisms */ - unsigned int authused; /* Auth mechanism used for the connection */ - imapstate state; /* Always use imap.c:state() to change state! */ - int cmdid; /* Next command ID */ - const char *idstr; /* String based response ID to wait for */ - bool ssldone; /* Is connect() over SSL done? */ - bool login_disabled; /* LOGIN command explicitly disabled by server */ + imapstate state; /* Always use imap.c:state() to change state! */ + bool ssldone; /* Is connect() over SSL done? */ + unsigned int authmechs; /* Accepted authentication mechanisms */ + unsigned int prefmech; /* Preferred authentication mechanism */ + unsigned int authused; /* Auth mechanism used for the connection */ + int cmdid; /* Last used command ID */ + char resptag[5]; /* Response tag to wait for */ + bool tls_supported; /* StartTLS capability supported by server */ + bool login_disabled; /* LOGIN command disabled by server */ + bool ir_supported; /* Initial response supported by server */ + char *mailbox; /* The last selected mailbox */ + char *mailbox_uidvalidity; /* UIDVALIDITY parsed from select response */ }; extern const struct Curl_handler Curl_handler_imap; diff --git a/plugins/FTPFileYM/curl/lib/krb5.c b/plugins/FTPFileYM/curl/lib/krb5.c index 1e99c709e6..1643f11a6a 100644 --- a/plugins/FTPFileYM/curl/lib/krb5.c +++ b/plugins/FTPFileYM/curl/lib/krb5.c @@ -1,6 +1,6 @@ /* GSSAPI/krb5 support for FTP - loosely based on old krb4.c * - * Copyright (c) 1995, 1996, 1997, 1998, 1999 Kungliga Tekniska Högskolan + * Copyright (c) 1995, 1996, 1997, 1998, 1999, 2013 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * Copyright (c) 2004 - 2012 Daniel Stenberg * All rights reserved. @@ -51,7 +51,7 @@ #include "ftp.h" #include "curl_gssapi.h" #include "sendf.h" -#include "krb4.h" +#include "curl_sec.h" #include "curl_memory.h" #include "warnless.h" diff --git a/plugins/FTPFileYM/curl/lib/ldap.c b/plugins/FTPFileYM/curl/lib/ldap.c index 833ffa4453..c2fa1735fa 100644 --- a/plugins/FTPFileYM/curl/lib/ldap.c +++ b/plugins/FTPFileYM/curl/lib/ldap.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -77,13 +77,16 @@ /* Use our own implementation. */ typedef struct { - char *lud_host; - int lud_port; - char *lud_dn; - char **lud_attrs; - int lud_scope; - char *lud_filter; - char **lud_exts; + char *lud_host; + int lud_port; + char *lud_dn; + char **lud_attrs; + int lud_scope; + char *lud_filter; + char **lud_exts; + size_t lud_attrs_dups; /* how many were dup'ed, this field is not in the + "real" struct so can only be used in code + without HAVE_LDAP_URL_PARSE defined */ } CURL_LDAPURLDesc; #undef LDAPURLDesc @@ -260,7 +263,7 @@ static CURLcode Curl_ldap(struct connectdata *conn, bool *done) } server = ldapssl_init(conn->host.name, (int)conn->port, 1); if(server == NULL) { - failf(data, "LDAP local: Cannot connect to %s:%hu", + failf(data, "LDAP local: Cannot connect to %s:%ld", conn->host.name, conn->port); status = CURLE_COULDNT_CONNECT; goto quit; @@ -301,7 +304,7 @@ static CURLcode Curl_ldap(struct connectdata *conn, bool *done) } server = ldap_init(conn->host.name, (int)conn->port); if(server == NULL) { - failf(data, "LDAP local: Cannot connect to %s:%hu", + failf(data, "LDAP local: Cannot connect to %s:%ld", conn->host.name, conn->port); status = CURLE_COULDNT_CONNECT; goto quit; @@ -337,7 +340,7 @@ static CURLcode Curl_ldap(struct connectdata *conn, bool *done) else { server = ldap_init(conn->host.name, (int)conn->port); if(server == NULL) { - failf(data, "LDAP local: Cannot connect to %s:%hu", + failf(data, "LDAP local: Cannot connect to %s:%ld", conn->host.name, conn->port); status = CURLE_COULDNT_CONNECT; goto quit; @@ -539,19 +542,15 @@ static bool unescape_elements (void *data, LDAPURLDesc *ludp) if(ludp->lud_filter) { ludp->lud_filter = curl_easy_unescape(data, ludp->lud_filter, 0, NULL); if(!ludp->lud_filter) - return (FALSE); + return FALSE; } for(i = 0; ludp->lud_attrs && ludp->lud_attrs[i]; i++) { - ludp->lud_attrs[i] = curl_easy_unescape(data, ludp->lud_attrs[i], 0, NULL); + ludp->lud_attrs[i] = curl_easy_unescape(data, ludp->lud_attrs[i], + 0, NULL); if(!ludp->lud_attrs[i]) - return (FALSE); - } - - for(i = 0; ludp->lud_exts && ludp->lud_exts[i]; i++) { - ludp->lud_exts[i] = curl_easy_unescape(data, ludp->lud_exts[i], 0, NULL); - if(!ludp->lud_exts[i]) - return (FALSE); + return FALSE; + ludp->lud_attrs_dups++; } if(ludp->lud_dn) { @@ -637,8 +636,9 @@ static int _ldap_url_parse2 (const struct connectdata *conn, LDAPURLDesc *ludp) if(*p && *p != '?') { ludp->lud_scope = str2scope(p); - if(ludp->lud_scope == -1) + if(ludp->lud_scope == -1) { return LDAP_INVALID_SYNTAX; + } LDAP_TRACE (("scope %d\n", ludp->lud_scope)); } @@ -651,25 +651,13 @@ static int _ldap_url_parse2 (const struct connectdata *conn, LDAPURLDesc *ludp) q = strchr(p, '?'); if(q) *q++ = '\0'; - if(!*p) + if(!*p) { return LDAP_INVALID_SYNTAX; + } ludp->lud_filter = p; LDAP_TRACE (("filter '%s'\n", ludp->lud_filter)); - p = q; - if(!p) - goto success; - - /* parse extensions - */ - ludp->lud_exts = split_str(p); - if(!ludp->lud_exts) - return LDAP_NO_MEMORY; - - for(i = 0; ludp->lud_exts[i]; i++) - LDAP_TRACE (("exts[%d] '%s'\n", i, ludp->lud_exts[i])); - success: if(!unescape_elements(conn->data, ludp)) return LDAP_NO_MEMORY; @@ -697,7 +685,7 @@ static int _ldap_url_parse (const struct connectdata *conn, static void _ldap_free_urldesc (LDAPURLDesc *ludp) { - int i; + size_t i; if(!ludp) return; @@ -709,16 +697,11 @@ static void _ldap_free_urldesc (LDAPURLDesc *ludp) free(ludp->lud_filter); if(ludp->lud_attrs) { - for(i = 0; ludp->lud_attrs[i]; i++) + for(i = 0; i < ludp->lud_attrs_dups; i++) free(ludp->lud_attrs[i]); free(ludp->lud_attrs); } - if(ludp->lud_exts) { - for(i = 0; ludp->lud_exts[i]; i++) - free(ludp->lud_exts[i]); - free(ludp->lud_exts); - } free (ludp); } #endif /* !HAVE_LDAP_URL_PARSE */ diff --git a/plugins/FTPFileYM/curl/lib/md5.c b/plugins/FTPFileYM/curl/lib/md5.c index 57efa431b5..d8344dbe43 100644 --- a/plugins/FTPFileYM/curl/lib/md5.c +++ b/plugins/FTPFileYM/curl/lib/md5.c @@ -90,16 +90,36 @@ static void MD5_Final(unsigned char digest[16], MD5_CTX * ctx) # include <md5.h> # endif -#elif defined(__MAC_10_4) || defined(__IPHONE_5_0) +#elif (defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && \ + (__MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)) || \ + (defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && \ + (__IPHONE_OS_VERSION_MAX_ALLOWED >= 20000)) /* For Apple operating systems: CommonCrypto has the functions we need. - The library's headers are even backward-compatible with OpenSSL's - headers as long as we define COMMON_DIGEST_FOR_OPENSSL first. + These functions are available on Tiger and later, as well as iOS 2.0 + and later. If you're building for an older cat, well, sorry. - These functions are available on Tiger and later, as well as iOS 5.0 - and later. If you're building for an older cat, well, sorry. */ -# define COMMON_DIGEST_FOR_OPENSSL + Declaring the functions as static like this seems to be a bit more + reliable than defining COMMON_DIGEST_FOR_OPENSSL on older cats. */ # include <CommonCrypto/CommonDigest.h> +# define MD5_CTX CC_MD5_CTX + +static void MD5_Init(MD5_CTX *ctx) +{ + CC_MD5_Init(ctx); +} + +static void MD5_Update(MD5_CTX *ctx, + const unsigned char *input, + unsigned int inputLen) +{ + CC_MD5_Update(ctx, input, inputLen); +} + +static void MD5_Final(unsigned char digest[16], MD5_CTX *ctx) +{ + CC_MD5_Final(digest, ctx); +} #elif defined(_WIN32) diff --git a/plugins/FTPFileYM/curl/lib/memdebug.c b/plugins/FTPFileYM/curl/lib/memdebug.c index 4d5f44d2f0..7d68af874c 100644 --- a/plugins/FTPFileYM/curl/lib/memdebug.c +++ b/plugins/FTPFileYM/curl/lib/memdebug.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -185,8 +185,10 @@ void *curl_domalloc(size_t wantedsize, int line, const char *source) } if(source) - curl_memlog("MEM %s:%d malloc(%zd) = %p\n", - source, line, wantedsize, mem ? mem->mem : 0); + curl_memlog("MEM %s:%d malloc(%zu) = %p\n", + source, line, wantedsize, + mem ? (void *)mem->mem : (void *)0); + return (mem ? mem->mem : NULL); } @@ -212,7 +214,9 @@ void *curl_docalloc(size_t wanted_elements, size_t wanted_size, if(source) curl_memlog("MEM %s:%d calloc(%zu,%zu) = %p\n", - source, line, wanted_elements, wanted_size, mem?mem->mem:0); + source, line, wanted_elements, wanted_size, + mem ? (void *)mem->mem : (void *)0); + return (mem ? mem->mem : NULL); } @@ -234,10 +238,36 @@ char *curl_dostrdup(const char *str, int line, const char *source) if(source) curl_memlog("MEM %s:%d strdup(%p) (%zu) = %p\n", - source, line, str, len, mem); + source, line, (void *)str, len, (void *)mem); + + return mem; +} + +#if defined(WIN32) && defined(UNICODE) +wchar_t *curl_dowcsdup(const wchar_t *str, int line, const char *source) +{ + wchar_t *mem; + size_t wsiz, bsiz; + + assert(str != NULL); + + if(countcheck("wcsdup", line, source)) + return NULL; + + wsiz = wcslen(str) + 1; + bsiz = wsiz * sizeof(wchar_t); + + mem = curl_domalloc(bsiz, 0, NULL); /* NULL prevents logging */ + if(mem) + memcpy(mem, str, bsiz); + + if(source) + curl_memlog("MEM %s:%d wcsdup(%p) (%zu) = %p\n", + source, line, (void *)str, bsiz, (void *)mem); return mem; } +#endif /* We provide a realloc() that accepts a NULL as pointer, which then performs a malloc(). In order to work with ares. */ @@ -269,7 +299,8 @@ void *curl_dorealloc(void *ptr, size_t wantedsize, mem = (Curl_crealloc)(mem, size); if(source) curl_memlog("MEM %s:%d realloc(%p, %zu) = %p\n", - source, line, ptr, wantedsize, mem?mem->mem:NULL); + source, line, (void *)ptr, wantedsize, + mem ? (void *)mem->mem : (void *)0); if(mem) { mem->size = wantedsize; @@ -304,7 +335,7 @@ void curl_dofree(void *ptr, int line, const char *source) (Curl_cfree)(mem); if(source) - curl_memlog("MEM %s:%d free(%p)\n", source, line, ptr); + curl_memlog("MEM %s:%d free(%p)\n", source, line, (void *)ptr); } curl_socket_t curl_socket(int domain, int type, int protocol, @@ -317,8 +348,10 @@ curl_socket_t curl_socket(int domain, int type, int protocol, "FD %s:%d socket() = %zd\n" ; curl_socket_t sockfd = socket(domain, type, protocol); + if(source && (sockfd != CURL_SOCKET_BAD)) curl_memlog(fmt, source, line, sockfd); + return sockfd; } @@ -334,8 +367,10 @@ int curl_socketpair(int domain, int type, int protocol, "FD %s:%d socketpair() = %zd %zd\n" ; int res = socketpair(domain, type, protocol, socket_vector); + if(source && (0 == res)) curl_memlog(fmt, source, line, socket_vector[0], socket_vector[1]); + return res; } #endif @@ -351,9 +386,12 @@ curl_socket_t curl_accept(curl_socket_t s, void *saddr, void *saddrlen, struct sockaddr *addr = (struct sockaddr *)saddr; curl_socklen_t *addrlen = (curl_socklen_t *)saddrlen; + curl_socket_t sockfd = accept(s, addr, addrlen); + if(source && (sockfd != CURL_SOCKET_BAD)) curl_memlog(fmt, source, line, sockfd); + return sockfd; } @@ -382,9 +420,11 @@ FILE *curl_fopen(const char *file, const char *mode, int line, const char *source) { FILE *res=fopen(file, mode); + if(source) curl_memlog("FILE %s:%d fopen(\"%s\",\"%s\") = %p\n", - source, line, file, mode, res); + source, line, file, mode, (void *)res); + return res; } @@ -393,9 +433,11 @@ FILE *curl_fdopen(int filedes, const char *mode, int line, const char *source) { FILE *res=fdopen(filedes, mode); + if(source) curl_memlog("FILE %s:%d fdopen(\"%d\",\"%s\") = %p\n", - source, line, filedes, mode, res); + source, line, filedes, mode, (void *)res); + return res; } #endif @@ -407,9 +449,11 @@ int curl_fclose(FILE *file, int line, const char *source) assert(file != NULL); res=fclose(file); + if(source) curl_memlog("FILE %s:%d fclose(%p)\n", - source, line, file); + source, line, (void *)file); + return res; } diff --git a/plugins/FTPFileYM/curl/lib/memdebug.h b/plugins/FTPFileYM/curl/lib/memdebug.h index fbeb61de5d..bd565c8dcf 100644 --- a/plugins/FTPFileYM/curl/lib/memdebug.h +++ b/plugins/FTPFileYM/curl/lib/memdebug.h @@ -8,7 +8,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -46,6 +46,11 @@ CURL_EXTERN void *curl_dorealloc(void *ptr, size_t size, int line, const char *source); CURL_EXTERN void curl_dofree(void *ptr, int line, const char *source); CURL_EXTERN char *curl_dostrdup(const char *str, int line, const char *source); +#if defined(WIN32) && defined(UNICODE) +CURL_EXTERN wchar_t *curl_dowcsdup(const wchar_t *str, int line, + const char *source); +#endif + CURL_EXTERN void curl_memdebug(const char *logname); CURL_EXTERN void curl_memlimit(long limit); CURL_EXTERN void curl_memlog(const char *format, ...); @@ -84,6 +89,20 @@ CURL_EXTERN int curl_fclose(FILE *file, int line, const char *source); #define realloc(ptr,size) curl_dorealloc(ptr, size, __LINE__, __FILE__) #define free(ptr) curl_dofree(ptr, __LINE__, __FILE__) +#ifdef WIN32 +# ifdef UNICODE +# undef wcsdup +# define wcsdup(ptr) curl_dowcsdup(ptr, __LINE__, __FILE__) +# undef _wcsdup +# define _wcsdup(ptr) curl_dowcsdup(ptr, __LINE__, __FILE__) +# undef _tcsdup +# define _tcsdup(ptr) curl_dowcsdup(ptr, __LINE__, __FILE__) +# else +# undef _tcsdup +# define _tcsdup(ptr) curl_dostrdup(ptr, __LINE__, __FILE__) +# endif +#endif + #define socket(domain,type,protocol)\ curl_socket(domain,type,protocol,__LINE__,__FILE__) #undef accept /* for those with accept as a macro */ diff --git a/plugins/FTPFileYM/curl/lib/mprintf.c b/plugins/FTPFileYM/curl/lib/mprintf.c index b5b81536ab..8f392c7f29 100644 --- a/plugins/FTPFileYM/curl/lib/mprintf.c +++ b/plugins/FTPFileYM/curl/lib/mprintf.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1999 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1999 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -203,101 +203,6 @@ static int dprintf_IsQualifierNoDollar(char c) } } -#ifdef DPRINTF_DEBUG2 -static void dprintf_Pass1Report(va_stack_t *vto, int max) -{ - int i; - char buffer[256]; - int bit; - int flags; - - for(i=0; i<max; i++) { - char *type; - switch(vto[i].type) { - case FORMAT_UNKNOWN: - type = "unknown"; - break; - case FORMAT_STRING: - type ="string"; - break; - case FORMAT_PTR: - type ="pointer"; - break; - case FORMAT_INT: - type = "int"; - break; - case FORMAT_INTPTR: - type = "intptr"; - break; - case FORMAT_LONG: - type = "long"; - break; - case FORMAT_LONGLONG: - type = "long long"; - break; - case FORMAT_DOUBLE: - type = "double"; - break; - case FORMAT_LONGDOUBLE: - type = "long double"; - break; - } - - - buffer[0]=0; - - for(bit=0; bit<31; bit++) { - flags = vto[i].flags & (1<<bit); - - if(flags & FLAGS_SPACE) - strcat(buffer, "space "); - else if(flags & FLAGS_SHOWSIGN) - strcat(buffer, "plus "); - else if(flags & FLAGS_LEFT) - strcat(buffer, "left "); - else if(flags & FLAGS_ALT) - strcat(buffer, "alt "); - else if(flags & FLAGS_SHORT) - strcat(buffer, "short "); - else if(flags & FLAGS_LONG) - strcat(buffer, "long "); - else if(flags & FLAGS_LONGLONG) - strcat(buffer, "longlong "); - else if(flags & FLAGS_LONGDOUBLE) - strcat(buffer, "longdouble "); - else if(flags & FLAGS_PAD_NIL) - strcat(buffer, "padnil "); - else if(flags & FLAGS_UNSIGNED) - strcat(buffer, "unsigned "); - else if(flags & FLAGS_OCTAL) - strcat(buffer, "octal "); - else if(flags & FLAGS_HEX) - strcat(buffer, "hex "); - else if(flags & FLAGS_UPPER) - strcat(buffer, "upper "); - else if(flags & FLAGS_WIDTH) - strcat(buffer, "width "); - else if(flags & FLAGS_WIDTHPARAM) - strcat(buffer, "widthparam "); - else if(flags & FLAGS_PREC) - strcat(buffer, "precision "); - else if(flags & FLAGS_PRECPARAM) - strcat(buffer, "precparam "); - else if(flags & FLAGS_CHAR) - strcat(buffer, "char "); - else if(flags & FLAGS_FLOATE) - strcat(buffer, "floate "); - else if(flags & FLAGS_FLOATG) - strcat(buffer, "floatg "); - } - printf("REPORT: %d. %s [%s]\n", i, type, buffer); - - } - - -} -#endif - /****************************************************************** * * Pass 1: @@ -475,11 +380,11 @@ static long dprintf_Pass1(const char *format, va_stack_t *vto, char **endpos, break; case 'x': vto[i].type = FORMAT_INT; - flags |= FLAGS_HEX; + flags |= FLAGS_HEX|FLAGS_UNSIGNED; break; case 'X': vto[i].type = FORMAT_INT; - flags |= FLAGS_HEX|FLAGS_UPPER; + flags |= FLAGS_HEX|FLAGS_UPPER|FLAGS_UNSIGNED; break; case 'c': vto[i].type = FORMAT_INT; @@ -537,10 +442,6 @@ static long dprintf_Pass1(const char *format, va_stack_t *vto, char **endpos, } } -#ifdef DPRINTF_DEBUG2 - dprintf_Pass1Report(vto, max_param); -#endif - /* Read the arg list parameters into our data list */ for(i=0; i<max_param; i++) { if((i + 1 < max_param) && (vto[i + 1].type == FORMAT_WIDTH)) { @@ -732,23 +633,23 @@ static int dprintf_formatf( OUTCHAR(' '); break; } - if(p->flags & FLAGS_UNSIGNED) { - /* Decimal unsigned integer. */ - base = 10; - goto unsigned_number; - } if(p->flags & FLAGS_OCTAL) { /* Octal unsigned integer. */ base = 8; goto unsigned_number; } - if(p->flags & FLAGS_HEX) { + else if(p->flags & FLAGS_HEX) { /* Hexadecimal unsigned integer. */ digits = (p->flags & FLAGS_UPPER)? upper_digits : lower_digits; base = 16; goto unsigned_number; } + else if(p->flags & FLAGS_UNSIGNED) { + /* Decimal unsigned integer. */ + base = 10; + goto unsigned_number; + } /* Decimal integer. */ base = 10; @@ -919,7 +820,7 @@ static int dprintf_formatf( case FORMAT_DOUBLE: { char formatbuf[32]="%"; - char *fptr; + char *fptr = &formatbuf[1]; size_t left = sizeof(formatbuf)-strlen(formatbuf); int len; @@ -936,15 +837,15 @@ static int dprintf_formatf( prec = (long)vto[p->precision].data.num.as_signed; if(p->flags & FLAGS_LEFT) - strcat(formatbuf, "-"); + *fptr++ = '-'; if(p->flags & FLAGS_SHOWSIGN) - strcat(formatbuf, "+"); + *fptr++ = '+'; if(p->flags & FLAGS_SPACE) - strcat(formatbuf, " "); + *fptr++ = ' '; if(p->flags & FLAGS_ALT) - strcat(formatbuf, "#"); + *fptr++ = '#'; - fptr=&formatbuf[strlen(formatbuf)]; + *fptr = 0; if(width >= 0) { /* RECURSIVE USAGE */ @@ -969,8 +870,8 @@ static int dprintf_formatf( *fptr = 0; /* and a final zero termination */ - /* NOTE NOTE NOTE!! Not all sprintf() implementations returns number - of output characters */ + /* NOTE NOTE NOTE!! Not all sprintf implementations return number of + output characters */ (sprintf)(work, formatbuf, p->data.dnum); for(fptr=work; *fptr; fptr++) diff --git a/plugins/FTPFileYM/curl/lib/multi.c b/plugins/FTPFileYM/curl/lib/multi.c index fa0afb9f83..e723a3ebf0 100644 --- a/plugins/FTPFileYM/curl/lib/multi.c +++ b/plugins/FTPFileYM/curl/lib/multi.c @@ -40,6 +40,7 @@ #include "conncache.h" #include "bundles.h" #include "multihandle.h" +#include "pipeline.h" #define _MPRINTF_REPLACE /* use our functions only */ #include <curl/mprintf.h> @@ -57,6 +58,7 @@ #define CURL_SOCKET_HASH_TABLE_SIZE 911 #endif +#define CURL_CONNECTION_HASH_SIZE 97 #define CURL_MULTI_HANDLE 0x000bab1e @@ -66,25 +68,21 @@ ((x) && (((struct SessionHandle *)(x))->magic == CURLEASY_MAGIC_NUMBER)) static void singlesocket(struct Curl_multi *multi, - struct Curl_one_easy *easy); + struct SessionHandle *data); static int update_timer(struct Curl_multi *multi); -static CURLcode addHandleToSendOrPendPipeline(struct SessionHandle *handle, - struct connectdata *conn); -static int checkPendPipeline(struct connectdata *conn); -static void moveHandleFromSendToRecvPipeline(struct SessionHandle *handle, - struct connectdata *conn); -static void moveHandleFromRecvToDonePipeline(struct SessionHandle *handle, - struct connectdata *conn); static bool isHandleAtHead(struct SessionHandle *handle, struct curl_llist *pipeline); static CURLMcode add_next_timeout(struct timeval now, struct Curl_multi *multi, struct SessionHandle *d); +static CURLMcode multi_timeout(struct Curl_multi *multi, + long *timeout_ms); #ifdef DEBUGBUILD static const char * const statename[]={ "INIT", + "CONNECT_PEND", "CONNECT", "WAITRESOLVE", "WAITCONNECT", @@ -107,7 +105,7 @@ static const char * const statename[]={ static void multi_freetimeout(void *a, void *b); /* always use this function to change state, to make debugging easier */ -static void mstate(struct Curl_one_easy *easy, CURLMstate state +static void mstate(struct SessionHandle *data, CURLMstate state #ifdef DEBUGBUILD , int lineno #endif @@ -116,29 +114,29 @@ static void mstate(struct Curl_one_easy *easy, CURLMstate state #ifdef DEBUGBUILD long connection_id = -5000; #endif - CURLMstate oldstate = easy->state; + CURLMstate oldstate = data->mstate; if(oldstate == state) /* don't bother when the new state is the same as the old state */ return; - easy->state = state; + data->mstate = state; #ifdef DEBUGBUILD - if(easy->easy_conn) { - if(easy->state > CURLM_STATE_CONNECT && - easy->state < CURLM_STATE_COMPLETED) - connection_id = easy->easy_conn->connection_id; + if(data->mstate >= CURLM_STATE_CONNECT_PEND && + data->mstate < CURLM_STATE_COMPLETED) { + if(data->easy_conn) + connection_id = data->easy_conn->connection_id; - infof(easy->easy_handle, + infof(data, "STATE: %s => %s handle %p; line %d (connection #%ld) \n", - statename[oldstate], statename[easy->state], - (char *)easy, lineno, connection_id); + statename[oldstate], statename[data->mstate], + (void *)data, lineno, connection_id); } #endif if(state == CURLM_STATE_COMPLETED) /* changing to COMPLETED means there's one less easy handle 'alive' */ - easy->easy_handle->multi->num_alive--; + data->multi->num_alive--; } #ifndef DEBUGBUILD @@ -218,16 +216,16 @@ static void sh_freeentry(void *freethis) free(p); } -static size_t fd_key_compare(void*k1, size_t k1_len, void*k2, size_t k2_len) +static size_t fd_key_compare(void *k1, size_t k1_len, void *k2, size_t k2_len) { (void) k1_len; (void) k2_len; - return (*((int* ) k1)) == (*((int* ) k2)); + return (*((int *) k1)) == (*((int *) k2)); } -static size_t hash_fd(void* key, size_t key_length, size_t slots_num) +static size_t hash_fd(void *key, size_t key_length, size_t slots_num) { - int fd = * ((int* ) key); + int fd = *((int *) key); (void) key_length; return (fd % (int)slots_num); @@ -251,9 +249,9 @@ static size_t hash_fd(void* key, size_t key_length, size_t slots_num) * per call." * */ -static struct curl_hash *sh_init(void) +static struct curl_hash *sh_init(int hashsize) { - return Curl_hash_alloc(CURL_SOCKET_HASH_TABLE_SIZE, hash_fd, fd_key_compare, + return Curl_hash_alloc(hashsize, hash_fd, fd_key_compare, sh_freeentry); } @@ -283,7 +281,8 @@ static void multi_freeamsg(void *a, void *b) (void)b; } -CURLM *curl_multi_init(void) +struct Curl_multi *Curl_multi_handle(int hashsize, /* socket hash */ + int chashsize) /* connection hash */ { struct Curl_multi *multi = calloc(1, sizeof(struct Curl_multi)); @@ -296,11 +295,11 @@ CURLM *curl_multi_init(void) if(!multi->hostcache) goto error; - multi->sockhash = sh_init(); + multi->sockhash = sh_init(hashsize); if(!multi->sockhash) goto error; - multi->conn_cache = Curl_conncache_init(); + multi->conn_cache = Curl_conncache_init(chashsize); if(!multi->conn_cache) goto error; @@ -308,12 +307,15 @@ CURLM *curl_multi_init(void) if(!multi->msglist) goto error; - /* Let's make the doubly-linked list a circular list. This makes - the linked list code simpler and allows inserting at the end - with less work (we didn't keep a tail pointer before). */ - multi->easy.next = &multi->easy; - multi->easy.prev = &multi->easy; + /* allocate a new easy handle to use when closing cached connections */ + multi->closure_handle = curl_easy_init(); + if(!multi->closure_handle) + goto error; + + multi->closure_handle->multi = multi; + multi->closure_handle->state.conn_cache = multi->conn_cache; + multi->max_pipeline_length = 5; return (CURLM *) multi; error: @@ -324,20 +326,25 @@ CURLM *curl_multi_init(void) multi->hostcache = NULL; Curl_conncache_destroy(multi->conn_cache); multi->conn_cache = NULL; + Curl_close(multi->closure_handle); + multi->closure_handle = NULL; free(multi); return NULL; } +CURLM *curl_multi_init(void) +{ + return Curl_multi_handle(CURL_SOCKET_HASH_TABLE_SIZE, + CURL_CONNECTION_HASH_SIZE); +} + CURLMcode curl_multi_add_handle(CURLM *multi_handle, CURL *easy_handle) { struct curl_llist *timeoutlist; - struct Curl_one_easy *easy; struct Curl_multi *multi = (struct Curl_multi *)multi_handle; struct SessionHandle *data = (struct SessionHandle *)easy_handle; - struct SessionHandle *new_closure = NULL; - struct curl_hash *hostcache = NULL; /* First, make some basic checks that the CURLM handle is a good handle */ if(!GOOD_MULTI_HANDLE(multi)) @@ -347,110 +354,73 @@ CURLMcode curl_multi_add_handle(CURLM *multi_handle, if(!GOOD_EASY_HANDLE(easy_handle)) return CURLM_BAD_EASY_HANDLE; - /* Prevent users from adding same easy handle more than - once and prevent adding to more than one multi stack */ + /* Prevent users from adding same easy handle more than once and prevent + adding to more than one multi stack */ if(data->multi) - /* possibly we should create a new unique error code for this condition */ - return CURLM_BAD_EASY_HANDLE; + return CURLM_ADDED_ALREADY; /* Allocate and initialize timeout list for easy handle */ timeoutlist = Curl_llist_alloc(multi_freetimeout); if(!timeoutlist) return CURLM_OUT_OF_MEMORY; - /* Allocate new node for the doubly-linked circular list of - Curl_one_easy structs that holds pointers to easy handles */ - easy = calloc(1, sizeof(struct Curl_one_easy)); - if(!easy) { - Curl_llist_destroy(timeoutlist, NULL); - return CURLM_OUT_OF_MEMORY; - } - - /* In case multi handle has no hostcache yet, allocate one */ - if(!multi->hostcache) { - hostcache = Curl_mk_dnscache(); - if(!hostcache) { - free(easy); - Curl_llist_destroy(timeoutlist, NULL); - return CURLM_OUT_OF_MEMORY; - } - } - - /* In case multi handle has no closure_handle yet, allocate - a new easy handle to use when closing cached connections */ - if(!multi->closure_handle) { - new_closure = (struct SessionHandle *)curl_easy_init(); - if(!new_closure) { - Curl_hash_destroy(hostcache); - free(easy); - Curl_llist_destroy(timeoutlist, NULL); - return CURLM_OUT_OF_MEMORY; - } - } - /* - ** No failure allowed in this function beyond this point. And - ** no modification of easy nor multi handle allowed before this - ** except for potential multi's connection cache growing which - ** won't be undone in this function no matter what. - */ - - /* In case a new closure handle has been initialized above, it - is associated now with the multi handle which lacked one. */ - if(new_closure) { - multi->closure_handle = new_closure; - Curl_easy_addmulti(multi->closure_handle, multi_handle); - multi->closure_handle->state.conn_cache = multi->conn_cache; - } - - /* In case hostcache has been allocated above, - it is associated now with the multi handle. */ - if(hostcache) - multi->hostcache = hostcache; + * No failure allowed in this function beyond this point. And no + * modification of easy nor multi handle allowed before this except for + * potential multi's connection cache growing which won't be undone in this + * function no matter what. + */ /* Make easy handle use timeout list initialized above */ data->state.timeoutlist = timeoutlist; timeoutlist = NULL; /* set the easy handle */ - easy->easy_handle = data; - multistate(easy, CURLM_STATE_INIT); - - /* set the back pointer to one_easy to assist in removal */ - easy->easy_handle->multi_pos = easy; - + multistate(data, CURLM_STATE_INIT); + + if((data->set.global_dns_cache) && + (data->dns.hostcachetype != HCACHE_GLOBAL)) { + /* global dns cache was requested but still isn't */ + struct curl_hash *global = Curl_global_host_cache_init(); + if(global) { + /* only do this if the global cache init works */ + data->dns.hostcache = global; + data->dns.hostcachetype = HCACHE_GLOBAL; + } + } /* for multi interface connections, we share DNS cache automatically if the easy handle's one is currently not set. */ - if(!easy->easy_handle->dns.hostcache || - (easy->easy_handle->dns.hostcachetype == HCACHE_NONE)) { - easy->easy_handle->dns.hostcache = multi->hostcache; - easy->easy_handle->dns.hostcachetype = HCACHE_MULTI; + else if(!data->dns.hostcache || + (data->dns.hostcachetype == HCACHE_NONE)) { + data->dns.hostcache = multi->hostcache; + data->dns.hostcachetype = HCACHE_MULTI; } /* Point to the multi's connection cache */ - easy->easy_handle->state.conn_cache = multi->conn_cache; + data->state.conn_cache = multi->conn_cache; /* This adds the new entry at the 'end' of the doubly-linked circular - list of Curl_one_easy structs to try and maintain a FIFO queue so + list of SessionHandle structs to try and maintain a FIFO queue so the pipelined requests are in order. */ - /* We add this new entry last in the list. We make our 'next' point to the - 'first' struct and our 'prev' point to the previous 'prev' */ - easy->next = &multi->easy; - easy->prev = multi->easy.prev; - - /* make 'easy' the last node in the chain */ - multi->easy.prev = easy; + /* We add this new entry last in the list. */ - /* if there was a prev node, make sure its 'next' pointer links to - the new node */ - easy->prev->next = easy; + data->next = NULL; /* end of the line */ + if(multi->easyp) { + struct SessionHandle *last = multi->easylp; + last->next = data; + data->prev = last; + multi->easylp = data; /* the new last node */ + } + else { + /* first node, make both prev and next be NULL! */ + data->next = NULL; + data->prev = NULL; + multi->easylp = multi->easyp = data; /* both first and last */ + } /* make the SessionHandle refer back to this multi handle */ - Curl_easy_addmulti(easy_handle, multi_handle); - - /* make the SessionHandle struct refer back to this struct */ - easy->easy_handle->set.one_easy = easy; + data->multi = multi_handle; /* Set the timeout for this handle to expire really soon so that it will be taken care of even when this handle is added in the midst of operation @@ -458,7 +428,7 @@ CURLMcode curl_multi_add_handle(CURLM *multi_handle, sockets that time-out or have actions will be dealt with. Since this handle has no action yet, we make sure it times out to get things to happen. */ - Curl_expire(easy->easy_handle, 1); + Curl_expire(data, 1); /* increase the node-counter */ multi->num_easy++; @@ -494,7 +464,7 @@ static void debug_print_sock_hash(void *p) struct Curl_sh_entry *sh = (struct Curl_sh_entry *)p; fprintf(stderr, " [easy %p/magic %x/socket %d]", - (void *)sh->easy, sh->easy->magic, (int)sh->socket); + (void *)sh->data, sh->data->magic, (int)sh->socket); } #endif @@ -502,8 +472,8 @@ CURLMcode curl_multi_remove_handle(CURLM *multi_handle, CURL *curl_handle) { struct Curl_multi *multi=(struct Curl_multi *)multi_handle; - struct Curl_one_easy *easy; - struct SessionHandle *data = curl_handle; + struct SessionHandle *easy = curl_handle; + struct SessionHandle *data = easy; /* First, make some basic checks that the CURLM handle is a good handle */ if(!GOOD_MULTI_HANDLE(multi)) @@ -513,13 +483,14 @@ CURLMcode curl_multi_remove_handle(CURLM *multi_handle, if(!GOOD_EASY_HANDLE(curl_handle)) return CURLM_BAD_EASY_HANDLE; - /* pick-up from the 'curl_handle' the kept position in the list */ - easy = data->multi_pos; + /* Prevent users from trying to remove same easy handle more than once */ + if(!data->multi) + return CURLM_OK; /* it is already removed so let's say it is fine! */ if(easy) { - bool premature = (easy->state < CURLM_STATE_COMPLETED) ? TRUE : FALSE; - bool easy_owns_conn = (easy->easy_conn && - (easy->easy_conn->data == easy->easy_handle)) ? + bool premature = (data->mstate < CURLM_STATE_COMPLETED) ? TRUE : FALSE; + bool easy_owns_conn = (data->easy_conn && + (data->easy_conn->data == easy)) ? TRUE : FALSE; /* If the 'state' is not INIT or COMPLETED, we might need to do something @@ -529,24 +500,24 @@ CURLMcode curl_multi_remove_handle(CURLM *multi_handle, alive connections when this is removed */ multi->num_alive--; - if(easy->easy_conn && - (easy->easy_conn->send_pipe->size + - easy->easy_conn->recv_pipe->size > 1) && - easy->state > CURLM_STATE_WAITDO && - easy->state < CURLM_STATE_COMPLETED) { + if(data->easy_conn && + (data->easy_conn->send_pipe->size + + data->easy_conn->recv_pipe->size > 1) && + data->mstate > CURLM_STATE_WAITDO && + data->mstate < CURLM_STATE_COMPLETED) { /* If the handle is in a pipeline and has started sending off its request but not received its response yet, we need to close connection. */ - easy->easy_conn->bits.close = TRUE; + data->easy_conn->bits.close = TRUE; /* Set connection owner so that Curl_done() closes it. We can sefely do this here since connection is killed. */ - easy->easy_conn->data = easy->easy_handle; + data->easy_conn->data = easy; } - /* The timer must be shut down before easy->multi is set to NULL, + /* The timer must be shut down before data->multi is set to NULL, else the timenode will remain in the splay tree after curl_easy_cleanup is called. */ - Curl_expire(easy->easy_handle, 0); + Curl_expire(data, 0); /* destroy the timeout list that is held in the easy handle */ if(data->state.timeoutlist) { @@ -554,13 +525,13 @@ CURLMcode curl_multi_remove_handle(CURLM *multi_handle, data->state.timeoutlist = NULL; } - if(easy->easy_handle->dns.hostcachetype == HCACHE_MULTI) { + if(data->dns.hostcachetype == HCACHE_MULTI) { /* stop using the multi handle's DNS cache */ - easy->easy_handle->dns.hostcache = NULL; - easy->easy_handle->dns.hostcachetype = HCACHE_NONE; + data->dns.hostcache = NULL; + data->dns.hostcachetype = HCACHE_NONE; } - if(easy->easy_conn) { + if(data->easy_conn) { /* we must call Curl_done() here (if we still "own it") so that we don't leave a half-baked one around */ @@ -571,31 +542,30 @@ CURLMcode curl_multi_remove_handle(CURLM *multi_handle, Note that this ignores the return code simply because there's nothing really useful to do with it anyway! */ - (void)Curl_done(&easy->easy_conn, easy->result, premature); + (void)Curl_done(&data->easy_conn, data->result, premature); } else /* Clear connection pipelines, if Curl_done above was not called */ - Curl_getoff_all_pipelines(easy->easy_handle, easy->easy_conn); + Curl_getoff_all_pipelines(data, data->easy_conn); } /* as this was using a shared connection cache we clear the pointer to that since we're not part of that multi handle anymore */ - easy->easy_handle->state.conn_cache = NULL; + data->state.conn_cache = NULL; /* change state without using multistate(), only to make singlesocket() do what we want */ - easy->state = CURLM_STATE_COMPLETED; + data->mstate = CURLM_STATE_COMPLETED; singlesocket(multi, easy); /* to let the application know what sockets that vanish with this handle */ /* Remove the association between the connection and the handle */ - if(easy->easy_conn) { - easy->easy_conn->data = NULL; - easy->easy_conn = NULL; + if(data->easy_conn) { + data->easy_conn->data = NULL; + data->easy_conn = NULL; } - Curl_easy_addmulti(easy->easy_handle, NULL); /* clear the association - to this multi handle */ + data->multi = NULL; /* clear the association to this multi handle */ { /* make sure there's no pending message in the queue sent from this easy @@ -605,7 +575,7 @@ CURLMcode curl_multi_remove_handle(CURLM *multi_handle, for(e = multi->msglist->head; e; e = e->next) { struct Curl_message *msg = e->ptr; - if(msg->extmsg.easy_handle == easy->easy_handle) { + if(msg->extmsg.easy_handle == easy) { Curl_llist_remove(multi->msglist, e, NULL); /* there can only be one from this specific handle */ break; @@ -614,20 +584,19 @@ CURLMcode curl_multi_remove_handle(CURLM *multi_handle, } /* make the previous node point to our next */ - if(easy->prev) - easy->prev->next = easy->next; - /* make our next point to our previous node */ - if(easy->next) - easy->next->prev = easy->prev; - - easy->easy_handle->set.one_easy = NULL; /* detached */ + if(data->prev) + data->prev->next = data->next; + else + multi->easyp = data->next; /* point to first node */ - /* Null the position in the controlling structure */ - easy->easy_handle->multi_pos = NULL; + /* make our next point to our previous node */ + if(data->next) + data->next->prev = data->prev; + else + multi->easylp = data->prev; /* point to last node */ /* NOTE NOTE NOTE We do not touch the easy handle here! */ - free(easy); multi->num_easy--; /* one less to care about now */ @@ -638,17 +607,14 @@ CURLMcode curl_multi_remove_handle(CURLM *multi_handle, return CURLM_BAD_EASY_HANDLE; /* twasn't found */ } -bool Curl_multi_canPipeline(const struct Curl_multi* multi) +bool Curl_multi_pipeline_enabled(const struct Curl_multi *multi) { - return multi->pipelining_enabled; + return (multi && multi->pipelining_enabled) ? TRUE : FALSE; } void Curl_multi_handlePipeBreak(struct SessionHandle *data) { - struct Curl_one_easy *one_easy = data->set.one_easy; - - if(one_easy) - one_easy->easy_conn = NULL; + data->easy_conn = NULL; } static int waitconnect_getsock(struct connectdata *conn, @@ -678,7 +644,7 @@ static int domore_getsock(struct connectdata *conn, } /* returns bitmapped flags for this handle and its sockets */ -static int multi_getsock(struct Curl_one_easy *easy, +static int multi_getsock(struct SessionHandle *data, curl_socket_t *socks, /* points to numsocks number of sockets */ int numsocks) @@ -688,16 +654,16 @@ static int multi_getsock(struct Curl_one_easy *easy, happen when this is called from curl_multi_remove_handle() => singlesocket() => multi_getsock(). */ - if(easy->easy_handle->state.pipe_broke || !easy->easy_conn) + if(data->state.pipe_broke || !data->easy_conn) return 0; - if(easy->state > CURLM_STATE_CONNECT && - easy->state < CURLM_STATE_COMPLETED) { + if(data->mstate > CURLM_STATE_CONNECT && + data->mstate < CURLM_STATE_COMPLETED) { /* Set up ownership correctly */ - easy->easy_conn->data = easy->easy_handle; + data->easy_conn->data = data; } - switch(easy->state) { + switch(data->mstate) { default: #if 0 /* switch back on these cases to get the compiler to check for all enums to be present */ @@ -715,28 +681,28 @@ static int multi_getsock(struct Curl_one_easy *easy, return 0; case CURLM_STATE_WAITRESOLVE: - return Curl_resolver_getsock(easy->easy_conn, socks, numsocks); + return Curl_resolver_getsock(data->easy_conn, socks, numsocks); case CURLM_STATE_PROTOCONNECT: - return Curl_protocol_getsock(easy->easy_conn, socks, numsocks); + return Curl_protocol_getsock(data->easy_conn, socks, numsocks); case CURLM_STATE_DO: case CURLM_STATE_DOING: - return Curl_doing_getsock(easy->easy_conn, socks, numsocks); + return Curl_doing_getsock(data->easy_conn, socks, numsocks); case CURLM_STATE_WAITPROXYCONNECT: case CURLM_STATE_WAITCONNECT: - return waitconnect_getsock(easy->easy_conn, socks, numsocks); + return waitconnect_getsock(data->easy_conn, socks, numsocks); case CURLM_STATE_DO_MORE: - return domore_getsock(easy->easy_conn, socks, numsocks); + return domore_getsock(data->easy_conn, socks, numsocks); case CURLM_STATE_DO_DONE: /* since is set after DO is completed, we switch to waiting for the same as the *PERFORM states */ case CURLM_STATE_PERFORM: case CURLM_STATE_WAITPERFORM: - return Curl_single_getsock(easy->easy_conn, socks, numsocks); + return Curl_single_getsock(data->easy_conn, socks, numsocks); } } @@ -749,7 +715,7 @@ CURLMcode curl_multi_fdset(CURLM *multi_handle, Some easy handles may not have connected to the remote host yet, and then we must make sure that is done. */ struct Curl_multi *multi=(struct Curl_multi *)multi_handle; - struct Curl_one_easy *easy; + struct SessionHandle *data; int this_max_fd=-1; curl_socket_t sockbunch[MAX_SOCKSPEREASYHANDLE]; int bitmap; @@ -759,9 +725,9 @@ CURLMcode curl_multi_fdset(CURLM *multi_handle, if(!GOOD_MULTI_HANDLE(multi)) return CURLM_BAD_HANDLE; - easy=multi->easy.next; - while(easy != &multi->easy) { - bitmap = multi_getsock(easy, sockbunch, MAX_SOCKSPEREASYHANDLE); + data=multi->easyp; + while(data) { + bitmap = multi_getsock(data, sockbunch, MAX_SOCKSPEREASYHANDLE); for(i=0; i< MAX_SOCKSPEREASYHANDLE; i++) { curl_socket_t s = CURL_SOCKET_BAD; @@ -783,7 +749,7 @@ CURLMcode curl_multi_fdset(CURLM *multi_handle, } } - easy = easy->next; /* check next handle */ + data = data->next; /* check next handle */ } *max_fd = this_max_fd; @@ -798,20 +764,29 @@ CURLMcode curl_multi_wait(CURLM *multi_handle, int *ret) { struct Curl_multi *multi=(struct Curl_multi *)multi_handle; - struct Curl_one_easy *easy; + struct SessionHandle *data; curl_socket_t sockbunch[MAX_SOCKSPEREASYHANDLE]; int bitmap; unsigned int i; - unsigned int nfds = extra_nfds; + unsigned int nfds = 0; + unsigned int curlfds; struct pollfd *ufds = NULL; + long timeout_internal; if(!GOOD_MULTI_HANDLE(multi)) return CURLM_BAD_HANDLE; + /* If the internally desired timeout is actually shorter than requested from + the outside, then use the shorter time! But only if the internal timer + is actually larger than 0! */ + (void)multi_timeout(multi, &timeout_internal); + if((timeout_internal > 0) && (timeout_internal < (long)timeout_ms)) + timeout_ms = (int)timeout_internal; + /* Count up how many fds we have from the multi handle */ - easy=multi->easy.next; - while(easy != &multi->easy) { - bitmap = multi_getsock(easy, sockbunch, MAX_SOCKSPEREASYHANDLE); + data=multi->easyp; + while(data) { + bitmap = multi_getsock(data, sockbunch, MAX_SOCKSPEREASYHANDLE); for(i=0; i< MAX_SOCKSPEREASYHANDLE; i++) { curl_socket_t s = CURL_SOCKET_BAD; @@ -829,9 +804,12 @@ CURLMcode curl_multi_wait(CURLM *multi_handle, } } - easy = easy->next; /* check next handle */ + data = data->next; /* check next handle */ } + curlfds = nfds; /* number of internal file descriptors */ + nfds += extra_nfds; /* add the externally provided ones */ + if(nfds) { ufds = malloc(nfds * sizeof(struct pollfd)); if(!ufds) @@ -839,32 +817,37 @@ CURLMcode curl_multi_wait(CURLM *multi_handle, } nfds = 0; - /* Add the curl handles to our pollfds first */ - easy=multi->easy.next; - while(easy != &multi->easy) { - bitmap = multi_getsock(easy, sockbunch, MAX_SOCKSPEREASYHANDLE); + /* only do the second loop if we found descriptors in the first stage run + above */ - for(i=0; i< MAX_SOCKSPEREASYHANDLE; i++) { - curl_socket_t s = CURL_SOCKET_BAD; + if(curlfds) { + /* Add the curl handles to our pollfds first */ + data=multi->easyp; + while(data) { + bitmap = multi_getsock(data, sockbunch, MAX_SOCKSPEREASYHANDLE); - if(bitmap & GETSOCK_READSOCK(i)) { - ufds[nfds].fd = sockbunch[i]; - ufds[nfds].events = POLLIN; - ++nfds; - s = sockbunch[i]; - } - if(bitmap & GETSOCK_WRITESOCK(i)) { - ufds[nfds].fd = sockbunch[i]; - ufds[nfds].events = POLLOUT; - ++nfds; - s = sockbunch[i]; - } - if(s == CURL_SOCKET_BAD) { - break; + for(i=0; i< MAX_SOCKSPEREASYHANDLE; i++) { + curl_socket_t s = CURL_SOCKET_BAD; + + if(bitmap & GETSOCK_READSOCK(i)) { + ufds[nfds].fd = sockbunch[i]; + ufds[nfds].events = POLLIN; + ++nfds; + s = sockbunch[i]; + } + if(bitmap & GETSOCK_WRITESOCK(i)) { + ufds[nfds].fd = sockbunch[i]; + ufds[nfds].events = POLLOUT; + ++nfds; + s = sockbunch[i]; + } + if(s == CURL_SOCKET_BAD) { + break; + } } - } - easy = easy->next; /* check next handle */ + data = data->next; /* check next handle */ + } } /* Add external file descriptions from poll-like struct curl_waitfd */ @@ -880,9 +863,30 @@ CURLMcode curl_multi_wait(CURLM *multi_handle, ++nfds; } - if(nfds) + if(nfds) { /* wait... */ i = Curl_poll(ufds, nfds, timeout_ms); + + if(i) { + unsigned int j; + /* copy revents results from the poll to the curl_multi_wait poll + struct, the bit values of the actual underlying poll() implementation + may not be the same as the ones in the public libcurl API! */ + for(j = 0; j < extra_nfds; j++) { + unsigned short mask = 0; + unsigned r = ufds[curlfds + j].revents; + + if(r & POLLIN) + mask |= CURL_WAIT_POLLIN; + if(r & POLLOUT) + mask |= CURL_WAIT_POLLOUT; + if(r & POLLPRI) + mask |= CURL_WAIT_POLLPRI; + + extra_fds[j].revents = mask; + } + } + } else i = 0; @@ -894,7 +898,7 @@ CURLMcode curl_multi_wait(CURLM *multi_handle, static CURLMcode multi_runsingle(struct Curl_multi *multi, struct timeval now, - struct Curl_one_easy *easy) + struct SessionHandle *data) { struct Curl_message *msg = NULL; bool connected; @@ -904,14 +908,12 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, bool done = FALSE; CURLMcode result = CURLM_OK; struct SingleRequest *k; - struct SessionHandle *data; long timeout_ms; + int control; - if(!GOOD_EASY_HANDLE(easy->easy_handle)) + if(!GOOD_EASY_HANDLE(data)) return CURLM_BAD_EASY_HANDLE; - data = easy->easy_handle; - do { /* this is a single-iteration do-while loop just to allow a break to skip to the end of it */ @@ -921,51 +923,51 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, we're using gets cleaned up and we're left with nothing. */ if(data->state.pipe_broke) { infof(data, "Pipe broke: handle 0x%p, url = %s\n", - easy, data->state.path); + (void *)data, data->state.path); - if(easy->state < CURLM_STATE_COMPLETED) { + if(data->mstate < CURLM_STATE_COMPLETED) { /* Head back to the CONNECT state */ - multistate(easy, CURLM_STATE_CONNECT); + multistate(data, CURLM_STATE_CONNECT); result = CURLM_CALL_MULTI_PERFORM; - easy->result = CURLE_OK; + data->result = CURLE_OK; } data->state.pipe_broke = FALSE; - easy->easy_conn = NULL; + data->easy_conn = NULL; break; } - if(!easy->easy_conn && - easy->state > CURLM_STATE_CONNECT && - easy->state < CURLM_STATE_DONE) { - /* In all these states, the code will blindly access 'easy->easy_conn' + if(!data->easy_conn && + data->mstate > CURLM_STATE_CONNECT && + data->mstate < CURLM_STATE_DONE) { + /* In all these states, the code will blindly access 'data->easy_conn' so this is precaution that it isn't NULL. And it silences static analyzers. */ - failf(data, "In state %d with no easy_conn, bail out!\n", easy->state); + failf(data, "In state %d with no easy_conn, bail out!\n", data->mstate); return CURLM_INTERNAL_ERROR; } - if(easy->easy_conn && easy->state > CURLM_STATE_CONNECT && - easy->state < CURLM_STATE_COMPLETED) + if(data->easy_conn && data->mstate > CURLM_STATE_CONNECT && + data->mstate < CURLM_STATE_COMPLETED) /* Make sure we set the connection's current owner */ - easy->easy_conn->data = data; + data->easy_conn->data = data; - if(easy->easy_conn && - (easy->state >= CURLM_STATE_CONNECT) && - (easy->state < CURLM_STATE_COMPLETED)) { + if(data->easy_conn && + (data->mstate >= CURLM_STATE_CONNECT) && + (data->mstate < CURLM_STATE_COMPLETED)) { /* we need to wait for the connect state as only then is the start time stored, but we must not check already completed handles */ timeout_ms = Curl_timeleft(data, &now, - (easy->state <= CURLM_STATE_WAITDO)? + (data->mstate <= CURLM_STATE_WAITDO)? TRUE:FALSE); if(timeout_ms < 0) { /* Handle timed out */ - if(easy->state == CURLM_STATE_WAITRESOLVE) + if(data->mstate == CURLM_STATE_WAITRESOLVE) failf(data, "Resolving timed out after %ld milliseconds", Curl_tvdiff(now, data->progress.t_startsingle)); - else if(easy->state == CURLM_STATE_WAITCONNECT) + else if(data->mstate == CURLM_STATE_WAITCONNECT) failf(data, "Connection timed out after %ld milliseconds", Curl_tvdiff(now, data->progress.t_startsingle)); else { @@ -979,41 +981,52 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, /* Force the connection closed because the server could continue to send us stuff at any time. (The disconnect_conn logic used below doesn't work at this point). */ - easy->easy_conn->bits.close = TRUE; - easy->result = CURLE_OPERATION_TIMEDOUT; - multistate(easy, CURLM_STATE_COMPLETED); + data->easy_conn->bits.close = TRUE; + data->result = CURLE_OPERATION_TIMEDOUT; + multistate(data, CURLM_STATE_COMPLETED); break; } } - switch(easy->state) { + switch(data->mstate) { case CURLM_STATE_INIT: /* init this transfer. */ - easy->result=Curl_pretransfer(data); + data->result=Curl_pretransfer(data); - if(CURLE_OK == easy->result) { + if(CURLE_OK == data->result) { /* after init, go CONNECT */ - multistate(easy, CURLM_STATE_CONNECT); + multistate(data, CURLM_STATE_CONNECT); result = CURLM_CALL_MULTI_PERFORM; } break; + case CURLM_STATE_CONNECT_PEND: + /* We will stay here until there is a connection available. Then + we try again in the CURLM_STATE_CONNECT state. */ + break; + case CURLM_STATE_CONNECT: - /* Connect. We get a connection identifier filled in. */ + /* Connect. We want to get a connection identifier filled in. */ Curl_pgrsTime(data, TIMER_STARTSINGLE); - easy->result = Curl_connect(data, &easy->easy_conn, + data->result = Curl_connect(data, &data->easy_conn, &async, &protocol_connect); + if(CURLE_NO_CONNECTION_AVAILABLE == data->result) { + /* There was no connection available. We will go to the pending + state and wait for an available connection. */ + multistate(data, CURLM_STATE_CONNECT_PEND); + data->result = CURLE_OK; + break; + } - if(CURLE_OK == easy->result) { + if(CURLE_OK == data->result) { /* Add this handle to the send or pend pipeline */ - easy->result = addHandleToSendOrPendPipeline(data, - easy->easy_conn); - if(CURLE_OK != easy->result) + data->result = Curl_add_handle_to_pipeline(data, data->easy_conn); + if(CURLE_OK != data->result) disconnect_conn = TRUE; else { if(async) /* We're now waiting for an asynchronous name lookup */ - multistate(easy, CURLM_STATE_WAITRESOLVE); + multistate(data, CURLM_STATE_WAITRESOLVE); else { /* after the connect has been sent off, go WAITCONNECT unless the protocol connect is already done and we can go directly to @@ -1021,15 +1034,15 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, result = CURLM_CALL_MULTI_PERFORM; if(protocol_connect) - multistate(easy, multi->pipelining_enabled? + multistate(data, multi->pipelining_enabled? CURLM_STATE_WAITDO:CURLM_STATE_DO); else { #ifndef CURL_DISABLE_HTTP - if(easy->easy_conn->tunnel_state[FIRSTSOCKET] == TUNNEL_CONNECT) - multistate(easy, CURLM_STATE_WAITPROXYCONNECT); + if(data->easy_conn->tunnel_state[FIRSTSOCKET] == TUNNEL_CONNECT) + multistate(data, CURLM_STATE_WAITPROXYCONNECT); else #endif - multistate(easy, CURLM_STATE_WAITCONNECT); + multistate(data, CURLM_STATE_WAITCONNECT); } } } @@ -1042,7 +1055,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, struct Curl_dns_entry *dns = NULL; /* check if we have the name resolved by now */ - easy->result = Curl_resolver_is_resolved(easy->easy_conn, &dns); + data->result = Curl_resolver_is_resolved(data->easy_conn, &dns); /* Update sockets here, because the socket(s) may have been closed and the application thus needs to be told, even if it @@ -1050,36 +1063,36 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, down. If the name has not yet been resolved, it is likely that new sockets have been opened in an attempt to contact another resolver. */ - singlesocket(multi, easy); + singlesocket(multi, data); if(dns) { /* Perform the next step in the connection phase, and then move on to the WAITCONNECT state */ - easy->result = Curl_async_resolved(easy->easy_conn, + data->result = Curl_async_resolved(data->easy_conn, &protocol_connect); - if(CURLE_OK != easy->result) + if(CURLE_OK != data->result) /* if Curl_async_resolved() returns failure, the connection struct is already freed and gone */ - easy->easy_conn = NULL; /* no more connection */ + data->easy_conn = NULL; /* no more connection */ else { /* call again please so that we get the next socket setup */ result = CURLM_CALL_MULTI_PERFORM; if(protocol_connect) - multistate(easy, multi->pipelining_enabled? + multistate(data, multi->pipelining_enabled? CURLM_STATE_WAITDO:CURLM_STATE_DO); else { #ifndef CURL_DISABLE_HTTP - if(easy->easy_conn->tunnel_state[FIRSTSOCKET] == TUNNEL_CONNECT) - multistate(easy, CURLM_STATE_WAITPROXYCONNECT); + if(data->easy_conn->tunnel_state[FIRSTSOCKET] == TUNNEL_CONNECT) + multistate(data, CURLM_STATE_WAITPROXYCONNECT); else #endif - multistate(easy, CURLM_STATE_WAITCONNECT); + multistate(data, CURLM_STATE_WAITCONNECT); } } } - if(CURLE_OK != easy->result) { + if(CURLE_OK != data->result) { /* failure detected */ disconnect_conn = TRUE; break; @@ -1090,40 +1103,40 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, #ifndef CURL_DISABLE_HTTP case CURLM_STATE_WAITPROXYCONNECT: /* this is HTTP-specific, but sending CONNECT to a proxy is HTTP... */ - easy->result = Curl_http_connect(easy->easy_conn, &protocol_connect); + data->result = Curl_http_connect(data->easy_conn, &protocol_connect); - if(easy->easy_conn->bits.proxy_connect_closed) { + if(data->easy_conn->bits.proxy_connect_closed) { /* reset the error buffer */ if(data->set.errorbuffer) data->set.errorbuffer[0] = '\0'; data->state.errorbuf = FALSE; - easy->result = CURLE_OK; + data->result = CURLE_OK; result = CURLM_CALL_MULTI_PERFORM; - multistate(easy, CURLM_STATE_CONNECT); + multistate(data, CURLM_STATE_CONNECT); } - else if(CURLE_OK == easy->result) { - if(easy->easy_conn->tunnel_state[FIRSTSOCKET] == TUNNEL_COMPLETE) - multistate(easy, CURLM_STATE_WAITCONNECT); + else if(CURLE_OK == data->result) { + if(data->easy_conn->tunnel_state[FIRSTSOCKET] == TUNNEL_COMPLETE) + multistate(data, CURLM_STATE_WAITCONNECT); } break; #endif case CURLM_STATE_WAITCONNECT: /* awaiting a completion of an asynch connect */ - easy->result = Curl_is_connected(easy->easy_conn, + data->result = Curl_is_connected(data->easy_conn, FIRSTSOCKET, &connected); if(connected) { - if(!easy->result) + if(!data->result) /* if everything is still fine we do the protocol-specific connect setup */ - easy->result = Curl_protocol_connect(easy->easy_conn, + data->result = Curl_protocol_connect(data->easy_conn, &protocol_connect); } - if(CURLE_OK != easy->result) { + if(CURLE_OK != data->result) { /* failure detected */ /* Just break, the cleaning up is handled all in one place */ disconnect_conn = TRUE; @@ -1138,16 +1151,16 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, BUT if we are using a proxy we must change to WAITPROXYCONNECT */ #ifndef CURL_DISABLE_HTTP - if(easy->easy_conn->tunnel_state[FIRSTSOCKET] == TUNNEL_CONNECT) - multistate(easy, CURLM_STATE_WAITPROXYCONNECT); + if(data->easy_conn->tunnel_state[FIRSTSOCKET] == TUNNEL_CONNECT) + multistate(data, CURLM_STATE_WAITPROXYCONNECT); else #endif - multistate(easy, CURLM_STATE_PROTOCONNECT); + multistate(data, CURLM_STATE_PROTOCONNECT); } else /* after the connect has completed, go WAITDO or DO */ - multistate(easy, multi->pipelining_enabled? + multistate(data, multi->pipelining_enabled? CURLM_STATE_WAITDO:CURLM_STATE_DO); result = CURLM_CALL_MULTI_PERFORM; @@ -1156,18 +1169,18 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, case CURLM_STATE_PROTOCONNECT: /* protocol-specific connect phase */ - easy->result = Curl_protocol_connecting(easy->easy_conn, + data->result = Curl_protocol_connecting(data->easy_conn, &protocol_connect); - if((easy->result == CURLE_OK) && protocol_connect) { + if((data->result == CURLE_OK) && protocol_connect) { /* after the connect has completed, go WAITDO or DO */ - multistate(easy, multi->pipelining_enabled? + multistate(data, multi->pipelining_enabled? CURLM_STATE_WAITDO:CURLM_STATE_DO); result = CURLM_CALL_MULTI_PERFORM; } - else if(easy->result) { + else if(data->result) { /* failure detected */ Curl_posttransfer(data); - Curl_done(&easy->easy_conn, easy->result, TRUE); + Curl_done(&data->easy_conn, data->result, TRUE); disconnect_conn = TRUE; } break; @@ -1175,19 +1188,19 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, case CURLM_STATE_WAITDO: /* Wait for our turn to DO when we're pipelining requests */ #ifdef DEBUGBUILD - infof(data, "WAITDO: Conn %ld send pipe %zu inuse %d athead %d\n", - easy->easy_conn->connection_id, - easy->easy_conn->send_pipe->size, - easy->easy_conn->writechannel_inuse?1:0, + infof(data, "WAITDO: Conn %ld send pipe %zu inuse %s athead %s\n", + data->easy_conn->connection_id, + data->easy_conn->send_pipe->size, + data->easy_conn->writechannel_inuse?"TRUE":"FALSE", isHandleAtHead(data, - easy->easy_conn->send_pipe)?1:0); + data->easy_conn->send_pipe)?"TRUE":"FALSE"); #endif - if(!easy->easy_conn->writechannel_inuse && + if(!data->easy_conn->writechannel_inuse && isHandleAtHead(data, - easy->easy_conn->send_pipe)) { + data->easy_conn->send_pipe)) { /* Grab the channel */ - easy->easy_conn->writechannel_inuse = TRUE; - multistate(easy, CURLM_STATE_DO); + data->easy_conn->writechannel_inuse = TRUE; + multistate(data, CURLM_STATE_DO); result = CURLM_CALL_MULTI_PERFORM; } break; @@ -1195,50 +1208,51 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, case CURLM_STATE_DO: if(data->set.connect_only) { /* keep connection open for application to use the socket */ - easy->easy_conn->bits.close = FALSE; - multistate(easy, CURLM_STATE_DONE); - easy->result = CURLE_OK; + data->easy_conn->bits.close = FALSE; + multistate(data, CURLM_STATE_DONE); + data->result = CURLE_OK; result = CURLM_CALL_MULTI_PERFORM; } else { /* Perform the protocol's DO action */ - easy->result = Curl_do(&easy->easy_conn, - &dophase_done); + data->result = Curl_do(&data->easy_conn, &dophase_done); + + /* When Curl_do() returns failure, data->easy_conn might be NULL! */ - if(CURLE_OK == easy->result) { + if(CURLE_OK == data->result) { if(!dophase_done) { /* some steps needed for wildcard matching */ if(data->set.wildcardmatch) { struct WildcardData *wc = &data->wildcard; if(wc->state == CURLWC_DONE || wc->state == CURLWC_SKIP) { /* skip some states if it is important */ - Curl_done(&easy->easy_conn, CURLE_OK, FALSE); - multistate(easy, CURLM_STATE_DONE); + Curl_done(&data->easy_conn, CURLE_OK, FALSE); + multistate(data, CURLM_STATE_DONE); result = CURLM_CALL_MULTI_PERFORM; break; } } /* DO was not completed in one function call, we must continue DOING... */ - multistate(easy, CURLM_STATE_DOING); + multistate(data, CURLM_STATE_DOING); result = CURLM_OK; } /* after DO, go DO_DONE... or DO_MORE */ - else if(easy->easy_conn->bits.do_more) { + else if(data->easy_conn->bits.do_more) { /* we're supposed to do more, but we need to sit down, relax and wait a little while first */ - multistate(easy, CURLM_STATE_DO_MORE); + multistate(data, CURLM_STATE_DO_MORE); result = CURLM_OK; } else { /* we're done with the DO, now DO_DONE */ - multistate(easy, CURLM_STATE_DO_DONE); + multistate(data, CURLM_STATE_DO_DONE); result = CURLM_CALL_MULTI_PERFORM; } } - else if((CURLE_SEND_ERROR == easy->result) && - easy->easy_conn->bits.reuse) { + else if((CURLE_SEND_ERROR == data->result) && + data->easy_conn->bits.reuse) { /* * In this situation, a connection that we were trying to use * may have unexpectedly died. If possible, send the connection @@ -1249,17 +1263,17 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, CURLcode drc; bool retry = FALSE; - drc = Curl_retry_request(easy->easy_conn, &newurl); + drc = Curl_retry_request(data->easy_conn, &newurl); if(drc) { /* a failure here pretty much implies an out of memory */ - easy->result = drc; + data->result = drc; disconnect_conn = TRUE; } else retry = (newurl)?TRUE:FALSE; Curl_posttransfer(data); - drc = Curl_done(&easy->easy_conn, easy->result, FALSE); + drc = Curl_done(&data->easy_conn, data->result, FALSE); /* When set to retry the connection, we must to go back to * the CONNECT state */ @@ -1268,19 +1282,19 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, follow = FOLLOW_RETRY; drc = Curl_follow(data, newurl, follow); if(drc == CURLE_OK) { - multistate(easy, CURLM_STATE_CONNECT); + multistate(data, CURLM_STATE_CONNECT); result = CURLM_CALL_MULTI_PERFORM; - easy->result = CURLE_OK; + data->result = CURLE_OK; } else { /* Follow failed */ - easy->result = drc; + data->result = drc; free(newurl); } } else { /* done didn't return OK or SEND_ERROR */ - easy->result = drc; + data->result = drc; free(newurl); } } @@ -1292,7 +1306,8 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, else { /* failure detected */ Curl_posttransfer(data); - Curl_done(&easy->easy_conn, easy->result, FALSE); + if(data->easy_conn) + Curl_done(&data->easy_conn, data->result, FALSE); disconnect_conn = TRUE; } } @@ -1300,12 +1315,12 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, case CURLM_STATE_DOING: /* we continue DOING until the DO phase is complete */ - easy->result = Curl_protocol_doing(easy->easy_conn, + data->result = Curl_protocol_doing(data->easy_conn, &dophase_done); - if(CURLE_OK == easy->result) { + if(CURLE_OK == data->result) { if(dophase_done) { /* after DO, go DO_DONE or DO_MORE */ - multistate(easy, easy->easy_conn->bits.do_more? + multistate(data, data->easy_conn->bits.do_more? CURLM_STATE_DO_MORE: CURLM_STATE_DO_DONE); result = CURLM_CALL_MULTI_PERFORM; @@ -1314,7 +1329,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, else { /* failure detected */ Curl_posttransfer(data); - Curl_done(&easy->easy_conn, easy->result, FALSE); + Curl_done(&data->easy_conn, data->result, FALSE); disconnect_conn = TRUE; } break; @@ -1323,13 +1338,17 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, /* * When we are connected, DO MORE and then go DO_DONE */ - easy->result = Curl_do_more(easy->easy_conn, &dophase_done); + data->result = Curl_do_more(data->easy_conn, &control); /* No need to remove this handle from the send pipeline here since that is done in Curl_done() */ - if(CURLE_OK == easy->result) { - if(dophase_done) { - multistate(easy, CURLM_STATE_DO_DONE); + if(CURLE_OK == data->result) { + if(control) { + /* if positive, advance to DO_DONE + if negative, go back to DOING */ + multistate(data, control==1? + CURLM_STATE_DO_DONE: + CURLM_STATE_DOING); result = CURLM_CALL_MULTI_PERFORM; } else @@ -1339,54 +1358,54 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, else { /* failure detected */ Curl_posttransfer(data); - Curl_done(&easy->easy_conn, easy->result, FALSE); + Curl_done(&data->easy_conn, data->result, FALSE); disconnect_conn = TRUE; } break; case CURLM_STATE_DO_DONE: /* Move ourselves from the send to recv pipeline */ - moveHandleFromSendToRecvPipeline(data, easy->easy_conn); + Curl_move_handle_from_send_to_recv_pipe(data, data->easy_conn); /* Check if we can move pending requests to send pipe */ - checkPendPipeline(easy->easy_conn); - multistate(easy, CURLM_STATE_WAITPERFORM); + Curl_multi_process_pending_handles(multi); + multistate(data, CURLM_STATE_WAITPERFORM); result = CURLM_CALL_MULTI_PERFORM; break; case CURLM_STATE_WAITPERFORM: /* Wait for our turn to PERFORM */ - if(!easy->easy_conn->readchannel_inuse && + if(!data->easy_conn->readchannel_inuse && isHandleAtHead(data, - easy->easy_conn->recv_pipe)) { + data->easy_conn->recv_pipe)) { /* Grab the channel */ - easy->easy_conn->readchannel_inuse = TRUE; - multistate(easy, CURLM_STATE_PERFORM); + data->easy_conn->readchannel_inuse = TRUE; + multistate(data, CURLM_STATE_PERFORM); result = CURLM_CALL_MULTI_PERFORM; } #ifdef DEBUGBUILD else { - infof(data, "WAITPERFORM: Conn %ld recv pipe %zu inuse %d athead %d\n", - easy->easy_conn->connection_id, - easy->easy_conn->recv_pipe->size, - easy->easy_conn->readchannel_inuse?1:0, + infof(data, "WAITPERFORM: Conn %ld recv pipe %zu inuse %s athead %s\n", + data->easy_conn->connection_id, + data->easy_conn->recv_pipe->size, + data->easy_conn->readchannel_inuse?"TRUE":"FALSE", isHandleAtHead(data, - easy->easy_conn->recv_pipe)?1:0); + data->easy_conn->recv_pipe)?"TRUE":"FALSE"); } #endif break; case CURLM_STATE_TOOFAST: /* limit-rate exceeded in either direction */ /* if both rates are within spec, resume transfer */ - if(Curl_pgrsUpdate(easy->easy_conn)) - easy->result = CURLE_ABORTED_BY_CALLBACK; + if(Curl_pgrsUpdate(data->easy_conn)) + data->result = CURLE_ABORTED_BY_CALLBACK; else - easy->result = Curl_speedcheck(data, now); + data->result = Curl_speedcheck(data, now); if(( (data->set.max_send_speed == 0) || (data->progress.ulspeed < data->set.max_send_speed )) && ( (data->set.max_recv_speed == 0) || (data->progress.dlspeed < data->set.max_recv_speed))) - multistate(easy, CURLM_STATE_PERFORM); + multistate(data, CURLM_STATE_PERFORM); break; case CURLM_STATE_PERFORM: @@ -1399,7 +1418,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, (data->progress.ulspeed > data->set.max_send_speed)) { int buffersize; - multistate(easy, CURLM_STATE_TOOFAST); + multistate(data, CURLM_STATE_TOOFAST); /* calculate upload rate-limitation timeout. */ buffersize = (int)(data->set.buffer_size ? @@ -1415,7 +1434,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, (data->progress.dlspeed > data->set.max_recv_speed)) { int buffersize; - multistate(easy, CURLM_STATE_TOOFAST); + multistate(data, CURLM_STATE_TOOFAST); /* Calculate download rate-limitation timeout. */ buffersize = (int)(data->set.buffer_size ? @@ -1427,38 +1446,38 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, } /* read/write data if it is ready to do so */ - easy->result = Curl_readwrite(easy->easy_conn, &done); + data->result = Curl_readwrite(data->easy_conn, &done); k = &data->req; if(!(k->keepon & KEEP_RECV)) { /* We're done receiving */ - easy->easy_conn->readchannel_inuse = FALSE; + data->easy_conn->readchannel_inuse = FALSE; } if(!(k->keepon & KEEP_SEND)) { /* We're done sending */ - easy->easy_conn->writechannel_inuse = FALSE; + data->easy_conn->writechannel_inuse = FALSE; } - if(done || (easy->result == CURLE_RECV_ERROR)) { + if(done || (data->result == CURLE_RECV_ERROR)) { /* If CURLE_RECV_ERROR happens early enough, we assume it was a race * condition and the server closed the re-used connection exactly when * we wanted to use it, so figure out if that is indeed the case. */ - CURLcode ret = Curl_retry_request(easy->easy_conn, &newurl); + CURLcode ret = Curl_retry_request(data->easy_conn, &newurl); if(!ret) retry = (newurl)?TRUE:FALSE; if(retry) { /* if we are to retry, set the result to OK and consider the request as done */ - easy->result = CURLE_OK; + data->result = CURLE_OK; done = TRUE; } } - if(easy->result) { + if(data->result) { /* * The transfer phase returned error, we mark the connection to get * closed to prevent being re-used. This is because we can't possibly @@ -1467,11 +1486,11 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, * happened in the data connection. */ - if(!(easy->easy_conn->handler->flags & PROTOPT_DUAL)) - easy->easy_conn->bits.close = TRUE; + if(!(data->easy_conn->handler->flags & PROTOPT_DUAL)) + data->easy_conn->bits.close = TRUE; Curl_posttransfer(data); - Curl_done(&easy->easy_conn, easy->result, FALSE); + Curl_done(&data->easy_conn, data->result, FALSE); } else if(done) { followtype follow=FOLLOW_NONE; @@ -1480,15 +1499,14 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, Curl_posttransfer(data); /* we're no longer receiving */ - moveHandleFromRecvToDonePipeline(data, - easy->easy_conn); + Curl_removeHandleFromPipeline(data, data->easy_conn->recv_pipe); /* expire the new receiving pipeline head */ - if(easy->easy_conn->recv_pipe->head) - Curl_expire(easy->easy_conn->recv_pipe->head->ptr, 1); + if(data->easy_conn->recv_pipe->head) + Curl_expire(data->easy_conn->recv_pipe->head->ptr, 1); /* Check if we can move pending requests to send pipe */ - checkPendPipeline(easy->easy_conn); + Curl_multi_process_pending_handles(multi); /* When we follow redirects or is set to retry the connection, we must to go back to the CONNECT state */ @@ -1502,15 +1520,16 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, } else follow = FOLLOW_RETRY; - easy->result = Curl_done(&easy->easy_conn, CURLE_OK, FALSE); - if(easy->result == CURLE_OK) - easy->result = Curl_follow(data, newurl, follow); - if(CURLE_OK == easy->result) { - multistate(easy, CURLM_STATE_CONNECT); - result = CURLM_CALL_MULTI_PERFORM; - newurl = NULL; /* handed over the memory ownership to - Curl_follow(), make sure we don't free() it - here */ + data->result = Curl_done(&data->easy_conn, CURLE_OK, FALSE); + if(CURLE_OK == data->result) { + data->result = Curl_follow(data, newurl, follow); + if(CURLE_OK == data->result) { + multistate(data, CURLM_STATE_CONNECT); + result = CURLM_CALL_MULTI_PERFORM; + newurl = NULL; /* handed over the memory ownership to + Curl_follow(), make sure we don't free() it + here */ + } } } else { @@ -1523,14 +1542,14 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, free(newurl); newurl = data->req.location; data->req.location = NULL; - easy->result = Curl_follow(data, newurl, FOLLOW_FAKE); - if(CURLE_OK == easy->result) + data->result = Curl_follow(data, newurl, FOLLOW_FAKE); + if(CURLE_OK == data->result) newurl = NULL; /* allocation was handed over Curl_follow() */ else disconnect_conn = TRUE; } - multistate(easy, CURLM_STATE_DONE); + multistate(data, CURLM_STATE_DONE); result = CURLM_CALL_MULTI_PERFORM; } } @@ -1541,50 +1560,39 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, } case CURLM_STATE_DONE: + /* this state is highly transient, so run another loop after this */ + result = CURLM_CALL_MULTI_PERFORM; - if(easy->easy_conn) { - /* Remove ourselves from the receive and done pipelines. Handle - should be on one of these lists, depending upon how we got here. */ - Curl_removeHandleFromPipeline(data, - easy->easy_conn->recv_pipe); - Curl_removeHandleFromPipeline(data, - easy->easy_conn->done_pipe); + if(data->easy_conn) { + /* Remove ourselves from the receive pipeline, if we are there. */ + Curl_removeHandleFromPipeline(data, data->easy_conn->recv_pipe); /* Check if we can move pending requests to send pipe */ - checkPendPipeline(easy->easy_conn); - - if(easy->easy_conn->bits.stream_was_rewound) { - /* This request read past its response boundary so we quickly let - the other requests consume those bytes since there is no - guarantee that the socket will become active again */ - result = CURLM_CALL_MULTI_PERFORM; - } + Curl_multi_process_pending_handles(multi); /* post-transfer command */ - easy->result = Curl_done(&easy->easy_conn, CURLE_OK, FALSE); + data->result = Curl_done(&data->easy_conn, CURLE_OK, FALSE); /* * If there are other handles on the pipeline, Curl_done won't set * easy_conn to NULL. In such a case, curl_multi_remove_handle() can * access free'd data, if the connection is free'd and the handle * removed before we perform the processing in CURLM_STATE_COMPLETED */ - if(easy->easy_conn) - easy->easy_conn = NULL; + if(data->easy_conn) + data->easy_conn = NULL; } if(data->set.wildcardmatch) { if(data->wildcard.state != CURLWC_DONE) { /* if a wildcard is set and we are not ending -> lets start again with CURLM_STATE_INIT */ - result = CURLM_CALL_MULTI_PERFORM; - multistate(easy, CURLM_STATE_INIT); + multistate(data, CURLM_STATE_INIT); break; } } /* after we have DONE what we're supposed to do, go COMPLETED, and it doesn't matter what the Curl_done() returned! */ - multistate(easy, CURLM_STATE_COMPLETED); - + multistate(data, CURLM_STATE_COMPLETED); break; case CURLM_STATE_COMPLETED: @@ -1595,7 +1603,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, /* Important: reset the conn pointer so that we don't point to memory that could be freed anytime */ - easy->easy_conn = NULL; + data->easy_conn = NULL; Curl_expire(data, 0); /* stop all timers */ break; @@ -1607,8 +1615,8 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, return CURLM_INTERNAL_ERROR; } - if(easy->state < CURLM_STATE_COMPLETED) { - if(CURLE_OK != easy->result) { + if(data->mstate < CURLM_STATE_COMPLETED) { + if(CURLE_OK != data->result) { /* * If an error was returned, and we aren't in completed state now, * then we go to completed and consider this transfer aborted. @@ -1619,61 +1627,59 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, data->state.pipe_broke = FALSE; - if(easy->easy_conn) { + if(data->easy_conn) { /* if this has a connection, unsubscribe from the pipelines */ - easy->easy_conn->writechannel_inuse = FALSE; - easy->easy_conn->readchannel_inuse = FALSE; + data->easy_conn->writechannel_inuse = FALSE; + data->easy_conn->readchannel_inuse = FALSE; Curl_removeHandleFromPipeline(data, - easy->easy_conn->send_pipe); + data->easy_conn->send_pipe); Curl_removeHandleFromPipeline(data, - easy->easy_conn->recv_pipe); - Curl_removeHandleFromPipeline(data, - easy->easy_conn->done_pipe); + data->easy_conn->recv_pipe); /* Check if we can move pending requests to send pipe */ - checkPendPipeline(easy->easy_conn); + Curl_multi_process_pending_handles(multi); if(disconnect_conn) { /* disconnect properly */ - Curl_disconnect(easy->easy_conn, /* dead_connection */ FALSE); + Curl_disconnect(data->easy_conn, /* dead_connection */ FALSE); /* This is where we make sure that the easy_conn pointer is reset. We don't have to do this in every case block above where a failure is detected */ - easy->easy_conn = NULL; + data->easy_conn = NULL; } } - else if(easy->state == CURLM_STATE_CONNECT) { + else if(data->mstate == CURLM_STATE_CONNECT) { /* Curl_connect() failed */ (void)Curl_posttransfer(data); } - multistate(easy, CURLM_STATE_COMPLETED); + multistate(data, CURLM_STATE_COMPLETED); } /* if there's still a connection to use, call the progress function */ - else if(easy->easy_conn && Curl_pgrsUpdate(easy->easy_conn)) { + else if(data->easy_conn && Curl_pgrsUpdate(data->easy_conn)) { /* aborted due to progress callback return code must close the connection */ - easy->easy_conn->bits.close = TRUE; + data->easy_conn->bits.close = TRUE; /* if not yet in DONE state, go there, otherwise COMPLETED */ - multistate(easy, (easy->state < CURLM_STATE_DONE)? + multistate(data, (data->mstate < CURLM_STATE_DONE)? CURLM_STATE_DONE: CURLM_STATE_COMPLETED); result = CURLM_CALL_MULTI_PERFORM; } } } WHILE_FALSE; /* just to break out from! */ - if(CURLM_STATE_COMPLETED == easy->state) { + if(CURLM_STATE_COMPLETED == data->mstate) { /* now fill in the Curl_message with this info */ - msg = &easy->msg; + msg = &data->msg; msg->extmsg.msg = CURLMSG_DONE; msg->extmsg.easy_handle = data; - msg->extmsg.data.result = easy->result; + msg->extmsg.data.result = data->result; result = multi_addmsg(multi, msg); - multistate(easy, CURLM_STATE_MSGSENT); + multistate(data, CURLM_STATE_MSGSENT); } return result; @@ -1683,7 +1689,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles) { struct Curl_multi *multi=(struct Curl_multi *)multi_handle; - struct Curl_one_easy *easy; + struct SessionHandle *data; CURLMcode returncode=CURLM_OK; struct Curl_tree *t; struct timeval now = Curl_tvnow(); @@ -1691,12 +1697,12 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles) if(!GOOD_MULTI_HANDLE(multi)) return CURLM_BAD_HANDLE; - easy=multi->easy.next; - while(easy != &multi->easy) { + data=multi->easyp; + while(data) { CURLMcode result; - struct WildcardData *wc = &easy->easy_handle->wildcard; + struct WildcardData *wc = &data->wildcard; - if(easy->easy_handle->set.wildcardmatch) { + if(data->set.wildcardmatch) { if(!wc->filelist) { CURLcode ret = Curl_wildcard_init(wc); /* init wildcard structures */ if(ret) @@ -1705,10 +1711,10 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles) } do - result = multi_runsingle(multi, now, easy); + result = multi_runsingle(multi, now, data); while(CURLM_CALL_MULTI_PERFORM == result); - if(easy->easy_handle->set.wildcardmatch) { + if(data->set.wildcardmatch) { /* destruct wildcard structures if it is needed */ if(wc->state == CURLWC_DONE || result) Curl_wildcard_dtor(wc); @@ -1717,7 +1723,7 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles) if(result) returncode = result; - easy = easy->next; /* operate on next handle */ + data = data->next; /* operate on next handle */ } /* @@ -1764,8 +1770,8 @@ static void close_all_connections(struct Curl_multi *multi) CURLMcode curl_multi_cleanup(CURLM *multi_handle) { struct Curl_multi *multi=(struct Curl_multi *)multi_handle; - struct Curl_one_easy *easy; - struct Curl_one_easy *nexteasy; + struct SessionHandle *data; + struct SessionHandle *nextdata; if(GOOD_MULTI_HANDLE(multi)) { multi->type = 0; /* not good anymore */ @@ -1773,11 +1779,14 @@ CURLMcode curl_multi_cleanup(CURLM *multi_handle) /* Close all the connections in the connection cache */ close_all_connections(multi); - multi->closure_handle->dns.hostcache = multi->hostcache; - Curl_hostcache_clean(multi->closure_handle); + if(multi->closure_handle) { + multi->closure_handle->dns.hostcache = multi->hostcache; + Curl_hostcache_clean(multi->closure_handle, + multi->closure_handle->dns.hostcache); - Curl_close(multi->closure_handle); - multi->closure_handle = NULL; + Curl_close(multi->closure_handle); + multi->closure_handle = NULL; + } Curl_hash_destroy(multi->sockhash); multi->sockhash = NULL; @@ -1790,28 +1799,30 @@ CURLMcode curl_multi_cleanup(CURLM *multi_handle) multi->msglist = NULL; /* remove all easy handles */ - easy = multi->easy.next; - while(easy != &multi->easy) { - nexteasy=easy->next; - if(easy->easy_handle->dns.hostcachetype == HCACHE_MULTI) { + data = multi->easyp; + while(data) { + nextdata=data->next; + if(data->dns.hostcachetype == HCACHE_MULTI) { /* clear out the usage of the shared DNS cache */ - Curl_hostcache_clean(easy->easy_handle); - easy->easy_handle->dns.hostcache = NULL; - easy->easy_handle->dns.hostcachetype = HCACHE_NONE; + Curl_hostcache_clean(data, data->dns.hostcache); + data->dns.hostcache = NULL; + data->dns.hostcachetype = HCACHE_NONE; } /* Clear the pointer to the connection cache */ - easy->easy_handle->state.conn_cache = NULL; - - Curl_easy_addmulti(easy->easy_handle, NULL); /* clear the association */ + data->state.conn_cache = NULL; + data->multi = NULL; /* clear the association */ - free(easy); - easy = nexteasy; + data = nextdata; } Curl_hash_destroy(multi->hostcache); multi->hostcache = NULL; + /* Free the blacklists by setting them to NULL */ + Curl_pipeline_set_site_blacklist(NULL, &multi->pipelining_site_bl); + Curl_pipeline_set_server_blacklist(NULL, &multi->pipelining_server_bl); + free(multi); return CURLM_OK; @@ -1863,7 +1874,7 @@ CURLMsg *curl_multi_info_read(CURLM *multi_handle, int *msgs_in_queue) * call the callback accordingly. */ static void singlesocket(struct Curl_multi *multi, - struct Curl_one_easy *easy) + struct SessionHandle *data) { curl_socket_t socks[MAX_SOCKSPEREASYHANDLE]; int i; @@ -1871,7 +1882,6 @@ static void singlesocket(struct Curl_multi *multi, curl_socket_t s; int num; unsigned int curraction; - struct Curl_one_easy *easy_by_hash; bool remove_sock_from_hash; for(i=0; i< MAX_SOCKSPEREASYHANDLE; i++) @@ -1879,7 +1889,7 @@ static void singlesocket(struct Curl_multi *multi, /* Fill in the 'current' struct with the state as it is now: what sockets to supervise and for what actions */ - curraction = multi_getsock(easy, socks, MAX_SOCKSPEREASYHANDLE); + curraction = multi_getsock(data, socks, MAX_SOCKSPEREASYHANDLE); /* We have 0 .. N sockets already and we get to know about the 0 .. M sockets we should have from now on. Detect the differences, remove no @@ -1909,7 +1919,7 @@ static void singlesocket(struct Curl_multi *multi, } else { /* this is a socket we didn't have before, add it! */ - entry = sh_addentry(multi->sockhash, s, easy->easy_handle); + entry = sh_addentry(multi->sockhash, s, data); if(!entry) /* fatal */ return; @@ -1917,7 +1927,7 @@ static void singlesocket(struct Curl_multi *multi, /* we know (entry != NULL) at this point, see the logic above */ if(multi->socket_cb) - multi->socket_cb(easy->easy_handle, + multi->socket_cb(data, s, action, multi->socket_userp, @@ -1930,9 +1940,9 @@ static void singlesocket(struct Curl_multi *multi, /* when we've walked over all the sockets we should have right now, we must make sure to detect sockets that are removed */ - for(i=0; i< easy->numsocks; i++) { + for(i=0; i< data->numsocks; i++) { int j; - s = easy->sockets[i]; + s = data->sockets[i]; for(j=0; j<num; j++) { if(s == socks[j]) { /* this is still supervised */ @@ -1950,10 +1960,7 @@ static void singlesocket(struct Curl_multi *multi, /* check if the socket to be removed serves a connection which has other easy-s in a pipeline. In this case the socket should not be removed. */ - struct connectdata *easy_conn; - - easy_by_hash = entry->easy->multi_pos; - easy_conn = easy_by_hash->easy_conn; + struct connectdata *easy_conn = data->easy_conn; if(easy_conn) { if(easy_conn->recv_pipe && easy_conn->recv_pipe->size > 1) { /* the handle should not be removed from the pipe yet */ @@ -1962,8 +1969,8 @@ static void singlesocket(struct Curl_multi *multi, /* Update the sockhash entry to instead point to the next in line for the recv_pipe, or the first (in case this particular easy isn't already) */ - if(entry->easy == easy->easy_handle) { - if(isHandleAtHead(easy->easy_handle, easy_conn->recv_pipe)) + if(entry->easy == data) { + if(isHandleAtHead(data, easy_conn->recv_pipe)) entry->easy = easy_conn->recv_pipe->head->next->ptr; else entry->easy = easy_conn->recv_pipe->head->ptr; @@ -1976,8 +1983,8 @@ static void singlesocket(struct Curl_multi *multi, /* Update the sockhash entry to instead point to the next in line for the send_pipe, or the first (in case this particular easy isn't already) */ - if(entry->easy == easy->easy_handle) { - if(isHandleAtHead(easy->easy_handle, easy_conn->send_pipe)) + if(entry->easy == data) { + if(isHandleAtHead(data, easy_conn->send_pipe)) entry->easy = easy_conn->send_pipe->head->next->ptr; else entry->easy = easy_conn->send_pipe->head->ptr; @@ -1998,7 +2005,7 @@ static void singlesocket(struct Curl_multi *multi, if(remove_sock_from_hash) { /* in this case 'entry' is always non-NULL */ if(multi->socket_cb) - multi->socket_cb(easy->easy_handle, + multi->socket_cb(data, s, CURL_POLL_REMOVE, multi->socket_userp, @@ -2009,11 +2016,44 @@ static void singlesocket(struct Curl_multi *multi, } } - memcpy(easy->sockets, socks, num*sizeof(curl_socket_t)); - easy->numsocks = num; + memcpy(data->sockets, socks, num*sizeof(curl_socket_t)); + data->numsocks = num; } /* + * Curl_multi_closed() + * + * Used by the connect code to tell the multi_socket code that one of the + * sockets we were using have just been closed. This function will then + * remove it from the sockethash for this handle to make the multi_socket API + * behave properly, especially for the case when libcurl will create another + * socket again and it gets the same file descriptor number. + */ + +void Curl_multi_closed(struct connectdata *conn, curl_socket_t s) +{ + struct Curl_multi *multi = conn->data->multi; + if(multi) { + /* this is set if this connection is part of a handle that is added to + a multi handle, and only then this is necessary */ + struct Curl_sh_entry *entry = + Curl_hash_pick(multi->sockhash, (char *)&s, sizeof(s)); + + if(entry) { + if(multi->socket_cb) + multi->socket_cb(conn->data, s, CURL_POLL_REMOVE, + multi->socket_userp, + entry->socketp); + + /* now remove it from the socket hash */ + sh_delentry(multi->sockhash, s); + } + } +} + + + +/* * add_next_timeout() * * Each SessionHandle has a list of timeouts. The add_next_timeout() is called @@ -2068,7 +2108,6 @@ static CURLMcode add_next_timeout(struct timeval now, return CURLM_OK; } - static CURLMcode multi_socket(struct Curl_multi *multi, bool checkall, curl_socket_t s, @@ -2081,16 +2120,15 @@ static CURLMcode multi_socket(struct Curl_multi *multi, struct timeval now = Curl_tvnow(); if(checkall) { - struct Curl_one_easy *easyp; /* *perform() deals with running_handles on its own */ result = curl_multi_perform(multi, running_handles); /* walk through each easy handle and do the socket state change magic and callbacks */ - easyp=multi->easy.next; - while(easyp != &multi->easy) { - singlesocket(multi, easyp); - easyp = easyp->next; + data=multi->easyp; + while(data) { + singlesocket(multi, data); + data = data->next; } /* or should we fall-through and do the timer-based stuff? */ @@ -2118,35 +2156,35 @@ static CURLMcode multi_socket(struct Curl_multi *multi, /* If the pipeline is enabled, take the handle which is in the head of the pipeline. If we should write into the socket, take the send_pipe head. If we should read from the socket, take the recv_pipe head. */ - if(data->set.one_easy->easy_conn) { + if(data->easy_conn) { if((ev_bitmask & CURL_POLL_OUT) && - data->set.one_easy->easy_conn->send_pipe && - data->set.one_easy->easy_conn->send_pipe->head) - data = data->set.one_easy->easy_conn->send_pipe->head->ptr; + data->easy_conn->send_pipe && + data->easy_conn->send_pipe->head) + data = data->easy_conn->send_pipe->head->ptr; else if((ev_bitmask & CURL_POLL_IN) && - data->set.one_easy->easy_conn->recv_pipe && - data->set.one_easy->easy_conn->recv_pipe->head) - data = data->set.one_easy->easy_conn->recv_pipe->head->ptr; + data->easy_conn->recv_pipe && + data->easy_conn->recv_pipe->head) + data = data->easy_conn->recv_pipe->head->ptr; } - if(data->set.one_easy->easy_conn && - !(data->set.one_easy->easy_conn->handler->flags & PROTOPT_DIRLOCK)) + if(data->easy_conn && + !(data->easy_conn->handler->flags & PROTOPT_DIRLOCK)) /* set socket event bitmask if they're not locked */ - data->set.one_easy->easy_conn->cselect_bits = ev_bitmask; + data->easy_conn->cselect_bits = ev_bitmask; do - result = multi_runsingle(multi, now, data->set.one_easy); + result = multi_runsingle(multi, now, data); while(CURLM_CALL_MULTI_PERFORM == result); - if(data->set.one_easy->easy_conn && - !(data->set.one_easy->easy_conn->handler->flags & PROTOPT_DIRLOCK)) + if(data->easy_conn && + !(data->easy_conn->handler->flags & PROTOPT_DIRLOCK)) /* clear the bitmask only if not locked */ - data->set.one_easy->easy_conn->cselect_bits = 0; + data->easy_conn->cselect_bits = 0; if(CURLM_OK >= result) /* get the socket(s) and check if the state has been changed since last */ - singlesocket(multi, data->set.one_easy); + singlesocket(multi, data); /* Now we fall-through and do the timer-based stuff, since we don't want to force the user to have to deal with timeouts as long as at least @@ -2157,8 +2195,25 @@ static CURLMcode multi_socket(struct Curl_multi *multi, } } - now.tv_usec += 40000; /* compensate for bad precision timers that might've - triggered too early */ + /* Compensate for bad precision timers that might've triggered too early. + + This precaution was added in commit 2c72732ebf3da5e as a result of bad + resolution in the windows function use(d). + + The problematic case here is when using the multi_socket API and libcurl + has told the application about a timeout, and that timeout is what fires + off a bit early. As we don't have any IDs associated with the timeout we + can't tell which timeout that fired off but we only have the times to use + to check what to do. If it fires off too early, we don't run the correct + actions and we don't tell the application again about the same timeout as + was already first in the queue... + + Originally we made the timeouts run 40 milliseconds early on all systems, + but now we have an #ifdef setup to provide a decent precaution inaccuracy + margin. + */ + + now.tv_usec += MULTI_TIMEOUT_INACCURACY; if(now.tv_usec >= 1000000) { now.tv_sec++; now.tv_usec -= 1000000; @@ -2173,13 +2228,13 @@ static CURLMcode multi_socket(struct Curl_multi *multi, /* the first loop lap 'data' can be NULL */ if(data) { do - result = multi_runsingle(multi, now, data->set.one_easy); + result = multi_runsingle(multi, now, data); while(CURLM_CALL_MULTI_PERFORM == result); if(CURLM_OK >= result) /* get the socket(s) and check if the state has been changed since last */ - singlesocket(multi, data->set.one_easy); + singlesocket(multi, data); } /* Check if there's one (more) expired timer to deal with! This function @@ -2229,6 +2284,29 @@ CURLMcode curl_multi_setopt(CURLM *multi_handle, case CURLMOPT_MAXCONNECTS: multi->maxconnects = va_arg(param, long); break; + case CURLMOPT_MAX_HOST_CONNECTIONS: + multi->max_host_connections = va_arg(param, long); + break; + case CURLMOPT_MAX_PIPELINE_LENGTH: + multi->max_pipeline_length = va_arg(param, long); + break; + case CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE: + multi->content_length_penalty_size = va_arg(param, long); + break; + case CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE: + multi->chunk_length_penalty_size = va_arg(param, long); + break; + case CURLMOPT_PIPELINING_SITE_BL: + res = Curl_pipeline_set_site_blacklist(va_arg(param, char **), + &multi->pipelining_site_bl); + break; + case CURLMOPT_PIPELINING_SERVER_BL: + res = Curl_pipeline_set_server_blacklist(va_arg(param, char **), + &multi->pipelining_server_bl); + break; + case CURLMOPT_MAX_TOTAL_CONNECTIONS: + multi->max_total_connections = va_arg(param, long); + break; default: res = CURLM_UNKNOWN_OPTION; break; @@ -2353,131 +2431,12 @@ static int update_timer(struct Curl_multi *multi) return multi->timer_cb((CURLM*)multi, timeout_ms, multi->timer_userp); } -static CURLcode addHandleToSendOrPendPipeline(struct SessionHandle *handle, - struct connectdata *conn) -{ - size_t pipeLen = conn->send_pipe->size + conn->recv_pipe->size; - struct curl_llist_element *sendhead = conn->send_pipe->head; - struct curl_llist *pipeline; - CURLcode rc; - - if(!Curl_isPipeliningEnabled(handle) || - pipeLen == 0) - pipeline = conn->send_pipe; - else { - if(conn->server_supports_pipelining && - pipeLen < MAX_PIPELINE_LENGTH) - pipeline = conn->send_pipe; - else - pipeline = conn->pend_pipe; - } - - rc = Curl_addHandleToPipeline(handle, pipeline); - - if(pipeline == conn->send_pipe && sendhead != conn->send_pipe->head) { - /* this is a new one as head, expire it */ - conn->writechannel_inuse = FALSE; /* not in use yet */ -#ifdef DEBUGBUILD - infof(conn->data, "%p is at send pipe head!\n", - conn->send_pipe->head->ptr); -#endif - Curl_expire(conn->send_pipe->head->ptr, 1); - } - - return rc; -} - -static int checkPendPipeline(struct connectdata *conn) -{ - int result = 0; - struct curl_llist_element *sendhead = conn->send_pipe->head; - - size_t pipeLen = conn->send_pipe->size + conn->recv_pipe->size; - if(conn->server_supports_pipelining || pipeLen == 0) { - struct curl_llist_element *curr = conn->pend_pipe->head; - const size_t maxPipeLen = - conn->server_supports_pipelining ? MAX_PIPELINE_LENGTH : 1; - - while(pipeLen < maxPipeLen && curr) { - Curl_llist_move(conn->pend_pipe, curr, - conn->send_pipe, conn->send_pipe->tail); - Curl_pgrsTime(curr->ptr, TIMER_PRETRANSFER); - ++result; /* count how many handles we moved */ - curr = conn->pend_pipe->head; - ++pipeLen; - } - } - - if(result) { - conn->now = Curl_tvnow(); - /* something moved, check for a new send pipeline leader */ - if(sendhead != conn->send_pipe->head) { - /* this is a new one as head, expire it */ - conn->writechannel_inuse = FALSE; /* not in use yet */ -#ifdef DEBUGBUILD - infof(conn->data, "%p is at send pipe head!\n", - conn->send_pipe->head->ptr); -#endif - Curl_expire(conn->send_pipe->head->ptr, 1); - } - } - - return result; -} - -/* Move this transfer from the sending list to the receiving list. - - Pay special attention to the new sending list "leader" as it needs to get - checked to update what sockets it acts on. - -*/ -static void moveHandleFromSendToRecvPipeline(struct SessionHandle *handle, - struct connectdata *conn) +void Curl_multi_set_easy_connection(struct SessionHandle *handle, + struct connectdata *conn) { - struct curl_llist_element *curr; - - curr = conn->send_pipe->head; - while(curr) { - if(curr->ptr == handle) { - Curl_llist_move(conn->send_pipe, curr, - conn->recv_pipe, conn->recv_pipe->tail); - - if(conn->send_pipe->head) { - /* Since there's a new easy handle at the start of the send pipeline, - set its timeout value to 1ms to make it trigger instantly */ - conn->writechannel_inuse = FALSE; /* not used now */ -#ifdef DEBUGBUILD - infof(conn->data, "%p is at send pipe head B!\n", - conn->send_pipe->head->ptr); -#endif - Curl_expire(conn->send_pipe->head->ptr, 1); - } - - /* The receiver's list is not really interesting here since either this - handle is now first in the list and we'll deal with it soon, or - another handle is already first and thus is already taken care of */ - - break; /* we're done! */ - } - curr = curr->next; - } + handle->easy_conn = conn; } -static void moveHandleFromRecvToDonePipeline(struct SessionHandle *handle, - struct connectdata *conn) -{ - struct curl_llist_element *curr; - - curr = conn->recv_pipe->head; - while(curr) { - if(curr->ptr == handle) { - Curl_llist_move(conn->recv_pipe, curr, - conn->done_pipe, conn->done_pipe->tail); - break; - } - curr = curr->next; - } -} static bool isHandleAtHead(struct SessionHandle *handle, struct curl_llist *pipeline) { @@ -2563,8 +2522,8 @@ void Curl_expire(struct SessionHandle *data, long milli) struct timeval *nowp = &data->state.expiretime; int rc; - /* this is only interesting for multi-interface using libcurl, and only - while there is still a multi interface struct remaining! */ + /* this is only interesting while there is still an associated multi struct + remaining! */ if(!multi) return; @@ -2657,22 +2616,72 @@ CURLMcode curl_multi_assign(CURLM *multi_handle, return CURLM_OK; } +size_t Curl_multi_max_host_connections(struct Curl_multi *multi) +{ + return multi ? multi->max_host_connections : 0; +} + +size_t Curl_multi_max_total_connections(struct Curl_multi *multi) +{ + return multi ? multi->max_total_connections : 0; +} + +size_t Curl_multi_max_pipeline_length(struct Curl_multi *multi) +{ + return multi ? multi->max_pipeline_length : 0; +} + +curl_off_t Curl_multi_content_length_penalty_size(struct Curl_multi *multi) +{ + return multi ? multi->content_length_penalty_size : 0; +} + +curl_off_t Curl_multi_chunk_length_penalty_size(struct Curl_multi *multi) +{ + return multi ? multi->chunk_length_penalty_size : 0; +} + +struct curl_llist *Curl_multi_pipelining_site_bl(struct Curl_multi *multi) +{ + return multi->pipelining_site_bl; +} + +struct curl_llist *Curl_multi_pipelining_server_bl(struct Curl_multi *multi) +{ + return multi->pipelining_server_bl; +} + +void Curl_multi_process_pending_handles(struct Curl_multi *multi) +{ + struct SessionHandle *data; + + data=multi->easyp; + while(data) { + if(data->mstate == CURLM_STATE_CONNECT_PEND) { + multistate(data, CURLM_STATE_CONNECT); + /* Make sure that the handle will be processed soonish. */ + Curl_expire(data, 1); + } + data = data->next; /* operate on next handle */ + } +} + #ifdef DEBUGBUILD void Curl_multi_dump(const struct Curl_multi *multi_handle) { struct Curl_multi *multi=(struct Curl_multi *)multi_handle; - struct Curl_one_easy *easy; + struct SessionHandle *data; int i; fprintf(stderr, "* Multi status: %d handles, %d alive\n", multi->num_easy, multi->num_alive); - for(easy=multi->easy.next; easy != &multi->easy; easy = easy->next) { - if(easy->state < CURLM_STATE_COMPLETED) { + for(data=multi->easyp; data; data = data->next) { + if(data->mstate < CURLM_STATE_COMPLETED) { /* only display handles that are not completed */ fprintf(stderr, "handle %p, state %s, %d sockets\n", - (void *)easy->easy_handle, - statename[easy->state], easy->numsocks); - for(i=0; i < easy->numsocks; i++) { - curl_socket_t s = easy->sockets[i]; + (void *)data, + statename[data->mstate], data->numsocks); + for(i=0; i < data->numsocks; i++) { + curl_socket_t s = data->sockets[i]; struct Curl_sh_entry *entry = Curl_hash_pick(multi->sockhash, (char *)&s, sizeof(s)); @@ -2685,7 +2694,7 @@ void Curl_multi_dump(const struct Curl_multi *multi_handle) entry->action&CURL_POLL_IN?"RECVING":"", entry->action&CURL_POLL_OUT?"SENDING":""); } - if(easy->numsocks) + if(data->numsocks) fprintf(stderr, "\n"); } } diff --git a/plugins/FTPFileYM/curl/lib/multihandle.h b/plugins/FTPFileYM/curl/lib/multihandle.h index 9418359415..552aa93797 100644 --- a/plugins/FTPFileYM/curl/lib/multihandle.h +++ b/plugins/FTPFileYM/curl/lib/multihandle.h @@ -31,25 +31,26 @@ struct Curl_message { well! */ typedef enum { - CURLM_STATE_INIT, /* 0 - start in this state */ - CURLM_STATE_CONNECT, /* 1 - resolve/connect has been sent off */ - CURLM_STATE_WAITRESOLVE, /* 2 - awaiting the resolve to finalize */ - CURLM_STATE_WAITCONNECT, /* 3 - awaiting the connect to finalize */ - CURLM_STATE_WAITPROXYCONNECT, /* 4 - awaiting proxy CONNECT to finalize */ - CURLM_STATE_PROTOCONNECT, /* 5 - completing the protocol-specific connect - phase */ - CURLM_STATE_WAITDO, /* 6 - wait for our turn to send the request */ - CURLM_STATE_DO, /* 7 - start send off the request (part 1) */ - CURLM_STATE_DOING, /* 8 - sending off the request (part 1) */ - CURLM_STATE_DO_MORE, /* 9 - send off the request (part 2) */ - CURLM_STATE_DO_DONE, /* 10 - done sending off request */ - CURLM_STATE_WAITPERFORM, /* 11 - wait for our turn to read the response */ - CURLM_STATE_PERFORM, /* 12 - transfer data */ - CURLM_STATE_TOOFAST, /* 13 - wait because limit-rate exceeded */ - CURLM_STATE_DONE, /* 14 - post data transfer operation */ - CURLM_STATE_COMPLETED, /* 15 - operation complete */ - CURLM_STATE_MSGSENT, /* 16 - the operation complete message is sent */ - CURLM_STATE_LAST /* 17 - not a true state, never use this */ + CURLM_STATE_INIT, /* 0 - start in this state */ + CURLM_STATE_CONNECT_PEND, /* 1 - no connections, waiting for one */ + CURLM_STATE_CONNECT, /* 2 - resolve/connect has been sent off */ + CURLM_STATE_WAITRESOLVE, /* 3 - awaiting the resolve to finalize */ + CURLM_STATE_WAITCONNECT, /* 4 - awaiting the connect to finalize */ + CURLM_STATE_WAITPROXYCONNECT, /* 5 - awaiting proxy CONNECT to finalize */ + CURLM_STATE_PROTOCONNECT, /* 6 - completing the protocol-specific connect + phase */ + CURLM_STATE_WAITDO, /* 7 - wait for our turn to send the request */ + CURLM_STATE_DO, /* 8 - start send off the request (part 1) */ + CURLM_STATE_DOING, /* 9 - sending off the request (part 1) */ + CURLM_STATE_DO_MORE, /* 10 - send off the request (part 2) */ + CURLM_STATE_DO_DONE, /* 11 - done sending off request */ + CURLM_STATE_WAITPERFORM, /* 12 - wait for our turn to read the response */ + CURLM_STATE_PERFORM, /* 13 - transfer data */ + CURLM_STATE_TOOFAST, /* 14 - wait because limit-rate exceeded */ + CURLM_STATE_DONE, /* 15 - post data transfer operation */ + CURLM_STATE_COMPLETED, /* 16 - operation complete */ + CURLM_STATE_MSGSENT, /* 17 - the operation complete message is sent */ + CURLM_STATE_LAST /* 18 - not a true state, never use this */ } CURLMstate; /* we support N sockets per easy handle. Set the corresponding bit to what @@ -58,27 +59,6 @@ typedef enum { #define GETSOCK_READABLE (0x00ff) #define GETSOCK_WRITABLE (0xff00) -struct Curl_one_easy { - /* first, two fields for the linked list of these */ - struct Curl_one_easy *next; - struct Curl_one_easy *prev; - - struct SessionHandle *easy_handle; /* the easy handle for this unit */ - struct connectdata *easy_conn; /* the "unit's" connection */ - - CURLMstate state; /* the handle's state */ - CURLcode result; /* previous result */ - - struct Curl_message msg; /* A single posted message. */ - - /* Array with the plain socket numbers this handle takes care of, in no - particular order. Note that all sockets are added to the sockhash, where - the state etc are also kept. This array is mostly used to detect when a - socket is to be removed from the hash. See singlesocket(). */ - curl_socket_t sockets[MAX_SOCKSPEREASYHANDLE]; - int numsocks; -}; - /* This is the struct known as CURLM on the outside */ struct Curl_multi { /* First a simple identifier to easier detect if a user mix up @@ -86,7 +66,8 @@ struct Curl_multi { long type; /* We have a doubly-linked circular list with easy handles */ - struct Curl_one_easy easy; + struct SessionHandle *easyp; + struct SessionHandle *easylp; /* last node */ int num_easy; /* amount of entries in the linked list above. */ int num_alive; /* amount of easy handles that are added but have not yet @@ -123,6 +104,30 @@ struct Curl_multi { long maxconnects; /* if >0, a fixed limit of the maximum number of entries we're allowed to grow the connection cache to */ + long max_host_connections; /* if >0, a fixed limit of the maximum number + of connections per host */ + + long max_total_connections; /* if >0, a fixed limit of the maximum number + of connections in total */ + + long max_pipeline_length; /* if >0, maximum number of requests in a + pipeline */ + + long content_length_penalty_size; /* a connection with a + content-length bigger than + this is not considered + for pipelining */ + + long chunk_length_penalty_size; /* a connection with a chunk length + bigger than this is not + considered for pipelining */ + + struct curl_llist *pipelining_site_bl; /* List of sites that are blacklisted + from pipelining */ + + struct curl_llist *pipelining_server_bl; /* List of server types that are + blacklisted from pipelining */ + /* timer callback and user data pointer for the *socket() API */ curl_multi_timer_callback timer_cb; void *timer_userp; diff --git a/plugins/FTPFileYM/curl/lib/multiif.h b/plugins/FTPFileYM/curl/lib/multiif.h index c84b6184c0..e61c5c6f2c 100644 --- a/plugins/FTPFileYM/curl/lib/multiif.h +++ b/plugins/FTPFileYM/curl/lib/multiif.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -22,14 +22,26 @@ * ***************************************************************************/ +/* See multi_socket() for the explanation of this constant. Counted in number + of microseconds. */ +#ifdef WIN32 +#define MULTI_TIMEOUT_INACCURACY 40000 +#else +#define MULTI_TIMEOUT_INACCURACY 3000 +#endif + /* * Prototypes for library-wide functions provided by multi.c */ void Curl_expire(struct SessionHandle *data, long milli); -bool Curl_multi_canPipeline(const struct Curl_multi* multi); +bool Curl_multi_pipeline_enabled(const struct Curl_multi* multi); void Curl_multi_handlePipeBreak(struct SessionHandle *data); +/* Internal version of curl_multi_init() accepts size parameters for the + socket and connection hashes */ +struct Curl_multi *Curl_multi_handle(int hashsize, int chashsize); + /* the write bits start at bit 16 for the *getsock() bitmap */ #define GETSOCK_WRITEBITSTART 16 @@ -50,5 +62,43 @@ void Curl_multi_handlePipeBreak(struct SessionHandle *data); void Curl_multi_dump(const struct Curl_multi *multi_handle); #endif -#endif /* HEADER_CURL_MULTIIF_H */ +/* Update the current connection of a One_Easy handle */ +void Curl_multi_set_easy_connection(struct SessionHandle *handle, + struct connectdata *conn); + +void Curl_multi_process_pending_handles(struct Curl_multi *multi); + +/* Return the value of the CURLMOPT_MAX_HOST_CONNECTIONS option */ +size_t Curl_multi_max_host_connections(struct Curl_multi *multi); + +/* Return the value of the CURLMOPT_MAX_PIPELINE_LENGTH option */ +size_t Curl_multi_max_pipeline_length(struct Curl_multi *multi); + +/* Return the value of the CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE option */ +curl_off_t Curl_multi_content_length_penalty_size(struct Curl_multi *multi); + +/* Return the value of the CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE option */ +curl_off_t Curl_multi_chunk_length_penalty_size(struct Curl_multi *multi); +/* Return the value of the CURLMOPT_PIPELINING_SITE_BL option */ +struct curl_llist *Curl_multi_pipelining_site_bl(struct Curl_multi *multi); + +/* Return the value of the CURLMOPT_PIPELINING_SERVER_BL option */ +struct curl_llist *Curl_multi_pipelining_server_bl(struct Curl_multi *multi); + +/* Return the value of the CURLMOPT_MAX_TOTAL_CONNECTIONS option */ +size_t Curl_multi_max_total_connections(struct Curl_multi *multi); + +/* + * Curl_multi_closed() + * + * Used by the connect code to tell the multi_socket code that one of the + * sockets we were using have just been closed. This function will then + * remove it from the sockethash for this handle to make the multi_socket API + * behave properly, especially for the case when libcurl will create another + * socket again and it gets the same file descriptor number. + */ + +void Curl_multi_closed(struct connectdata *conn, curl_socket_t s); + +#endif /* HEADER_CURL_MULTIIF_H */ diff --git a/plugins/FTPFileYM/curl/lib/netrc.c b/plugins/FTPFileYM/curl/lib/netrc.c index 2c5942afc4..e35328a9ed 100644 --- a/plugins/FTPFileYM/curl/lib/netrc.c +++ b/plugins/FTPFileYM/curl/lib/netrc.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -50,15 +50,18 @@ enum host_lookup_state { /* * @unittest: 1304 + * + * *loginp and *passwordp MUST be allocated if they aren't NULL when passed + * in. */ int Curl_parsenetrc(const char *host, - char *login, - char *password, + char **loginp, + char **passwordp, char *netrcfile) { FILE *file; int retcode=1; - int specific_login = (login[0] != 0); + int specific_login = (**loginp != 0); char *home = NULL; bool home_alloc = FALSE; bool netrc_alloc = FALSE; @@ -109,7 +112,7 @@ int Curl_parsenetrc(const char *host, tok=strtok_r(netrcbuffer, " \t\n", &tok_buf); while(!done && tok) { - if(login[0] && password[0]) { + if(**loginp && **passwordp) { done=TRUE; break; } @@ -138,16 +141,22 @@ int Curl_parsenetrc(const char *host, /* we are now parsing sub-keywords concerning "our" host */ if(state_login) { if(specific_login) { - state_our_login = Curl_raw_equal(login, tok); + state_our_login = Curl_raw_equal(*loginp, tok); } else { - strncpy(login, tok, LOGINSIZE-1); + free(*loginp); + *loginp = strdup(tok); + if(!*loginp) + return -1; /* allocation failed */ } state_login=0; } else if(state_password) { if(state_our_login || !specific_login) { - strncpy(password, tok, PASSWORDSIZE-1); + free(*passwordp); + *passwordp = strdup(tok); + if(!*passwordp) + return -1; /* allocation failed */ } state_password=0; } diff --git a/plugins/FTPFileYM/curl/lib/netrc.h b/plugins/FTPFileYM/curl/lib/netrc.h index 4db764df24..a145601148 100644 --- a/plugins/FTPFileYM/curl/lib/netrc.h +++ b/plugins/FTPFileYM/curl/lib/netrc.h @@ -22,19 +22,15 @@ * ***************************************************************************/ -/* Make sure we have room for at least this size: */ -#define LOGINSIZE 64 -#define PASSWORDSIZE 64 - /* returns -1 on failure, 0 if the host is found, 1 is the host isn't found */ int Curl_parsenetrc(const char *host, - char *login, - char *password, + char **loginp, + char **passwordp, char *filename); - /* Assume: password[0]=0, host[0] != 0. - * If login[0] = 0, search for login and password within a machine section - * in the netrc. - * If login[0] != 0, search for password within machine and login. + /* Assume: (*passwordp)[0]=0, host[0] != 0. + * If (*loginp)[0] = 0, search for login and password within a machine + * section in the netrc. + * If (*loginp)[0] != 0, search for password within machine and login. */ #endif /* HEADER_CURL_NETRC_H */ diff --git a/plugins/FTPFileYM/curl/lib/nss.c b/plugins/FTPFileYM/curl/lib/nss.c index 8a2cb09e66..2d4bf9e9c8 100644 --- a/plugins/FTPFileYM/curl/lib/nss.c +++ b/plugins/FTPFileYM/curl/lib/nss.c @@ -1237,12 +1237,6 @@ CURLcode Curl_nss_connect(struct connectdata *conn, int sockindex) goto error; model = SSL_ImportFD(NULL, model); - /* make the socket nonblocking */ - sock_opt.option = PR_SockOpt_Nonblocking; - sock_opt.value.non_blocking = PR_TRUE; - if(PR_SetSocketOption(model, &sock_opt) != PR_SUCCESS) - goto error; - if(SSL_OptionSet(model, SSL_SECURITY, PR_TRUE) != SECSuccess) goto error; if(SSL_OptionSet(model, SSL_HANDSHAKE_AS_SERVER, PR_FALSE) != SECSuccess) @@ -1415,6 +1409,12 @@ CURLcode Curl_nss_connect(struct connectdata *conn, int sockindex) goto error; } + /* switch the SSL socket into non-blocking mode */ + sock_opt.option = PR_SockOpt_Nonblocking; + sock_opt.value.non_blocking = PR_TRUE; + if(PR_SetSocketOption(connssl->handle, &sock_opt) != PR_SUCCESS) + goto error; + connssl->state = ssl_connection_complete; conn->recv[sockindex] = nss_recv; conn->send[sockindex] = nss_send; @@ -1482,10 +1482,8 @@ static ssize_t nss_send(struct connectdata *conn, /* connection data */ size_t len, /* amount to write */ CURLcode *curlcode) { - int rc; - - rc = PR_Send(conn->ssl[sockindex].handle, mem, (int)len, 0, -1); - + ssize_t rc = PR_Send(conn->ssl[sockindex].handle, mem, (int)len, 0, + PR_INTERVAL_NO_WAIT); if(rc < 0) { PRInt32 err = PR_GetError(); if(err == PR_WOULD_BLOCK_ERROR) @@ -1513,9 +1511,8 @@ static ssize_t nss_recv(struct connectdata * conn, /* connection data */ size_t buffersize, /* max amount to read */ CURLcode *curlcode) { - ssize_t nread; - - nread = PR_Recv(conn->ssl[num].handle, buf, (int)buffersize, 0, -1); + ssize_t nread = PR_Recv(conn->ssl[num].handle, buf, (int)buffersize, 0, + PR_INTERVAL_NO_WAIT); if(nread < 0) { /* failed SSL read */ PRInt32 err = PR_GetError(); @@ -1546,9 +1543,8 @@ size_t Curl_nss_version(char *buffer, size_t size) int Curl_nss_seed(struct SessionHandle *data) { - /* TODO: implement? */ - (void) data; - return 0; + /* make sure that NSS is initialized */ + return !!Curl_nss_force_init(data); } void Curl_nss_random(struct SessionHandle *data, @@ -1556,7 +1552,11 @@ void Curl_nss_random(struct SessionHandle *data, size_t length) { Curl_nss_seed(data); /* Initiate the seed if not already done */ - PK11_GenerateRandom(entropy, curlx_uztosi(length)); + if(SECSuccess != PK11_GenerateRandom(entropy, curlx_uztosi(length))) { + /* no way to signal a failure from here, we have to abort */ + failf(data, "PK11_GenerateRandom() failed, calling abort()..."); + abort(); + } } void Curl_nss_md5sum(unsigned char *tmp, /* input */ diff --git a/plugins/FTPFileYM/curl/lib/nssg.h b/plugins/FTPFileYM/curl/lib/nssg.h index a881a9ad2f..cd32706a71 100644 --- a/plugins/FTPFileYM/curl/lib/nssg.h +++ b/plugins/FTPFileYM/curl/lib/nssg.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -60,6 +60,10 @@ void Curl_nss_md5sum(unsigned char *tmp, /* input */ unsigned char *md5sum, /* output */ size_t md5len); +/* this backend provides these functions: */ +#define have_curlssl_random 1 +#define have_curlssl_md5sum 1 + /* API setup for NSS */ #define curlssl_init Curl_nss_init #define curlssl_cleanup Curl_nss_cleanup diff --git a/plugins/FTPFileYM/curl/lib/openldap.c b/plugins/FTPFileYM/curl/lib/openldap.c index cb3b420205..98793b3067 100644 --- a/plugins/FTPFileYM/curl/lib/openldap.c +++ b/plugins/FTPFileYM/curl/lib/openldap.c @@ -378,7 +378,7 @@ static CURLcode ldap_do(struct connectdata *conn, bool *done) if(!lr) return CURLE_OUT_OF_MEMORY; lr->msgid = msgid; - data->state.proto.generic = lr; + data->req.protop = lr; Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, NULL, -1, NULL); *done = TRUE; return CURLE_OK; @@ -387,7 +387,7 @@ static CURLcode ldap_do(struct connectdata *conn, bool *done) static CURLcode ldap_done(struct connectdata *conn, CURLcode res, bool premature) { - ldapreqinfo *lr = conn->data->state.proto.generic; + ldapreqinfo *lr = conn->data->req.protop; (void)res; (void)premature; @@ -398,7 +398,7 @@ static CURLcode ldap_done(struct connectdata *conn, CURLcode res, ldap_abandon_ext(li->ld, lr->msgid, NULL, NULL); lr->msgid = 0; } - conn->data->state.proto.generic = NULL; + conn->data->req.protop = NULL; free(lr); } return CURLE_OK; @@ -409,7 +409,7 @@ static ssize_t ldap_recv(struct connectdata *conn, int sockindex, char *buf, { ldapconninfo *li = conn->proto.generic; struct SessionHandle *data=conn->data; - ldapreqinfo *lr = data->state.proto.generic; + ldapreqinfo *lr = data->req.protop; int rc, ret; LDAPMessage *result = NULL; LDAPMessage *ent; diff --git a/plugins/FTPFileYM/curl/lib/pingpong.c b/plugins/FTPFileYM/curl/lib/pingpong.c index 16b4ad37e4..3ebeabe537 100644 --- a/plugins/FTPFileYM/curl/lib/pingpong.c +++ b/plugins/FTPFileYM/curl/lib/pingpong.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -33,6 +33,7 @@ #include "pingpong.h" #include "multiif.h" #include "non-ascii.h" +#include "sslgen.h" #define _MPRINTF_REPLACE /* use our functions only */ #include <curl/mprintf.h> @@ -76,48 +77,10 @@ long Curl_pp_state_timeout(struct pingpong *pp) return timeout_ms; } - -/* - * Curl_pp_multi_statemach() - * - * called repeatedly until done when the multi interface is used. - */ -CURLcode Curl_pp_multi_statemach(struct pingpong *pp) -{ - struct connectdata *conn = pp->conn; - curl_socket_t sock = conn->sock[FIRSTSOCKET]; - int rc; - struct SessionHandle *data=conn->data; - CURLcode result = CURLE_OK; - long timeout_ms = Curl_pp_state_timeout(pp); - - if(timeout_ms <= 0) { - failf(data, "server response timeout"); - return CURLE_OPERATION_TIMEDOUT; - } - - rc = Curl_socket_ready(pp->sendleft?CURL_SOCKET_BAD:sock, /* reading */ - pp->sendleft?sock:CURL_SOCKET_BAD, /* writing */ - 0); - - if(rc == -1) { - failf(data, "select/poll error"); - return CURLE_OUT_OF_MEMORY; - } - else if(rc != 0) - result = pp->statemach_act(conn); - - /* if rc == 0, then select() timed out */ - - return result; -} - /* - * Curl_pp_easy_statemach() - * - * called repeatedly until done when the easy interface is used. + * Curl_pp_statemach() */ -CURLcode Curl_pp_easy_statemach(struct pingpong *pp) +CURLcode Curl_pp_statemach(struct pingpong *pp, bool block) { struct connectdata *conn = pp->conn; curl_socket_t sock = conn->sock[FIRSTSOCKET]; @@ -125,29 +88,44 @@ CURLcode Curl_pp_easy_statemach(struct pingpong *pp) long interval_ms; long timeout_ms = Curl_pp_state_timeout(pp); struct SessionHandle *data=conn->data; - CURLcode result; + CURLcode result = CURLE_OK; if(timeout_ms <=0 ) { failf(data, "server response timeout"); return CURLE_OPERATION_TIMEDOUT; /* already too little time */ } - interval_ms = 1000; /* use 1 second timeout intervals */ - if(timeout_ms < interval_ms) - interval_ms = timeout_ms; - - rc = Curl_socket_ready(pp->sendleft?CURL_SOCKET_BAD:sock, /* reading */ - pp->sendleft?sock:CURL_SOCKET_BAD, /* writing */ - interval_ms); - - if(Curl_pgrsUpdate(conn)) - result = CURLE_ABORTED_BY_CALLBACK; + if(block) { + interval_ms = 1000; /* use 1 second timeout intervals */ + if(timeout_ms < interval_ms) + interval_ms = timeout_ms; + } + else + interval_ms = 0; /* immediate */ + + if(Curl_pp_moredata(pp)) + /* We are receiving and there is data in the cache so just read it */ + rc = 1; + else if(!pp->sendleft && Curl_ssl_data_pending(conn, FIRSTSOCKET)) + /* We are receiving and there is data ready in the SSL library */ + rc = 1; else - result = Curl_speedcheck(data, Curl_tvnow()); + rc = Curl_socket_ready(pp->sendleft?CURL_SOCKET_BAD:sock, /* reading */ + pp->sendleft?sock:CURL_SOCKET_BAD, /* writing */ + interval_ms); + + if(block) { + /* if we didn't wait, we don't have to spend time on this now */ + if(Curl_pgrsUpdate(conn)) + result = CURLE_ABORTED_BY_CALLBACK; + else + result = Curl_speedcheck(data, Curl_tvnow()); + + if(result) + return result; + } - if(result) - ; - else if(rc == -1) { + if(rc == -1) { failf(data, "select/poll error"); result = CURLE_OUT_OF_MEMORY; } @@ -191,7 +169,7 @@ CURLcode Curl_pp_vsendf(struct pingpong *pp, struct connectdata *conn = pp->conn; struct SessionHandle *data = conn->data; -#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI) +#ifdef HAVE_GSSAPI enum protection_level data_sec = conn->data_prot; #endif @@ -220,12 +198,12 @@ CURLcode Curl_pp_vsendf(struct pingpong *pp, return error; } -#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI) +#ifdef HAVE_GSSAPI conn->data_prot = PROT_CMD; #endif error = Curl_write(conn, conn->sock[FIRSTSOCKET], s, write_len, &bytes_written); -#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI) +#ifdef HAVE_GSSAPI DEBUGASSERT(data_sec > PROT_NONE && data_sec < PROT_LAST); conn->data_prot = data_sec; #endif @@ -328,14 +306,14 @@ CURLcode Curl_pp_readresp(curl_socket_t sockfd, } else { int res; -#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI) +#ifdef HAVE_GSSAPI enum protection_level prot = conn->data_prot; conn->data_prot = PROT_CLEAR; #endif DEBUGASSERT((ptr+BUFSIZE-pp->nread_resp) <= (buf+BUFSIZE+1)); res = Curl_read(conn, sockfd, ptr, BUFSIZE-pp->nread_resp, &gotbytes); -#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI) +#ifdef HAVE_GSSAPI DEBUGASSERT(prot > PROT_NONE && prot < PROT_LAST); conn->data_prot = prot; #endif @@ -378,7 +356,7 @@ CURLcode Curl_pp_readresp(curl_socket_t sockfd, the line isn't really terminated until the LF comes */ /* output debug output if that is requested */ -#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI) +#ifdef HAVE_GSSAPI if(!conn->sec_complete) #endif if(data->set.verbose) @@ -395,10 +373,9 @@ CURLcode Curl_pp_readresp(curl_socket_t sockfd, if(result) return result; - if(pp->endofresp(pp, code)) { + if(pp->endofresp(conn, pp->linestart_resp, perline, code)) { /* This is the end of the last line, copy the last line to the - start of the buffer and zero terminate, for old times sake (and - krb4)! */ + start of the buffer and zero terminate, for old times sake */ char *meow; int n; for(meow=pp->linestart_resp, n=0; meow<ptr; meow++, n++) @@ -533,6 +510,10 @@ CURLcode Curl_pp_disconnect(struct pingpong *pp) return CURLE_OK; } - +bool Curl_pp_moredata(struct pingpong *pp) +{ + return (!pp->sendleft && pp->cache && pp->nread_resp < pp->cache_size) ? + TRUE : FALSE; +} #endif diff --git a/plugins/FTPFileYM/curl/lib/pingpong.h b/plugins/FTPFileYM/curl/lib/pingpong.h index b48c1ed61a..b925ab98e1 100644 --- a/plugins/FTPFileYM/curl/lib/pingpong.h +++ b/plugins/FTPFileYM/curl/lib/pingpong.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -32,6 +32,13 @@ /* forward-declaration, this is defined in urldata.h */ struct connectdata; +typedef enum { + FTPTRANSFER_BODY, /* yes do transfer a body */ + FTPTRANSFER_INFO, /* do still go through to get info/headers */ + FTPTRANSFER_NONE, /* don't get anything and don't get info */ + FTPTRANSFER_LAST /* end of list marker, never used */ +} curl_pp_transfer; + /* * 'pingpong' is the generic struct used for protocols doing server<->client * conversations in a back-and-forth style such as FTP, IMAP, POP3, SMTP etc. @@ -64,23 +71,17 @@ struct pingpong { CURLcode (*statemach_act)(struct connectdata *conn); - int (*endofresp)(struct pingpong *pp, int *code); + bool (*endofresp)(struct connectdata *conn, char *ptr, size_t len, + int *code); }; /* - * Curl_pp_multi_statemach() - * - * called repeatedly until done when the multi interface is used. - */ -CURLcode Curl_pp_multi_statemach(struct pingpong *pp); - -/* - * Curl_pp_easy_statemach() + * Curl_pp_statemach() * - * called repeatedly until done when the easy interface is used. + * called repeatedly until done. Set 'wait' to make it wait a while on the + * socket if there's no traffic. */ -CURLcode Curl_pp_easy_statemach(struct pingpong *pp); - +CURLcode Curl_pp_statemach(struct pingpong *pp, bool block); /* initialize stuff to prepare for reading a fresh new response */ void Curl_pp_init(struct pingpong *pp); @@ -136,4 +137,14 @@ CURLcode Curl_pp_disconnect(struct pingpong *pp); int Curl_pp_getsock(struct pingpong *pp, curl_socket_t *socks, int numsocks); + +/*********************************************************************** + * + * Curl_pp_moredata() + * + * Returns whether there are still more data in the cache and so a call + * to Curl_pp_readresp() will not block. + */ +bool Curl_pp_moredata(struct pingpong *pp); + #endif /* HEADER_CURL_PINGPONG_H */ diff --git a/plugins/FTPFileYM/curl/lib/pipeline.c b/plugins/FTPFileYM/curl/lib/pipeline.c new file mode 100644 index 0000000000..418058afa0 --- /dev/null +++ b/plugins/FTPFileYM/curl/lib/pipeline.c @@ -0,0 +1,333 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 2013, Linus Nielsen Feltzing, <linus@haxx.se> + * Copyright (C) 2013, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "curl_setup.h" + +#include <curl/curl.h> + +#include "urldata.h" +#include "url.h" +#include "progress.h" +#include "multiif.h" +#include "pipeline.h" +#include "sendf.h" +#include "rawstr.h" +#include "bundles.h" + +#include "curl_memory.h" +/* The last #include file should be: */ +#include "memdebug.h" + +struct site_blacklist_entry { + char *hostname; + unsigned short port; +}; + +static void site_blacklist_llist_dtor(void *user, void *element) +{ + struct site_blacklist_entry *entry = element; + (void)user; + + Curl_safefree(entry->hostname); + Curl_safefree(entry); +} + +static void server_blacklist_llist_dtor(void *user, void *element) +{ + char *server_name = element; + (void)user; + + Curl_safefree(server_name); +} + +bool Curl_pipeline_penalized(struct SessionHandle *data, + struct connectdata *conn) +{ + if(data) { + bool penalized = FALSE; + curl_off_t penalty_size = + Curl_multi_content_length_penalty_size(data->multi); + curl_off_t chunk_penalty_size = + Curl_multi_chunk_length_penalty_size(data->multi); + curl_off_t recv_size = -2; /* Make it easy to spot in the log */ + + /* Find the head of the recv pipe, if any */ + if(conn->recv_pipe && conn->recv_pipe->head) { + struct SessionHandle *recv_handle = conn->recv_pipe->head->ptr; + + recv_size = recv_handle->req.size; + + if(penalty_size > 0 && recv_size > penalty_size) + penalized = TRUE; + } + + if(chunk_penalty_size > 0 && + (curl_off_t)conn->chunk.datasize > chunk_penalty_size) + penalized = TRUE; + + infof(data, "Conn: %ld (%p) Receive pipe weight: (%" FORMAT_OFF_T + "/%zu), penalized: %s\n", + conn->connection_id, (void *)conn, recv_size, + conn->chunk.datasize, penalized?"TRUE":"FALSE"); + return penalized; + } + return FALSE; +} + +CURLcode Curl_add_handle_to_pipeline(struct SessionHandle *handle, + struct connectdata *conn) +{ + struct curl_llist_element *sendhead = conn->send_pipe->head; + struct curl_llist *pipeline; + CURLcode rc; + + pipeline = conn->send_pipe; + + infof(conn->data, "Adding handle: conn: %p\n", (void *)conn); + infof(conn->data, "Adding handle: send: %d\n", conn->send_pipe->size); + infof(conn->data, "Adding handle: recv: %d\n", conn->recv_pipe->size); + rc = Curl_addHandleToPipeline(handle, pipeline); + + if(pipeline == conn->send_pipe && sendhead != conn->send_pipe->head) { + /* this is a new one as head, expire it */ + conn->writechannel_inuse = FALSE; /* not in use yet */ +#ifdef DEBUGBUILD + infof(conn->data, "%p is at send pipe head!\n", + (void *)conn->send_pipe->head->ptr); +#endif + Curl_expire(conn->send_pipe->head->ptr, 1); + } + + print_pipeline(conn); + + return rc; +} + +/* Move this transfer from the sending list to the receiving list. + + Pay special attention to the new sending list "leader" as it needs to get + checked to update what sockets it acts on. + +*/ +void Curl_move_handle_from_send_to_recv_pipe(struct SessionHandle *handle, + struct connectdata *conn) +{ + struct curl_llist_element *curr; + + curr = conn->send_pipe->head; + while(curr) { + if(curr->ptr == handle) { + Curl_llist_move(conn->send_pipe, curr, + conn->recv_pipe, conn->recv_pipe->tail); + + if(conn->send_pipe->head) { + /* Since there's a new easy handle at the start of the send pipeline, + set its timeout value to 1ms to make it trigger instantly */ + conn->writechannel_inuse = FALSE; /* not used now */ +#ifdef DEBUGBUILD + infof(conn->data, "%p is at send pipe head B!\n", + (void *)conn->send_pipe->head->ptr); +#endif + Curl_expire(conn->send_pipe->head->ptr, 1); + } + + /* The receiver's list is not really interesting here since either this + handle is now first in the list and we'll deal with it soon, or + another handle is already first and thus is already taken care of */ + + break; /* we're done! */ + } + curr = curr->next; + } +} + +bool Curl_pipeline_site_blacklisted(struct SessionHandle *handle, + struct connectdata *conn) +{ + if(handle->multi) { + struct curl_llist *blacklist = + Curl_multi_pipelining_site_bl(handle->multi); + + if(blacklist) { + struct curl_llist_element *curr; + + curr = blacklist->head; + while(curr) { + struct site_blacklist_entry *site; + + site = curr->ptr; + if(Curl_raw_equal(site->hostname, conn->host.name) && + site->port == conn->remote_port) { + infof(handle, "Site %s:%d is pipeline blacklisted\n", + conn->host.name, conn->remote_port); + return TRUE; + } + curr = curr->next; + } + } + } + return FALSE; +} + +CURLMcode Curl_pipeline_set_site_blacklist(char **sites, + struct curl_llist **list_ptr) +{ + struct curl_llist *old_list = *list_ptr; + struct curl_llist *new_list = NULL; + + if(sites) { + new_list = Curl_llist_alloc((curl_llist_dtor) site_blacklist_llist_dtor); + if(!new_list) + return CURLM_OUT_OF_MEMORY; + + /* Parse the URLs and populate the list */ + while(*sites) { + char *hostname; + char *port; + struct site_blacklist_entry *entry; + + entry = malloc(sizeof(struct site_blacklist_entry)); + + hostname = strdup(*sites); + if(!hostname) + return CURLM_OUT_OF_MEMORY; + + port = strchr(hostname, ':'); + if(port) { + *port = '\0'; + port++; + entry->port = (unsigned short)strtol(port, NULL, 10); + } + else { + /* Default port number for HTTP */ + entry->port = 80; + } + + entry->hostname = hostname; + + if(!Curl_llist_insert_next(new_list, new_list->tail, entry)) + return CURLM_OUT_OF_MEMORY; + + sites++; + } + } + + /* Free the old list */ + if(old_list) { + Curl_llist_destroy(old_list, NULL); + } + + /* This might be NULL if sites == NULL, i.e the blacklist is cleared */ + *list_ptr = new_list; + + return CURLM_OK; +} + +bool Curl_pipeline_server_blacklisted(struct SessionHandle *handle, + char *server_name) +{ + if(handle->multi) { + struct curl_llist *blacklist = + Curl_multi_pipelining_server_bl(handle->multi); + + if(blacklist) { + struct curl_llist_element *curr; + + curr = blacklist->head; + while(curr) { + char *bl_server_name; + + bl_server_name = curr->ptr; + if(Curl_raw_nequal(bl_server_name, server_name, + strlen(bl_server_name))) { + infof(handle, "Server %s is blacklisted\n", server_name); + return TRUE; + } + curr = curr->next; + } + } + + infof(handle, "Server %s is not blacklisted\n", server_name); + } + return FALSE; +} + +CURLMcode Curl_pipeline_set_server_blacklist(char **servers, + struct curl_llist **list_ptr) +{ + struct curl_llist *old_list = *list_ptr; + struct curl_llist *new_list = NULL; + + if(servers) { + new_list = Curl_llist_alloc((curl_llist_dtor) server_blacklist_llist_dtor); + if(!new_list) + return CURLM_OUT_OF_MEMORY; + + /* Parse the URLs and populate the list */ + while(*servers) { + char *server_name; + + server_name = strdup(*servers); + if(!server_name) + return CURLM_OUT_OF_MEMORY; + + if(!Curl_llist_insert_next(new_list, new_list->tail, server_name)) + return CURLM_OUT_OF_MEMORY; + + servers++; + } + } + + /* Free the old list */ + if(old_list) { + Curl_llist_destroy(old_list, NULL); + } + + /* This might be NULL if sites == NULL, i.e the blacklist is cleared */ + *list_ptr = new_list; + + return CURLM_OK; +} + + +void print_pipeline(struct connectdata *conn) +{ + struct curl_llist_element *curr; + struct connectbundle *cb_ptr; + struct SessionHandle *data = conn->data; + + cb_ptr = conn->bundle; + + if(cb_ptr) { + curr = cb_ptr->conn_list->head; + while(curr) { + conn = curr->ptr; + infof(data, "- Conn %ld (%p) send_pipe: %zu, recv_pipe: %zu\n", + conn->connection_id, + (void *)conn, + conn->send_pipe->size, + conn->recv_pipe->size); + curr = curr->next; + } + } +} diff --git a/plugins/FTPFileYM/curl/lib/pipeline.h b/plugins/FTPFileYM/curl/lib/pipeline.h new file mode 100644 index 0000000000..1df9589535 --- /dev/null +++ b/plugins/FTPFileYM/curl/lib/pipeline.h @@ -0,0 +1,46 @@ +#ifndef HEADER_CURL_PIPELINE_H +#define HEADER_CURL_PIPELINE_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 2013, Linus Nielsen Feltzing, <linus@haxx.se> + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +CURLcode Curl_add_handle_to_pipeline(struct SessionHandle *handle, + struct connectdata *conn); +void Curl_move_handle_from_send_to_recv_pipe(struct SessionHandle *handle, + struct connectdata *conn); +bool Curl_pipeline_penalized(struct SessionHandle *data, + struct connectdata *conn); + +bool Curl_pipeline_site_blacklisted(struct SessionHandle *handle, + struct connectdata *conn); + +CURLMcode Curl_pipeline_set_site_blacklist(char **sites, + struct curl_llist **list_ptr); + +bool Curl_pipeline_server_blacklisted(struct SessionHandle *handle, + char *server_name); + +CURLMcode Curl_pipeline_set_server_blacklist(char **servers, + struct curl_llist **list_ptr); + +void print_pipeline(struct connectdata *conn); + +#endif /* HEADER_CURL_PIPELINE_H */ diff --git a/plugins/FTPFileYM/curl/lib/polarssl.c b/plugins/FTPFileYM/curl/lib/polarssl.c index f4ca63e116..808f54c243 100644 --- a/plugins/FTPFileYM/curl/lib/polarssl.c +++ b/plugins/FTPFileYM/curl/lib/polarssl.c @@ -5,8 +5,8 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 2010, 2011, Hoi-Ho Chan, <hoiho.chan@gmail.com> - * Copyright (C) 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 2010 - 2011, Hoi-Ho Chan, <hoiho.chan@gmail.com> + * Copyright (C) 2012 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -33,13 +33,21 @@ #include <polarssl/net.h> #include <polarssl/ssl.h> -#include <polarssl/havege.h> #include <polarssl/certs.h> #include <polarssl/x509.h> #include <polarssl/version.h> +#if POLARSSL_VERSION_NUMBER >= 0x01000000 +#include <polarssl/error.h> +#endif /* POLARSSL_VERSION_NUMBER >= 0x01000000 */ + +#if POLARSSL_VERSION_NUMBER>0x01010000 #include <polarssl/entropy.h> #include <polarssl/ctr_drbg.h> +#else +#include <polarssl/havege.h> +#endif /* POLARSSL_VERSION_NUMBER>0x01010000 */ + #if POLARSSL_VERSION_NUMBER<0x01000000 /* @@ -58,6 +66,7 @@ #include "connect.h" /* for the connect timeout */ #include "select.h" #include "rawstr.h" +#include "polarssl_threadlock.h" #define _MPRINTF_REPLACE /* use our functions only */ #include <curl/mprintf.h> @@ -65,15 +74,44 @@ /* The last #include file should be: */ #include "memdebug.h" -/* version dependent differences */ -#if POLARSSL_VERSION_NUMBER < 0x01010000 -/* the old way */ -#define HAVEGE_RANDOM havege_rand -#else -/* from 1.1.0 */ -#define HAVEGE_RANDOM havege_random +/* apply threading? */ +#if defined(USE_THREADS_POSIX) || defined(USE_THREADS_WIN32) +#define THREADING_SUPPORT #endif +#if defined(THREADING_SUPPORT) && POLARSSL_VERSION_NUMBER>0x01010000 +static entropy_context entropy; + +static int entropy_init_initialized = 0; + +/* start of entropy_init_mutex() */ +static void entropy_init_mutex(entropy_context *ctx) +{ + /* lock 0 = entropy_init_mutex() */ + polarsslthreadlock_lock_function(0); + if(entropy_init_initialized == 0) { + entropy_init(ctx); + entropy_init_initialized = 1; + } + polarsslthreadlock_unlock_function(0); +} +/* end of entropy_init_mutex() */ + +/* start of entropy_func_mutex() */ +static int entropy_func_mutex(void *data, unsigned char *output, size_t len) +{ + int ret; + /* lock 1 = entropy_func_mutex() */ + polarsslthreadlock_lock_function(1); + ret = entropy_func(data, output, len); + polarsslthreadlock_unlock_function(1); + + return ret; +} +/* end of entropy_func_mutex() */ + +#endif /* THREADING_SUPPORT && POLARSSL_VERSION_NUMBER>0x01010000 */ + /* Define this to enable lots of debugging for PolarSSL */ #undef POLARSSL_DEBUG @@ -113,6 +151,10 @@ polarssl_connect_step1(struct connectdata *conn, void *old_session = NULL; size_t old_session_size = 0; + char errorbuf[128]; + memset(errorbuf, 0, sizeof(errorbuf)); + + /* PolarSSL only supports SSLv3 and TLSv1 */ if(data->set.ssl.version == CURL_SSLVERSION_SSLv2) { failf(data, "PolarSSL does not support SSLv2"); @@ -121,7 +163,33 @@ polarssl_connect_step1(struct connectdata *conn, else if(data->set.ssl.version == CURL_SSLVERSION_SSLv3) sni = FALSE; /* SSLv3 has no SNI */ +#if POLARSSL_VERSION_NUMBER<0x01010000 havege_init(&connssl->hs); +#else +#ifdef THREADING_SUPPORT + entropy_init_mutex(&entropy); + + if((ret = ctr_drbg_init(&connssl->ctr_drbg, entropy_func_mutex, &entropy, + connssl->ssn.id, connssl->ssn.length)) != 0) { +#ifdef POLARSSL_ERROR_C + error_strerror(ret, errorbuf, sizeof(errorbuf)); +#endif /* POLARSSL_ERROR_C */ + failf(data, "Failed - PolarSSL: ctr_drbg_init returned (-0x%04X) %s\n", + -ret, errorbuf); + } +#else + entropy_init(&connssl->entropy); + + if((ret = ctr_drbg_init(&connssl->ctr_drbg, entropy_func, &connssl->entropy, + connssl->ssn.id, connssl->ssn.length)) != 0) { +#ifdef POLARSSL_ERROR_C + error_strerror(ret, errorbuf, sizeof(errorbuf)); +#endif /* POLARSSL_ERROR_C */ + failf(data, "Failed - PolarSSL: ctr_drbg_init returned (-0x%04X) %s\n", + -ret, errorbuf); + } +#endif /* THREADING_SUPPORT */ +#endif /* POLARSSL_VERSION_NUMBER<0x01010000 */ /* Load the trusted CA */ memset(&connssl->cacert, 0, sizeof(x509_cert)); @@ -131,8 +199,11 @@ polarssl_connect_step1(struct connectdata *conn, data->set.str[STRING_SSL_CAFILE]); if(ret<0) { - failf(data, "Error reading ca cert file %s: -0x%04X", - data->set.str[STRING_SSL_CAFILE], ret); +#ifdef POLARSSL_ERROR_C + error_strerror(ret, errorbuf, sizeof(errorbuf)); +#endif /* POLARSSL_ERROR_C */ + failf(data, "Error reading ca cert file %s - PolarSSL: (-0x%04X) %s", + data->set.str[STRING_SSL_CAFILE], -ret, errorbuf); if(data->set.ssl.verifypeer) return CURLE_SSL_CACERT_BADFILE; @@ -147,8 +218,12 @@ polarssl_connect_step1(struct connectdata *conn, data->set.str[STRING_CERT]); if(ret) { - failf(data, "Error reading client cert file %s: -0x%04X", - data->set.str[STRING_CERT], -ret); +#ifdef POLARSSL_ERROR_C + error_strerror(ret, errorbuf, sizeof(errorbuf)); +#endif /* POLARSSL_ERROR_C */ + failf(data, "Error reading client cert file %s - PolarSSL: (-0x%04X) %s", + data->set.str[STRING_CERT], -ret, errorbuf); + return CURLE_SSL_CERTPROBLEM; } } @@ -160,8 +235,12 @@ polarssl_connect_step1(struct connectdata *conn, data->set.str[STRING_KEY_PASSWD]); if(ret) { - failf(data, "Error reading private key %s: -0x%04X", - data->set.str[STRING_KEY], -ret); +#ifdef POLARSSL_ERROR_C + error_strerror(ret, errorbuf, sizeof(errorbuf)); +#endif /* POLARSSL_ERROR_C */ + failf(data, "Error reading private key %s - PolarSSL: (-0x%04X) %s", + data->set.str[STRING_KEY], -ret, errorbuf); + return CURLE_SSL_CERTPROBLEM; } } @@ -174,8 +253,12 @@ polarssl_connect_step1(struct connectdata *conn, data->set.str[STRING_SSL_CRLFILE]); if(ret) { - failf(data, "Error reading CRL file %s: -0x%04X", - data->set.str[STRING_SSL_CRLFILE], -ret); +#ifdef POLARSSL_ERROR_C + error_strerror(ret, errorbuf, sizeof(errorbuf)); +#endif /* POLARSSL_ERROR_C */ + failf(data, "Error reading CRL file %s - PolarSSL: (-0x%04X) %s", + data->set.str[STRING_SSL_CRLFILE], -ret, errorbuf); + return CURLE_SSL_CRL_BADFILE; } } @@ -191,8 +274,13 @@ polarssl_connect_step1(struct connectdata *conn, ssl_set_endpoint(&connssl->ssl, SSL_IS_CLIENT); ssl_set_authmode(&connssl->ssl, SSL_VERIFY_OPTIONAL); - ssl_set_rng(&connssl->ssl, HAVEGE_RANDOM, +#if POLARSSL_VERSION_NUMBER<0x01010000 + ssl_set_rng(&connssl->ssl, havege_rand, &connssl->hs); +#else + ssl_set_rng(&connssl->ssl, ctr_drbg_random, + &connssl->ctr_drbg); +#endif /* POLARSSL_VERSION_NUMBER<0x01010000 */ ssl_set_bio(&connssl->ssl, net_recv, &conn->sock[sockindex], net_send, &conn->sock[sockindex]); @@ -253,6 +341,9 @@ polarssl_connect_step2(struct connectdata *conn, struct ssl_connect_data* connssl = &conn->ssl[sockindex]; char buffer[1024]; + char errorbuf[128]; + memset(errorbuf, 0, sizeof(errorbuf)); + conn->recv[sockindex] = polarssl_recv; conn->send[sockindex] = polarssl_send; @@ -261,8 +352,13 @@ polarssl_connect_step2(struct connectdata *conn, break; else if(ret != POLARSSL_ERR_NET_WANT_READ && ret != POLARSSL_ERR_NET_WANT_WRITE) { - failf(data, "ssl_handshake returned -0x%04X", -ret); - return CURLE_SSL_CONNECT_ERROR; +#ifdef POLARSSL_ERROR_C + error_strerror(ret, errorbuf, sizeof(errorbuf)); +#endif /* POLARSSL_ERROR_C */ + failf(data, "ssl_handshake returned - PolarSSL: (-0x%04X) %s", + -ret, errorbuf); + + return CURLE_SSL_CONNECT_ERROR; } else { if(ret == POLARSSL_ERR_NET_WANT_READ) { @@ -593,4 +689,18 @@ Curl_polarssl_connect(struct connectdata *conn, return CURLE_OK; } -#endif +/* + * return 0 error initializing SSL + * return 1 SSL initialized successfully + */ +int polarssl_init(void) +{ + return polarsslthreadlock_thread_setup(); +} + +void polarssl_cleanup(void) +{ + (void)polarsslthreadlock_thread_cleanup(); +} + +#endif /* USE_POLARSSL */ diff --git a/plugins/FTPFileYM/curl/lib/polarssl.h b/plugins/FTPFileYM/curl/lib/polarssl.h index 12b3db28c0..af3b28b89a 100644 --- a/plugins/FTPFileYM/curl/lib/polarssl.h +++ b/plugins/FTPFileYM/curl/lib/polarssl.h @@ -25,6 +25,11 @@ #ifdef USE_POLARSSL +/* Called on first use PolarSSL, setup threading if supported */ +int polarssl_init(void); +void polarssl_cleanup(void); + + CURLcode Curl_polarssl_connect(struct connectdata *conn, int sockindex); CURLcode Curl_polarssl_connect_nonblocking(struct connectdata *conn, @@ -43,8 +48,8 @@ size_t Curl_polarssl_version(char *buffer, size_t size); int Curl_polarssl_shutdown(struct connectdata *conn, int sockindex); /* API setup for PolarSSL */ -#define curlssl_init() (1) -#define curlssl_cleanup() Curl_nop_stmt +#define curlssl_init() polarssl_init() +#define curlssl_cleanup() polarssl_cleanup() #define curlssl_connect Curl_polarssl_connect #define curlssl_connect_nonblocking Curl_polarssl_connect_nonblocking #define curlssl_session_free(x) Curl_polarssl_session_free(x) diff --git a/plugins/FTPFileYM/curl/lib/polarssl_threadlock.c b/plugins/FTPFileYM/curl/lib/polarssl_threadlock.c new file mode 100644 index 0000000000..ad18715375 --- /dev/null +++ b/plugins/FTPFileYM/curl/lib/polarssl_threadlock.c @@ -0,0 +1,156 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 2010, 2011, Hoi-Ho Chan, <hoiho.chan@gmail.com> + * Copyright (C) 2013, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +#include "curl_setup.h" + +#if defined(USE_POLARSSL) && \ + (defined(USE_THREADS_POSIX) || defined(USE_THREADS_WIN32)) + +#if defined(USE_THREADS_POSIX) +# ifdef HAVE_PTHREAD_H +# include <pthread.h> +# endif +#elif defined(USE_THREADS_WIN32) +# ifdef HAVE_PROCESS_H +# include <process.h> +# endif +#endif + +#include "polarssl_threadlock.h" + +#define _MPRINTF_REPLACE /* use our functions only */ +#include <curl/mprintf.h> + +#include "curl_memory.h" +/* The last #include file should be: */ +#include "memdebug.h" + +/* number of thread locks */ +#define NUMT 2 + +/* This array will store all of the mutexes available to PolarSSL. */ +static POLARSSL_MUTEX_T *mutex_buf = NULL; + +int polarsslthreadlock_thread_setup(void) +{ + int i; + int ret; + + mutex_buf = malloc(NUMT * sizeof(POLARSSL_MUTEX_T)); + if(!mutex_buf) + return 0; /* error, no number of threads defined */ + +#ifdef HAVE_PTHREAD_H + for(i = 0; i < NUMT; i++) { + ret = pthread_mutex_init(&mutex_buf[i], NULL); + if(ret) + return 0; /* pthread_mutex_init failed */ + } +#elif defined(HAVE_PROCESS_H) + for(i = 0; i < NUMT; i++) { + mutex_buf[i] = CreateMutex(0, FALSE, 0); + if(mutex_buf[i] == 0) + return 0; /* CreateMutex failed */ + } +#endif /* HAVE_PTHREAD_H */ + + return 1; /* OK */ +} + +int polarsslthreadlock_thread_cleanup(void) +{ + int i; + int ret; + + if(!mutex_buf) + return 0; /* error, no threads locks defined */ + +#ifdef HAVE_PTHREAD_H + for(i = 0; i < NUMT; i++) { + ret = pthread_mutex_destroy(&mutex_buf[i]); + if(ret) + return 0; /* pthread_mutex_destroy failed */ + } +#elif defined(HAVE_PROCESS_H) + for(i = 0; i < NUMT; i++) { + ret = CloseHandle(mutex_buf[i]); + if(!ret) + return 0; /* CloseHandle failed */ + } +#endif /* HAVE_PTHREAD_H */ + free(mutex_buf); + mutex_buf = NULL; + + return 1; /* OK */ +} + +int polarsslthreadlock_lock_function(int n) +{ + int ret; +#ifdef HAVE_PTHREAD_H + if(n < NUMT) { + ret = pthread_mutex_lock(&mutex_buf[n]); + if(ret) { + DEBUGF(fprintf(stderr, + "Error: polarsslthreadlock_lock_function failed\n")); + return 0; /* pthread_mutex_lock failed */ + } + } +#elif defined(HAVE_PROCESS_H) + if(n < NUMT) { + ret = (WaitForSingleObject(mutex_buf[n], INFINITE)==WAIT_FAILED?1:0); + if(ret) { + DEBUGF(fprintf(stderr, + "Error: polarsslthreadlock_lock_function failed\n")); + return 0; /* pthread_mutex_lock failed */ + } + } +#endif /* HAVE_PTHREAD_H */ + return 1; /* OK */ +} + +int polarsslthreadlock_unlock_function(int n) +{ + int ret; +#ifdef HAVE_PTHREAD_H + if(n < NUMT) { + ret = pthread_mutex_unlock(&mutex_buf[n]); + if(ret) { + DEBUGF(fprintf(stderr, + "Error: polarsslthreadlock_unlock_function failed\n")); + return 0; /* pthread_mutex_unlock failed */ + } + } +#elif defined(HAVE_PROCESS_H) + if(n < NUMT) { + ret = ReleaseMutex(mutex_buf[n]); + if(!ret) { + DEBUGF(fprintf(stderr, + "Error: polarsslthreadlock_unlock_function failed\n")); + return 0; /* pthread_mutex_lock failed */ + } + } +#endif /* HAVE_PTHREAD_H */ + return 1; /* OK */ +} + +#endif /* USE_POLARSSL */ diff --git a/plugins/FTPFileYM/curl/lib/polarssl_threadlock.h b/plugins/FTPFileYM/curl/lib/polarssl_threadlock.h new file mode 100644 index 0000000000..b67b3f9abd --- /dev/null +++ b/plugins/FTPFileYM/curl/lib/polarssl_threadlock.h @@ -0,0 +1,53 @@ +#ifndef HEADER_CURL_POLARSSL_THREADLOCK_H +#define HEADER_CURL_POLARSSL_THREADLOCK_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 2010, Hoi-Ho Chan, <hoiho.chan@gmail.com> + * Copyright (C) 2013, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +#include "curl_setup.h" + +#ifdef USE_POLARSSL + +#if defined(USE_THREADS_POSIX) +# define POLARSSL_MUTEX_T pthread_mutex_t +#elif defined(USE_THREADS_WIN32) +# define POLARSSL_MUTEX_T HANDLE +#endif + +#if defined(USE_THREADS_POSIX) || defined(USE_THREADS_WIN32) + +int polarsslthreadlock_thread_setup(void); +int polarsslthreadlock_thread_cleanup(void); +int polarsslthreadlock_lock_function(int n); +int polarsslthreadlock_unlock_function(int n); + +#else + +#define polarsslthreadlock_thread_setup() 1 +#define polarsslthreadlock_thread_cleanup() 1 +#define polarsslthreadlock_lock_function(x) 1 +#define polarsslthreadlock_unlock_function(x) 1 + +#endif /* USE_THREADS_POSIX || USE_THREADS_WIN32 */ + +#endif /* USE_POLARSSL */ + +#endif /* HEADER_CURL_POLARSSL_THREADLOCK_H */ diff --git a/plugins/FTPFileYM/curl/lib/pop3.c b/plugins/FTPFileYM/curl/lib/pop3.c index f0c6155c02..a771933840 100644 --- a/plugins/FTPFileYM/curl/lib/pop3.c +++ b/plugins/FTPFileYM/curl/lib/pop3.c @@ -27,6 +27,8 @@ * RFC2831 DIGEST-MD5 authentication * RFC4422 Simple Authentication and Security Layer (SASL) * RFC4616 PLAIN authentication + * RFC5034 POP3 SASL Authentication Mechanism + * RFC6749 OAuth 2.0 Authorization Framework * ***************************************************************************/ @@ -89,8 +91,6 @@ #include "memdebug.h" /* Local API functions */ -static CURLcode pop3_parse_url_path(struct connectdata *conn); -static CURLcode pop3_parse_custom_request(struct connectdata *conn); static CURLcode pop3_regular_transfer(struct connectdata *conn, bool *done); static CURLcode pop3_do(struct connectdata *conn, bool *done); static CURLcode pop3_done(struct connectdata *conn, CURLcode status, @@ -102,7 +102,9 @@ static int pop3_getsock(struct connectdata *conn, curl_socket_t *socks, int numsocks); static CURLcode pop3_doing(struct connectdata *conn, bool *dophase_done); static CURLcode pop3_setup_connection(struct connectdata *conn); -static CURLcode pop3_state_upgrade_tls(struct connectdata *conn); +static CURLcode pop3_parse_url_options(struct connectdata *conn); +static CURLcode pop3_parse_url_path(struct connectdata *conn); +static CURLcode pop3_parse_custom_request(struct connectdata *conn); /* * POP3 protocol handler. @@ -162,7 +164,7 @@ const struct Curl_handler Curl_handler_pop3s = { static const struct Curl_handler Curl_handler_pop3_proxy = { "POP3", /* scheme */ - ZERO_NULL, /* setup_connection */ + Curl_http_setup_conn, /* setup_connection */ Curl_http, /* do_it */ Curl_http_done, /* done */ ZERO_NULL, /* do_more */ @@ -187,7 +189,7 @@ static const struct Curl_handler Curl_handler_pop3_proxy = { static const struct Curl_handler Curl_handler_pop3s_proxy = { "POP3S", /* scheme */ - ZERO_NULL, /* setup_connection */ + Curl_http_setup_conn, /* setup_connection */ Curl_http, /* do_it */ Curl_http_done, /* done */ ZERO_NULL, /* do_more */ @@ -207,15 +209,27 @@ static const struct Curl_handler Curl_handler_pop3s_proxy = { #endif #endif -/* Function that checks for an ending pop3 status code at the start of the - given string, but also detects the APOP timestamp from the server greeting - as well as the supported authentication types and allowed SASL mechanisms - from the CAPA response. */ -static int pop3_endofresp(struct pingpong *pp, int *resp) +#ifdef USE_SSL +static void pop3_to_pop3s(struct connectdata *conn) +{ + conn->handler = &Curl_handler_pop3s; +} +#else +#define pop3_to_pop3s(x) Curl_nop_stmt +#endif + +/*********************************************************************** + * + * pop3_endofresp() + * + * Checks for an ending POP3 status code at the start of the given string, but + * also detects the APOP timestamp from the server greeting and various + * capabilities from the CAPA response including the supported authentication + * types and allowed SASL mechanisms. + */ +static bool pop3_endofresp(struct connectdata *conn, char *line, size_t len, + int *resp) { - char *line = pp->linestart_resp; - size_t len = strlen(pp->linestart_resp); - struct connectdata *conn = pp->conn; struct pop3_conn *pop3c = &conn->proto.pop3c; size_t wordlen; size_t i; @@ -224,7 +238,7 @@ static int pop3_endofresp(struct pingpong *pp, int *resp) if(len >= 4 && !memcmp("-ERR", line, 4)) { *resp = '-'; - return FALSE; + return TRUE; } /* Are we processing servergreet responses? */ @@ -252,90 +266,95 @@ static int pop3_endofresp(struct pingpong *pp, int *resp) } /* Are we processing CAPA command responses? */ else if(pop3c->state == POP3_CAPA) { - - /* Do we have the terminating character? */ + /* Do we have the terminating line? */ if(len >= 1 && !memcmp(line, ".", 1)) { *resp = '+'; return TRUE; } + /* Does the server support the STLS capability? */ + if(len >= 4 && !memcmp(line, "STLS", 4)) + pop3c->tls_supported = TRUE; + /* Does the server support clear text authentication? */ - if(len >= 4 && !memcmp(line, "USER", 4)) { + else if(len >= 4 && !memcmp(line, "USER", 4)) pop3c->authtypes |= POP3_TYPE_CLEARTEXT; - return FALSE; - } /* Does the server support APOP authentication? */ - if(len >= 4 && !memcmp(line, "APOP", 4)) { + else if(len >= 4 && !memcmp(line, "APOP", 4)) pop3c->authtypes |= POP3_TYPE_APOP; - return FALSE; - } /* Does the server support SASL based authentication? */ - if(len < 4 || memcmp(line, "SASL", 4)) - return FALSE; + else if(len >= 5 && !memcmp(line, "SASL ", 5)) { + pop3c->authtypes |= POP3_TYPE_SASL; - pop3c->authtypes |= POP3_TYPE_SASL; + /* Advance past the SASL keyword */ + line += 5; + len -= 5; - /* Advance past the SASL keyword */ - line += 4; - len -= 4; + /* Loop through the data line */ + for(;;) { + while(len && + (*line == ' ' || *line == '\t' || + *line == '\r' || *line == '\n')) { - /* Loop through the data line */ - for(;;) { - while(len && - (*line == ' ' || *line == '\t' || - *line == '\r' || *line == '\n')) { + line++; + len--; + } - if(*line == '\n') - return FALSE; + if(!len) + break; - line++; - len--; + /* Extract the word */ + for(wordlen = 0; wordlen < len && line[wordlen] != ' ' && + line[wordlen] != '\t' && line[wordlen] != '\r' && + line[wordlen] != '\n';) + wordlen++; + + /* Test the word for a matching authentication mechanism */ + if(sasl_mech_equal(line, wordlen, SASL_MECH_STRING_LOGIN)) + pop3c->authmechs |= SASL_MECH_LOGIN; + else if(sasl_mech_equal(line, wordlen, SASL_MECH_STRING_PLAIN)) + pop3c->authmechs |= SASL_MECH_PLAIN; + else if(sasl_mech_equal(line, wordlen, SASL_MECH_STRING_CRAM_MD5)) + pop3c->authmechs |= SASL_MECH_CRAM_MD5; + else if(sasl_mech_equal(line, wordlen, SASL_MECH_STRING_DIGEST_MD5)) + pop3c->authmechs |= SASL_MECH_DIGEST_MD5; + else if(sasl_mech_equal(line, wordlen, SASL_MECH_STRING_GSSAPI)) + pop3c->authmechs |= SASL_MECH_GSSAPI; + else if(sasl_mech_equal(line, wordlen, SASL_MECH_STRING_EXTERNAL)) + pop3c->authmechs |= SASL_MECH_EXTERNAL; + else if(sasl_mech_equal(line, wordlen, SASL_MECH_STRING_NTLM)) + pop3c->authmechs |= SASL_MECH_NTLM; + else if(sasl_mech_equal(line, wordlen, SASL_MECH_STRING_XOAUTH2)) + pop3c->authmechs |= SASL_MECH_XOAUTH2; + + line += wordlen; + len -= wordlen; } - - if(!len) - break; - - /* Extract the word */ - for(wordlen = 0; wordlen < len && line[wordlen] != ' ' && - line[wordlen] != '\t' && line[wordlen] != '\r' && - line[wordlen] != '\n';) - wordlen++; - - /* Test the word for a matching authentication mechanism */ - if(wordlen == 5 && !memcmp(line, "LOGIN", 5)) - pop3c->authmechs |= SASL_MECH_LOGIN; - else if(wordlen == 5 && !memcmp(line, "PLAIN", 5)) - pop3c->authmechs |= SASL_MECH_PLAIN; - else if(wordlen == 8 && !memcmp(line, "CRAM-MD5", 8)) - pop3c->authmechs |= SASL_MECH_CRAM_MD5; - else if(wordlen == 10 && !memcmp(line, "DIGEST-MD5", 10)) - pop3c->authmechs |= SASL_MECH_DIGEST_MD5; - else if(wordlen == 6 && !memcmp(line, "GSSAPI", 6)) - pop3c->authmechs |= SASL_MECH_GSSAPI; - else if(wordlen == 8 && !memcmp(line, "EXTERNAL", 8)) - pop3c->authmechs |= SASL_MECH_EXTERNAL; - else if(wordlen == 4 && !memcmp(line, "NTLM", 4)) - pop3c->authmechs |= SASL_MECH_NTLM; - - line += wordlen; - len -= wordlen; } + + return FALSE; } - if((len < 1 || memcmp("+", line, 1)) && - (len < 3 || memcmp("+OK", line, 3))) - return FALSE; /* Nothing for us */ + /* Do we have a command or continuation response? */ + if((len >= 3 && !memcmp("+OK", line, 3)) || + (len >= 1 && !memcmp("+", line, 1))) { + *resp = '+'; - /* Otherwise it's a positive response */ - *resp = '+'; + return TRUE; + } - return TRUE; + return FALSE; /* Nothing for us */ } -/* This is the ONLY way to change POP3 state! */ +/*********************************************************************** + * + * state() + * + * This is the ONLY way to change POP3 state! + */ static void state(struct connectdata *conn, pop3state newstate) { struct pop3_conn *pop3c = &conn->proto.pop3c; @@ -344,9 +363,9 @@ static void state(struct connectdata *conn, pop3state newstate) static const char * const names[] = { "STOP", "SERVERGREET", + "CAPA", "STARTTLS", "UPGRADETLS", - "CAPA", "AUTH_PLAIN", "AUTH_LOGIN", "AUTH_LOGIN_PASSWD", @@ -355,7 +374,8 @@ static void state(struct connectdata *conn, pop3state newstate) "AUTH_DIGESTMD5_RESP", "AUTH_NTLM", "AUTH_NTLM_TYPE2MSG", - "AUTH", + "AUTH_XOAUTH2", + "AUTH_FINAL", "APOP", "USER", "PASS", @@ -366,57 +386,118 @@ static void state(struct connectdata *conn, pop3state newstate) if(pop3c->state != newstate) infof(conn->data, "POP3 %p state change from %s to %s\n", - pop3c, names[pop3c->state], names[newstate]); + (void *)pop3c, names[pop3c->state], names[newstate]); #endif pop3c->state = newstate; } -static CURLcode pop3_state_capa(struct connectdata *conn) +/*********************************************************************** + * + * pop3_perform_capa() + * + * Sends the CAPA command in order to obtain a list of server side supported + * capabilities. + */ +static CURLcode pop3_perform_capa(struct connectdata *conn) { CURLcode result = CURLE_OK; struct pop3_conn *pop3c = &conn->proto.pop3c; pop3c->authmechs = 0; /* No known authentication mechanisms yet */ pop3c->authused = 0; /* Clear the authentication mechanism used */ + pop3c->tls_supported = FALSE; /* Clear the TLS capability */ - /* Check we have a username and password to authenticate with and end the - connect phase if we don't */ - if(!conn->bits.user_passwd) { - state(conn, POP3_STOP); + /* Send the CAPA command */ + result = Curl_pp_sendf(&pop3c->pp, "%s", "CAPA"); - return result; - } + if(!result) + state(conn, POP3_CAPA); - /* Send the CAPA command */ - result = Curl_pp_sendf(&pop3c->pp, "CAPA"); + return result; +} - if(result) - return result; +/*********************************************************************** + * + * pop3_perform_starttls() + * + * Sends the STLS command to start the upgrade to TLS. + */ +static CURLcode pop3_perform_starttls(struct connectdata *conn) +{ + CURLcode result = CURLE_OK; - state(conn, POP3_CAPA); + /* Send the STLS command */ + result = Curl_pp_sendf(&conn->proto.pop3c.pp, "%s", "STLS"); - return CURLE_OK; + if(!result) + state(conn, POP3_STARTTLS); + + return result; } -static CURLcode pop3_state_user(struct connectdata *conn) +/*********************************************************************** + * + * pop3_perform_upgrade_tls() + * + * Performs the upgrade to TLS. + */ +static CURLcode pop3_perform_upgrade_tls(struct connectdata *conn) { - CURLcode result; - struct FTP *pop3 = conn->data->state.proto.pop3; + CURLcode result = CURLE_OK; + struct pop3_conn *pop3c = &conn->proto.pop3c; + + /* Start the SSL connection */ + result = Curl_ssl_connect_nonblocking(conn, FIRSTSOCKET, &pop3c->ssldone); + + if(!result) { + if(pop3c->state != POP3_UPGRADETLS) + state(conn, POP3_UPGRADETLS); + + if(pop3c->ssldone) { + pop3_to_pop3s(conn); + result = pop3_perform_capa(conn); + } + } + + return result; +} + +/*********************************************************************** + * + * pop3_perform_user() + * + * Sends a clear text USER command to authenticate with. + */ +static CURLcode pop3_perform_user(struct connectdata *conn) +{ + CURLcode result = CURLE_OK; + + /* Check we have a username and password to authenticate with and end the + connect phase if we don't */ + if(!conn->bits.user_passwd) { + state(conn, POP3_STOP); - /* Send the USER command */ - result = Curl_pp_sendf(&conn->proto.pop3c.pp, "USER %s", - pop3->user ? pop3->user : ""); - if(result) return result; + } - state(conn, POP3_USER); + /* Send the USER command */ + result = Curl_pp_sendf(&conn->proto.pop3c.pp, "USER %s", + conn->user ? conn->user : ""); + if(!result) + state(conn, POP3_USER); - return CURLE_OK; + return result; } #ifndef CURL_DISABLE_CRYPTO_AUTH -static CURLcode pop3_state_apop(struct connectdata *conn) +/*********************************************************************** + * + * pop3_perform_apop() + * + * Sends an APOP command to authenticate with. + */ +static CURLcode pop3_perform_apop(struct connectdata *conn) { CURLcode result = CURLE_OK; struct pop3_conn *pop3c = &conn->proto.pop3c; @@ -425,6 +506,15 @@ static CURLcode pop3_state_apop(struct connectdata *conn) unsigned char digest[MD5_DIGEST_LEN]; char secret[2 * MD5_DIGEST_LEN + 1]; + /* Check we have a username and password to authenticate with and end the + connect phase if we don't */ + if(!conn->bits.user_passwd) { + state(conn, POP3_STOP); + + return result; + } + + /* Create the digest */ ctxt = Curl_MD5_init(Curl_DIGEST_MD5); if(!ctxt) return CURLE_OUT_OF_MEMORY; @@ -451,88 +541,203 @@ static CURLcode pop3_state_apop(struct connectdata *conn) } #endif -static CURLcode pop3_authenticate(struct connectdata *conn) +/*********************************************************************** + * + * pop3_perform_authenticate() + * + * Sends an AUTH command allowing the client to login with the appropriate + * SASL authentication mechanism. + * + * Additionally, the function will perform fallback to APOP and USER commands + * should a common mechanism not be available between the client and server. + */ +static CURLcode pop3_perform_authenticate(struct connectdata *conn) { CURLcode result = CURLE_OK; + struct SessionHandle *data = conn->data; struct pop3_conn *pop3c = &conn->proto.pop3c; const char *mech = NULL; - pop3state authstate = POP3_STOP; + char *initresp = NULL; + size_t len = 0; + pop3state state1 = POP3_STOP; + pop3state state2 = POP3_STOP; + + /* Check we have a username and password to authenticate with and end the + connect phase if we don't */ + if(!conn->bits.user_passwd) { + state(conn, POP3_STOP); + + return result; + } /* Calculate the supported authentication mechanism by decreasing order of security */ if(pop3c->authtypes & POP3_TYPE_SASL) { #ifndef CURL_DISABLE_CRYPTO_AUTH - if(pop3c->authmechs & SASL_MECH_DIGEST_MD5) { - mech = "DIGEST-MD5"; - authstate = POP3_AUTH_DIGESTMD5; + if((pop3c->authmechs & SASL_MECH_DIGEST_MD5) && + (pop3c->prefmech & SASL_MECH_DIGEST_MD5)) { + mech = SASL_MECH_STRING_DIGEST_MD5; + state1 = POP3_AUTH_DIGESTMD5; pop3c->authused = SASL_MECH_DIGEST_MD5; } - else if(pop3c->authmechs & SASL_MECH_CRAM_MD5) { - mech = "CRAM-MD5"; - authstate = POP3_AUTH_CRAMMD5; + else if((pop3c->authmechs & SASL_MECH_CRAM_MD5) && + (pop3c->prefmech & SASL_MECH_CRAM_MD5)) { + mech = SASL_MECH_STRING_CRAM_MD5; + state1 = POP3_AUTH_CRAMMD5; pop3c->authused = SASL_MECH_CRAM_MD5; } else #endif #ifdef USE_NTLM - if(pop3c->authmechs & SASL_MECH_NTLM) { - mech = "NTLM"; - authstate = POP3_AUTH_NTLM; + if((pop3c->authmechs & SASL_MECH_NTLM) && + (pop3c->prefmech & SASL_MECH_NTLM)) { + mech = SASL_MECH_STRING_NTLM; + state1 = POP3_AUTH_NTLM; + state2 = POP3_AUTH_NTLM_TYPE2MSG; pop3c->authused = SASL_MECH_NTLM; + + if(data->set.sasl_ir) + result = Curl_sasl_create_ntlm_type1_message(conn->user, conn->passwd, + &conn->ntlm, + &initresp, &len); } else #endif - if(pop3c->authmechs & SASL_MECH_LOGIN) { - mech = "LOGIN"; - authstate = POP3_AUTH_LOGIN; + if(((pop3c->authmechs & SASL_MECH_XOAUTH2) && + (pop3c->prefmech & SASL_MECH_XOAUTH2) && + (pop3c->prefmech != SASL_AUTH_ANY)) || conn->xoauth2_bearer) { + mech = SASL_MECH_STRING_XOAUTH2; + state1 = POP3_AUTH_XOAUTH2; + state2 = POP3_AUTH_FINAL; + pop3c->authused = SASL_MECH_XOAUTH2; + + if(data->set.sasl_ir) + result = Curl_sasl_create_xoauth2_message(conn->data, conn->user, + conn->xoauth2_bearer, + &initresp, &len); + } + else if((pop3c->authmechs & SASL_MECH_LOGIN) && + (pop3c->prefmech & SASL_MECH_LOGIN)) { + mech = SASL_MECH_STRING_LOGIN; + state1 = POP3_AUTH_LOGIN; + state2 = POP3_AUTH_LOGIN_PASSWD; pop3c->authused = SASL_MECH_LOGIN; + + if(data->set.sasl_ir) + result = Curl_sasl_create_login_message(conn->data, conn->user, + &initresp, &len); } - else if(pop3c->authmechs & SASL_MECH_PLAIN) { - mech = "PLAIN"; - authstate = POP3_AUTH_PLAIN; + else if((pop3c->authmechs & SASL_MECH_PLAIN) && + (pop3c->prefmech & SASL_MECH_PLAIN)) { + mech = SASL_MECH_STRING_PLAIN; + state1 = POP3_AUTH_PLAIN; + state2 = POP3_AUTH_FINAL; pop3c->authused = SASL_MECH_PLAIN; + + if(data->set.sasl_ir) + result = Curl_sasl_create_plain_message(conn->data, conn->user, + conn->passwd, &initresp, + &len); } } - if(mech) { - /* Perform SASL based authentication */ - result = Curl_pp_sendf(&pop3c->pp, "AUTH %s", mech); + if(!result) { + if(mech && (pop3c->preftype & POP3_TYPE_SASL)) { + /* Perform SASL based authentication */ + if(initresp && + 8 + strlen(mech) + len <= 255) { /* AUTH <mech> ...<crlf> */ + result = Curl_pp_sendf(&pop3c->pp, "AUTH %s %s", mech, initresp); - if(!result) - state(conn, authstate); - } + if(!result) + state(conn, state2); + } + else { + result = Curl_pp_sendf(&pop3c->pp, "AUTH %s", mech); + + if(!result) + state(conn, state1); + } + + Curl_safefree(initresp); + } #ifndef CURL_DISABLE_CRYPTO_AUTH - else if(pop3c->authtypes & POP3_TYPE_APOP) - /* Perform APOP authentication */ - result = pop3_state_apop(conn); + else if((pop3c->authtypes & POP3_TYPE_APOP) && + (pop3c->preftype & POP3_TYPE_APOP)) + /* Perform APOP authentication */ + result = pop3_perform_apop(conn); #endif - else if(pop3c->authtypes & POP3_TYPE_CLEARTEXT) - /* Perform clear text authentication */ - result = pop3_state_user(conn); - else { - /* Other mechanisms not supported */ - infof(conn->data, "No known authentication mechanisms supported!\n"); - result = CURLE_LOGIN_DENIED; + else if((pop3c->authtypes & POP3_TYPE_CLEARTEXT) && + (pop3c->preftype & POP3_TYPE_CLEARTEXT)) + /* Perform clear text authentication */ + result = pop3_perform_user(conn); + else { + /* Other mechanisms not supported */ + infof(conn->data, "No known authentication mechanisms supported!\n"); + result = CURLE_LOGIN_DENIED; + } } return result; } -/* For the POP3 "protocol connect" and "doing" phases only */ -static int pop3_getsock(struct connectdata *conn, curl_socket_t *socks, - int numsocks) +/*********************************************************************** + * + * pop3_perform_command() + * + * Sends a POP3 based command. + */ +static CURLcode pop3_perform_command(struct connectdata *conn) { - return Curl_pp_getsock(&conn->proto.pop3c.pp, socks, numsocks); + CURLcode result = CURLE_OK; + struct SessionHandle *data = conn->data; + struct POP3 *pop3 = data->req.protop; + const char *command = NULL; + + /* Calculate the default command */ + if(pop3->id[0] == '\0' || conn->data->set.ftp_list_only) { + command = "LIST"; + + if(pop3->id[0] != '\0') + /* Message specific LIST so skip the BODY transfer */ + pop3->transfer = FTPTRANSFER_INFO; + } + else + command = "RETR"; + + /* Send the command */ + if(pop3->id[0] != '\0') + result = Curl_pp_sendf(&conn->proto.pop3c.pp, "%s %s", + (pop3->custom && pop3->custom[0] != '\0' ? + pop3->custom : command), pop3->id); + else + result = Curl_pp_sendf(&conn->proto.pop3c.pp, "%s", + (pop3->custom && pop3->custom[0] != '\0' ? + pop3->custom : command)); + + if(!result) + state(conn, POP3_COMMAND); + + return result; } -#ifdef USE_SSL -static void pop3_to_pop3s(struct connectdata *conn) +/*********************************************************************** + * + * pop3_perform_quit() + * + * Performs the quit action prior to sclose() be called. + */ +static CURLcode pop3_perform_quit(struct connectdata *conn) { - conn->handler = &Curl_handler_pop3s; + CURLcode result = CURLE_OK; + + /* Send the QUIT command */ + result = Curl_pp_sendf(&conn->proto.pop3c.pp, "%s", "QUIT"); + + if(!result) + state(conn, POP3_QUIT); + + return result; } -#else -#define pop3_to_pop3s(x) Curl_nop_stmt -#endif /* For the initial server greeting */ static CURLcode pop3_state_servergreet_resp(struct connectdata *conn, @@ -541,89 +746,75 @@ static CURLcode pop3_state_servergreet_resp(struct connectdata *conn, { CURLcode result = CURLE_OK; struct SessionHandle *data = conn->data; - struct pop3_conn *pop3c = &conn->proto.pop3c; (void)instate; /* no use for this yet */ if(pop3code != '+') { failf(data, "Got unexpected pop3-server response"); - return CURLE_FTP_WEIRD_SERVER_REPLY; - } - - if(data->set.use_ssl && !conn->ssl[FIRSTSOCKET].use) { - /* We don't have a SSL/TLS connection yet, but SSL is requested. Switch - to TLS connection now */ - result = Curl_pp_sendf(&pop3c->pp, "STLS"); - if(!result) - state(conn, POP3_STARTTLS); + result = CURLE_FTP_WEIRD_SERVER_REPLY; } else - result = pop3_state_capa(conn); + result = pop3_perform_capa(conn); return result; } -/* For STARTTLS responses */ -static CURLcode pop3_state_starttls_resp(struct connectdata *conn, - int pop3code, - pop3state instate) +/* For CAPA responses */ +static CURLcode pop3_state_capa_resp(struct connectdata *conn, int pop3code, + pop3state instate) { CURLcode result = CURLE_OK; struct SessionHandle *data = conn->data; + struct pop3_conn *pop3c = &conn->proto.pop3c; (void)instate; /* no use for this yet */ - if(pop3code != '+') { - if(data->set.use_ssl != CURLUSESSL_TRY) { - failf(data, "STARTTLS denied. %c", pop3code); + if(pop3code != '+') + result = pop3_perform_user(conn); + else if(data->set.use_ssl && !conn->ssl[FIRSTSOCKET].use) { + /* We don't have a SSL/TLS connection yet, but SSL is requested */ + if(pop3c->tls_supported) + /* Switch to TLS connection now */ + result = pop3_perform_starttls(conn); + else if(data->set.use_ssl == CURLUSESSL_TRY) + /* Fallback and carry on with authentication */ + result = pop3_perform_authenticate(conn); + else { + failf(data, "STLS not supported."); result = CURLE_USE_SSL_FAILED; } - else - result = pop3_state_capa(conn); } else - result = pop3_state_upgrade_tls(conn); + result = pop3_perform_authenticate(conn); return result; } -static CURLcode pop3_state_upgrade_tls(struct connectdata *conn) -{ - struct pop3_conn *pop3c = &conn->proto.pop3c; - CURLcode result; - - result = Curl_ssl_connect_nonblocking(conn, FIRSTSOCKET, &pop3c->ssldone); - - if(!result) { - if(pop3c->state != POP3_UPGRADETLS) - state(conn, POP3_UPGRADETLS); - - if(pop3c->ssldone) { - pop3_to_pop3s(conn); - result = pop3_state_capa(conn); - } - } - - return result; -} - -/* For CAPA responses */ -static CURLcode pop3_state_capa_resp(struct connectdata *conn, int pop3code, - pop3state instate) +/* For STARTTLS responses */ +static CURLcode pop3_state_starttls_resp(struct connectdata *conn, + int pop3code, + pop3state instate) { CURLcode result = CURLE_OK; + struct SessionHandle *data = conn->data; (void)instate; /* no use for this yet */ - if(pop3code == '+') - result = pop3_authenticate(conn); + if(pop3code != '+') { + if(data->set.use_ssl != CURLUSESSL_TRY) { + failf(data, "STARTTLS denied. %c", pop3code); + result = CURLE_USE_SSL_FAILED; + } + else + result = pop3_perform_authenticate(conn); + } else - result = pop3_state_user(conn); + result = pop3_perform_upgrade_tls(conn); return result; } -/* For AUTH PLAIN responses */ +/* For AUTH PLAIN (without initial response) responses */ static CURLcode pop3_state_auth_plain_resp(struct connectdata *conn, int pop3code, pop3state instate) @@ -650,7 +841,7 @@ static CURLcode pop3_state_auth_plain_resp(struct connectdata *conn, result = Curl_pp_sendf(&conn->proto.pop3c.pp, "%s", plainauth); if(!result) - state(conn, POP3_AUTH); + state(conn, POP3_AUTH_FINAL); } Curl_safefree(plainauth); @@ -660,7 +851,7 @@ static CURLcode pop3_state_auth_plain_resp(struct connectdata *conn, return result; } -/* For AUTH LOGIN responses */ +/* For AUTH LOGIN (without initial response) responses */ static CURLcode pop3_state_auth_login_resp(struct connectdata *conn, int pop3code, pop3state instate) @@ -724,7 +915,7 @@ static CURLcode pop3_state_auth_login_password_resp(struct connectdata *conn, result = Curl_pp_sendf(&conn->proto.pop3c.pp, "%s", authpasswd); if(!result) - state(conn, POP3_AUTH); + state(conn, POP3_AUTH_FINAL); } Curl_safefree(authpasswd); @@ -779,7 +970,7 @@ static CURLcode pop3_state_auth_cram_resp(struct connectdata *conn, result = Curl_pp_sendf(&conn->proto.pop3c.pp, "%s", rplyb64); if(!result) - state(conn, POP3_AUTH); + state(conn, POP3_AUTH_FINAL); } Curl_safefree(rplyb64); @@ -846,10 +1037,10 @@ static CURLcode pop3_state_auth_digest_resp_resp(struct connectdata *conn, } else { /* Send an empty response */ - result = Curl_pp_sendf(&conn->proto.pop3c.pp, ""); + result = Curl_pp_sendf(&conn->proto.pop3c.pp, "%s", ""); if(!result) - state(conn, POP3_AUTH); + state(conn, POP3_AUTH_FINAL); } return result; @@ -857,7 +1048,7 @@ static CURLcode pop3_state_auth_digest_resp_resp(struct connectdata *conn, #endif #ifdef USE_NTLM -/* For AUTH NTLM responses */ +/* For AUTH NTLM (without initial response) responses */ static CURLcode pop3_state_auth_ntlm_resp(struct connectdata *conn, int pop3code, pop3state instate) @@ -925,7 +1116,7 @@ static CURLcode pop3_state_auth_ntlm_type2msg_resp(struct connectdata *conn, result = Curl_pp_sendf(&conn->proto.pop3c.pp, "%s", type3msg); if(!result) - state(conn, POP3_AUTH); + state(conn, POP3_AUTH_FINAL); } Curl_safefree(type3msg); @@ -936,6 +1127,43 @@ static CURLcode pop3_state_auth_ntlm_type2msg_resp(struct connectdata *conn, } #endif +/* For AUTH XOAUTH2 (without initial response) responses */ +static CURLcode pop3_state_auth_xoauth2_resp(struct connectdata *conn, + int pop3code, pop3state instate) +{ + CURLcode result = CURLE_OK; + struct SessionHandle *data = conn->data; + size_t len = 0; + char *xoauth = NULL; + + (void)instate; /* no use for this yet */ + + if(pop3code != '+') { + failf(data, "Access denied: %d", pop3code); + result = CURLE_LOGIN_DENIED; + } + else { + /* Create the authorisation message */ + result = Curl_sasl_create_xoauth2_message(conn->data, conn->user, + conn->xoauth2_bearer, + &xoauth, &len); + + /* Send the message */ + if(!result) { + if(xoauth) { + result = Curl_pp_sendf(&conn->proto.pop3c.pp, "%s", xoauth); + + if(!result) + state(conn, POP3_AUTH_FINAL); + } + + Curl_safefree(xoauth); + } + } + + return result; +} + /* For final responses to the AUTH sequence */ static CURLcode pop3_state_auth_final_resp(struct connectdata *conn, int pop3code, @@ -950,14 +1178,15 @@ static CURLcode pop3_state_auth_final_resp(struct connectdata *conn, failf(data, "Authentication failed: %d", pop3code); result = CURLE_LOGIN_DENIED; } - - /* End of connect phase */ - state(conn, POP3_STOP); + else + /* End of connect phase */ + state(conn, POP3_STOP); return result; } #ifndef CURL_DISABLE_CRYPTO_AUTH +/* For APOP responses */ static CURLcode pop3_state_apop_resp(struct connectdata *conn, int pop3code, pop3state instate) { @@ -970,9 +1199,9 @@ static CURLcode pop3_state_apop_resp(struct connectdata *conn, int pop3code, failf(data, "Authentication failed: %d", pop3code); result = CURLE_LOGIN_DENIED; } - - /* End of connect phase */ - state(conn, POP3_STOP); + else + /* End of connect phase */ + state(conn, POP3_STOP); return result; } @@ -984,7 +1213,6 @@ static CURLcode pop3_state_user_resp(struct connectdata *conn, int pop3code, { CURLcode result = CURLE_OK; struct SessionHandle *data = conn->data; - struct FTP *pop3 = data->state.proto.pop3; (void)instate; /* no use for this yet */ @@ -995,11 +1223,9 @@ static CURLcode pop3_state_user_resp(struct connectdata *conn, int pop3code, else /* Send the PASS command */ result = Curl_pp_sendf(&conn->proto.pop3c.pp, "PASS %s", - pop3->passwd ? pop3->passwd : ""); - if(result) - return result; - - state(conn, POP3_PASS); + conn->passwd ? conn->passwd : ""); + if(!result) + state(conn, POP3_PASS); return result; } @@ -1017,47 +1243,9 @@ static CURLcode pop3_state_pass_resp(struct connectdata *conn, int pop3code, failf(data, "Access denied. %c", pop3code); result = CURLE_LOGIN_DENIED; } - - /* End of connect phase */ - state(conn, POP3_STOP); - - return result; -} - -/* Start the DO phase for the command */ -static CURLcode pop3_command(struct connectdata *conn) -{ - CURLcode result = CURLE_OK; - struct pop3_conn *pop3c = &conn->proto.pop3c; - const char *command = NULL; - - /* Calculate the default command */ - if(pop3c->mailbox[0] == '\0' || conn->data->set.ftp_list_only) { - command = "LIST"; - - if(pop3c->mailbox[0] != '\0') { - /* Message specific LIST so skip the BODY transfer */ - struct FTP *pop3 = conn->data->state.proto.pop3; - pop3->transfer = FTPTRANSFER_INFO; - } - } else - command = "RETR"; - - /* Send the command */ - if(pop3c->mailbox[0] != '\0') - result = Curl_pp_sendf(&conn->proto.pop3c.pp, "%s %s", - (pop3c->custom && pop3c->custom[0] != '\0' ? - pop3c->custom : command), pop3c->mailbox); - else - result = Curl_pp_sendf(&conn->proto.pop3c.pp, - (pop3c->custom && pop3c->custom[0] != '\0' ? - pop3c->custom : command)); - - if(result) - return result; - - state(conn, POP3_COMMAND); + /* End of connect phase */ + state(conn, POP3_STOP); return result; } @@ -1069,7 +1257,7 @@ static CURLcode pop3_state_command_resp(struct connectdata *conn, { CURLcode result = CURLE_OK; struct SessionHandle *data = conn->data; - struct FTP *pop3 = data->state.proto.pop3; + struct POP3 *pop3 = data->req.protop; struct pop3_conn *pop3c = &conn->proto.pop3c; struct pingpong *pp = &pop3c->pp; @@ -1090,29 +1278,30 @@ static CURLcode pop3_state_command_resp(struct connectdata *conn, the strip counter here so that these bytes won't be delivered. */ pop3c->strip = 2; - /* POP3 download */ - Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, pop3->bytecountp, - -1, NULL); /* no upload here */ + if(pop3->transfer == FTPTRANSFER_BODY) { + /* POP3 download */ + Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, NULL, -1, NULL); - if(pp->cache) { - /* The header "cache" contains a bunch of data that is actually body - content so send it as such. Note that there may even be additional - "headers" after the body */ + if(pp->cache) { + /* The header "cache" contains a bunch of data that is actually body + content so send it as such. Note that there may even be additional + "headers" after the body */ - if(!data->set.opt_no_body) { - result = Curl_pop3_write(conn, pp->cache, pp->cache_size); - if(result) - return result; - } + if(!data->set.opt_no_body) { + result = Curl_pop3_write(conn, pp->cache, pp->cache_size); + if(result) + return result; + } - /* Free the cache */ - Curl_safefree(pp->cache); + /* Free the cache */ + Curl_safefree(pp->cache); - /* Reset the cache size */ - pp->cache_size = 0; + /* Reset the cache size */ + pp->cache_size = 0; + } } - /* End of do phase */ + /* End of DO phase */ state(conn, POP3_STOP); return result; @@ -1120,7 +1309,7 @@ static CURLcode pop3_state_command_resp(struct connectdata *conn, static CURLcode pop3_statemach_act(struct connectdata *conn) { - CURLcode result; + CURLcode result = CURLE_OK; curl_socket_t sock = conn->sock[FIRSTSOCKET]; int pop3code; struct pop3_conn *pop3c = &conn->proto.pop3c; @@ -1129,7 +1318,7 @@ static CURLcode pop3_statemach_act(struct connectdata *conn) /* Busy upgrading the connection; right now all I/O is SSL/TLS, not POP3 */ if(pop3c->state == POP3_UPGRADETLS) - return pop3_state_upgrade_tls(conn); + return pop3_perform_upgrade_tls(conn); /* Flush any data that needs to be sent */ if(pp->sendleft) @@ -1147,14 +1336,14 @@ static CURLcode pop3_statemach_act(struct connectdata *conn) result = pop3_state_servergreet_resp(conn, pop3code, pop3c->state); break; - case POP3_STARTTLS: - result = pop3_state_starttls_resp(conn, pop3code, pop3c->state); - break; - case POP3_CAPA: result = pop3_state_capa_resp(conn, pop3code, pop3c->state); break; + case POP3_STARTTLS: + result = pop3_state_starttls_resp(conn, pop3code, pop3c->state); + break; + case POP3_AUTH_PLAIN: result = pop3_state_auth_plain_resp(conn, pop3code, pop3c->state); break; @@ -1193,7 +1382,11 @@ static CURLcode pop3_statemach_act(struct connectdata *conn) break; #endif - case POP3_AUTH: + case POP3_AUTH_XOAUTH2: + result = pop3_state_auth_xoauth2_resp(conn, pop3code, pop3c->state); + break; + + case POP3_AUTH_FINAL: result = pop3_state_auth_final_resp(conn, pop3code, pop3c->state); break; @@ -1230,30 +1423,28 @@ static CURLcode pop3_statemach_act(struct connectdata *conn) /* Called repeatedly until done from multi.c */ static CURLcode pop3_multi_statemach(struct connectdata *conn, bool *done) { + CURLcode result = CURLE_OK; struct pop3_conn *pop3c = &conn->proto.pop3c; - CURLcode result; - if((conn->handler->flags & PROTOPT_SSL) && !pop3c->ssldone) + if((conn->handler->flags & PROTOPT_SSL) && !pop3c->ssldone) { result = Curl_ssl_connect_nonblocking(conn, FIRSTSOCKET, &pop3c->ssldone); - else - result = Curl_pp_multi_statemach(&pop3c->pp); + if(result || !pop3c->ssldone) + return result; + } + result = Curl_pp_statemach(&pop3c->pp, FALSE); *done = (pop3c->state == POP3_STOP) ? TRUE : FALSE; return result; } -static CURLcode pop3_easy_statemach(struct connectdata *conn) +static CURLcode pop3_block_statemach(struct connectdata *conn) { - struct pop3_conn *pop3c = &conn->proto.pop3c; - struct pingpong *pp = &pop3c->pp; CURLcode result = CURLE_OK; + struct pop3_conn *pop3c = &conn->proto.pop3c; - while(pop3c->state != POP3_STOP) { - result = Curl_pp_easy_statemach(pp); - if(result) - break; - } + while(pop3c->state != POP3_STOP && !result) + result = Curl_pp_statemach(&pop3c->pp, TRUE); return result; } @@ -1262,26 +1453,22 @@ static CURLcode pop3_easy_statemach(struct connectdata *conn) required */ static CURLcode pop3_init(struct connectdata *conn) { + CURLcode result = CURLE_OK; struct SessionHandle *data = conn->data; - struct FTP *pop3 = data->state.proto.pop3; - - if(!pop3) { - pop3 = data->state.proto.pop3 = calloc(sizeof(struct FTP), 1); - if(!pop3) - return CURLE_OUT_OF_MEMORY; - } + struct POP3 *pop3; - /* Get some initial data into the pop3 struct */ - pop3->bytecountp = &data->req.bytecount; + pop3 = data->req.protop = calloc(sizeof(struct POP3), 1); + if(!pop3) + result = CURLE_OUT_OF_MEMORY; - /* No need to duplicate user+password, the connectdata struct won't change - during a session, but we re-init them here since on subsequent inits - since the conn struct may have changed or been replaced. - */ - pop3->user = conn->user; - pop3->passwd = conn->passwd; + return result; +} - return CURLE_OK; +/* For the POP3 "protocol connect" and "doing" phases only */ +static int pop3_getsock(struct connectdata *conn, curl_socket_t *socks, + int numsocks) +{ + return Curl_pp_getsock(&conn->proto.pop3c.pp, socks, numsocks); } /*********************************************************************** @@ -1292,44 +1479,37 @@ static CURLcode pop3_init(struct connectdata *conn) * connection phase. * * The variable 'done' points to will be TRUE if the protocol-layer connect - * phase is done when this function returns, or FALSE is not. When called as - * a part of the easy interface, it will always be TRUE. + * phase is done when this function returns, or FALSE if not. */ static CURLcode pop3_connect(struct connectdata *conn, bool *done) { - CURLcode result; + CURLcode result = CURLE_OK; struct pop3_conn *pop3c = &conn->proto.pop3c; struct pingpong *pp = &pop3c->pp; *done = FALSE; /* default to not done yet */ - /* If there already is a protocol-specific struct allocated for this - sessionhandle, deal with it */ - Curl_reset_reqproto(conn); - - result = pop3_init(conn); - if(CURLE_OK != result) - return result; - - /* We always support persistent connections on pop3 */ + /* We always support persistent connections in POP3 */ conn->bits.close = FALSE; - pp->response_time = RESP_TIMEOUT; /* set default response time-out */ + /* Set the default response time-out */ + pp->response_time = RESP_TIMEOUT; pp->statemach_act = pop3_statemach_act; pp->endofresp = pop3_endofresp; pp->conn = conn; - if(conn->handler->flags & PROTOPT_SSL) { - /* POP3S is simply pop3 with SSL for the control channel */ - /* so perform the SSL initialization for this socket */ - result = Curl_ssl_connect(conn, FIRSTSOCKET); - if(result) - return result; - } + /* Set the default preferred authentication type and mechanism */ + pop3c->preftype = POP3_TYPE_ANY; + pop3c->prefmech = SASL_AUTH_ANY; - /* Initialise the response reader stuff */ + /* Initialise the pingpong layer */ Curl_pp_init(pp); + /* Parse the URL options */ + result = pop3_parse_url_options(conn); + if(result) + return result; + /* Start off waiting for the server greeting response */ state(conn, POP3_SERVERGREET); @@ -1350,19 +1530,17 @@ static CURLcode pop3_connect(struct connectdata *conn, bool *done) static CURLcode pop3_done(struct connectdata *conn, CURLcode status, bool premature) { - struct SessionHandle *data = conn->data; - struct FTP *pop3 = data->state.proto.pop3; - struct pop3_conn *pop3c = &conn->proto.pop3c; CURLcode result = CURLE_OK; + struct SessionHandle *data = conn->data; + struct POP3 *pop3 = data->req.protop; (void)premature; if(!pop3) - /* When the easy handle is removed from the multi while libcurl is still - * trying to resolve the host name, it seems that the pop3 struct is not - * yet initialized, but the removal action calls Curl_done() which calls - * this function. So we simply return success if no pop3 pointer is set. - */ + /* When the easy handle is removed from the multi interface while libcurl + is still trying to resolve the host name, the POP3 struct is not yet + initialized. However, the removal action calls Curl_done() which in + turn calls this function, so we simply return success. */ return CURLE_OK; if(status) { @@ -1370,11 +1548,11 @@ static CURLcode pop3_done(struct connectdata *conn, CURLcode status, result = status; /* use the already set error code */ } - /* Cleanup our do based variables */ - Curl_safefree(pop3c->mailbox); - Curl_safefree(pop3c->custom); + /* Cleanup our per-request based variables */ + Curl_safefree(pop3->id); + Curl_safefree(pop3->custom); - /* Clear the transfer mode for the next connection */ + /* Clear the transfer mode for the next request */ pop3->transfer = FTPTRANSFER_BODY; return result; @@ -1384,7 +1562,7 @@ static CURLcode pop3_done(struct connectdata *conn, CURLcode status, * * pop3_perform() * - * This is the actual DO function for POP3. Get a file/directory according to + * This is the actual DO function for POP3. Get a message/listing according to * the options previously setup. */ static CURLcode pop3_perform(struct connectdata *conn, bool *connected, @@ -1397,14 +1575,14 @@ static CURLcode pop3_perform(struct connectdata *conn, bool *connected, if(conn->data->set.opt_no_body) { /* Requested no body means no transfer */ - struct FTP *pop3 = conn->data->state.proto.pop3; + struct POP3 *pop3 = conn->data->req.protop; pop3->transfer = FTPTRANSFER_INFO; } *dophase_done = FALSE; /* not done yet */ /* Start the first command in the DO phase */ - result = pop3_command(conn); + result = pop3_perform_command(conn); if(result) return result; @@ -1430,55 +1608,21 @@ static CURLcode pop3_perform(struct connectdata *conn, bool *connected, */ static CURLcode pop3_do(struct connectdata *conn, bool *done) { - CURLcode retcode = CURLE_OK; + CURLcode result = CURLE_OK; *done = FALSE; /* default to false */ - /* - Since connections can be re-used between SessionHandles, this might be a - connection already existing but on a fresh SessionHandle struct so we must - make sure we have a good 'struct POP3' to play with. For new connections, - the struct POP3 is allocated and setup in the pop3_connect() function. - */ - Curl_reset_reqproto(conn); - retcode = pop3_init(conn); - if(retcode) - return retcode; - /* Parse the URL path */ - retcode = pop3_parse_url_path(conn); - if(retcode) - return retcode; + result = pop3_parse_url_path(conn); + if(result) + return result; /* Parse the custom request */ - retcode = pop3_parse_custom_request(conn); - if(retcode) - return retcode; - - retcode = pop3_regular_transfer(conn, done); - - return retcode; -} - -/*********************************************************************** - * - * pop3_quit() - * - * This should be called before calling sclose(). We should then wait for the - * response from the server before returning. The calling code should then try - * to close the connection. - */ -static CURLcode pop3_quit(struct connectdata *conn) -{ - CURLcode result = CURLE_OK; - - result = Curl_pp_sendf(&conn->proto.pop3c.pp, "QUIT", NULL); + result = pop3_parse_custom_request(conn); if(result) return result; - state(conn, POP3_QUIT); - - result = pop3_easy_statemach(conn); + result = pop3_regular_transfer(conn, done); return result; } @@ -1497,12 +1641,13 @@ static CURLcode pop3_disconnect(struct connectdata *conn, /* We cannot send quit unconditionally. If this connection is stale or bad in any way, sending quit and waiting around here will make the - disconnect wait in vain and cause more problems than we need to */ + disconnect wait in vain and cause more problems than we need to. */ /* The POP3 session may or may not have been allocated/setup at this point! */ if(!dead_connection && pop3c->pp.conn) - (void)pop3_quit(conn); /* ignore errors on the LOGOUT */ + if(!pop3_perform_quit(conn)) + (void)pop3_block_statemach(conn); /* ignore errors on QUIT */ /* Disconnect from the server */ Curl_pp_disconnect(&pop3c->pp); @@ -1516,48 +1661,12 @@ static CURLcode pop3_disconnect(struct connectdata *conn, return CURLE_OK; } -/*********************************************************************** - * - * pop3_parse_url_path() - * - * Parse the URL path into separate path components. - */ -static CURLcode pop3_parse_url_path(struct connectdata *conn) -{ - /* The POP3 struct is already initialised in pop3_connect() */ - struct pop3_conn *pop3c = &conn->proto.pop3c; - struct SessionHandle *data = conn->data; - const char *path = data->state.path; - - /* URL decode the path and use this mailbox */ - return Curl_urldecode(data, path, 0, &pop3c->mailbox, NULL, TRUE); -} - -static CURLcode pop3_parse_custom_request(struct connectdata *conn) -{ - CURLcode result = CURLE_OK; - struct pop3_conn *pop3c = &conn->proto.pop3c; - struct SessionHandle *data = conn->data; - const char *custom = conn->data->set.str[STRING_CUSTOMREQUEST]; - - /* URL decode the custom request */ - if(custom) - result = Curl_urldecode(data, custom, 0, &pop3c->custom, NULL, TRUE); - - return result; -} - /* Call this when the DO phase has completed */ static CURLcode pop3_dophase_done(struct connectdata *conn, bool connected) { - struct FTP *pop3 = conn->data->state.proto.pop3; - + (void)conn; (void)connected; - if(pop3->transfer != FTPTRANSFER_BODY) - /* no data to transfer */ - Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL); - return CURLE_OK; } @@ -1568,12 +1677,10 @@ static CURLcode pop3_doing(struct connectdata *conn, bool *dophase_done) if(result) DEBUGF(infof(conn->data, "DO phase failed\n")); - else { - if(*dophase_done) { - result = pop3_dophase_done(conn, FALSE /* not connected */); + else if(*dophase_done) { + result = pop3_dophase_done(conn, FALSE /* not connected */); - DEBUGF(infof(conn->data, "DO phase is complete\n")); - } + DEBUGF(infof(conn->data, "DO phase is complete\n")); } return result; @@ -1598,30 +1705,33 @@ static CURLcode pop3_regular_transfer(struct connectdata *conn, /* Make sure size is unknown at this point */ data->req.size = -1; + /* Set the progress data */ Curl_pgrsSetUploadCounter(data, 0); Curl_pgrsSetDownloadCounter(data, 0); Curl_pgrsSetUploadSize(data, 0); Curl_pgrsSetDownloadSize(data, 0); + /* Carry out the perform */ result = pop3_perform(conn, &connected, dophase_done); - if(CURLE_OK == result) { - if(!*dophase_done) - /* The DO phase has not completed yet */ - return CURLE_OK; - + /* Perform post DO phase operations if necessary */ + if(!result && *dophase_done) result = pop3_dophase_done(conn, connected); - } return result; } -static CURLcode pop3_setup_connection(struct connectdata * conn) +static CURLcode pop3_setup_connection(struct connectdata *conn) { struct SessionHandle *data = conn->data; + /* Initialise the POP3 layer */ + CURLcode result = pop3_init(conn); + if(result) + return result; + if(conn->bits.httpproxy && !data->set.tunnel_thru_httpproxy) { - /* Unless we have asked to tunnel pop3 operations through the proxy, we + /* Unless we have asked to tunnel POP3 operations through the proxy, we switch and use HTTP operations only */ #ifndef CURL_DISABLE_HTTP if(conn->handler == &Curl_handler_pop3) @@ -1635,10 +1745,8 @@ static CURLcode pop3_setup_connection(struct connectdata * conn) #endif } - /* We explicitly mark this connection as persistent here as we're doing - POP3 over HTTP and thus we accidentally avoid setting this value - otherwise */ - conn->bits.close = FALSE; + /* set it up as an HTTP connection instead */ + return conn->handler->setup_connection(conn); #else failf(data, "POP3 over http proxy requires HTTP support built-in!"); return CURLE_UNSUPPORTED_PROTOCOL; @@ -1650,8 +1758,120 @@ static CURLcode pop3_setup_connection(struct connectdata * conn) return CURLE_OK; } -/* This function scans the body after the end-of-body and writes everything - until the end is found */ +/*********************************************************************** + * + * pop3_parse_url_options() + * + * Parse the URL login options. + */ +static CURLcode pop3_parse_url_options(struct connectdata *conn) +{ + CURLcode result = CURLE_OK; + struct pop3_conn *pop3c = &conn->proto.pop3c; + const char *options = conn->options; + const char *ptr = options; + + if(options) { + const char *key = ptr; + + while(*ptr && *ptr != '=') + ptr++; + + if(strnequal(key, "AUTH", 4)) { + const char *value = ptr + 1; + + if(strequal(value, "*")) { + pop3c->preftype = POP3_TYPE_ANY; + pop3c->prefmech = SASL_AUTH_ANY; + } + else if(strequal(value, "+APOP")) { + pop3c->preftype = POP3_TYPE_APOP; + pop3c->prefmech = SASL_AUTH_NONE; + } + else if(strequal(value, SASL_MECH_STRING_LOGIN)) { + pop3c->preftype = POP3_TYPE_SASL; + pop3c->prefmech = SASL_MECH_LOGIN; + } + else if(strequal(value, SASL_MECH_STRING_PLAIN)) { + pop3c->preftype = POP3_TYPE_SASL; + pop3c->prefmech = SASL_MECH_PLAIN; + } + else if(strequal(value, SASL_MECH_STRING_CRAM_MD5)) { + pop3c->preftype = POP3_TYPE_SASL; + pop3c->prefmech = SASL_MECH_CRAM_MD5; + } + else if(strequal(value, SASL_MECH_STRING_DIGEST_MD5)) { + pop3c->preftype = POP3_TYPE_SASL; + pop3c->prefmech = SASL_MECH_DIGEST_MD5; + } + else if(strequal(value, SASL_MECH_STRING_GSSAPI)) { + pop3c->preftype = POP3_TYPE_SASL; + pop3c->prefmech = SASL_MECH_GSSAPI; + } + else if(strequal(value, SASL_MECH_STRING_NTLM)) { + pop3c->preftype = POP3_TYPE_SASL; + pop3c->prefmech = SASL_MECH_NTLM; + } + else if(strequal(value, SASL_MECH_STRING_XOAUTH2)) { + pop3c->preftype = POP3_TYPE_SASL; + pop3c->prefmech = SASL_MECH_XOAUTH2; + } + else { + pop3c->preftype = POP3_TYPE_NONE; + pop3c->prefmech = SASL_AUTH_NONE; + } + } + else + result = CURLE_URL_MALFORMAT; + } + + return result; +} + +/*********************************************************************** + * + * pop3_parse_url_path() + * + * Parse the URL path into separate path components. + */ +static CURLcode pop3_parse_url_path(struct connectdata *conn) +{ + /* The POP3 struct is already initialised in pop3_connect() */ + struct SessionHandle *data = conn->data; + struct POP3 *pop3 = data->req.protop; + const char *path = data->state.path; + + /* URL decode the path for the message ID */ + return Curl_urldecode(data, path, 0, &pop3->id, NULL, TRUE); +} + +/*********************************************************************** + * + * pop3_parse_custom_request() + * + * Parse the custom request. + */ +static CURLcode pop3_parse_custom_request(struct connectdata *conn) +{ + CURLcode result = CURLE_OK; + struct SessionHandle *data = conn->data; + struct POP3 *pop3 = data->req.protop; + const char *custom = data->set.str[STRING_CUSTOMREQUEST]; + + /* URL decode the custom request */ + if(custom) + result = Curl_urldecode(data, custom, 0, &pop3->custom, NULL, TRUE); + + return result; +} + +/*********************************************************************** + * + * Curl_pop3_write() + * + * This function scans the body after the end-of-body and writes everything + * until the end is found. + */ CURLcode Curl_pop3_write(struct connectdata *conn, char *str, size_t nread) { /* This code could be made into a special function in the handler struct */ @@ -1668,7 +1888,7 @@ CURLcode Curl_pop3_write(struct connectdata *conn, char *str, size_t nread) 5 bytes (0d 0a 2e 0d 0a). Note that a line starting with a dot matches the eob so the server will have prefixed it with an extra dot which we need to strip out. Additionally the marker could of course be spread out - over 5 different data chunks */ + over 5 different data chunks. */ for(i = 0; i < nread; i++) { size_t prev = pop3c->eob; diff --git a/plugins/FTPFileYM/curl/lib/pop3.h b/plugins/FTPFileYM/curl/lib/pop3.h index b9d7bd4e66..7bc7744955 100644 --- a/plugins/FTPFileYM/curl/lib/pop3.h +++ b/plugins/FTPFileYM/curl/lib/pop3.h @@ -22,6 +22,8 @@ * ***************************************************************************/ +#include "pingpong.h" + /**************************************************************************** * POP3 unique setup ***************************************************************************/ @@ -29,10 +31,10 @@ typedef enum { POP3_STOP, /* do nothing state, stops the state machine */ POP3_SERVERGREET, /* waiting for the initial greeting immediately after a connect */ + POP3_CAPA, POP3_STARTTLS, POP3_UPGRADETLS, /* asynchronously upgrade the connection to SSL/TLS (multi mode only) */ - POP3_CAPA, POP3_AUTH_PLAIN, POP3_AUTH_LOGIN, POP3_AUTH_LOGIN_PASSWD, @@ -41,7 +43,8 @@ typedef enum { POP3_AUTH_DIGESTMD5_RESP, POP3_AUTH_NTLM, POP3_AUTH_NTLM_TYPE2MSG, - POP3_AUTH, + POP3_AUTH_XOAUTH2, + POP3_AUTH_FINAL, POP3_APOP, POP3_USER, POP3_PASS, @@ -50,31 +53,46 @@ typedef enum { POP3_LAST /* never used */ } pop3state; +/* This POP3 struct is used in the SessionHandle. All POP3 data that is + connection-oriented must be in pop3_conn to properly deal with the fact that + perhaps the SessionHandle is changed between the times the connection is + used. */ +struct POP3 { + curl_pp_transfer transfer; + char *id; /* Message ID */ + char *custom; /* Custom Request */ +}; + /* pop3_conn is used for struct connection-oriented data in the connectdata struct */ struct pop3_conn { struct pingpong pp; - char *mailbox; /* Message ID */ - char *custom; /* Custom Request */ + pop3state state; /* Always use pop3.c:state() to change state! */ + bool ssldone; /* Is connect() over SSL done? */ size_t eob; /* Number of bytes of the EOB (End Of Body) that have been received so far */ size_t strip; /* Number of bytes from the start to ignore as non-body */ - unsigned int authtypes; /* Supported authentication types */ + unsigned int authtypes; /* Accepted authentication types */ unsigned int authmechs; /* Accepted SASL authentication mechanisms */ + unsigned int preftype; /* Preferred authentication type */ + unsigned int prefmech; /* Preferred SASL authentication mechanism */ unsigned int authused; /* SASL auth mechanism used for the connection */ char *apoptimestamp; /* APOP timestamp from the server greeting */ - pop3state state; /* Always use pop3.c:state() to change state! */ - bool ssldone; /* Is connect() over SSL done? */ + bool tls_supported; /* StartTLS capability supported by server */ }; extern const struct Curl_handler Curl_handler_pop3; extern const struct Curl_handler Curl_handler_pop3s; /* Authentication type flags */ -#define POP3_TYPE_CLEARTEXT 0x0001 -#define POP3_TYPE_APOP 0x0002 -#define POP3_TYPE_SASL 0x0004 +#define POP3_TYPE_CLEARTEXT (1 << 0) +#define POP3_TYPE_APOP (1 << 1) +#define POP3_TYPE_SASL (1 << 2) + +/* Authentication type values */ +#define POP3_TYPE_NONE 0 +#define POP3_TYPE_ANY ~0 /* This is the 5-bytes End-Of-Body marker for POP3 */ #define POP3_EOB "\x0d\x0a\x2e\x0d\x0a" diff --git a/plugins/FTPFileYM/curl/lib/progress.c b/plugins/FTPFileYM/curl/lib/progress.c index 4cff2b76ec..dac7f8d6ec 100644 --- a/plugins/FTPFileYM/curl/lib/progress.c +++ b/plugins/FTPFileYM/curl/lib/progress.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -357,12 +357,21 @@ int Curl_pgrsUpdate(struct connectdata *conn) } /* Calculations end */ if(!(data->progress.flags & PGRS_HIDE)) { - /* progress meter has not been shut off */ - if(data->set.fprogress) { - /* There's a callback set, so we call that instead of writing - anything ourselves. This really is the way to go. */ + if(data->set.fxferinfo) { + /* There's a callback set, call that */ + result= data->set.fxferinfo(data->set.progress_client, + data->progress.size_dl, + data->progress.downloaded, + data->progress.size_ul, + data->progress.uploaded); + if(result) + failf(data, "Callback aborted"); + return result; + } + else if(data->set.fprogress) { + /* The older deprecated callback is set, call that */ result= data->set.fprogress(data->set.progress_client, (double)data->progress.size_dl, (double)data->progress.downloaded, diff --git a/plugins/FTPFileYM/curl/lib/qssl.c b/plugins/FTPFileYM/curl/lib/qssl.c index 8ef6fec8d8..b8a8daecac 100644 --- a/plugins/FTPFileYM/curl/lib/qssl.c +++ b/plugins/FTPFileYM/curl/lib/qssl.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -37,6 +37,7 @@ #include "sslgen.h" #include "connect.h" /* for the connect timeout */ #include "select.h" +#include "x509asn1.h" #include "curl_memory.h" /* The last #include file should be: */ #include "memdebug.h" @@ -169,10 +170,7 @@ static CURLcode Curl_qsossl_handshake(struct connectdata * conn, int sockindex) SSLHandle * h = connssl->handle; long timeout_ms; - h->exitPgm = NULL; - - if(!data->set.ssl.verifyhost) - h->exitPgm = Curl_qsossl_trap_cert; + h->exitPgm = data->set.ssl.verifypeer? NULL: Curl_qsossl_trap_cert; /* figure out how long time we should wait at maximum */ timeout_ms = Curl_timeleft(data, NULL, TRUE); @@ -208,6 +206,8 @@ static CURLcode Curl_qsossl_handshake(struct connectdata * conn, int sockindex) break; } + h->peerCert = NULL; + h->peerCertLen = 0; rc = SSL_Handshake(h, SSL_HANDSHAKE_AS_CLIENT); switch (rc) { @@ -238,6 +238,23 @@ static CURLcode Curl_qsossl_handshake(struct connectdata * conn, int sockindex) return CURLE_SSL_CONNECT_ERROR; } + /* Verify host. */ + rc = Curl_verifyhost(conn, h->peerCert, h->peerCert + h->peerCertLen); + if(rc != CURLE_OK) + return rc; + + /* Gather certificate info. */ + if(data->set.ssl.certinfo) { + if(Curl_ssl_init_certinfo(data, 1)) + return CURLE_OUT_OF_MEMORY; + if(h->peerCert) { + rc = Curl_extract_certinfo(conn, 0, h->peerCert, + h->peerCert + h->peerCertLen); + if(rc != CURLE_OK) + return rc; + } + } + return CURLE_OK; } @@ -257,19 +274,22 @@ CURLcode Curl_qsossl_connect(struct connectdata * conn, int sockindex) if(rc == CURLE_OK) { rc = Curl_qsossl_create(conn, sockindex); - if(rc == CURLE_OK) + if(rc == CURLE_OK) { rc = Curl_qsossl_handshake(conn, sockindex); - else { - SSL_Destroy(connssl->handle); - connssl->handle = NULL; - connssl->use = FALSE; - connssl->state = ssl_connection_none; + if(rc != CURLE_OK) + SSL_Destroy(connssl->handle); } } + if(rc == CURLE_OK) { - connssl->state = ssl_connection_complete; conn->recv[sockindex] = qsossl_recv; conn->send[sockindex] = qsossl_send; + connssl->state = ssl_connection_complete; + } + else { + connssl->handle = NULL; + connssl->use = FALSE; + connssl->state = ssl_connection_none; } return rc; diff --git a/plugins/FTPFileYM/curl/lib/rtsp.c b/plugins/FTPFileYM/curl/lib/rtsp.c index 9d7a9a94b0..f7c6562a7b 100644 --- a/plugins/FTPFileYM/curl/lib/rtsp.c +++ b/plugins/FTPFileYM/curl/lib/rtsp.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -81,6 +81,8 @@ static CURLcode rtsp_rtp_readwrite(struct SessionHandle *data, ssize_t *nread, bool *readmore); +static CURLcode rtsp_setup_connection(struct connectdata *conn); + /* this returns the socket to wait for in the DO and DOING state for the multi interface and then we're always _sending_ a request and thus we wait for @@ -104,7 +106,7 @@ CURLcode rtp_client_write(struct connectdata *conn, char *ptr, size_t len); */ const struct Curl_handler Curl_handler_rtsp = { "RTSP", /* scheme */ - ZERO_NULL, /* setup_connection */ + rtsp_setup_connection, /* setup_connection */ rtsp_do, /* do_it */ rtsp_done, /* done */ ZERO_NULL, /* do_more */ @@ -122,6 +124,19 @@ const struct Curl_handler Curl_handler_rtsp = { PROTOPT_NONE /* flags */ }; + +static CURLcode rtsp_setup_connection(struct connectdata *conn) +{ + struct RTSP *rtsp; + + conn->data->req.protop = rtsp = calloc(1, sizeof(struct RTSP)); + if(!rtsp) + return CURLE_OUT_OF_MEMORY; + + return CURLE_OK; +} + + /* * The server may send us RTP data at any point, and RTSPREQ_RECEIVE does not * want to block the application forever while receiving a stream. Therefore, @@ -185,7 +200,7 @@ static CURLcode rtsp_done(struct connectdata *conn, CURLcode status, bool premature) { struct SessionHandle *data = conn->data; - struct RTSP *rtsp = data->state.proto.rtsp; + struct RTSP *rtsp = data->req.protop; CURLcode httpStatus; long CSeq_sent; long CSeq_recv; @@ -221,7 +236,7 @@ static CURLcode rtsp_do(struct connectdata *conn, bool *done) struct SessionHandle *data = conn->data; CURLcode result=CURLE_OK; Curl_RtspReq rtspreq = data->set.rtspreq; - struct RTSP *rtsp; + struct RTSP *rtsp = data->req.protop; struct HTTP *http; Curl_send_buffer *req_buffer; curl_off_t postsize = 0; /* for ANNOUNCE and SET_PARAMETER */ @@ -239,20 +254,6 @@ static CURLcode rtsp_do(struct connectdata *conn, bool *done) *done = TRUE; - Curl_reset_reqproto(conn); - - if(!data->state.proto.rtsp) { - /* Only allocate this struct if we don't already have it! */ - - rtsp = calloc(1, sizeof(struct RTSP)); - if(!rtsp) - return CURLE_OUT_OF_MEMORY; - data->state.proto.rtsp = rtsp; - } - else { - rtsp = data->state.proto.rtsp; - } - http = &(rtsp->http_wrapper); /* Assert that no one has changed the RTSP struct in an evil way */ DEBUGASSERT((void *)http == (void *)rtsp); @@ -668,7 +669,7 @@ static CURLcode rtsp_rtp_readwrite(struct SessionHandle *data, } if(rtp_dataleft != 0 && rtp[0] == '$') { - DEBUGF(infof(data, "RTP Rewinding %zu %s\n", rtp_dataleft, + DEBUGF(infof(data, "RTP Rewinding %zd %s\n", rtp_dataleft, *readmore ? "(READMORE)" : "")); /* Store the incomplete RTP packet for a "rewind" */ @@ -749,7 +750,8 @@ CURLcode Curl_rtsp_parseheader(struct connectdata *conn, /* Store the received CSeq. Match is verified in rtsp_done */ int nc = sscanf(&header[4], ": %ld", &CSeq); if(nc == 1) { - data->state.proto.rtsp->CSeq_recv = CSeq; /* mark the request */ + struct RTSP *rtsp = data->req.protop; + rtsp->CSeq_recv = CSeq; /* mark the request */ data->state.rtsp_CSeq_recv = CSeq; /* update the handle */ } else { diff --git a/plugins/FTPFileYM/curl/lib/security.c b/plugins/FTPFileYM/curl/lib/security.c index 3c46953cbf..508c7b41ec 100644 --- a/plugins/FTPFileYM/curl/lib/security.c +++ b/plugins/FTPFileYM/curl/lib/security.c @@ -7,10 +7,10 @@ * rewrite to work around the paragraph 2 in the BSD licenses as explained * below. * - * Copyright (c) 1998, 1999 Kungliga Tekniska Högskolan + * Copyright (c) 1998, 1999, 2013 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * - * Copyright (C) 2001 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 2001 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * * All rights reserved. * @@ -44,7 +44,7 @@ #include "curl_setup.h" #ifndef CURL_DISABLE_FTP -#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI) +#ifdef HAVE_GSSAPI #ifdef HAVE_NETDB_H #include <netdb.h> @@ -57,7 +57,7 @@ #include "urldata.h" #include "curl_base64.h" #include "curl_memory.h" -#include "krb4.h" +#include "curl_sec.h" #include "ftp.h" #include "sendf.h" #include "rawstr.h" @@ -110,12 +110,9 @@ static char level_to_char(int level) { } static const struct Curl_sec_client_mech * const mechs[] = { -#if defined(HAVE_GSSAPI) +#ifdef HAVE_GSSAPI &Curl_krb5_client_mech, #endif -#if defined(HAVE_KRB4) - &Curl_krb4_client_mech, -#endif NULL }; @@ -199,7 +196,7 @@ socket_write(struct connectdata *conn, curl_socket_t fd, const void *to, static CURLcode read_data(struct connectdata *conn, curl_socket_t fd, - struct krb4buffer *buf) + struct krb5buffer *buf) { int len; void* tmp; @@ -225,7 +222,7 @@ static CURLcode read_data(struct connectdata *conn, } static size_t -buffer_read(struct krb4buffer *buf, void *data, size_t len) +buffer_read(struct krb5buffer *buf, void *data, size_t len) { if(buf->size - buf->index < len) len = buf->size - buf->index; @@ -498,7 +495,7 @@ static CURLcode choose_mech(struct connectdata *conn) /* We have no mechanism with a NULL name but keep this check */ DEBUGASSERT(mech_name != NULL); if(mech_name == NULL) { - infof(data, "Skipping mechanism with empty name (%p)\n", mech); + infof(data, "Skipping mechanism with empty name (%p)\n", (void *)mech); continue; } tmp_allocation = realloc(conn->app_data, (*mech)->size); @@ -599,6 +596,6 @@ Curl_sec_end(struct connectdata *conn) conn->mech = NULL; } -#endif /* HAVE_KRB4 || HAVE_GSSAPI */ +#endif /* HAVE_GSSAPI */ #endif /* CURL_DISABLE_FTP */ diff --git a/plugins/FTPFileYM/curl/lib/select.c b/plugins/FTPFileYM/curl/lib/select.c index d13e1228ad..db7fb6d43c 100644 --- a/plugins/FTPFileYM/curl/lib/select.c +++ b/plugins/FTPFileYM/curl/lib/select.c @@ -50,11 +50,8 @@ #define elapsed_ms (int)curlx_tvdiff(curlx_tvnow(), initial_tv) -#ifdef CURL_ACKNOWLEDGE_EINTR -#define error_not_EINTR (1) -#else -#define error_not_EINTR (error != EINTR) -#endif +int Curl_ack_eintr = 0; +#define error_not_EINTR (Curl_ack_eintr || error != EINTR) /* * Internal function used for waiting a specific amount of ms @@ -67,10 +64,6 @@ * Timeout resolution, accuracy, as well as maximum supported * value is system dependent, neither factor is a citical issue * for the intended use of this function in the library. - * On non-DOS and non-Winsock platforms, when compiled with - * CURL_ACKNOWLEDGE_EINTR defined, EINTR condition is honored - * and function might exit early without awaiting full timeout, - * otherwise EINTR will be ignored and full timeout will elapse. * * Return values: * -1 = system call error, invalid timeout value, or interrupted @@ -133,9 +126,6 @@ int Curl_wait_ms(int timeout_ms) * A negative timeout value makes this function wait indefinitely, * unles no valid file descriptor is given, when this happens the * negative timeout is ignored and the function times out immediately. - * When compiled with CURL_ACKNOWLEDGE_EINTR defined, EINTR condition - * is honored and function might exit early without awaiting timeout, - * otherwise EINTR will be ignored. * * Return values: * -1 = system call error or fd >= FD_SETSIZE @@ -351,9 +341,6 @@ int Curl_socket_check(curl_socket_t readfd0, /* two sockets to read from */ * A negative timeout value makes this function wait indefinitely, * unles no valid file descriptor is given, when this happens the * negative timeout is ignored and the function times out immediately. - * When compiled with CURL_ACKNOWLEDGE_EINTR defined, EINTR condition - * is honored and function might exit early without awaiting timeout, - * otherwise EINTR will be ignored. * * Return values: * -1 = system call error or fd >= FD_SETSIZE diff --git a/plugins/FTPFileYM/curl/lib/select.h b/plugins/FTPFileYM/curl/lib/select.h index 00789bb894..c00afe166f 100644 --- a/plugins/FTPFileYM/curl/lib/select.h +++ b/plugins/FTPFileYM/curl/lib/select.h @@ -81,6 +81,12 @@ int Curl_socket_check(curl_socket_t readfd, curl_socket_t readfd2, int Curl_poll(struct pollfd ufds[], unsigned int nfds, int timeout_ms); +/* On non-DOS and non-Winsock platforms, when Curl_ack_eintr is set, + * EINTR condition is honored and function might exit early without + * awaiting full timeout. Otherwise EINTR will be ignored and full + * timeout will elapse. */ +extern int Curl_ack_eintr; + int Curl_wait_ms(int timeout_ms); #ifdef TPF diff --git a/plugins/FTPFileYM/curl/lib/sendf.c b/plugins/FTPFileYM/curl/lib/sendf.c index c64d686b93..7b6fca6108 100644 --- a/plugins/FTPFileYM/curl/lib/sendf.c +++ b/plugins/FTPFileYM/curl/lib/sendf.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -35,14 +35,6 @@ #define _MPRINTF_REPLACE /* use the internal *printf() functions */ #include <curl/mprintf.h> -/* the krb4 functions only exists for FTP and if krb4 or gssapi is defined */ -#if !defined(CURL_DISABLE_FTP) && (defined(HAVE_KRB4) || defined(HAVE_GSSAPI)) -#include "krb4.h" -#else -#define Curl_sec_send(a,b,c,d) -1 -#define Curl_sec_read(a,b,c,d) -1 -#endif - #include "curl_memory.h" #include "strerror.h" @@ -529,8 +521,7 @@ CURLcode Curl_read(struct connectdata *conn, /* connection data */ ssize_t nread = 0; size_t bytesfromsocket = 0; char *buffertofill = NULL; - bool pipelining = (conn->data->multi && - Curl_multi_canPipeline(conn->data->multi)) ? TRUE : FALSE; + bool pipelining = Curl_multi_pipeline_enabled(conn->data->multi); /* Set 'num' to 0 or 1, depending on which socket that has been sent here. If it is the second socket, we set num to 1. Otherwise to 0. This lets diff --git a/plugins/FTPFileYM/curl/lib/setup-os400.h b/plugins/FTPFileYM/curl/lib/setup-os400.h index cdeefe3ddb..319efec929 100644 --- a/plugins/FTPFileYM/curl/lib/setup-os400.h +++ b/plugins/FTPFileYM/curl/lib/setup-os400.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -38,6 +38,8 @@ typedef unsigned long u_int32_t; #include <sys/socket.h> #include <netdb.h> #include <qsossl.h> +#include <gskssl.h> +#include <qsoasync.h> #include <gssapi.h> extern int Curl_getaddrinfo_a(const char * nodename, const char * servname, @@ -68,6 +70,93 @@ extern char * Curl_SSL_Strerror_a(int sslreturnvalue, SSLErrorMsg * serrmsgp); #define SSL_Strerror Curl_SSL_Strerror_a +/* GSKit wrappers. */ + +extern int Curl_gsk_environment_open(gsk_handle * my_env_handle); +#define gsk_environment_open Curl_gsk_environment_open + +extern int Curl_gsk_secure_soc_open(gsk_handle my_env_handle, + gsk_handle * my_session_handle); +#define gsk_secure_soc_open Curl_gsk_secure_soc_open + +extern int Curl_gsk_environment_close(gsk_handle * my_env_handle); +#define gsk_environment_close Curl_gsk_environment_close + +extern int Curl_gsk_secure_soc_close(gsk_handle * my_session_handle); +#define gsk_secure_soc_close Curl_gsk_secure_soc_close + +extern int Curl_gsk_environment_init(gsk_handle my_env_handle); +#define gsk_environment_init Curl_gsk_environment_init + +extern int Curl_gsk_secure_soc_init(gsk_handle my_session_handle); +#define gsk_secure_soc_init Curl_gsk_secure_soc_init + +extern int Curl_gsk_attribute_set_buffer_a(gsk_handle my_gsk_handle, + GSK_BUF_ID bufID, + const char * buffer, + int bufSize); +#define gsk_attribute_set_buffer Curl_gsk_attribute_set_buffer_a + +extern int Curl_gsk_attribute_set_enum(gsk_handle my_gsk_handle, + GSK_ENUM_ID enumID, + GSK_ENUM_VALUE enumValue); +#define gsk_attribute_set_enum Curl_gsk_attribute_set_enum + +extern int Curl_gsk_attribute_set_numeric_value(gsk_handle my_gsk_handle, + GSK_NUM_ID numID, + int numValue); +#define gsk_attribute_set_numeric_value Curl_gsk_attribute_set_numeric_value + +extern int Curl_gsk_attribute_set_callback(gsk_handle my_gsk_handle, + GSK_CALLBACK_ID callBackID, + void * callBackAreaPtr); +#define gsk_attribute_set_callback Curl_gsk_attribute_set_callback + +extern int Curl_gsk_attribute_get_buffer_a(gsk_handle my_gsk_handle, + GSK_BUF_ID bufID, + const char * * buffer, + int * bufSize); +#define gsk_attribute_get_buffer Curl_gsk_attribute_get_buffer_a + +extern int Curl_gsk_attribute_get_enum(gsk_handle my_gsk_handle, + GSK_ENUM_ID enumID, + GSK_ENUM_VALUE * enumValue); +#define gsk_attribute_get_enum Curl_gsk_attribute_get_enum + +extern int Curl_gsk_attribute_get_numeric_value(gsk_handle my_gsk_handle, + GSK_NUM_ID numID, + int * numValue); +#define gsk_attribute_get_numeric_value Curl_gsk_attribute_get_numeric_value + +extern int Curl_gsk_attribute_get_cert_info(gsk_handle my_gsk_handle, + GSK_CERT_ID certID, + const gsk_cert_data_elem * * certDataElem, + int * certDataElementCount); +#define gsk_attribute_get_cert_info Curl_gsk_attribute_get_cert_info + +extern int Curl_gsk_secure_soc_misc(gsk_handle my_session_handle, + GSK_MISC_ID miscID); +#define gsk_secure_soc_misc Curl_gsk_secure_soc_misc + +extern int Curl_gsk_secure_soc_read(gsk_handle my_session_handle, + char * readBuffer, + int readBufSize, int * amtRead); +#define gsk_secure_soc_read Curl_gsk_secure_soc_read + +extern int Curl_gsk_secure_soc_write(gsk_handle my_session_handle, + char * writeBuffer, + int writeBufSize, int * amtWritten); +#define gsk_secure_soc_write Curl_gsk_secure_soc_write + +extern const char * Curl_gsk_strerror_a(int gsk_return_value); +#define gsk_strerror Curl_gsk_strerror_a + +extern int Curl_gsk_secure_soc_startInit(gsk_handle my_session_handle, + int IOCompletionPort, + Qso_OverlappedIO_t * communicationsArea); +#define gsk_secure_soc_startInit Curl_gsk_secure_soc_startInit + + /* GSSAPI wrappers. */ extern OM_uint32 Curl_gss_import_name_a(OM_uint32 * minor_status, @@ -107,6 +196,7 @@ extern OM_uint32 Curl_gss_delete_sec_context_a(OM_uint32 * minor_status, gss_buffer_t output_token); #define gss_delete_sec_context Curl_gss_delete_sec_context_a + /* LDAP wrappers. */ #define BerValue struct berval diff --git a/plugins/FTPFileYM/curl/lib/setup-vms.h b/plugins/FTPFileYM/curl/lib/setup-vms.h index 4eefbba49a..f5eedf7566 100644 --- a/plugins/FTPFileYM/curl/lib/setup-vms.h +++ b/plugins/FTPFileYM/curl/lib/setup-vms.h @@ -315,6 +315,7 @@ char * unix_path; #define d2i_PKCS12_fp D2I_PKCS12_FP #define i2t_ASN1_OBJECT I2T_ASN1_OBJECT #define sk_num SK_NUM +#define sk_pop SK_POP #define sk_pop_free SK_POP_FREE #define sk_value SK_VALUE diff --git a/plugins/FTPFileYM/curl/lib/slist.c b/plugins/FTPFileYM/curl/lib/slist.c index 92c699ec96..3cac6ca21c 100644 --- a/plugins/FTPFileYM/curl/lib/slist.c +++ b/plugins/FTPFileYM/curl/lib/slist.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -46,6 +46,38 @@ static struct curl_slist *slist_get_last(struct curl_slist *list) } /* + * Curl_slist_append_nodup() appends a string to the linked list. Rather than + * copying the string in dynamic storage, it takes its ownership. The string + * should have been malloc()ated. Curl_slist_append_nodup always returns + * the address of the first record, so that you can use this function as an + * initialization function as well as an append function. + * If an error occurs, NULL is returned and the string argument is NOT + * released. + */ +struct curl_slist *Curl_slist_append_nodup(struct curl_slist *list, char *data) +{ + struct curl_slist *last; + struct curl_slist *new_item; + + DEBUGASSERT(data); + + new_item = malloc(sizeof(struct curl_slist)); + if(!new_item) + return NULL; + + new_item->next = NULL; + new_item->data = data; + + /* if this is the first item, then new_item *is* the list */ + if(!list) + return new_item; + + last = slist_get_last(list); + last->next = new_item; + return list; +} + +/* * curl_slist_append() appends a string to the linked list. It always returns * the address of the first record, so that you can use this function as an * initialization function as well as an append function. If you find this @@ -55,32 +87,16 @@ static struct curl_slist *slist_get_last(struct curl_slist *list) struct curl_slist *curl_slist_append(struct curl_slist *list, const char *data) { - struct curl_slist *last; - struct curl_slist *new_item; + char *dupdata = strdup(data); - new_item = malloc(sizeof(struct curl_slist)); - if(new_item) { - char *dupdata = strdup(data); - if(dupdata) { - new_item->next = NULL; - new_item->data = dupdata; - } - else { - free(new_item); - return NULL; - } - } - else + if(!dupdata) return NULL; - if(list) { - last = slist_get_last(list); - last->next = new_item; - return list; - } + list = Curl_slist_append_nodup(list, dupdata); + if(!list) + free(dupdata); - /* if this is the first item, then new_item *is* the list */ - return new_item; + return list; } /* diff --git a/plugins/FTPFileYM/curl/lib/slist.h b/plugins/FTPFileYM/curl/lib/slist.h index aede1f0418..ea7dcc48b6 100644 --- a/plugins/FTPFileYM/curl/lib/slist.h +++ b/plugins/FTPFileYM/curl/lib/slist.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -29,5 +29,12 @@ */ struct curl_slist *Curl_slist_duplicate(struct curl_slist *inlist); +/* + * Curl_slist_append_nodup() takes ownership of the given string and appends + * it to the list. + */ +struct curl_slist *Curl_slist_append_nodup(struct curl_slist *list, + char *data); + #endif /* HEADER_CURL_SLIST_H */ diff --git a/plugins/FTPFileYM/curl/lib/smtp.c b/plugins/FTPFileYM/curl/lib/smtp.c index d2d4aeb141..9626a30d83 100644 --- a/plugins/FTPFileYM/curl/lib/smtp.c +++ b/plugins/FTPFileYM/curl/lib/smtp.c @@ -26,6 +26,8 @@ * RFC4616 PLAIN authentication * RFC4954 SMTP Authentication * RFC5321 SMTP protocol + * RFC6749 OAuth 2.0 Authorization Framework + * Draft SMTP URL Interface * ***************************************************************************/ @@ -99,7 +101,8 @@ static int smtp_getsock(struct connectdata *conn, curl_socket_t *socks, int numsocks); static CURLcode smtp_doing(struct connectdata *conn, bool *dophase_done); static CURLcode smtp_setup_connection(struct connectdata *conn); -static CURLcode smtp_state_upgrade_tls(struct connectdata *conn); +static CURLcode smtp_parse_url_options(struct connectdata *conn); +static CURLcode smtp_parse_url_path(struct connectdata *conn); /* * SMTP protocol handler. @@ -159,7 +162,7 @@ const struct Curl_handler Curl_handler_smtps = { static const struct Curl_handler Curl_handler_smtp_proxy = { "SMTP", /* scheme */ - ZERO_NULL, /* setup_connection */ + Curl_http_setup_conn, /* setup_connection */ Curl_http, /* do_it */ Curl_http_done, /* done */ ZERO_NULL, /* do_more */ @@ -184,7 +187,7 @@ static const struct Curl_handler Curl_handler_smtp_proxy = { static const struct Curl_handler Curl_handler_smtps_proxy = { "SMTPS", /* scheme */ - ZERO_NULL, /* setup_connection */ + Curl_http_setup_conn, /* setup_connection */ Curl_http, /* do_it */ Curl_http_done, /* done */ ZERO_NULL, /* do_more */ @@ -204,81 +207,108 @@ static const struct Curl_handler Curl_handler_smtps_proxy = { #endif #endif -/* Function that checks for an ending smtp status code at the start of the - given string, but also detects the supported authentication mechanisms - from the EHLO AUTH response. */ -static int smtp_endofresp(struct pingpong *pp, int *resp) +#ifdef USE_SSL +static void smtp_to_smtps(struct connectdata *conn) +{ + conn->handler = &Curl_handler_smtps; +} +#else +#define smtp_to_smtps(x) Curl_nop_stmt +#endif + +/*********************************************************************** + * + * pop3_endofresp() + * + * Checks for an ending SMTP status code at the start of the given string, but + * also detects various capabilities from the EHLO response including the + * supported authentication mechanisms. + */ +static bool smtp_endofresp(struct connectdata *conn, char *line, size_t len, + int *resp) { - char *line = pp->linestart_resp; - size_t len = pp->nread_resp; - struct connectdata *conn = pp->conn; struct smtp_conn *smtpc = &conn->proto.smtpc; - int result; + bool result = FALSE; size_t wordlen; if(len < 4 || !ISDIGIT(line[0]) || !ISDIGIT(line[1]) || !ISDIGIT(line[2])) return FALSE; /* Nothing for us */ - /* Extract the response code if necessary */ - if((result = (line[3] == ' ')) != 0) + /* Do we have a command response? */ + result = (line[3] == ' ') ? TRUE : FALSE; + if(result) *resp = curlx_sltosi(strtol(line, NULL, 10)); - line += 4; - len -= 4; - - /* Does the server support the SIZE capability? */ - if(smtpc->state == SMTP_EHLO && len >= 4 && !memcmp(line, "SIZE", 4)) { - DEBUGF(infof(conn->data, "Server supports SIZE extension.\n")); - smtpc->size_supported = true; - } - - /* Do we have the authentication mechanism list? */ - if(smtpc->state == SMTP_EHLO && len >= 5 && !memcmp(line, "AUTH ", 5)) { - line += 5; - len -= 5; - - for(;;) { - while(len && - (*line == ' ' || *line == '\t' || - *line == '\r' || *line == '\n')) { - line++; - len--; + /* Are we processing EHLO command data? */ + if(smtpc->state == SMTP_EHLO && (!result || (result && *resp/100 == 2))) { + line += 4; + len -= 4; + + /* Does the server support the STARTTLS capability? */ + if(len >= 8 && !memcmp(line, "STARTTLS", 8)) + smtpc->tls_supported = TRUE; + + /* Does the server support the SIZE capability? */ + else if(len >= 4 && !memcmp(line, "SIZE", 4)) + smtpc->size_supported = TRUE; + + /* Do we have the authentication mechanism list? */ + else if(len >= 5 && !memcmp(line, "AUTH ", 5)) { + line += 5; + len -= 5; + + /* Loop through the data line */ + for(;;) { + while(len && + (*line == ' ' || *line == '\t' || + *line == '\r' || *line == '\n')) { + + line++; + len--; + } + + if(!len) + break; + + /* Extract the word */ + for(wordlen = 0; wordlen < len && line[wordlen] != ' ' && + line[wordlen] != '\t' && line[wordlen] != '\r' && + line[wordlen] != '\n';) + wordlen++; + + /* Test the word for a matching authentication mechanism */ + if(sasl_mech_equal(line, wordlen, SASL_MECH_STRING_LOGIN)) + smtpc->authmechs |= SASL_MECH_LOGIN; + else if(sasl_mech_equal(line, wordlen, SASL_MECH_STRING_PLAIN)) + smtpc->authmechs |= SASL_MECH_PLAIN; + else if(sasl_mech_equal(line, wordlen, SASL_MECH_STRING_CRAM_MD5)) + smtpc->authmechs |= SASL_MECH_CRAM_MD5; + else if(sasl_mech_equal(line, wordlen, SASL_MECH_STRING_DIGEST_MD5)) + smtpc->authmechs |= SASL_MECH_DIGEST_MD5; + else if(sasl_mech_equal(line, wordlen, SASL_MECH_STRING_GSSAPI)) + smtpc->authmechs |= SASL_MECH_GSSAPI; + else if(sasl_mech_equal(line, wordlen, SASL_MECH_STRING_EXTERNAL)) + smtpc->authmechs |= SASL_MECH_EXTERNAL; + else if(sasl_mech_equal(line, wordlen, SASL_MECH_STRING_NTLM)) + smtpc->authmechs |= SASL_MECH_NTLM; + else if(sasl_mech_equal(line, wordlen, SASL_MECH_STRING_XOAUTH2)) + smtpc->authmechs |= SASL_MECH_XOAUTH2; + + line += wordlen; + len -= wordlen; } - - if(!len) - break; - - /* Extract the word */ - for(wordlen = 0; wordlen < len && line[wordlen] != ' ' && - line[wordlen] != '\t' && line[wordlen] != '\r' && - line[wordlen] != '\n';) - wordlen++; - - /* Test the word for a matching authentication mechanism */ - if(wordlen == 5 && !memcmp(line, "LOGIN", 5)) - smtpc->authmechs |= SASL_MECH_LOGIN; - else if(wordlen == 5 && !memcmp(line, "PLAIN", 5)) - smtpc->authmechs |= SASL_MECH_PLAIN; - else if(wordlen == 8 && !memcmp(line, "CRAM-MD5", 8)) - smtpc->authmechs |= SASL_MECH_CRAM_MD5; - else if(wordlen == 10 && !memcmp(line, "DIGEST-MD5", 10)) - smtpc->authmechs |= SASL_MECH_DIGEST_MD5; - else if(wordlen == 6 && !memcmp(line, "GSSAPI", 6)) - smtpc->authmechs |= SASL_MECH_GSSAPI; - else if(wordlen == 8 && !memcmp(line, "EXTERNAL", 8)) - smtpc->authmechs |= SASL_MECH_EXTERNAL; - else if(wordlen == 4 && !memcmp(line, "NTLM", 4)) - smtpc->authmechs |= SASL_MECH_NTLM; - - line += wordlen; - len -= wordlen; } } return result; } -/* This is the ONLY way to change SMTP state! */ +/*********************************************************************** + * + * state() + * + * This is the ONLY way to change SMTP state! + */ static void state(struct connectdata *conn, smtpstate newstate) { struct smtp_conn *smtpc = &conn->proto.smtpc; @@ -293,13 +323,14 @@ static void state(struct connectdata *conn, smtpstate newstate) "UPGRADETLS", "AUTH_PLAIN", "AUTH_LOGIN", - "AUTH_PASSWD", + "AUTH_LOGIN_PASSWD", "AUTH_CRAMMD5", "AUTH_DIGESTMD5", "AUTH_DIGESTMD5_RESP", "AUTH_NTLM", "AUTH_NTLM_TYPE2MSG", - "AUTH", + "AUTH_XOAUTH2", + "AUTH_FINAL", "MAIL", "RCPT", "DATA", @@ -310,35 +341,47 @@ static void state(struct connectdata *conn, smtpstate newstate) if(smtpc->state != newstate) infof(conn->data, "SMTP %p state change from %s to %s\n", - smtpc, names[smtpc->state], names[newstate]); + (void *)smtpc, names[smtpc->state], names[newstate]); #endif smtpc->state = newstate; } -static CURLcode smtp_state_ehlo(struct connectdata *conn) +/*********************************************************************** + * + * smtp_perform_ehlo() + * + * Sends the EHLO command to not only initialise communication with the ESMTP + * server but to also obtain a list of server side supported capabilities. + */ +static CURLcode smtp_perform_ehlo(struct connectdata *conn) { - CURLcode result; + CURLcode result = CURLE_OK; struct smtp_conn *smtpc = &conn->proto.smtpc; smtpc->authmechs = 0; /* No known authentication mechanisms yet */ smtpc->authused = 0; /* Clear the authentication mechanism used for esmtp connections */ + smtpc->tls_supported = FALSE; /* Clear the TLS capability */ /* Send the EHLO command */ result = Curl_pp_sendf(&smtpc->pp, "EHLO %s", smtpc->domain); - if(result) - return result; + if(!result) + state(conn, SMTP_EHLO); - state(conn, SMTP_EHLO); - - return CURLE_OK; + return result; } -static CURLcode smtp_state_helo(struct connectdata *conn) +/*********************************************************************** + * + * smtp_perform_helo() + * + * Sends the HELO command to initialise communication with the SMTP server. + */ +static CURLcode smtp_perform_helo(struct connectdata *conn) { - CURLcode result; + CURLcode result = CURLE_OK; struct smtp_conn *smtpc = &conn->proto.smtpc; smtpc->authused = 0; /* No authentication mechanism used in smtp @@ -347,20 +390,72 @@ static CURLcode smtp_state_helo(struct connectdata *conn) /* Send the HELO command */ result = Curl_pp_sendf(&smtpc->pp, "HELO %s", smtpc->domain); - if(result) - return result; + if(!result) + state(conn, SMTP_HELO); - state(conn, SMTP_HELO); + return result; +} - return CURLE_OK; +/*********************************************************************** + * + * smtp_perform_starttls() + * + * Sends the STLS command to start the upgrade to TLS. + */ +static CURLcode smtp_perform_starttls(struct connectdata *conn) +{ + CURLcode result = CURLE_OK; + + /* Send the STARTTLS command */ + result = Curl_pp_sendf(&conn->proto.smtpc.pp, "%s", "STARTTLS"); + + if(!result) + state(conn, SMTP_STARTTLS); + + return result; } -static CURLcode smtp_authenticate(struct connectdata *conn) +/*********************************************************************** + * + * smtp_perform_upgrade_tls() + * + * Performs the upgrade to TLS. + */ +static CURLcode smtp_perform_upgrade_tls(struct connectdata *conn) { CURLcode result = CURLE_OK; struct smtp_conn *smtpc = &conn->proto.smtpc; - char *initresp = NULL; + + /* Start the SSL connection */ + result = Curl_ssl_connect_nonblocking(conn, FIRSTSOCKET, &smtpc->ssldone); + + if(!result) { + if(smtpc->state != SMTP_UPGRADETLS) + state(conn, SMTP_UPGRADETLS); + + if(smtpc->ssldone) { + smtp_to_smtps(conn); + result = smtp_perform_ehlo(conn); + } + } + + return result; +} + +/*********************************************************************** + * + * smtp_perform_authenticate() + * + * Sends an AUTH command allowing the client to login with the appropriate + * SASL authentication mechanism. + */ +static CURLcode smtp_perform_authenticate(struct connectdata *conn) +{ + CURLcode result = CURLE_OK; + struct SessionHandle *data = conn->data; + struct smtp_conn *smtpc = &conn->proto.smtpc; const char *mech = NULL; + char *initresp = NULL; size_t len = 0; smtpstate state1 = SMTP_STOP; smtpstate state2 = SMTP_STOP; @@ -376,89 +471,223 @@ static CURLcode smtp_authenticate(struct connectdata *conn) /* Calculate the supported authentication mechanism, by decreasing order of security, as well as the initial response where appropriate */ #ifndef CURL_DISABLE_CRYPTO_AUTH - if(smtpc->authmechs & SASL_MECH_DIGEST_MD5) { - mech = "DIGEST-MD5"; + if((smtpc->authmechs & SASL_MECH_DIGEST_MD5) && + (smtpc->prefmech & SASL_MECH_DIGEST_MD5)) { + mech = SASL_MECH_STRING_DIGEST_MD5; state1 = SMTP_AUTH_DIGESTMD5; smtpc->authused = SASL_MECH_DIGEST_MD5; } - else if(smtpc->authmechs & SASL_MECH_CRAM_MD5) { - mech = "CRAM-MD5"; + else if((smtpc->authmechs & SASL_MECH_CRAM_MD5) && + (smtpc->prefmech & SASL_MECH_CRAM_MD5)) { + mech = SASL_MECH_STRING_CRAM_MD5; state1 = SMTP_AUTH_CRAMMD5; smtpc->authused = SASL_MECH_CRAM_MD5; } else #endif #ifdef USE_NTLM - if(smtpc->authmechs & SASL_MECH_NTLM) { - mech = "NTLM"; + if((smtpc->authmechs & SASL_MECH_NTLM) && + (smtpc->prefmech & SASL_MECH_NTLM)) { + mech = SASL_MECH_STRING_NTLM; state1 = SMTP_AUTH_NTLM; state2 = SMTP_AUTH_NTLM_TYPE2MSG; smtpc->authused = SASL_MECH_NTLM; - result = Curl_sasl_create_ntlm_type1_message(conn->user, conn->passwd, - &conn->ntlm, - &initresp, &len); - } + + if(data->set.sasl_ir) + result = Curl_sasl_create_ntlm_type1_message(conn->user, conn->passwd, + &conn->ntlm, + &initresp, &len); + } else #endif - if(smtpc->authmechs & SASL_MECH_LOGIN) { - mech = "LOGIN"; + if(((smtpc->authmechs & SASL_MECH_XOAUTH2) && + (smtpc->prefmech & SASL_MECH_XOAUTH2) && + (smtpc->prefmech != SASL_AUTH_ANY)) || conn->xoauth2_bearer) { + mech = SASL_MECH_STRING_XOAUTH2; + state1 = SMTP_AUTH_XOAUTH2; + state2 = SMTP_AUTH_FINAL; + smtpc->authused = SASL_MECH_XOAUTH2; + + if(data->set.sasl_ir) + result = Curl_sasl_create_xoauth2_message(conn->data, conn->user, + conn->xoauth2_bearer, + &initresp, &len); + } + else if((smtpc->authmechs & SASL_MECH_LOGIN) && + (smtpc->prefmech & SASL_MECH_LOGIN)) { + mech = SASL_MECH_STRING_LOGIN; state1 = SMTP_AUTH_LOGIN; - state2 = SMTP_AUTH_PASSWD; + state2 = SMTP_AUTH_LOGIN_PASSWD; smtpc->authused = SASL_MECH_LOGIN; - result = Curl_sasl_create_login_message(conn->data, conn->user, - &initresp, &len); + + if(data->set.sasl_ir) + result = Curl_sasl_create_login_message(conn->data, conn->user, + &initresp, &len); } - else if(smtpc->authmechs & SASL_MECH_PLAIN) { - mech = "PLAIN"; + else if((smtpc->authmechs & SASL_MECH_PLAIN) && + (smtpc->prefmech & SASL_MECH_PLAIN)) { + mech = SASL_MECH_STRING_PLAIN; state1 = SMTP_AUTH_PLAIN; - state2 = SMTP_AUTH; + state2 = SMTP_AUTH_FINAL; smtpc->authused = SASL_MECH_PLAIN; - result = Curl_sasl_create_plain_message(conn->data, conn->user, - conn->passwd, &initresp, &len); - } - else { - /* Other mechanisms not supported */ - infof(conn->data, "No known authentication mechanisms supported!\n"); - result = CURLE_LOGIN_DENIED; + + if(data->set.sasl_ir) + result = Curl_sasl_create_plain_message(conn->data, conn->user, + conn->passwd, &initresp, &len); } if(!result) { - /* Perform SASL based authentication */ - if(initresp && - strlen(mech) + len <= 512 - 8) { /* AUTH <mech> ...<crlf> */ - result = Curl_pp_sendf(&smtpc->pp, "AUTH %s %s", mech, initresp); + if(mech) { + /* Perform SASL based authentication */ + if(initresp && + 8 + strlen(mech) + len <= 512) { /* AUTH <mech> ...<crlf> */ + result = Curl_pp_sendf(&smtpc->pp, "AUTH %s %s", mech, initresp); - if(!result) - state(conn, state2); + if(!result) + state(conn, state2); + } + else { + result = Curl_pp_sendf(&smtpc->pp, "AUTH %s", mech); + + if(!result) + state(conn, state1); + } + + Curl_safefree(initresp); } else { - result = Curl_pp_sendf(&smtpc->pp, "AUTH %s", mech); + /* Other mechanisms not supported */ + infof(conn->data, "No known authentication mechanisms supported!\n"); + result = CURLE_LOGIN_DENIED; + } + } - if(!result) - state(conn, state1); + return result; +} + +/*********************************************************************** + * + * smtp_perform_mail() + * + * Sends an MAIL command to initiate the upload of a message. + */ +static CURLcode smtp_perform_mail(struct connectdata *conn) +{ + char *from = NULL; + char *auth = NULL; + char *size = NULL; + CURLcode result = CURLE_OK; + struct SessionHandle *data = conn->data; + + /* Calculate the FROM parameter */ + if(!data->set.str[STRING_MAIL_FROM]) + /* Null reverse-path, RFC-5321, sect. 3.6.3 */ + from = strdup("<>"); + else if(data->set.str[STRING_MAIL_FROM][0] == '<') + from = aprintf("%s", data->set.str[STRING_MAIL_FROM]); + else + from = aprintf("<%s>", data->set.str[STRING_MAIL_FROM]); + + if(!from) + return CURLE_OUT_OF_MEMORY; + + /* Calculate the optional AUTH parameter */ + if(data->set.str[STRING_MAIL_AUTH] && conn->proto.smtpc.authused) { + if(data->set.str[STRING_MAIL_AUTH][0] != '\0') + auth = aprintf("%s", data->set.str[STRING_MAIL_AUTH]); + else + /* Empty AUTH, RFC-2554, sect. 5 */ + auth = strdup("<>"); + + if(!auth) { + Curl_safefree(from); + + return CURLE_OUT_OF_MEMORY; } + } - Curl_safefree(initresp); + /* Calculate the optional SIZE parameter */ + if(conn->proto.smtpc.size_supported && conn->data->set.infilesize > 0) { + size = aprintf("%" FORMAT_OFF_T, data->set.infilesize); + + if(!size) { + Curl_safefree(from); + Curl_safefree(auth); + + return CURLE_OUT_OF_MEMORY; + } } + /* Send the MAIL command */ + if(!auth && !size) + result = Curl_pp_sendf(&conn->proto.smtpc.pp, + "MAIL FROM:%s", from); + else if(auth && !size) + result = Curl_pp_sendf(&conn->proto.smtpc.pp, + "MAIL FROM:%s AUTH=%s", from, auth); + else if(auth && size) + result = Curl_pp_sendf(&conn->proto.smtpc.pp, + "MAIL FROM:%s AUTH=%s SIZE=%s", from, auth, size); + else + result = Curl_pp_sendf(&conn->proto.smtpc.pp, + "MAIL FROM:%s SIZE=%s", from, size); + + Curl_safefree(from); + Curl_safefree(auth); + Curl_safefree(size); + + if(!result) + state(conn, SMTP_MAIL); + return result; } -/* For the SMTP "protocol connect" and "doing" phases only */ -static int smtp_getsock(struct connectdata *conn, curl_socket_t *socks, - int numsocks) +/*********************************************************************** + * + * smtp_perform_rcpt_to() + * + * Sends a RCPT TO command for a given recipient as part of the message upload + * process. + */ +static CURLcode smtp_perform_rcpt_to(struct connectdata *conn) { - return Curl_pp_getsock(&conn->proto.smtpc.pp, socks, numsocks); + CURLcode result = CURLE_OK; + struct SessionHandle *data = conn->data; + struct SMTP *smtp = data->req.protop; + + /* Send the RCPT TO command */ + if(smtp->rcpt) { + if(smtp->rcpt->data[0] == '<') + result = Curl_pp_sendf(&conn->proto.smtpc.pp, "RCPT TO:%s", + smtp->rcpt->data); + else + result = Curl_pp_sendf(&conn->proto.smtpc.pp, "RCPT TO:<%s>", + smtp->rcpt->data); + if(!result) + state(conn, SMTP_RCPT); + } + + return result; } -#ifdef USE_SSL -static void smtp_to_smtps(struct connectdata *conn) +/*********************************************************************** + * + * smtp_perform_quit() + * + * Performs the quit action prior to sclose() being called. + */ +static CURLcode smtp_perform_quit(struct connectdata *conn) { - conn->handler = &Curl_handler_smtps; + CURLcode result = CURLE_OK; + + /* Send the QUIT command */ + result = Curl_pp_sendf(&conn->proto.smtpc.pp, "%s", "QUIT"); + + if(!result) + state(conn, SMTP_QUIT); + + return result; } -#else -#define smtp_to_smtps(x) Curl_nop_stmt -#endif /* For the initial server greeting */ static CURLcode smtp_state_servergreet_resp(struct connectdata *conn, @@ -472,10 +701,10 @@ static CURLcode smtp_state_servergreet_resp(struct connectdata *conn, if(smtpcode/100 != 2) { failf(data, "Got unexpected smtp-server response: %d", smtpcode); - return CURLE_FTP_WEIRD_SERVER_REPLY; + result = CURLE_FTP_WEIRD_SERVER_REPLY; } - - result = smtp_state_ehlo(conn); + else + result = smtp_perform_ehlo(conn); return result; } @@ -496,30 +725,10 @@ static CURLcode smtp_state_starttls_resp(struct connectdata *conn, result = CURLE_USE_SSL_FAILED; } else - result = smtp_authenticate(conn); + result = smtp_perform_authenticate(conn); } else - result = smtp_state_upgrade_tls(conn); - - return result; -} - -static CURLcode smtp_state_upgrade_tls(struct connectdata *conn) -{ - struct smtp_conn *smtpc = &conn->proto.smtpc; - CURLcode result; - - result = Curl_ssl_connect_nonblocking(conn, FIRSTSOCKET, &smtpc->ssldone); - - if(!result) { - if(smtpc->state != SMTP_UPGRADETLS) - state(conn, SMTP_UPGRADETLS); - - if(smtpc->ssldone) { - smtp_to_smtps(conn); - result = smtp_state_ehlo(conn); - } - } + result = smtp_perform_upgrade_tls(conn); return result; } @@ -530,27 +739,34 @@ static CURLcode smtp_state_ehlo_resp(struct connectdata *conn, int smtpcode, { CURLcode result = CURLE_OK; struct SessionHandle *data = conn->data; + struct smtp_conn *smtpc = &conn->proto.smtpc; (void)instate; /* no use for this yet */ if(smtpcode/100 != 2) { if((data->set.use_ssl <= CURLUSESSL_TRY || conn->ssl[FIRSTSOCKET].use) && !conn->bits.user_passwd) - result = smtp_state_helo(conn); + result = smtp_perform_helo(conn); else { failf(data, "Remote access denied: %d", smtpcode); result = CURLE_REMOTE_ACCESS_DENIED; } } else if(data->set.use_ssl && !conn->ssl[FIRSTSOCKET].use) { - /* We don't have a SSL/TLS connection yet, but SSL is requested. Switch - to TLS connection now */ - result = Curl_pp_sendf(&conn->proto.smtpc.pp, "STARTTLS"); - if(!result) - state(conn, SMTP_STARTTLS); + /* We don't have a SSL/TLS connection yet, but SSL is requested */ + if(smtpc->tls_supported) + /* Switch to TLS connection now */ + result = smtp_perform_starttls(conn); + else if(data->set.use_ssl == CURLUSESSL_TRY) + /* Fallback and carry on with authentication */ + result = smtp_perform_authenticate(conn); + else { + failf(data, "STARTTLS not supported."); + result = CURLE_USE_SSL_FAILED; + } } else - result = smtp_authenticate(conn); + result = smtp_perform_authenticate(conn); return result; } @@ -602,7 +818,7 @@ static CURLcode smtp_state_auth_plain_resp(struct connectdata *conn, result = Curl_pp_sendf(&conn->proto.smtpc.pp, "%s", plainauth); if(!result) - state(conn, SMTP_AUTH); + state(conn, SMTP_AUTH_FINAL); } Curl_safefree(plainauth); @@ -639,7 +855,7 @@ static CURLcode smtp_state_auth_login_resp(struct connectdata *conn, result = Curl_pp_sendf(&conn->proto.smtpc.pp, "%s", authuser); if(!result) - state(conn, SMTP_AUTH_PASSWD); + state(conn, SMTP_AUTH_LOGIN_PASSWD); } Curl_safefree(authuser); @@ -649,10 +865,10 @@ static CURLcode smtp_state_auth_login_resp(struct connectdata *conn, return result; } -/* For responses to user entry of AUTH LOGIN */ -static CURLcode smtp_state_auth_passwd_resp(struct connectdata *conn, - int smtpcode, - smtpstate instate) +/* For AUTH LOGIN user entry responses */ +static CURLcode smtp_state_auth_login_password_resp(struct connectdata *conn, + int smtpcode, + smtpstate instate) { CURLcode result = CURLE_OK; struct SessionHandle *data = conn->data; @@ -676,7 +892,7 @@ static CURLcode smtp_state_auth_passwd_resp(struct connectdata *conn, result = Curl_pp_sendf(&conn->proto.smtpc.pp, "%s", authpasswd); if(!result) - state(conn, SMTP_AUTH); + state(conn, SMTP_AUTH_FINAL); } Curl_safefree(authpasswd); @@ -731,7 +947,7 @@ static CURLcode smtp_state_auth_cram_resp(struct connectdata *conn, result = Curl_pp_sendf(&conn->proto.smtpc.pp, "%s", rplyb64); if(!result) - state(conn, SMTP_AUTH); + state(conn, SMTP_AUTH_FINAL); } Curl_safefree(rplyb64); @@ -798,10 +1014,10 @@ static CURLcode smtp_state_auth_digest_resp_resp(struct connectdata *conn, } else { /* Send an empty response */ - result = Curl_pp_sendf(&conn->proto.smtpc.pp, ""); + result = Curl_pp_sendf(&conn->proto.smtpc.pp, "%s", ""); if(!result) - state(conn, SMTP_AUTH); + state(conn, SMTP_AUTH_FINAL); } return result; @@ -878,7 +1094,7 @@ static CURLcode smtp_state_auth_ntlm_type2msg_resp(struct connectdata *conn, result = Curl_pp_sendf(&conn->proto.smtpc.pp, "%s", type3msg); if(!result) - state(conn, SMTP_AUTH); + state(conn, SMTP_AUTH_FINAL); } Curl_safefree(type3msg); @@ -889,116 +1105,60 @@ static CURLcode smtp_state_auth_ntlm_type2msg_resp(struct connectdata *conn, } #endif -/* For the final responses to the AUTH sequence */ -static CURLcode smtp_state_auth_resp(struct connectdata *conn, int smtpcode, - smtpstate instate) +/* For AUTH XOAUTH2 (without initial response) responses */ +static CURLcode smtp_state_auth_xoauth2_resp(struct connectdata *conn, + int smtpcode, smtpstate instate) { CURLcode result = CURLE_OK; struct SessionHandle *data = conn->data; + size_t len = 0; + char *xoauth = NULL; (void)instate; /* no use for this yet */ - if(smtpcode != 235) { - failf(data, "Authentication failed: %d", smtpcode); + if(smtpcode != 334) { + failf(data, "Access denied: %d", smtpcode); result = CURLE_LOGIN_DENIED; } - else - /* End of connect phase */ - state(conn, SMTP_STOP); - - return result; -} - -/* Start the DO phase */ -static CURLcode smtp_mail(struct connectdata *conn) -{ - char *from = NULL; - char *auth = NULL; - char *size = NULL; - CURLcode result = CURLE_OK; - struct SessionHandle *data = conn->data; - - /* Calculate the FROM parameter */ - if(!data->set.str[STRING_MAIL_FROM]) - /* Null reverse-path, RFC-2821, sect. 3.7 */ - from = strdup("<>"); - else if(data->set.str[STRING_MAIL_FROM][0] == '<') - from = aprintf("%s", data->set.str[STRING_MAIL_FROM]); - else - from = aprintf("<%s>", data->set.str[STRING_MAIL_FROM]); - - if(!from) - return CURLE_OUT_OF_MEMORY; + else { + /* Create the authorisation message */ + result = Curl_sasl_create_xoauth2_message(conn->data, conn->user, + conn->xoauth2_bearer, + &xoauth, &len); - /* Calculate the optional AUTH parameter */ - if(data->set.str[STRING_MAIL_AUTH] && conn->proto.smtpc.authused) { - if(data->set.str[STRING_MAIL_AUTH][0] != '\0') - auth = aprintf("%s", data->set.str[STRING_MAIL_AUTH]); - else - /* Empty AUTH, RFC-2554, sect. 5 */ - auth = strdup("<>"); + /* Send the message */ + if(!result) { + if(xoauth) { + result = Curl_pp_sendf(&conn->proto.smtpc.pp, "%s", xoauth); - if(!auth) { - Curl_safefree(from); + if(!result) + state(conn, SMTP_AUTH_FINAL); + } - return CURLE_OUT_OF_MEMORY; + Curl_safefree(xoauth); } } - /* calculate the optional SIZE parameter */ - if(conn->proto.smtpc.size_supported && conn->data->set.infilesize > 0) { - size = aprintf("%" FORMAT_OFF_T, data->set.infilesize); - - if(!size) { - Curl_safefree(from); - Curl_safefree(auth); - - return CURLE_OUT_OF_MEMORY; - } - } - - /* Send the MAIL command */ - if(!auth && !size) - result = Curl_pp_sendf(&conn->proto.smtpc.pp, - "MAIL FROM:%s", from); - else if(auth && !size) - result = Curl_pp_sendf(&conn->proto.smtpc.pp, - "MAIL FROM:%s AUTH=%s", from, auth); - else if(auth && size) - result = Curl_pp_sendf(&conn->proto.smtpc.pp, - "MAIL FROM:%s AUTH=%s SIZE=%s", from, auth, size); - else - result = Curl_pp_sendf(&conn->proto.smtpc.pp, - "MAIL FROM:%s SIZE=%s", from, size); - - Curl_safefree(from); - Curl_safefree(auth); - Curl_safefree(size); - - if(result) - return result; - - state(conn, SMTP_MAIL); - return result; } -static CURLcode smtp_rcpt_to(struct connectdata *conn) +/* For the final responses to the AUTH sequence */ +static CURLcode smtp_state_auth_final_resp(struct connectdata *conn, + int smtpcode, + smtpstate instate) { CURLcode result = CURLE_OK; - struct smtp_conn *smtpc = &conn->proto.smtpc; + struct SessionHandle *data = conn->data; - /* Send the RCPT TO command */ - if(smtpc->rcpt) { - if(smtpc->rcpt->data[0] == '<') - result = Curl_pp_sendf(&conn->proto.smtpc.pp, "RCPT TO:%s", - smtpc->rcpt->data); - else - result = Curl_pp_sendf(&conn->proto.smtpc.pp, "RCPT TO:<%s>", - smtpc->rcpt->data); - if(!result) - state(conn, SMTP_RCPT); + (void)instate; /* no use for this yet */ + + if(smtpcode != 235) { + failf(data, "Authentication failed: %d", smtpcode); + result = CURLE_LOGIN_DENIED; } + else + /* End of connect phase */ + state(conn, SMTP_STOP); return result; } @@ -1009,6 +1169,7 @@ static CURLcode smtp_state_mail_resp(struct connectdata *conn, int smtpcode, { CURLcode result = CURLE_OK; struct SessionHandle *data = conn->data; + struct SMTP *smtp = data->req.protop; (void)instate; /* no use for this yet */ @@ -1018,10 +1179,9 @@ static CURLcode smtp_state_mail_resp(struct connectdata *conn, int smtpcode, state(conn, SMTP_STOP); } else { - struct smtp_conn *smtpc = &conn->proto.smtpc; - smtpc->rcpt = data->set.mail_rcpt; + smtp->rcpt = data->set.mail_rcpt; - result = smtp_rcpt_to(conn); + result = smtp_perform_rcpt_to(conn); } return result; @@ -1033,6 +1193,7 @@ static CURLcode smtp_state_rcpt_resp(struct connectdata *conn, int smtpcode, { CURLcode result = CURLE_OK; struct SessionHandle *data = conn->data; + struct SMTP *smtp = data->req.protop; (void)instate; /* no use for this yet */ @@ -1042,24 +1203,20 @@ static CURLcode smtp_state_rcpt_resp(struct connectdata *conn, int smtpcode, state(conn, SMTP_STOP); } else { - struct smtp_conn *smtpc = &conn->proto.smtpc; - - if(smtpc->rcpt) { - smtpc->rcpt = smtpc->rcpt->next; - result = smtp_rcpt_to(conn); + if(smtp->rcpt) { + smtp->rcpt = smtp->rcpt->next; + result = smtp_perform_rcpt_to(conn); /* If we failed or still are sending RCPT data then return */ - if(result || smtpc->rcpt) + if(result || smtp->rcpt) return result; } /* Send the DATA command */ - result = Curl_pp_sendf(&conn->proto.smtpc.pp, "DATA"); + result = Curl_pp_sendf(&conn->proto.smtpc.pp, "%s", "DATA"); - if(result) - return result; - - state(conn, SMTP_DATA); + if(!result) + state(conn, SMTP_DATA); } return result; @@ -1070,7 +1227,6 @@ static CURLcode smtp_state_data_resp(struct connectdata *conn, int smtpcode, smtpstate instate) { struct SessionHandle *data = conn->data; - struct FTP *smtp = data->state.proto.smtp; (void)instate; /* no use for this yet */ @@ -1079,11 +1235,13 @@ static CURLcode smtp_state_data_resp(struct connectdata *conn, int smtpcode, return CURLE_SEND_ERROR; } + /* Set the progress upload size */ + Curl_pgrsSetUploadSize(data, data->set.infilesize); + /* SMTP upload */ - Curl_setup_transfer(conn, -1, -1, FALSE, NULL, /* no download */ - FIRSTSOCKET, smtp->bytecountp); + Curl_setup_transfer(conn, -1, -1, FALSE, NULL, FIRSTSOCKET, NULL); - /* End of do phase */ + /* End of DO phase */ state(conn, SMTP_STOP); return CURLE_OK; @@ -1102,7 +1260,7 @@ static CURLcode smtp_state_postdata_resp(struct connectdata *conn, if(smtpcode != 250) result = CURLE_RECV_ERROR; - /* End of done phase */ + /* End of DONE phase */ state(conn, SMTP_STOP); return result; @@ -1110,7 +1268,7 @@ static CURLcode smtp_state_postdata_resp(struct connectdata *conn, static CURLcode smtp_statemach_act(struct connectdata *conn) { - CURLcode result; + CURLcode result = CURLE_OK; curl_socket_t sock = conn->sock[FIRSTSOCKET]; struct SessionHandle *data = conn->data; int smtpcode; @@ -1120,7 +1278,7 @@ static CURLcode smtp_statemach_act(struct connectdata *conn) /* Busy upgrading the connection; right now all I/O is SSL/TLS, not SMTP */ if(smtpc->state == SMTP_UPGRADETLS) - return smtp_state_upgrade_tls(conn); + return smtp_perform_upgrade_tls(conn); /* Flush any data that needs to be sent */ if(pp->sendleft) @@ -1162,8 +1320,9 @@ static CURLcode smtp_statemach_act(struct connectdata *conn) result = smtp_state_auth_login_resp(conn, smtpcode, smtpc->state); break; - case SMTP_AUTH_PASSWD: - result = smtp_state_auth_passwd_resp(conn, smtpcode, smtpc->state); + case SMTP_AUTH_LOGIN_PASSWD: + result = smtp_state_auth_login_password_resp(conn, smtpcode, + smtpc->state); break; #ifndef CURL_DISABLE_CRYPTO_AUTH @@ -1191,8 +1350,12 @@ static CURLcode smtp_statemach_act(struct connectdata *conn) break; #endif - case SMTP_AUTH: - result = smtp_state_auth_resp(conn, smtpcode, smtpc->state); + case SMTP_AUTH_XOAUTH2: + result = smtp_state_auth_xoauth2_resp(conn, smtpcode, smtpc->state); + break; + + case SMTP_AUTH_FINAL: + result = smtp_state_auth_final_resp(conn, smtpcode, smtpc->state); break; case SMTP_MAIL: @@ -1226,30 +1389,28 @@ static CURLcode smtp_statemach_act(struct connectdata *conn) /* Called repeatedly until done from multi.c */ static CURLcode smtp_multi_statemach(struct connectdata *conn, bool *done) { + CURLcode result = CURLE_OK; struct smtp_conn *smtpc = &conn->proto.smtpc; - CURLcode result; - if((conn->handler->flags & PROTOPT_SSL) && !smtpc->ssldone) + if((conn->handler->flags & PROTOPT_SSL) && !smtpc->ssldone) { result = Curl_ssl_connect_nonblocking(conn, FIRSTSOCKET, &smtpc->ssldone); - else - result = Curl_pp_multi_statemach(&smtpc->pp); + if(result || !smtpc->ssldone) + return result; + } + result = Curl_pp_statemach(&smtpc->pp, FALSE); *done = (smtpc->state == SMTP_STOP) ? TRUE : FALSE; return result; } -static CURLcode smtp_easy_statemach(struct connectdata *conn) +static CURLcode smtp_block_statemach(struct connectdata *conn) { - struct smtp_conn *smtpc = &conn->proto.smtpc; - struct pingpong *pp = &smtpc->pp; CURLcode result = CURLE_OK; + struct smtp_conn *smtpc = &conn->proto.smtpc; - while(smtpc->state != SMTP_STOP) { - result = Curl_pp_easy_statemach(pp); - if(result) - break; - } + while(smtpc->state != SMTP_STOP && !result) + result = Curl_pp_statemach(&smtpc->pp, TRUE); return result; } @@ -1258,26 +1419,22 @@ static CURLcode smtp_easy_statemach(struct connectdata *conn) required */ static CURLcode smtp_init(struct connectdata *conn) { + CURLcode result = CURLE_OK; struct SessionHandle *data = conn->data; - struct FTP *smtp = data->state.proto.smtp; + struct SMTP *smtp; - if(!smtp) { - smtp = data->state.proto.smtp = calloc(sizeof(struct FTP), 1); - if(!smtp) - return CURLE_OUT_OF_MEMORY; - } - - /* Get some initial data into the smtp struct */ - smtp->bytecountp = &data->req.bytecount; + smtp = data->req.protop = calloc(sizeof(struct SMTP), 1); + if(!smtp) + result = CURLE_OUT_OF_MEMORY; - /* No need to duplicate user+password, the connectdata struct won't change - during a session, but we re-init them here since on subsequent inits - since the conn struct may have changed or been replaced. - */ - smtp->user = conn->user; - smtp->passwd = conn->passwd; + return result; +} - return CURLE_OK; +/* For the SMTP "protocol connect" and "doing" phases only */ +static int smtp_getsock(struct connectdata *conn, curl_socket_t *socks, + int numsocks) +{ + return Curl_pp_getsock(&conn->proto.smtpc.pp, socks, numsocks); } /*********************************************************************** @@ -1288,54 +1445,38 @@ static CURLcode smtp_init(struct connectdata *conn) * the connection phase. * * The variable pointed to by 'done' will be TRUE if the protocol-layer - * connect phase is done when this function returns, or FALSE if not. When - * called as a part of the easy interface, it will always be TRUE. + * connect phase is done when this function returns, or FALSE if not. */ static CURLcode smtp_connect(struct connectdata *conn, bool *done) { - CURLcode result; + CURLcode result = CURLE_OK; struct smtp_conn *smtpc = &conn->proto.smtpc; struct pingpong *pp = &smtpc->pp; - const char *path = conn->data->state.path; - char localhost[HOSTNAME_MAX + 1]; *done = FALSE; /* default to not done yet */ - /* If there already is a protocol-specific struct allocated for this - sessionhandle, deal with it */ - Curl_reset_reqproto(conn); - - result = smtp_init(conn); - if(CURLE_OK != result) - return result; - - /* We always support persistent connections on smtp */ + /* We always support persistent connections in SMTP */ conn->bits.close = FALSE; - pp->response_time = RESP_TIMEOUT; /* set default response time-out */ - pp->statemach_act = smtp_statemach_act; - pp->endofresp = smtp_endofresp; - pp->conn = conn; - - /* Initialise the response reader stuff */ - Curl_pp_init(pp); - /* Set the default response time-out */ pp->response_time = RESP_TIMEOUT; pp->statemach_act = smtp_statemach_act; pp->endofresp = smtp_endofresp; pp->conn = conn; - /* Calculate the path if necessary */ - if(!*path) { - if(!Curl_gethostname(localhost, sizeof(localhost))) - path = localhost; - else - path = "localhost"; - } + /* Set the default preferred authentication mechanism */ + smtpc->prefmech = SASL_AUTH_ANY; - /* URL decode the path and use it as the domain in our EHLO */ - result = Curl_urldecode(conn->data, path, 0, &smtpc->domain, NULL, TRUE); + /* Initialise the pingpong layer */ + Curl_pp_init(pp); + + /* Parse the URL options */ + result = smtp_parse_url_options(conn); + if(result) + return result; + + /* Parse the URL path */ + result = smtp_parse_url_path(conn); if(result) return result; @@ -1359,19 +1500,21 @@ static CURLcode smtp_connect(struct connectdata *conn, bool *done) static CURLcode smtp_done(struct connectdata *conn, CURLcode status, bool premature) { - struct SessionHandle *data = conn->data; - struct FTP *smtp = data->state.proto.smtp; CURLcode result = CURLE_OK; + struct SessionHandle *data = conn->data; + struct SMTP *smtp = data->req.protop; + struct pingpong *pp = &conn->proto.smtpc.pp; + const char *eob; + ssize_t len; ssize_t bytes_written; (void)premature; if(!smtp) - /* When the easy handle is removed from the multi while libcurl is still - * trying to resolve the host name, it seems that the smtp struct is not - * yet initialized, but the removal action calls Curl_done() which calls - * this function. So we simply return success if no smtp pointer is set. - */ + /* When the easy handle is removed from the multi interface while libcurl + is still trying to resolve the host name, the SMTP struct is not yet + initialized. However, the removal action calls Curl_done() which in + turn calls this function, so we simply return success. */ return CURLE_OK; if(status) { @@ -1379,25 +1522,27 @@ static CURLcode smtp_done(struct connectdata *conn, CURLcode status, result = status; /* use the already set error code */ } else if(!data->set.connect_only) { - struct smtp_conn *smtpc = &conn->proto.smtpc; - struct pingpong *pp = &smtpc->pp; + /* Calculate the EOB taking into account any terminating CRLF from the + previous line of the email or the CRLF of the DATA command when there + is "no mail data". RFC-5321, sect. 4.1.1.4. */ + eob = SMTP_EOB; + len = SMTP_EOB_LEN; + if(smtp->trailing_crlf || !conn->data->set.infilesize) { + eob += 2; + len -= 2; + } /* Send the end of block data */ - result = Curl_write(conn, - conn->writesockfd, /* socket to send to */ - SMTP_EOB, /* buffer pointer */ - SMTP_EOB_LEN, /* buffer size */ - &bytes_written); /* actually sent away */ - + result = Curl_write(conn, conn->writesockfd, eob, len, &bytes_written); if(result) return result; - if(bytes_written != SMTP_EOB_LEN) { + if(bytes_written != len) { /* The whole chunk was not sent so keep it around and adjust the pingpong structure accordingly */ - pp->sendthis = strdup(SMTP_EOB); - pp->sendsize = SMTP_EOB_LEN; - pp->sendleft = SMTP_EOB_LEN - bytes_written; + pp->sendthis = strdup(eob); + pp->sendsize = len; + pp->sendleft = len - bytes_written; } else /* Successfully sent so adjust the response timeout relative to now */ @@ -1412,10 +1557,10 @@ static CURLcode smtp_done(struct connectdata *conn, CURLcode status, non-blocking DONE operations, not in the multi state machine and with Curl_done() invokes on several places in the code! */ - result = smtp_easy_statemach(conn); + result = smtp_block_statemach(conn); } - /* Clear the transfer mode for the next connection */ + /* Clear the transfer mode for the next request */ smtp->transfer = FTPTRANSFER_BODY; return result; @@ -1425,8 +1570,8 @@ static CURLcode smtp_done(struct connectdata *conn, CURLcode status, * * smtp_perform() * - * This is the actual DO function for SMTP. Get a file/directory according to - * the options previously setup. + * This is the actual DO function for SMTP. Send a mail according to the + * options previously setup. */ static CURLcode smtp_perform(struct connectdata *conn, bool *connected, bool *dophase_done) @@ -1438,14 +1583,14 @@ static CURLcode smtp_perform(struct connectdata *conn, bool *connected, if(conn->data->set.opt_no_body) { /* Requested no body means no transfer */ - struct FTP *smtp = conn->data->state.proto.smtp; + struct SMTP *smtp = conn->data->req.protop; smtp->transfer = FTPTRANSFER_INFO; } *dophase_done = FALSE; /* not done yet */ /* Start the first command in the DO phase */ - result = smtp_mail(conn); + result = smtp_perform_mail(conn); if(result) return result; @@ -1471,45 +1616,11 @@ static CURLcode smtp_perform(struct connectdata *conn, bool *connected, */ static CURLcode smtp_do(struct connectdata *conn, bool *done) { - CURLcode retcode = CURLE_OK; - - *done = FALSE; /* default to false */ - - /* - Since connections can be re-used between SessionHandles, this might be a - connection already existing but on a fresh SessionHandle struct so we must - make sure we have a good 'struct SMTP' to play with. For new connections, - the struct SMTP is allocated and setup in the smtp_connect() function. - */ - Curl_reset_reqproto(conn); - retcode = smtp_init(conn); - if(retcode) - return retcode; - - retcode = smtp_regular_transfer(conn, done); - - return retcode; -} - -/*********************************************************************** - * - * smtp_quit() - * - * This should be called before calling sclose(). We should then wait for the - * response from the server before returning. The calling code should then try - * to close the connection. - */ -static CURLcode smtp_quit(struct connectdata *conn) -{ CURLcode result = CURLE_OK; - result = Curl_pp_sendf(&conn->proto.smtpc.pp, "QUIT"); - if(result) - return result; - - state(conn, SMTP_QUIT); + *done = FALSE; /* default to false */ - result = smtp_easy_statemach(conn); + result = smtp_regular_transfer(conn, done); return result; } @@ -1528,12 +1639,13 @@ static CURLcode smtp_disconnect(struct connectdata *conn, /* We cannot send quit unconditionally. If this connection is stale or bad in any way, sending quit and waiting around here will make the - disconnect wait in vain and cause more problems than we need to */ + disconnect wait in vain and cause more problems than we need to. */ /* The SMTP session may or may not have been allocated/setup at this point! */ if(!dead_connection && smtpc->pp.conn) - (void)smtp_quit(conn); /* ignore errors on the LOGOUT */ + if(!smtp_perform_quit(conn)) + (void)smtp_block_statemach(conn); /* ignore errors on QUIT */ /* Disconnect from the server */ Curl_pp_disconnect(&smtpc->pp); @@ -1550,7 +1662,7 @@ static CURLcode smtp_disconnect(struct connectdata *conn, /* Call this when the DO phase has completed */ static CURLcode smtp_dophase_done(struct connectdata *conn, bool connected) { - struct FTP *smtp = conn->data->state.proto.smtp; + struct SMTP *smtp = conn->data->req.protop; (void)connected; @@ -1568,12 +1680,10 @@ static CURLcode smtp_doing(struct connectdata *conn, bool *dophase_done) if(result) DEBUGF(infof(conn->data, "DO phase failed\n")); - else { - if(*dophase_done) { - result = smtp_dophase_done(conn, FALSE /* not connected */); + else if(*dophase_done) { + result = smtp_dophase_done(conn, FALSE /* not connected */); - DEBUGF(infof(conn->data, "DO phase is complete\n")); - } + DEBUGF(infof(conn->data, "DO phase is complete\n")); } return result; @@ -1598,20 +1708,18 @@ static CURLcode smtp_regular_transfer(struct connectdata *conn, /* Make sure size is unknown at this point */ data->req.size = -1; + /* Set the progress data */ Curl_pgrsSetUploadCounter(data, 0); Curl_pgrsSetDownloadCounter(data, 0); Curl_pgrsSetUploadSize(data, 0); Curl_pgrsSetDownloadSize(data, 0); + /* Carry out the perform */ result = smtp_perform(conn, &connected, dophase_done); - if(CURLE_OK == result) { - if(!*dophase_done) - /* The DO phase has not completed yet */ - return CURLE_OK; - + /* Perform post DO phase operations if necessary */ + if(!result && *dophase_done) result = smtp_dophase_done(conn, connected); - } return result; } @@ -1619,9 +1727,10 @@ static CURLcode smtp_regular_transfer(struct connectdata *conn, static CURLcode smtp_setup_connection(struct connectdata *conn) { struct SessionHandle *data = conn->data; + CURLcode result; if(conn->bits.httpproxy && !data->set.tunnel_thru_httpproxy) { - /* Unless we have asked to tunnel smtp operations through the proxy, we + /* Unless we have asked to tunnel SMTP operations through the proxy, we switch and use HTTP operations only */ #ifndef CURL_DISABLE_HTTP if(conn->handler == &Curl_handler_smtp) @@ -1634,34 +1743,111 @@ static CURLcode smtp_setup_connection(struct connectdata *conn) return CURLE_UNSUPPORTED_PROTOCOL; #endif } + /* set it up as a HTTP connection instead */ + return conn->handler->setup_connection(conn); - /* We explicitly mark this connection as persistent here as we're doing - SMTP over HTTP and thus we accidentally avoid setting this value - otherwise */ - conn->bits.close = FALSE; #else failf(data, "SMTP over http proxy requires HTTP support built-in!"); return CURLE_UNSUPPORTED_PROTOCOL; #endif } + /* Initialise the SMTP layer */ + result = smtp_init(conn); + if(result) + return result; + data->state.path++; /* don't include the initial slash */ return CURLE_OK; } +/*********************************************************************** + * + * smtp_parse_url_options() + * + * Parse the URL login options. + */ +static CURLcode smtp_parse_url_options(struct connectdata *conn) +{ + CURLcode result = CURLE_OK; + struct smtp_conn *smtpc = &conn->proto.smtpc; + const char *options = conn->options; + const char *ptr = options; + + if(options) { + const char *key = ptr; + + while(*ptr && *ptr != '=') + ptr++; + + if(strnequal(key, "AUTH", 4)) { + const char *value = ptr + 1; + + if(strequal(value, "*")) + smtpc->prefmech = SASL_AUTH_ANY; + else if(strequal(value, SASL_MECH_STRING_LOGIN)) + smtpc->prefmech = SASL_MECH_LOGIN; + else if(strequal(value, SASL_MECH_STRING_PLAIN)) + smtpc->prefmech = SASL_MECH_PLAIN; + else if(strequal(value, SASL_MECH_STRING_CRAM_MD5)) + smtpc->prefmech = SASL_MECH_CRAM_MD5; + else if(strequal(value, SASL_MECH_STRING_DIGEST_MD5)) + smtpc->prefmech = SASL_MECH_DIGEST_MD5; + else if(strequal(value, SASL_MECH_STRING_GSSAPI)) + smtpc->prefmech = SASL_MECH_GSSAPI; + else if(strequal(value, SASL_MECH_STRING_NTLM)) + smtpc->prefmech = SASL_MECH_NTLM; + else if(strequal(value, SASL_MECH_STRING_XOAUTH2)) + smtpc->prefmech = SASL_MECH_XOAUTH2; + else + smtpc->prefmech = SASL_AUTH_NONE; + } + else + result = CURLE_URL_MALFORMAT; + } + + return result; +} + +/*********************************************************************** + * + * smtp_parse_url_path() + * + * Parse the URL path into separate path components. + */ +static CURLcode smtp_parse_url_path(struct connectdata *conn) +{ + /* The SMTP struct is already initialised in smtp_connect() */ + struct SessionHandle *data = conn->data; + struct smtp_conn *smtpc = &conn->proto.smtpc; + const char *path = data->state.path; + char localhost[HOSTNAME_MAX + 1]; + + /* Calculate the path if necessary */ + if(!*path) { + if(!Curl_gethostname(localhost, sizeof(localhost))) + path = localhost; + else + path = "localhost"; + } + + /* URL decode the path and use it as the domain in our EHLO */ + return Curl_urldecode(conn->data, path, 0, &smtpc->domain, NULL, TRUE); +} + CURLcode Curl_smtp_escape_eob(struct connectdata *conn, ssize_t nread) { /* When sending a SMTP payload we must detect CRLF. sequences making sure they are sent as CRLF.. instead, as a . on the beginning of a line will be deleted by the server when not part of an EOB terminator and a genuine CRLF.CRLF which isn't escaped will wrongly be detected as end of - data by the server. + data by the server */ ssize_t i; ssize_t si; - struct smtp_conn *smtpc = &conn->proto.smtpc; struct SessionHandle *data = conn->data; + struct SMTP *smtp = data->req.protop; /* Do we need to allocate the scatch buffer? */ if(!data->state.scratch) { @@ -1676,36 +1862,46 @@ CURLcode Curl_smtp_escape_eob(struct connectdata *conn, ssize_t nread) /* This loop can be improved by some kind of Boyer-Moore style of approach but that is saved for later... */ for(i = 0, si = 0; i < nread; i++) { - if(SMTP_EOB[smtpc->eob] == data->req.upload_fromhere[i]) - smtpc->eob++; - else if(smtpc->eob) { + if(SMTP_EOB[smtp->eob] == data->req.upload_fromhere[i]) { + smtp->eob++; + + /* Is the EOB potentially the terminating CRLF? */ + if(2 == smtp->eob || SMTP_EOB_LEN == smtp->eob) + smtp->trailing_crlf = TRUE; + else + smtp->trailing_crlf = FALSE; + } + else if(smtp->eob) { /* A previous substring matched so output that first */ - memcpy(&data->state.scratch[si], SMTP_EOB, smtpc->eob); - si += smtpc->eob; + memcpy(&data->state.scratch[si], SMTP_EOB, smtp->eob); + si += smtp->eob; /* Then compare the first byte */ if(SMTP_EOB[0] == data->req.upload_fromhere[i]) - smtpc->eob = 1; + smtp->eob = 1; else - smtpc->eob = 0; + smtp->eob = 0; + + /* Reset the trailing CRLF flag as there was more data */ + smtp->trailing_crlf = FALSE; } - /* Do we have a match for CRLF. as per RFC-2821, sect. 4.5.2 */ - if(SMTP_EOB_FIND_LEN == smtpc->eob) { + /* Do we have a match for CRLF. as per RFC-5321, sect. 4.5.2 */ + if(SMTP_EOB_FIND_LEN == smtp->eob) { /* Copy the replacement data to the target buffer */ memcpy(&data->state.scratch[si], SMTP_EOB_REPL, SMTP_EOB_REPL_LEN); si += SMTP_EOB_REPL_LEN; - smtpc->eob = 0; + smtp->eob = 0; } - else if(!smtpc->eob) + else if(!smtp->eob) data->state.scratch[si++] = data->req.upload_fromhere[i]; } - if(smtpc->eob) { + if(smtp->eob) { /* A substring matched before processing ended so output that now */ - memcpy(&data->state.scratch[si], SMTP_EOB, smtpc->eob); - si += smtpc->eob; - smtpc->eob = 0; + memcpy(&data->state.scratch[si], SMTP_EOB, smtp->eob); + si += smtp->eob; + smtp->eob = 0; } if(si != nread) { diff --git a/plugins/FTPFileYM/curl/lib/smtp.h b/plugins/FTPFileYM/curl/lib/smtp.h index d926795f5f..14429a5e7e 100644 --- a/plugins/FTPFileYM/curl/lib/smtp.h +++ b/plugins/FTPFileYM/curl/lib/smtp.h @@ -38,13 +38,14 @@ typedef enum { (multi mode only) */ SMTP_AUTH_PLAIN, SMTP_AUTH_LOGIN, - SMTP_AUTH_PASSWD, + SMTP_AUTH_LOGIN_PASSWD, SMTP_AUTH_CRAMMD5, SMTP_AUTH_DIGESTMD5, SMTP_AUTH_DIGESTMD5_RESP, SMTP_AUTH_NTLM, SMTP_AUTH_NTLM_TYPE2MSG, - SMTP_AUTH, + SMTP_AUTH_XOAUTH2, + SMTP_AUTH_FINAL, SMTP_MAIL, /* MAIL FROM */ SMTP_RCPT, /* RCPT TO */ SMTP_DATA, @@ -53,18 +54,29 @@ typedef enum { SMTP_LAST /* never used */ } smtpstate; +/* This SMTP struct is used in the SessionHandle. All SMTP data that is + connection-oriented must be in smtp_conn to properly deal with the fact that + perhaps the SessionHandle is changed between the times the connection is + used. */ +struct SMTP { + curl_pp_transfer transfer; + struct curl_slist *rcpt; /* Recipient list */ + size_t eob; /* Number of bytes of the EOB (End Of Body) that + have been received so far */ + bool trailing_crlf; /* Specifies if the tailing CRLF is present */ +}; + /* smtp_conn is used for struct connection-oriented data in the connectdata struct */ struct smtp_conn { struct pingpong pp; + smtpstate state; /* Always use smtp.c:state() to change state! */ + bool ssldone; /* Is connect() over SSL done? */ char *domain; /* Client address/name to send in the EHLO */ - size_t eob; /* Number of bytes of the EOB (End Of Body) that - have been received so far */ unsigned int authmechs; /* Accepted authentication mechanisms */ + unsigned int prefmech; /* Preferred authentication mechanism */ unsigned int authused; /* Auth mechanism used for the connection */ - smtpstate state; /* Always use smtp.c:state() to change state! */ - struct curl_slist *rcpt; /* Recipient list */ - bool ssldone; /* Is connect() over SSL done? */ + bool tls_supported; /* StartTLS capability supported by server */ bool size_supported; /* If server supports SIZE extension according to RFC 1870 */ }; diff --git a/plugins/FTPFileYM/curl/lib/socks.c b/plugins/FTPFileYM/curl/lib/socks.c index 51bb946643..b101a0de48 100644 --- a/plugins/FTPFileYM/curl/lib/socks.c +++ b/plugins/FTPFileYM/curl/lib/socks.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -196,8 +196,15 @@ CURLcode Curl_SOCKS4(const char *proxy_name, * This is currently not supporting "Identification Protocol (RFC1413)". */ socksreq[8] = 0; /* ensure empty userid is NUL-terminated */ - if(proxy_name) - strlcat((char*)socksreq + 8, proxy_name, sizeof(socksreq) - 8); + if(proxy_name) { + size_t plen = strlen(proxy_name); + if(plen >= sizeof(socksreq) - 8) { + failf(data, "Too long SOCKS proxy name, can't use!\n"); + return CURLE_COULDNT_CONNECT; + } + /* copy the proxy name WITH trailing zero */ + memcpy(socksreq + 8, proxy_name, plen+1); + } /* * Make connection diff --git a/plugins/FTPFileYM/curl/lib/socks_sspi.c b/plugins/FTPFileYM/curl/lib/socks_sspi.c index b4b23e0149..0313de3334 100644 --- a/plugins/FTPFileYM/curl/lib/socks_sspi.c +++ b/plugins/FTPFileYM/curl/lib/socks_sspi.c @@ -6,7 +6,7 @@ * \___|\___/|_| \_\_____| * * Copyright (C) 2009, 2011, Markus Moeller, <markus_moeller@compuserve.com> - * Copyright (C) 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 2012 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -260,8 +260,8 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex, /* ignore the first (VER) byte */ if(socksreq[1] == 255) { /* status / message type */ - failf(data, "User was rejected by the SOCKS5 server (%d %d).", - socksreq[0], socksreq[1]); + failf(data, "User was rejected by the SOCKS5 server (%u %u).", + (unsigned int)socksreq[0], (unsigned int)socksreq[1]); Curl_safefree(service_name); s_pSecFn->FreeCredentialsHandle(&cred_handle); s_pSecFn->DeleteSecurityContext(&sspi_context); @@ -269,8 +269,8 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex, } if(socksreq[1] != 1) { /* status / messgae type */ - failf(data, "Invalid SSPI authentication response type (%d %d).", - socksreq[0], socksreq[1]); + failf(data, "Invalid SSPI authentication response type (%u %u).", + (unsigned int)socksreq[0], (unsigned int)socksreq[1]); Curl_safefree(service_name); s_pSecFn->FreeCredentialsHandle(&cred_handle); s_pSecFn->DeleteSecurityContext(&sspi_context); @@ -494,15 +494,15 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex, /* ignore the first (VER) byte */ if(socksreq[1] == 255) { /* status / message type */ - failf(data, "User was rejected by the SOCKS5 server (%d %d).", - socksreq[0], socksreq[1]); + failf(data, "User was rejected by the SOCKS5 server (%u %u).", + (unsigned int)socksreq[0], (unsigned int)socksreq[1]); s_pSecFn->DeleteSecurityContext(&sspi_context); return CURLE_COULDNT_CONNECT; } if(socksreq[1] != 2) { /* status / message type */ - failf(data, "Invalid SSPI encryption response type (%d %d).", - socksreq[0], socksreq[1]); + failf(data, "Invalid SSPI encryption response type (%u %u).", + (unsigned int)socksreq[0], (unsigned int)socksreq[1]); s_pSecFn->DeleteSecurityContext(&sspi_context); return CURLE_COULDNT_CONNECT; } @@ -549,8 +549,8 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex, } if(sspi_w_token[1].cbBuffer != 1) { - failf(data, "Invalid SSPI encryption response length (%d).", - sspi_w_token[1].cbBuffer); + failf(data, "Invalid SSPI encryption response length (%lu).", + (unsigned long)sspi_w_token[1].cbBuffer); s_pSecFn->FreeContextBuffer(sspi_w_token[0].pvBuffer); s_pSecFn->FreeContextBuffer(sspi_w_token[1].pvBuffer); s_pSecFn->DeleteSecurityContext(&sspi_context); @@ -563,8 +563,8 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex, } else { if(sspi_w_token[0].cbBuffer != 1) { - failf(data, "Invalid SSPI encryption response length (%d).", - sspi_w_token[0].cbBuffer); + failf(data, "Invalid SSPI encryption response length (%lu).", + (unsigned long)sspi_w_token[0].cbBuffer); s_pSecFn->FreeContextBuffer(sspi_w_token[0].pvBuffer); s_pSecFn->DeleteSecurityContext(&sspi_context); return CURLE_COULDNT_CONNECT; diff --git a/plugins/FTPFileYM/curl/lib/ssh.c b/plugins/FTPFileYM/curl/lib/ssh.c index 0c7d36ecc9..c213225db4 100644 --- a/plugins/FTPFileYM/curl/lib/ssh.c +++ b/plugins/FTPFileYM/curl/lib/ssh.c @@ -149,13 +149,15 @@ static int ssh_perform_getsock(const struct connectdata *conn, number of sockets */ int numsocks); +static CURLcode ssh_setup_connection(struct connectdata *conn); + /* * SCP protocol handler. */ const struct Curl_handler Curl_handler_scp = { "SCP", /* scheme */ - ZERO_NULL, /* setup_connection */ + ssh_setup_connection, /* setup_connection */ ssh_do, /* do_it */ scp_done, /* done */ ZERO_NULL, /* do_more */ @@ -181,7 +183,7 @@ const struct Curl_handler Curl_handler_scp = { const struct Curl_handler Curl_handler_sftp = { "SFTP", /* scheme */ - ZERO_NULL, /* setup_connection */ + ssh_setup_connection, /* setup_connection */ ssh_do, /* do_it */ sftp_done, /* done */ ZERO_NULL, /* do_more */ @@ -200,7 +202,6 @@ const struct Curl_handler Curl_handler_sftp = { | PROTOPT_NOURLQUERY /* flags */ }; - static void kbd_callback(const char *name, int name_len, const char *instruction, int instruction_len, int num_prompts, @@ -392,7 +393,7 @@ static void state(struct connectdata *conn, sshstate nowstate) #if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS) if(sshc->state != nowstate) { infof(conn->data, "SFTP %p state change from %s to %s\n", - sshc, names[sshc->state], names[nowstate]); + (void *)sshc, names[sshc->state], names[nowstate]); } #endif @@ -687,7 +688,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block) { CURLcode result = CURLE_OK; struct SessionHandle *data = conn->data; - struct SSHPROTO *sftp_scp = data->state.proto.ssh; + struct SSHPROTO *sftp_scp = data->req.protop; struct ssh_conn *sshc = &conn->proto.sshc; curl_socket_t sock = conn->sock[FIRSTSOCKET]; char *new_readdir_line; @@ -2287,6 +2288,10 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block) sshc->actualcode = result; } else { + /* store this original bitmask setup to use later on if we can't + figure out a "real" bitmask */ + sshc->orig_waitfor = data->req.keepon; + /* we want to use the _sending_ function even when the socket turns out readable as the underlying libssh2 scp send function will deal with both accordingly */ @@ -2603,9 +2608,7 @@ static void ssh_block2waitfor(struct connectdata *conn, bool block) { struct ssh_conn *sshc = &conn->proto.sshc; int dir; - if(!block) - conn->waitfor = 0; - else if((dir = libssh2_session_block_directions(sshc->ssh_session))) { + if(block && (dir = libssh2_session_block_directions(sshc->ssh_session))) { /* translate the libssh2 define bits into our own bit defines */ conn->waitfor = ((dir&LIBSSH2_SESSION_BLOCK_INBOUND)?KEEP_RECV:0) | ((dir&LIBSSH2_SESSION_BLOCK_OUTBOUND)?KEEP_SEND:0); @@ -2635,7 +2638,7 @@ static CURLcode ssh_multi_statemach(struct connectdata *conn, bool *done) return result; } -static CURLcode ssh_easy_statemach(struct connectdata *conn, +static CURLcode ssh_block_statemach(struct connectdata *conn, bool duringconnect) { struct ssh_conn *sshc = &conn->proto.sshc; @@ -2689,25 +2692,14 @@ static CURLcode ssh_easy_statemach(struct connectdata *conn, /* * SSH setup and connection */ -static CURLcode ssh_init(struct connectdata *conn) +static CURLcode ssh_setup_connection(struct connectdata *conn) { - struct SessionHandle *data = conn->data; struct SSHPROTO *ssh; - struct ssh_conn *sshc = &conn->proto.sshc; - - sshc->actualcode = CURLE_OK; /* reset error code */ - sshc->secondCreateDirs =0; /* reset the create dir attempt state - variable */ - - if(data->state.proto.ssh) - return CURLE_OK; - ssh = calloc(1, sizeof(struct SSHPROTO)); + conn->data->req.protop = ssh = calloc(1, sizeof(struct SSHPROTO)); if(!ssh) return CURLE_OUT_OF_MEMORY; - data->state.proto.ssh = ssh; - return CURLE_OK; } @@ -2731,14 +2723,6 @@ static CURLcode ssh_connect(struct connectdata *conn, bool *done) function to make the re-use checks properly be able to check this bit. */ conn->bits.close = FALSE; - /* If there already is a protocol-specific struct allocated for this - sessionhandle, deal with it */ - Curl_reset_reqproto(conn); - - result = ssh_init(conn); - if(result) - return result; - if(conn->handler->protocol & CURLPROTO_SCP) { conn->recv[FIRSTSOCKET] = scp_recv; conn->send[FIRSTSOCKET] = scp_send; @@ -2856,23 +2840,16 @@ static CURLcode ssh_do(struct connectdata *conn, bool *done) CURLcode res; bool connected = 0; struct SessionHandle *data = conn->data; + struct ssh_conn *sshc = &conn->proto.sshc; *done = FALSE; /* default to false */ - /* - Since connections can be re-used between SessionHandles, this might be a - connection already existing but on a fresh SessionHandle struct so we must - make sure we have a good 'struct SSHPROTO' to play with. For new - connections, the struct SSHPROTO is allocated and setup in the - ssh_connect() function. - */ - Curl_reset_reqproto(conn); - res = ssh_init(conn); - if(res) - return res; - data->req.size = -1; /* make sure this is unknown at this point */ + sshc->actualcode = CURLE_OK; /* reset error code */ + sshc->secondCreateDirs =0; /* reset the create dir attempt state + variable */ + Curl_pgrsSetUploadCounter(data, 0); Curl_pgrsSetDownloadCounter(data, 0); Curl_pgrsSetUploadSize(data, 0); @@ -2895,14 +2872,14 @@ static CURLcode scp_disconnect(struct connectdata *conn, bool dead_connection) struct ssh_conn *ssh = &conn->proto.sshc; (void) dead_connection; - Curl_safefree(conn->data->state.proto.ssh); + Curl_safefree(conn->data->req.protop); if(ssh->ssh_session) { /* only if there's a session still around to use! */ state(conn, SSH_SESSION_DISCONNECT); - result = ssh_easy_statemach(conn, FALSE); + result = ssh_block_statemach(conn, FALSE); } return result; @@ -2913,7 +2890,7 @@ static CURLcode scp_disconnect(struct connectdata *conn, bool dead_connection) static CURLcode ssh_done(struct connectdata *conn, CURLcode status) { CURLcode result = CURLE_OK; - struct SSHPROTO *sftp_scp = conn->data->state.proto.ssh; + struct SSHPROTO *sftp_scp = conn->data->req.protop; if(status == CURLE_OK) { /* run the state-machine @@ -2923,7 +2900,7 @@ static CURLcode ssh_done(struct connectdata *conn, CURLcode status) non-blocking DONE operations, not in the multi state machine and with Curl_done() invokes on several places in the code! */ - result = ssh_easy_statemach(conn, FALSE); + result = ssh_block_statemach(conn, FALSE); } else result = status; @@ -3060,12 +3037,12 @@ static CURLcode sftp_disconnect(struct connectdata *conn, bool dead_connection) DEBUGF(infof(conn->data, "SSH DISCONNECT starts now\n")); - Curl_safefree(conn->data->state.proto.ssh); + Curl_safefree(conn->data->req.protop); if(conn->proto.sshc.ssh_session) { /* only if there's a session still around to use! */ state(conn, SSH_SFTP_SHUTDOWN); - result = ssh_easy_statemach(conn, FALSE); + result = ssh_block_statemach(conn, FALSE); } DEBUGF(infof(conn->data, "SSH DISCONNECT is done\n")); diff --git a/plugins/FTPFileYM/curl/lib/sslgen.c b/plugins/FTPFileYM/curl/lib/sslgen.c index 48758742a2..d2d0e303ec 100644 --- a/plugins/FTPFileYM/curl/lib/sslgen.c +++ b/plugins/FTPFileYM/curl/lib/sslgen.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -31,6 +31,8 @@ Curl_ossl_ - prefix for OpenSSL ones Curl_gtls_ - prefix for GnuTLS ones Curl_nss_ - prefix for NSS ones + Curl_qssl_ - prefix for QsoSSL ones + Curl_gskit_ - prefix for GSKit ones Curl_polarssl_ - prefix for PolarSSL ones Curl_cyassl_ - prefix for CyaSSL ones Curl_schannel_ - prefix for Schannel SSPI ones @@ -45,6 +47,16 @@ #include "curl_setup.h" +#ifdef HAVE_SYS_TYPES_H +#include <sys/types.h> +#endif +#ifdef HAVE_SYS_STAT_H +#include <sys/stat.h> +#endif +#ifdef HAVE_FCNTL_H +#include <fcntl.h> +#endif + #include "urldata.h" #define SSLGEN_C #include "sslgen.h" /* generic SSL protos etc */ @@ -52,17 +64,24 @@ #include "gtls.h" /* GnuTLS versions */ #include "nssg.h" /* NSS versions */ #include "qssl.h" /* QSOSSL versions */ +#include "gskit.h" /* Global Secure ToolKit versions */ #include "polarssl.h" /* PolarSSL versions */ #include "axtls.h" /* axTLS versions */ #include "cyassl.h" /* CyaSSL versions */ #include "curl_schannel.h" /* Schannel SSPI version */ #include "curl_darwinssl.h" /* SecureTransport (Darwin) version */ +#include "slist.h" #include "sendf.h" #include "rawstr.h" #include "url.h" #include "curl_memory.h" #include "progress.h" #include "share.h" +#include "timeval.h" + +#define _MPRINTF_REPLACE /* use our functions only */ +#include <curl/mprintf.h> + /* The last #include file should be: */ #include "memdebug.h" @@ -159,6 +178,62 @@ void Curl_free_ssl_config(struct ssl_config_data* sslc) Curl_safefree(sslc->random_file); } + +/* + * Curl_rand() returns a random unsigned integer, 32bit. + * + * This non-SSL function is put here only because this file is the only one + * with knowledge of what the underlying SSL libraries provide in terms of + * randomizers. + * + * NOTE: 'data' may be passed in as NULL when coming from external API without + * easy handle! + * + */ + +unsigned int Curl_rand(struct SessionHandle *data) +{ + unsigned int r; + static unsigned int randseed; + static bool seeded = FALSE; + +#ifndef have_curlssl_random + (void)data; +#else + if(data) { + Curl_ssl_random(data, (unsigned char *)&r, sizeof(r)); + return r; + } +#endif + +#ifdef RANDOM_FILE + if(!seeded) { + /* if there's a random file to read a seed from, use it */ + int fd = open(RANDOM_FILE, O_RDONLY); + if(fd > -1) { + /* read random data into the randseed variable */ + ssize_t nread = read(fd, &randseed, sizeof(randseed)); + if(nread == sizeof(randseed)) + seeded = TRUE; + close(fd); + } + } +#endif + + if(!seeded) { + struct timeval now = curlx_tvnow(); + randseed += (unsigned int)now.tv_usec + (unsigned int)now.tv_sec; + randseed = randseed * 1103515245 + 12345; + randseed = randseed * 1103515245 + 12345; + randseed = randseed * 1103515245 + 12345; + seeded = TRUE; + } + + /* Return an unsigned 32-bit pseudo-random number. */ + r = randseed = randseed * 1103515245 + 12345; + return (r << 16) | ((r >> 16) & 0xFFFF); +} + #ifdef USE_SSL /* "global" init done? */ @@ -518,17 +593,77 @@ void Curl_ssl_free_certinfo(struct SessionHandle *data) } } -#if defined(USE_SSLEAY) || defined(USE_GNUTLS) || defined(USE_NSS) || \ - defined(USE_DARWINSSL) -/* these functions are only used by some SSL backends */ +int Curl_ssl_init_certinfo(struct SessionHandle * data, + int num) +{ + struct curl_certinfo * ci = &data->info.certs; + struct curl_slist * * table; + + /* Initialize the certificate information structures. Return 0 if OK, else 1. + */ + Curl_ssl_free_certinfo(data); + ci->num_of_certs = num; + table = calloc((size_t) num, sizeof(struct curl_slist *)); + if(!table) + return 1; + + ci->certinfo = table; + return 0; +} + +CURLcode Curl_ssl_push_certinfo_len(struct SessionHandle *data, + int certnum, + const char *label, + const char *value, + size_t valuelen) +{ + struct curl_certinfo * ci = &data->info.certs; + char * output; + struct curl_slist * nl; + CURLcode res = CURLE_OK; + + /* Add an information record for a particular certificate. */ + output = curl_maprintf("%s:%.*s", label, valuelen, value); + if(!output) + return CURLE_OUT_OF_MEMORY; + + nl = Curl_slist_append_nodup(ci->certinfo[certnum], output); + if(!nl) { + free(output); + curl_slist_free_all(ci->certinfo[certnum]); + res = CURLE_OUT_OF_MEMORY; + } + + ci->certinfo[certnum] = nl; + return res; +} + +/* + * This is a convenience function for push_certinfo_len that takes a zero + * terminated value. + */ +CURLcode Curl_ssl_push_certinfo(struct SessionHandle *data, + int certnum, + const char *label, + const char *value) +{ + size_t valuelen = strlen(value); + + return Curl_ssl_push_certinfo_len(data, certnum, label, value, valuelen); +} + +/* these functions are only provided by some SSL backends */ +#ifdef have_curlssl_random void Curl_ssl_random(struct SessionHandle *data, unsigned char *entropy, size_t length) { curlssl_random(data, entropy, length); } +#endif +#ifdef have_curlssl_md5sum void Curl_ssl_md5sum(unsigned char *tmp, /* input */ size_t tmplen, unsigned char *md5sum, /* output */ @@ -536,6 +671,6 @@ void Curl_ssl_md5sum(unsigned char *tmp, /* input */ { curlssl_md5sum(tmp, tmplen, md5sum, md5len); } -#endif /* USE_SSLEAY || USE_GNUTLS || USE_NSS || USE_DARWINSSL */ +#endif #endif /* USE_SSL */ diff --git a/plugins/FTPFileYM/curl/lib/sslgen.h b/plugins/FTPFileYM/curl/lib/sslgen.h index 17ad8e343d..c7f5f0092d 100644 --- a/plugins/FTPFileYM/curl/lib/sslgen.h +++ b/plugins/FTPFileYM/curl/lib/sslgen.h @@ -33,6 +33,8 @@ bool Curl_clone_ssl_config(struct ssl_config_data* source, struct ssl_config_data* dest); void Curl_free_ssl_config(struct ssl_config_data* sslc); +unsigned int Curl_rand(struct SessionHandle *); + #ifdef USE_SSL int Curl_ssl_init(void); void Curl_ssl_cleanup(void); @@ -56,7 +58,16 @@ size_t Curl_ssl_version(char *buffer, size_t size); bool Curl_ssl_data_pending(const struct connectdata *conn, int connindex); int Curl_ssl_check_cxn(struct connectdata *conn); + +/* Certificate information list handling. */ + void Curl_ssl_free_certinfo(struct SessionHandle *data); +int Curl_ssl_init_certinfo(struct SessionHandle * data, int num); +CURLcode Curl_ssl_push_certinfo_len(struct SessionHandle * data, int certnum, + const char * label, const char * value, + size_t valuelen); +CURLcode Curl_ssl_push_certinfo(struct SessionHandle * data, int certnum, + const char * label, const char * value); /* Functions to be used by SSL library adaptation functions */ @@ -83,6 +94,13 @@ void Curl_ssl_md5sum(unsigned char *tmp, /* input */ #define SSL_SHUTDOWN_TIMEOUT 10000 /* ms */ +#ifdef have_curlssl_random +#define HAVE_CURL_SSL_RANDOM +#endif +#ifdef have_curlssl_md5sum +#define HAVE_CURL_SSL_MD5SUM +#endif + #else /* When SSL support is not present, just define away these function calls */ #define Curl_ssl_init() 1 diff --git a/plugins/FTPFileYM/curl/lib/ssluse.c b/plugins/FTPFileYM/curl/lib/ssluse.c index 4a0dba734d..c747420f60 100644 --- a/plugins/FTPFileYM/curl/lib/ssluse.c +++ b/plugins/FTPFileYM/curl/lib/ssluse.c @@ -43,6 +43,7 @@ #include "inet_pton.h" #include "ssluse.h" #include "connect.h" +#include "slist.h" #include "strequal.h" #include "select.h" #include "sslgen.h" @@ -236,27 +237,12 @@ static int ossl_seed(struct SessionHandle *data) /* If we get here, it means we need to seed the PRNG using a "silly" approach! */ - { - int len; - char *area; - - /* Changed call to RAND_seed to use the underlying RAND_add implementation - * directly. Do this in a loop, with the amount of additional entropy - * being dependent upon the algorithm used by Curl_FormBoundary(): N bytes - * of a 7-bit ascii set. -- Richard Gorton, March 11 2003. - */ - - do { - area = Curl_FormBoundary(); - if(!area) - return 3; /* out of memory */ - - len = curlx_uztosi(strlen(area)); - RAND_add(area, len, (len >> 1)); - - free(area); /* now remove the random junk */ - } while(!RAND_status()); - } + do { + unsigned char randb[64]; + int len = sizeof(randb); + RAND_bytes(randb, len); + RAND_add(randb, len, (len >> 1)); + } while(!RAND_status()); /* generates a default path for the random seed file */ buf[0]=0; /* blank it first */ @@ -308,6 +294,49 @@ static int do_file_type(const char *type) return -1; } +#if defined(HAVE_OPENSSL_ENGINE_H) && defined(HAVE_ENGINE_LOAD_FOUR_ARGS) +/* + * Supply default password to the engine user interface conversation. + * The password is passed by OpenSSL engine from ENGINE_load_private_key() + * last argument to the ui and can be obtained by UI_get0_user_data(ui) here. + */ +static int ssl_ui_reader(UI *ui, UI_STRING *uis) +{ + const char *password; + switch(UI_get_string_type(uis)) { + case UIT_PROMPT: + case UIT_VERIFY: + password = (const char*)UI_get0_user_data(ui); + if(NULL != password && + UI_get_input_flags(uis) & UI_INPUT_FLAG_DEFAULT_PWD) { + UI_set_result(ui, uis, password); + return 1; + } + default: + break; + } + return (UI_method_get_reader(UI_OpenSSL()))(ui, uis); +} + +/* + * Suppress interactive request for a default password if available. + */ +static int ssl_ui_writer(UI *ui, UI_STRING *uis) +{ + switch(UI_get_string_type(uis)) { + case UIT_PROMPT: + case UIT_VERIFY: + if(NULL != UI_get0_user_data(ui) && + UI_get_input_flags(uis) & UI_INPUT_FLAG_DEFAULT_PWD) { + return 1; + } + default: + break; + } + return (UI_method_get_writer(UI_OpenSSL()))(ui, uis); +} +#endif + static int cert_stuff(struct connectdata *conn, SSL_CTX* ctx, @@ -450,7 +479,7 @@ int cert_stuff(struct connectdata *conn, PKCS12_PBE_add(); if(!PKCS12_parse(p12, data->set.str[STRING_KEY_PASSWD], &pri, &x509, - &ca)) { + &ca)) { failf(data, "could not parse PKCS12 file, check password, OpenSSL error %s", ERR_error_string(ERR_get_error(), NULL) ); @@ -462,54 +491,53 @@ int cert_stuff(struct connectdata *conn, if(SSL_CTX_use_certificate(ctx, x509) != 1) { failf(data, SSL_CLIENT_CERT_ERR); - EVP_PKEY_free(pri); - X509_free(x509); - sk_X509_pop_free(ca, X509_free); - return 0; + goto fail; } if(SSL_CTX_use_PrivateKey(ctx, pri) != 1) { failf(data, "unable to use private key from PKCS12 file '%s'", cert_file); - EVP_PKEY_free(pri); - X509_free(x509); - sk_X509_pop_free(ca, X509_free); - return 0; + goto fail; } if(!SSL_CTX_check_private_key (ctx)) { failf(data, "private key from PKCS12 file '%s' " "does not match certificate in same file", cert_file); - EVP_PKEY_free(pri); - X509_free(x509); - sk_X509_pop_free(ca, X509_free); - return 0; + goto fail; } /* Set Certificate Verification chain */ if(ca && sk_X509_num(ca)) { for(i = 0; i < sk_X509_num(ca); i++) { - if(!SSL_CTX_add_extra_chain_cert(ctx,sk_X509_value(ca, i))) { + /* + * Note that sk_X509_pop() is used below to make sure the cert is + * removed from the stack properly before getting passed to + * SSL_CTX_add_extra_chain_cert(). Previously we used + * sk_X509_value() instead, but then we'd clean it in the subsequent + * sk_X509_pop_free() call. + */ + X509 *x = sk_X509_pop(ca); + if(!SSL_CTX_add_extra_chain_cert(ctx, x)) { failf(data, "cannot add certificate to certificate chain"); - EVP_PKEY_free(pri); - X509_free(x509); - sk_X509_pop_free(ca, X509_free); - return 0; + goto fail; } - if(!SSL_CTX_add_client_CA(ctx, sk_X509_value(ca, i))) { + /* SSL_CTX_add_client_CA() seems to work with either sk_* function, + * presumably because it duplicates what we pass to it. + */ + if(!SSL_CTX_add_client_CA(ctx, x)) { failf(data, "cannot add certificate to client CA list"); - EVP_PKEY_free(pri); - X509_free(x509); - sk_X509_pop_free(ca, X509_free); - return 0; + goto fail; } } } + cert_done = 1; + fail: EVP_PKEY_free(pri); X509_free(x509); sk_X509_pop_free(ca, X509_free); - cert_done = 1; - break; + + if(!cert_done) + return 0; /* failure! */ #else failf(data, "file type P12 for certificate not supported"); return 0; @@ -542,7 +570,16 @@ int cert_stuff(struct connectdata *conn, EVP_PKEY *priv_key = NULL; if(data->state.engine) { #ifdef HAVE_ENGINE_LOAD_FOUR_ARGS - UI_METHOD *ui_method = UI_OpenSSL(); + UI_METHOD *ui_method = + UI_create_method((char *)"cURL user interface"); + if(NULL == ui_method) { + failf(data, "unable do create OpenSSL user-interface method"); + return 0; + } + UI_method_set_opener(ui_method, UI_method_get_opener(UI_OpenSSL())); + UI_method_set_closer(ui_method, UI_method_get_closer(UI_OpenSSL())); + UI_method_set_reader(ui_method, ssl_ui_reader); + UI_method_set_writer(ui_method, ssl_ui_writer); #endif /* the typecast below was added to please mingw32 */ priv_key = (EVP_PKEY *) @@ -551,6 +588,9 @@ int cert_stuff(struct connectdata *conn, ui_method, #endif data->set.str[STRING_KEY_PASSWD]); +#ifdef HAVE_ENGINE_LOAD_FOUR_ARGS + UI_destroy_method(ui_method); +#endif if(!priv_key) { failf(data, "failed to load private key from crypto engine"); return 0; @@ -1152,6 +1192,8 @@ static CURLcode verifyhost(struct connectdata *conn, /* an alternative name field existed, but didn't match and then we MUST fail */ infof(data, "\t subjectAltName does not match %s\n", conn->host.dispname); + failf(data, "SSL: no alternative certificate subject name matches " + "target host name '%s'", conn->host.dispname); res = CURLE_PEER_FAILED_VERIFICATION; } else { @@ -1770,7 +1812,7 @@ ossl_connect_step2(struct connectdata *conn, int sockindex) */ if(CURLE_SSL_CONNECT_ERROR == rc && errdetail == 0) { failf(data, "Unknown SSL protocol error in connection to %s:%ld ", - conn->host.name, conn->port); + conn->host.name, conn->remote_port); return rc; } /* Could be a CERT problem */ @@ -1806,60 +1848,6 @@ static int asn1_object_dump(ASN1_OBJECT *a, char *buf, size_t len) return 0; } -static CURLcode push_certinfo_len(struct SessionHandle *data, - int certnum, - const char *label, - const char *value, - size_t valuelen) -{ - struct curl_certinfo *ci = &data->info.certs; - char *output; - struct curl_slist *nl; - CURLcode res = CURLE_OK; - size_t labellen = strlen(label); - size_t outlen = labellen + 1 + valuelen + 1; /* label:value\0 */ - - output = malloc(outlen); - if(!output) - return CURLE_OUT_OF_MEMORY; - - /* sprintf the label and colon */ - snprintf(output, outlen, "%s:", label); - - /* memcpy the value (it might not be zero terminated) */ - memcpy(&output[labellen+1], value, valuelen); - - /* zero terminate the output */ - output[labellen + 1 + valuelen] = 0; - - /* TODO: we should rather introduce an internal API that can do the - equivalent of curl_slist_append but doesn't strdup() the given data as - like in this place the extra malloc/free is totally pointless */ - nl = curl_slist_append(ci->certinfo[certnum], output); - free(output); - if(!nl) { - curl_slist_free_all(ci->certinfo[certnum]); - ci->certinfo[certnum] = NULL; - res = CURLE_OUT_OF_MEMORY; - } - else - ci->certinfo[certnum] = nl; - - return res; -} - -/* this is a convenience function for push_certinfo_len that takes a zero - terminated value */ -static CURLcode push_certinfo(struct SessionHandle *data, - int certnum, - const char *label, - const char *value) -{ - size_t valuelen = strlen(value); - - return push_certinfo_len(data, certnum, label, value, valuelen); -} - static void pubkey_show(struct SessionHandle *data, int num, const char *type, @@ -1883,7 +1871,7 @@ static void pubkey_show(struct SessionHandle *data, left -= 3; } infof(data, " %s: %s\n", namebuf, buffer); - push_certinfo(data, num, namebuf, buffer); + Curl_ssl_push_certinfo(data, num, namebuf, buffer); free(buffer); } } @@ -1952,7 +1940,7 @@ static int X509V3_ext(struct SessionHandle *data, } infof(data, " %s\n", buf); - push_certinfo(data, certnum, namebuf, buf); + Curl_ssl_push_certinfo(data, certnum, namebuf, buf); BIO_free(bio_out); @@ -1972,7 +1960,7 @@ static void X509_signature(struct SessionHandle *data, ptr+=snprintf(ptr, sizeof(buf)-(ptr-buf), "%02x:", sig->data[i]); infof(data, " Signature: %s\n", buf); - push_certinfo(data, numcert, "Signature", buf); + Curl_ssl_push_certinfo(data, numcert, "Signature", buf); } static void dumpcert(struct SessionHandle *data, X509 *x, int numcert) @@ -1988,30 +1976,13 @@ static void dumpcert(struct SessionHandle *data, X509 *x, int numcert) infof(data, "%s\n", biomem->data); - push_certinfo_len(data, numcert, "Cert", biomem->data, biomem->length); + Curl_ssl_push_certinfo_len(data, numcert, + "Cert", biomem->data, biomem->length); BIO_free(bio_out); } - -static int init_certinfo(struct SessionHandle *data, - int num) -{ - struct curl_certinfo *ci = &data->info.certs; - struct curl_slist **table; - - Curl_ssl_free_certinfo(data); - - ci->num_of_certs = num; - table = calloc((size_t)num, sizeof(struct curl_slist *)); - if(!table) - return 1; - - ci->certinfo = table; - return 0; -} - /* * This size was previously 512 which has been reported "too small" without * any specifics, so it was enlarged to allow more data to get shown uncut. @@ -2040,7 +2011,7 @@ static CURLcode get_cert_chain(struct connectdata *conn, } numcerts = sk_X509_num(sk); - if(init_certinfo(data, numcerts)) { + if(Curl_ssl_init_certinfo(data, numcerts)) { free(bufp); return CURLE_OUT_OF_MEMORY; } @@ -2065,16 +2036,16 @@ static CURLcode get_cert_chain(struct connectdata *conn, (void)x509_name_oneline(X509_get_subject_name(x), bufp, CERTBUFFERSIZE); infof(data, "%2d Subject: %s\n", i, bufp); - push_certinfo(data, i, "Subject", bufp); + Curl_ssl_push_certinfo(data, i, "Subject", bufp); (void)x509_name_oneline(X509_get_issuer_name(x), bufp, CERTBUFFERSIZE); infof(data, " Issuer: %s\n", bufp); - push_certinfo(data, i, "Issuer", bufp); + Curl_ssl_push_certinfo(data, i, "Issuer", bufp); value = X509_get_version(x); infof(data, " Version: %lu (0x%lx)\n", value+1, value); snprintf(bufp, CERTBUFFERSIZE, "%lx", value); - push_certinfo(data, i, "Version", bufp); /* hex */ + Curl_ssl_push_certinfo(data, i, "Version", bufp); /* hex */ num=X509_get_serialNumber(x); if(num->length <= 4) { @@ -2103,30 +2074,30 @@ static CURLcode get_cert_chain(struct connectdata *conn, bufp[0]=0; } if(bufp[0]) - push_certinfo(data, i, "Serial Number", bufp); /* hex */ + Curl_ssl_push_certinfo(data, i, "Serial Number", bufp); /* hex */ cinf = x->cert_info; j = asn1_object_dump(cinf->signature->algorithm, bufp, CERTBUFFERSIZE); if(!j) { infof(data, " Signature Algorithm: %s\n", bufp); - push_certinfo(data, i, "Signature Algorithm", bufp); + Curl_ssl_push_certinfo(data, i, "Signature Algorithm", bufp); } certdate = X509_get_notBefore(x); asn1_output(certdate, bufp, CERTBUFFERSIZE); infof(data, " Start date: %s\n", bufp); - push_certinfo(data, i, "Start date", bufp); + Curl_ssl_push_certinfo(data, i, "Start date", bufp); certdate = X509_get_notAfter(x); asn1_output(certdate, bufp, CERTBUFFERSIZE); infof(data, " Expire date: %s\n", bufp); - push_certinfo(data, i, "Expire date", bufp); + Curl_ssl_push_certinfo(data, i, "Expire date", bufp); j = asn1_object_dump(cinf->key->algor->algorithm, bufp, CERTBUFFERSIZE); if(!j) { infof(data, " Public Key Algorithm: %s\n", bufp); - push_certinfo(data, i, "Public Key Algorithm", bufp); + Curl_ssl_push_certinfo(data, i, "Public Key Algorithm", bufp); } pubkey = X509_get_pubkey(x); @@ -2138,7 +2109,7 @@ static CURLcode get_cert_chain(struct connectdata *conn, infof(data, " RSA Public Key (%d bits)\n", BN_num_bits(pubkey->pkey.rsa->n)); snprintf(bufp, CERTBUFFERSIZE, "%d", BN_num_bits(pubkey->pkey.rsa->n)); - push_certinfo(data, i, "RSA Public Key", bufp); + Curl_ssl_push_certinfo(data, i, "RSA Public Key", bufp); print_pubkey_BN(rsa, n, i); print_pubkey_BN(rsa, e, i); @@ -2220,14 +2191,7 @@ static CURLcode servercert(struct connectdata *conn, rc = x509_name_oneline(X509_get_subject_name(connssl->server_cert), buffer, BUFSIZE); - if(rc) { - if(strict) - failf(data, "SSL: couldn't get X509-subject!"); - X509_free(connssl->server_cert); - connssl->server_cert = NULL; - return CURLE_SSL_CONNECT_ERROR; - } - infof(data, "\t subject: %s\n", buffer); + infof(data, "\t subject: %s\n", rc?"[NONE]":buffer); certdate = X509_get_notBefore(connssl->server_cert); asn1_output(certdate, buffer, BUFSIZE); @@ -2389,7 +2353,7 @@ ossl_connect_step3(struct connectdata *conn, * operations. */ - if(!data->set.ssl.verifypeer) + if(!data->set.ssl.verifypeer && !data->set.ssl.verifyhost) (void)servercert(conn, connssl, FALSE); else retcode = servercert(conn, connssl, TRUE); @@ -2568,7 +2532,7 @@ static ssize_t ossl_send(struct connectdata *conn, memlen = (len > (size_t)INT_MAX) ? INT_MAX : (int)len; rc = SSL_write(conn->ssl[sockindex].handle, mem, memlen); - if(rc < 0) { + if(rc <= 0) { err = SSL_get_error(conn->ssl[sockindex].handle, rc); switch(err) { @@ -2617,7 +2581,7 @@ static ssize_t ossl_recv(struct connectdata *conn, /* connection data */ buffsize = (buffersize > (size_t)INT_MAX) ? INT_MAX : (int)buffersize; nread = (ssize_t)SSL_read(conn->ssl[num].handle, buf, buffsize); - if(nread < 0) { + if(nread <= 0) { /* failed SSL_read */ int err = SSL_get_error(conn->ssl[num].handle, (int)nread); @@ -2631,13 +2595,19 @@ static ssize_t ossl_recv(struct connectdata *conn, /* connection data */ *curlcode = CURLE_AGAIN; return -1; default: - /* openssl/ssl.h says "look at error stack/return value/errno" */ + /* openssl/ssl.h for SSL_ERROR_SYSCALL says "look at error stack/return + value/errno" */ + /* http://www.openssl.org/docs/crypto/ERR_get_error.html */ sslerror = ERR_get_error(); - failf(conn->data, "SSL read: %s, errno %d", - ERR_error_string(sslerror, error_buffer), - SOCKERRNO); - *curlcode = CURLE_RECV_ERROR; - return -1; + if((nread < 0) || sslerror) { + /* If the return code was negative or there actually is an error in the + queue */ + failf(conn->data, "SSL read: %s, errno %d", + ERR_error_string(sslerror, error_buffer), + SOCKERRNO); + *curlcode = CURLE_RECV_ERROR; + return -1; + } } } return nread; diff --git a/plugins/FTPFileYM/curl/lib/ssluse.h b/plugins/FTPFileYM/curl/lib/ssluse.h index bdec2b513e..d6efcb2717 100644 --- a/plugins/FTPFileYM/curl/lib/ssluse.h +++ b/plugins/FTPFileYM/curl/lib/ssluse.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -73,6 +73,10 @@ void Curl_ossl_md5sum(unsigned char *tmp, /* input */ unsigned char *md5sum /* output */, size_t unused); +/* this backend provides these functions: */ +#define have_curlssl_random 1 +#define have_curlssl_md5sum 1 + /* API setup for OpenSSL */ #define curlssl_init Curl_ossl_init #define curlssl_cleanup Curl_ossl_cleanup diff --git a/plugins/FTPFileYM/curl/lib/strequal.c b/plugins/FTPFileYM/curl/lib/strequal.c index f69c5bf9e7..5f2f508e21 100644 --- a/plugins/FTPFileYM/curl/lib/strequal.c +++ b/plugins/FTPFileYM/curl/lib/strequal.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -77,48 +77,3 @@ int curl_strnequal(const char *first, const char *second, size_t max) return toupper(*first) == toupper(*second); #endif } - -#ifndef HAVE_STRLCAT -/* - * The strlcat() function appends the NUL-terminated string src to the end - * of dst. It will append at most size - strlen(dst) - 1 bytes, NUL-termi- - * nating the result. - * - * The strlcpy() and strlcat() functions return the total length of the - * string they tried to create. For strlcpy() that means the length of src. - * For strlcat() that means the initial length of dst plus the length of - * src. While this may seem somewhat confusing it was done to make trunca- - * tion detection simple. - * - * - */ -size_t Curl_strlcat(char *dst, const char *src, size_t siz) -{ - char *d = dst; - const char *s = src; - size_t n = siz; - union { - ssize_t sig; - size_t uns; - } dlen; - - /* Find the end of dst and adjust bytes left but don't go past end */ - while(n-- != 0 && *d != '\0') - d++; - dlen.sig = d - dst; - n = siz - dlen.uns; - - if(n == 0) - return(dlen.uns + strlen(s)); - while(*s != '\0') { - if(n != 1) { - *d++ = *s; - n--; - } - s++; - } - *d = '\0'; - - return(dlen.uns + (s - src)); /* count does not include NUL */ -} -#endif diff --git a/plugins/FTPFileYM/curl/lib/strequal.h b/plugins/FTPFileYM/curl/lib/strequal.h index 287e042f4e..117a305b76 100644 --- a/plugins/FTPFileYM/curl/lib/strequal.h +++ b/plugins/FTPFileYM/curl/lib/strequal.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -27,10 +27,5 @@ #define strequal(a,b) curl_strequal(a,b) #define strnequal(a,b,c) curl_strnequal(a,b,c) -#ifndef HAVE_STRLCAT -#define strlcat(x,y,z) Curl_strlcat(x,y,z) -#endif -size_t strlcat(char *dst, const char *src, size_t siz); - #endif /* HEADER_CURL_STREQUAL_H */ diff --git a/plugins/FTPFileYM/curl/lib/strerror.c b/plugins/FTPFileYM/curl/lib/strerror.c index 58c6dc310b..9e8c83f726 100644 --- a/plugins/FTPFileYM/curl/lib/strerror.c +++ b/plugins/FTPFileYM/curl/lib/strerror.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 2004 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 2004 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -292,6 +292,9 @@ curl_easy_strerror(CURLcode error) case CURLE_CHUNK_FAILED: return "Chunk callback failed"; + case CURLE_NO_CONNECTION_AVAILABLE: + return "The max connection limit is reached"; + /* error codes not used by current libcurl */ case CURLE_OBSOLETE16: case CURLE_OBSOLETE20: @@ -358,6 +361,9 @@ curl_multi_strerror(CURLMcode error) case CURLM_UNKNOWN_OPTION: return "Unknown option"; + case CURLM_ADDED_ALREADY: + return "The easy handle is already added to a multi handle"; + case CURLM_LAST: break; } diff --git a/plugins/FTPFileYM/curl/lib/telnet.c b/plugins/FTPFileYM/curl/lib/telnet.c index 77d8b7b6b5..3206ee1137 100644 --- a/plugins/FTPFileYM/curl/lib/telnet.c +++ b/plugins/FTPFileYM/curl/lib/telnet.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -247,7 +247,7 @@ CURLcode init_telnet(struct connectdata *conn) if(!tn) return CURLE_OUT_OF_MEMORY; - conn->data->state.proto.telnet = (void *)tn; /* make us known */ + conn->data->req.protop = tn; /* make us known */ tn->telrcv_state = CURL_TS_DATA; @@ -292,7 +292,7 @@ CURLcode init_telnet(struct connectdata *conn) static void negotiate(struct connectdata *conn) { int i; - struct TELNET *tn = (struct TELNET *) conn->data->state.proto.telnet; + struct TELNET *tn = (struct TELNET *) conn->data->req.protop; for(i = 0;i < CURL_NTELOPTS;i++) { if(i==CURL_TELOPT_ECHO) @@ -366,7 +366,7 @@ static void send_negotiation(struct connectdata *conn, int cmd, int option) static void set_remote_option(struct connectdata *conn, int option, int newstate) { - struct TELNET *tn = (struct TELNET *)conn->data->state.proto.telnet; + struct TELNET *tn = (struct TELNET *)conn->data->req.protop; if(newstate == CURL_YES) { switch(tn->him[option]) { case CURL_NO: @@ -440,7 +440,7 @@ void set_remote_option(struct connectdata *conn, int option, int newstate) static void rec_will(struct connectdata *conn, int option) { - struct TELNET *tn = (struct TELNET *)conn->data->state.proto.telnet; + struct TELNET *tn = (struct TELNET *)conn->data->req.protop; switch(tn->him[option]) { case CURL_NO: if(tn->him_preferred[option] == CURL_YES) { @@ -488,7 +488,7 @@ void rec_will(struct connectdata *conn, int option) static void rec_wont(struct connectdata *conn, int option) { - struct TELNET *tn = (struct TELNET *)conn->data->state.proto.telnet; + struct TELNET *tn = (struct TELNET *)conn->data->req.protop; switch(tn->him[option]) { case CURL_NO: /* Already disabled */ @@ -530,7 +530,7 @@ void rec_wont(struct connectdata *conn, int option) static void set_local_option(struct connectdata *conn, int option, int newstate) { - struct TELNET *tn = (struct TELNET *)conn->data->state.proto.telnet; + struct TELNET *tn = (struct TELNET *)conn->data->req.protop; if(newstate == CURL_YES) { switch(tn->us[option]) { case CURL_NO: @@ -604,7 +604,7 @@ set_local_option(struct connectdata *conn, int option, int newstate) static void rec_do(struct connectdata *conn, int option) { - struct TELNET *tn = (struct TELNET *)conn->data->state.proto.telnet; + struct TELNET *tn = (struct TELNET *)conn->data->req.protop; switch(tn->us[option]) { case CURL_NO: if(tn->us_preferred[option] == CURL_YES) { @@ -664,7 +664,7 @@ void rec_do(struct connectdata *conn, int option) static void rec_dont(struct connectdata *conn, int option) { - struct TELNET *tn = (struct TELNET *)conn->data->state.proto.telnet; + struct TELNET *tn = (struct TELNET *)conn->data->req.protop; switch(tn->us[option]) { case CURL_NO: /* Already disabled */ @@ -825,7 +825,7 @@ static CURLcode check_telnet_options(struct connectdata *conn) char option_keyword[128]; char option_arg[256]; struct SessionHandle *data = conn->data; - struct TELNET *tn = (struct TELNET *)conn->data->state.proto.telnet; + struct TELNET *tn = (struct TELNET *)conn->data->req.protop; CURLcode result = CURLE_OK; int binary_option; @@ -935,7 +935,7 @@ static void suboption(struct connectdata *conn) char varname[128]; char varval[128]; struct SessionHandle *data = conn->data; - struct TELNET *tn = (struct TELNET *)data->state.proto.telnet; + struct TELNET *tn = (struct TELNET *)data->req.protop; printsub(data, '<', (unsigned char *)tn->subbuffer, CURL_SB_LEN(tn)+2); switch (CURL_SB_GET(tn)) { @@ -1009,7 +1009,7 @@ static void sendsuboption(struct connectdata *conn, int option) unsigned char*uc1, *uc2; struct SessionHandle *data = conn->data; - struct TELNET *tn = (struct TELNET *)data->state.proto.telnet; + struct TELNET *tn = (struct TELNET *)data->req.protop; switch (option) { case CURL_TELOPT_NAWS: @@ -1067,7 +1067,7 @@ CURLcode telrcv(struct connectdata *conn, int in = 0; int startwrite=-1; struct SessionHandle *data = conn->data; - struct TELNET *tn = (struct TELNET *)data->state.proto.telnet; + struct TELNET *tn = (struct TELNET *)data->req.protop; #define startskipping() \ if(startwrite >= 0) { \ @@ -1264,7 +1264,7 @@ static CURLcode send_telnet_data(struct connectdata *conn, static CURLcode telnet_done(struct connectdata *conn, CURLcode status, bool premature) { - struct TELNET *tn = (struct TELNET *)conn->data->state.proto.telnet; + struct TELNET *tn = (struct TELNET *)conn->data->req.protop; (void)status; /* unused */ (void)premature; /* not used */ @@ -1274,7 +1274,7 @@ static CURLcode telnet_done(struct connectdata *conn, curl_slist_free_all(tn->telnet_vars); tn->telnet_vars = NULL; - Curl_safefree(conn->data->state.proto.telnet); + Curl_safefree(conn->data->req.protop); return CURLE_OK; } @@ -1318,7 +1318,7 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done) if(code) return code; - tn = (struct TELNET *)data->state.proto.telnet; + tn = (struct TELNET *)data->req.protop; code = check_telnet_options(conn); if(code) diff --git a/plugins/FTPFileYM/curl/lib/tftp.c b/plugins/FTPFileYM/curl/lib/tftp.c index ef740b8569..f1ffd2a3ad 100644 --- a/plugins/FTPFileYM/curl/lib/tftp.c +++ b/plugins/FTPFileYM/curl/lib/tftp.c @@ -56,6 +56,7 @@ #include "multiif.h" #include "url.h" #include "rawstr.h" +#include "speedcheck.h" #define _MPRINTF_REPLACE /* use our functions only */ #include <curl/mprintf.h> @@ -947,10 +948,6 @@ static CURLcode tftp_connect(struct connectdata *conn, bool *done) blksize = TFTP_BLKSIZE_DEFAULT; - /* If there already is a protocol-specific struct allocated for this - sessionhandle, deal with it */ - Curl_reset_reqproto(conn); - state = conn->proto.tftpc = calloc(1, sizeof(tftp_state_data_t)); if(!state) return CURLE_OUT_OF_MEMORY; @@ -1259,6 +1256,15 @@ static CURLcode tftp_doing(struct connectdata *conn, bool *dophase_done) if(*dophase_done) { DEBUGF(infof(conn->data, "DO phase is complete\n")); } + else { + /* The multi code doesn't have this logic for the DOING state so we + provide it for TFTP since it may do the entire transfer in this + state. */ + if(Curl_pgrsUpdate(conn)) + result = CURLE_ABORTED_BY_CALLBACK; + else + result = Curl_speedcheck(conn->data, Curl_tvnow()); + } return result; } @@ -1307,14 +1313,6 @@ static CURLcode tftp_do(struct connectdata *conn, bool *done) *done = FALSE; - /* - Since connections can be re-used between SessionHandles, this might be a - connection already existing but on a fresh SessionHandle struct so we must - make sure we have a good 'struct TFTP' to play with. For new connections, - the struct TFTP is allocated and setup in the tftp_connect() function. - */ - Curl_reset_reqproto(conn); - if(!conn->proto.tftpc) { code = tftp_connect(conn, done); if(code) diff --git a/plugins/FTPFileYM/curl/lib/transfer.c b/plugins/FTPFileYM/curl/lib/transfer.c index 330b37a2b1..533e394b6b 100644 --- a/plugins/FTPFileYM/curl/lib/transfer.c +++ b/plugins/FTPFileYM/curl/lib/transfer.c @@ -101,11 +101,13 @@ CURLcode Curl_fillreadbuffer(struct connectdata *conn, int bytes, int *nreadp) #ifdef CURL_DOES_CONVERSIONS bool sending_http_headers = FALSE; - if((conn->handler->protocol&(CURLPROTO_HTTP|CURLPROTO_RTSP)) && - (data->state.proto.http->sending == HTTPSEND_REQUEST)) { - /* We're sending the HTTP request headers, not the data. - Remember that so we don't re-translate them into garbage. */ - sending_http_headers = TRUE; + if(conn->handler->protocol&(CURLPROTO_HTTP|CURLPROTO_RTSP)) { + const struct HTTP *http = data->req.protop; + + if(http->sending == HTTPSEND_REQUEST) + /* We're sending the HTTP request headers, not the data. + Remember that so we don't re-translate them into garbage. */ + sending_http_headers = TRUE; } #endif @@ -473,7 +475,7 @@ static CURLcode readwrite_data(struct SessionHandle *data, /* We've stopped dealing with input, get out of the do-while loop */ if(nread > 0) { - if(conn->data->multi && Curl_multi_canPipeline(conn->data->multi)) { + if(Curl_multi_pipeline_enabled(conn->data->multi)) { infof(data, "Rewinding stream by : %zd" " bytes on url %s (zero-length body)\n", @@ -540,6 +542,10 @@ static CURLcode readwrite_data(struct SessionHandle *data, if(!Curl_meets_timecondition(data, k->timeofdoc)) { *done = TRUE; + /* We're simulating a http 304 from server so we return + what should have been returned from the server */ + data->info.httpcode = 304; + infof(data, "Simulate a HTTP 304 response!\n"); /* we abort the transfer before it is completed == we ruin the re-use ability. Close the connection */ conn->bits.close = TRUE; @@ -602,8 +608,7 @@ static CURLcode readwrite_data(struct SessionHandle *data, if(dataleft != 0) { infof(conn->data, "Leftovers after chunking: %zu bytes\n", dataleft); - if(conn->data->multi && - Curl_multi_canPipeline(conn->data->multi)) { + if(Curl_multi_pipeline_enabled(conn->data->multi)) { /* only attempt the rewind if we truly are pipelining */ infof(conn->data, "Rewinding %zu bytes\n",dataleft); read_rewind(conn, dataleft); @@ -626,7 +631,7 @@ static CURLcode readwrite_data(struct SessionHandle *data, excess = (size_t)(k->bytecount + nread - k->maxdownload); if(excess > 0 && !k->ignorebody) { - if(conn->data->multi && Curl_multi_canPipeline(conn->data->multi)) { + if(Curl_multi_pipeline_enabled(conn->data->multi)) { /* The 'excess' amount below can't be more than BUFSIZE which always will fit in a size_t */ infof(data, @@ -811,9 +816,10 @@ static CURLcode readwrite_upload(struct SessionHandle *data, /* HTTP pollution, this should be written nicer to become more protocol agnostic. */ int fillcount; + struct HTTP *http = data->req.protop; if((k->exp100 == EXP100_SENDING_REQUEST) && - (data->state.proto.http->sending == HTTPSEND_BODY)) { + (http->sending == HTTPSEND_BODY)) { /* If this call is to send body data, we must take some action: We have sent off the full HTTP 1.1 request, and we shall now go into the Expect: 100 state and await such a header */ @@ -828,7 +834,7 @@ static CURLcode readwrite_upload(struct SessionHandle *data, } if(conn->handler->protocol&(CURLPROTO_HTTP|CURLPROTO_RTSP)) { - if(data->state.proto.http->sending == HTTPSEND_REQUEST) + if(http->sending == HTTPSEND_REQUEST) /* We're sending the HTTP request headers, not the data. Remember that so we don't change the line endings. */ sending_http_headers = TRUE; @@ -1853,7 +1859,7 @@ CURLcode Curl_retry_request(struct connectdata *conn, data->req.headerbytecount == 0) && conn->bits.reuse && !data->set.opt_no_body && - data->set.rtspreq != RTSPREQ_RECEIVE)) { + data->set.rtspreq != RTSPREQ_RECEIVE)) { /* We got no data, we attempted to re-use a connection and yet we want a "body". This might happen if the connection was left alive when we were done using it before, but that was closed when we wanted to read from @@ -1871,9 +1877,11 @@ CURLcode Curl_retry_request(struct connectdata *conn, transferred! */ - if((conn->handler->protocol&CURLPROTO_HTTP) && - data->state.proto.http->writebytecount) - return Curl_readrewind(conn); + if(conn->handler->protocol&CURLPROTO_HTTP) { + struct HTTP *http = data->req.protop; + if(http->writebytecount) + return Curl_readrewind(conn); + } } return CURLE_OK; } @@ -1931,6 +1939,7 @@ Curl_setup_transfer( k->keepon |= KEEP_RECV; if(conn->writesockfd != CURL_SOCKET_BAD) { + struct HTTP *http = data->req.protop; /* HTTP 1.1 magic: Even if we require a 100-return code before uploading data, we might @@ -1941,13 +1950,16 @@ Curl_setup_transfer( state info where we wait for the 100-return code */ if((data->state.expect100header) && - (data->state.proto.http->sending == HTTPSEND_BODY)) { + (conn->handler->protocol&CURLPROTO_HTTP) && + (http->sending == HTTPSEND_BODY)) { /* wait with write until we either got 100-continue or a timeout */ k->exp100 = EXP100_AWAITING_CONTINUE; k->start100 = Curl_tvnow(); - /* set a timeout for the multi interface */ - Curl_expire(data, CURL_TIMEOUT_EXPECT_100); + /* Set a timeout for the multi interface. Add the inaccuracy margin so + that we don't fire slightly too early and get denied to run. */ + Curl_expire(data, CURL_TIMEOUT_EXPECT_100 + + MULTI_TIMEOUT_INACCURACY / 1000); } else { if(data->state.expect100header) diff --git a/plugins/FTPFileYM/curl/lib/url.c b/plugins/FTPFileYM/curl/lib/url.c index 918ce58c3f..c1672d08bc 100644 --- a/plugins/FTPFileYM/curl/lib/url.c +++ b/plugins/FTPFileYM/curl/lib/url.c @@ -123,6 +123,8 @@ int curl_win32_idn_to_ascii(const char *in, char **out); #include "bundles.h" #include "conncache.h" #include "multihandle.h" +#include "pipeline.h" +#include "dotdot.h" #define _MPRINTF_REPLACE /* use our functions only */ #include <curl/mprintf.h> @@ -134,12 +136,19 @@ int curl_win32_idn_to_ascii(const char *in, char **out); /* Local static prototypes */ static struct connectdata * find_oldest_idle_connection(struct SessionHandle *data); +static struct connectdata * +find_oldest_idle_connection_in_bundle(struct SessionHandle *data, + struct connectbundle *bundle); static void conn_free(struct connectdata *conn); static void signalPipeClose(struct curl_llist *pipeline, bool pipe_broke); static CURLcode do_init(struct connectdata *conn); -static CURLcode parse_url_userpass(struct SessionHandle *data, - struct connectdata *conn, - char *user, char *passwd); +static CURLcode parse_url_login(struct SessionHandle *data, + struct connectdata *conn, + char **userptr, char **passwdptr, + char **optionsptr); +static CURLcode parse_login_details(const char *login, const size_t len, + char **userptr, char **passwdptr, + char **optionsptr); /* * Protocol table. */ @@ -257,7 +266,7 @@ static const struct Curl_handler Curl_handler_dummy = { PROTOPT_NONE /* flags */ }; -void Curl_freeset(struct SessionHandle * data) +void Curl_freeset(struct SessionHandle *data) { /* Free all dynamic strings stored in the data->set substructure. */ enum dupstring i; @@ -271,7 +280,7 @@ void Curl_freeset(struct SessionHandle * data) data->change.referer = NULL; } -static CURLcode setstropt(char **charp, char * s) +static CURLcode setstropt(char **charp, char *s) { /* Release the previous storage at `charp' and replace by a dynamic storage copy of `s'. Return CURLE_OK or CURLE_OUT_OF_MEMORY. */ @@ -290,48 +299,54 @@ static CURLcode setstropt(char **charp, char * s) return CURLE_OK; } -static CURLcode setstropt_userpwd(char *option, char **user_storage, - char **pwd_storage) +static CURLcode setstropt_userpwd(char *option, char **userp, char **passwdp, + char **optionsp) { - char* separator; CURLcode result = CURLE_OK; - - if(!option) { - /* we treat a NULL passed in as a hint to clear existing info */ - Curl_safefree(*user_storage); - *user_storage = (char *) NULL; - Curl_safefree(*pwd_storage); - *pwd_storage = (char *) NULL; - return CURLE_OK; + char *user = NULL; + char *passwd = NULL; + char *options = NULL; + + /* Parse the login details if specified. It not then we treat NULL as a hint + to clear the existing data */ + if(option) { + result = parse_login_details(option, strlen(option), + (userp ? &user : NULL), + (passwdp ? &passwd : NULL), + (optionsp ? &options : NULL)); } - separator = strchr(option, ':'); - if(separator != NULL) { + if(!result) { + /* Store the username part of option if required */ + if(userp) { + if(!user && option && option[0] == ':') { + /* Allocate an empty string instead of returning NULL as user name */ + user = strdup(""); + if(!user) + result = CURLE_OUT_OF_MEMORY; + } - /* store username part of option */ - char * p; - size_t username_len = (size_t)(separator-option); - p = malloc(username_len+1); - if(!p) - result = CURLE_OUT_OF_MEMORY; - else { - memcpy(p, option, username_len); - p[username_len] = '\0'; - Curl_safefree(*user_storage); - *user_storage = p; + Curl_safefree(*userp); + *userp = user; } - /* store password part of option */ - if(result == CURLE_OK) - result = setstropt(pwd_storage, separator+1); - } - else { - result = setstropt(user_storage, option); + /* Store the password part of option if required */ + if(passwdp) { + Curl_safefree(*passwdp); + *passwdp = passwd; + } + + /* Store the options part of option if required */ + if(optionsp) { + Curl_safefree(*optionsp); + *optionsp = options; + } } + return result; } -CURLcode Curl_dupset(struct SessionHandle * dst, struct SessionHandle * src) +CURLcode Curl_dupset(struct SessionHandle *dst, struct SessionHandle *src) { CURLcode r = CURLE_OK; enum dupstring i; @@ -403,7 +418,8 @@ CURLcode Curl_close(struct SessionHandle *data) Curl_safefree(data->state.pathbuffer); data->state.path = NULL; - Curl_safefree(data->state.proto.generic); + /* freed here just in case DONE wasn't called */ + Curl_free_request_state(data); /* Close down all open SSL info and sessions */ Curl_ssl_close_all(data); @@ -597,7 +613,6 @@ CURLcode Curl_open(struct SessionHandle **curl) res = CURLE_OUT_OF_MEMORY; } else { - Curl_easy_initHandleData(data); res = Curl_init_userdefined(&data->set); data->state.headersize=HEADERSIZE; @@ -613,12 +628,9 @@ CURLcode Curl_open(struct SessionHandle **curl) data->wildcard.state = CURLWC_INIT; data->wildcard.filelist = NULL; data->set.fnmatch = ZERO_NULL; - /* This no longer creates a connection cache here. It is instead made on - the first call to curl_easy_perform() or when the handle is added to a - multi stack. */ + data->set.maxconnects = DEFAULT_CONNCACHE_SIZE; /* for easy handles */ } - if(res) { Curl_resolver_cleanup(data->state.resolver); if(data->state.headerbuff) @@ -1134,41 +1146,44 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, if(argptr == NULL) break; + Curl_share_lock(data, CURL_LOCK_DATA_COOKIE, CURL_LOCK_ACCESS_SINGLE); + if(Curl_raw_equal(argptr, "ALL")) { /* clear all cookies */ Curl_cookie_clearall(data->cookies); - break; } else if(Curl_raw_equal(argptr, "SESS")) { /* clear session cookies */ Curl_cookie_clearsess(data->cookies); - break; } else if(Curl_raw_equal(argptr, "FLUSH")) { /* flush cookies to file */ Curl_flush_cookies(data, 0); - break; } + else { + if(!data->cookies) + /* if cookie engine was not running, activate it */ + data->cookies = Curl_cookie_init(data, NULL, NULL, TRUE); - if(!data->cookies) - /* if cookie engine was not running, activate it */ - data->cookies = Curl_cookie_init(data, NULL, NULL, TRUE); + argptr = strdup(argptr); + if(!argptr) { + result = CURLE_OUT_OF_MEMORY; + } + else { - argptr = strdup(argptr); - if(!argptr) { - result = CURLE_OUT_OF_MEMORY; - break; - } + if(checkprefix("Set-Cookie:", argptr)) + /* HTTP Header format line */ + Curl_cookie_add(data, data->cookies, TRUE, argptr + 11, NULL, NULL); - if(checkprefix("Set-Cookie:", argptr)) - /* HTTP Header format line */ - Curl_cookie_add(data, data->cookies, TRUE, argptr + 11, NULL, NULL); + else + /* Netscape format line */ + Curl_cookie_add(data, data->cookies, FALSE, argptr, NULL, NULL); - else - /* Netscape format line */ - Curl_cookie_add(data, data->cookies, FALSE, argptr, NULL, NULL); + free(argptr); + } + } + Curl_share_unlock(data, CURL_LOCK_DATA_COOKIE); - free(argptr); break; #endif /* CURL_DISABLE_COOKIES */ @@ -1188,7 +1203,12 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, * This sets a requested HTTP version to be used. The value is one of * the listed enums in curl/curl.h. */ - data->set.httpversion = va_arg(param, long); + arg = va_arg(param, long); +#ifndef USE_NGHTTP2 + if(arg == CURL_HTTP_VERSION_2_0) + return CURLE_UNSUPPORTED_PROTOCOL; +#endif + data->set.httpversion = arg; break; case CURLOPT_HTTPAUTH: @@ -1394,9 +1414,10 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, break; case CURLOPT_FILE: /* - * FILE pointer to write to or include in the data write callback + * FILE pointer to write to. Or possibly + * used as argument to the write callback. */ - data->set.out = va_arg(param, FILE *); + data->set.out = va_arg(param, void *); break; case CURLOPT_FTPPORT: /* @@ -1437,7 +1458,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, * FILE pointer to read the file to be uploaded from. Or possibly * used as argument to the read callback. */ - data->set.in = va_arg(param, FILE *); + data->set.in = va_arg(param, void *); break; case CURLOPT_INFILESIZE: /* @@ -1532,11 +1553,12 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, case CURLOPT_USERPWD: /* - * user:password to use in the operation + * user:password;options to use in the operation */ result = setstropt_userpwd(va_arg(param, char *), &data->set.str[STRING_USERNAME], - &data->set.str[STRING_PASSWORD]); + &data->set.str[STRING_PASSWORD], + &data->set.str[STRING_OPTIONS]); break; case CURLOPT_USERNAME: /* @@ -1552,6 +1574,13 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, result = setstropt(&data->set.str[STRING_PASSWORD], va_arg(param, char *)); break; + case CURLOPT_XOAUTH2_BEARER: + /* + * XOAUTH2 bearer token to use in the operation + */ + result = setstropt(&data->set.str[STRING_BEARER], + va_arg(param, char *)); + break; case CURLOPT_POSTQUOTE: /* * List of RAW FTP commands to use after a transfer @@ -1593,8 +1622,20 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, data->progress.callback = TRUE; /* no longer internal */ else data->progress.callback = FALSE; /* NULL enforces internal */ + break; + + case CURLOPT_XFERINFOFUNCTION: + /* + * Transfer info callback function + */ + data->set.fxferinfo = va_arg(param, curl_xferinfo_callback); + if(data->set.fxferinfo) + data->progress.callback = TRUE; /* no longer internal */ + else + data->progress.callback = FALSE; /* NULL enforces internal */ break; + case CURLOPT_PROGRESSDATA: /* * Custom client data to pass to the progress callback @@ -1609,7 +1650,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, */ result = setstropt_userpwd(va_arg(param, char *), &data->set.str[STRING_PROXYUSERNAME], - &data->set.str[STRING_PROXYPASSWORD]); + &data->set.str[STRING_PROXYPASSWORD], NULL); break; case CURLOPT_PROXYUSERNAME: /* @@ -1884,6 +1925,8 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, */ data->set.ssl.fsslctxp = va_arg(param, void *); break; +#endif +#if defined(USE_SSLEAY) || defined(USE_QSOSSL) || defined(USE_GSKIT) case CURLOPT_CERTINFO: data->set.ssl.certinfo = (0 != va_arg(param, long))?TRUE:FALSE; break; @@ -2241,20 +2284,27 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, break; case CURLOPT_MAIL_FROM: + /* Set the SMTP mail originator */ result = setstropt(&data->set.str[STRING_MAIL_FROM], va_arg(param, char *)); break; case CURLOPT_MAIL_AUTH: + /* Set the SMTP auth originator */ result = setstropt(&data->set.str[STRING_MAIL_AUTH], va_arg(param, char *)); break; case CURLOPT_MAIL_RCPT: - /* get a list of mail recipients */ + /* Set the list of mail recipients */ data->set.mail_rcpt = va_arg(param, struct curl_slist *); break; + case CURLOPT_SASL_IR: + /* Enable/disable SASL initial response */ + data->set.sasl_ir = (0 != va_arg(param, long)) ? TRUE : FALSE; + break; + case CURLOPT_RTSP_REQUEST: { /* @@ -2405,6 +2455,15 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, case CURLOPT_DNS_SERVERS: result = Curl_set_dns_servers(data, va_arg(param, char *)); break; + case CURLOPT_DNS_INTERFACE: + result = Curl_set_dns_interface(data, va_arg(param, char *)); + break; + case CURLOPT_DNS_LOCAL_IP4: + result = Curl_set_dns_local_ip4(data, va_arg(param, char *)); + break; + case CURLOPT_DNS_LOCAL_IP6: + result = Curl_set_dns_local_ip6(data, va_arg(param, char *)); + break; case CURLOPT_TCP_KEEPALIVE: data->set.tcp_keepalive = (0 != va_arg(param, long))?TRUE:FALSE; @@ -2450,6 +2509,8 @@ static void conn_free(struct connectdata *conn) Curl_safefree(conn->user); Curl_safefree(conn->passwd); + Curl_safefree(conn->xoauth2_bearer); + Curl_safefree(conn->options); Curl_safefree(conn->proxyuser); Curl_safefree(conn->proxypasswd); Curl_safefree(conn->allocptr.proxyuserpwd); @@ -2469,13 +2530,9 @@ static void conn_free(struct connectdata *conn) Curl_llist_destroy(conn->send_pipe, NULL); Curl_llist_destroy(conn->recv_pipe, NULL); - Curl_llist_destroy(conn->pend_pipe, NULL); - Curl_llist_destroy(conn->done_pipe, NULL); conn->send_pipe = NULL; conn->recv_pipe = NULL; - conn->pend_pipe = NULL; - conn->done_pipe = NULL; Curl_safefree(conn->localdev); Curl_free_ssl_config(&conn->ssl_config); @@ -2522,13 +2579,13 @@ CURLcode Curl_disconnect(struct connectdata *conn, bool dead_connection) data->state.authproxy.want; } - if(has_host_ntlm || has_proxy_ntlm) { + if(has_host_ntlm || has_proxy_ntlm) data->state.authproblem = FALSE; - - Curl_http_ntlm_cleanup(conn); - } } + /* Cleanup NTLM connection-related data */ + Curl_http_ntlm_cleanup(conn); + /* Cleanup possible redirect junk */ if(data->req.newurl) { free(data->req.newurl); @@ -2540,7 +2597,7 @@ CURLcode Curl_disconnect(struct connectdata *conn, bool dead_connection) conn->handler->disconnect(conn, dead_connection); /* unlink ourselves! */ - infof(data, "Closing connection %d\n", conn->connection_id); + infof(data, "Closing connection %ld\n", conn->connection_id); Curl_conncache_remove_conn(data->state.conn_cache, conn); #if defined(USE_LIBIDN) @@ -2565,15 +2622,13 @@ CURLcode Curl_disconnect(struct connectdata *conn, bool dead_connection) Curl_ssl_close(conn, FIRSTSOCKET); /* Indicate to all handles on the pipe that we're dead */ - if(Curl_isPipeliningEnabled(data)) { + if(Curl_multi_pipeline_enabled(data->multi)) { signalPipeClose(conn->send_pipe, TRUE); signalPipeClose(conn->recv_pipe, TRUE); - signalPipeClose(conn->pend_pipe, TRUE); - signalPipeClose(conn->done_pipe, FALSE); } conn_free(conn); - data->state.current_conn = NULL; + Curl_speedinit(data); return CURLE_OK; @@ -2601,7 +2656,7 @@ static bool IsPipeliningPossible(const struct SessionHandle *handle, const struct connectdata *conn) { if((conn->handler->protocol & CURLPROTO_HTTP) && - handle->multi && Curl_multi_canPipeline(handle->multi) && + Curl_multi_pipeline_enabled(handle->multi) && (handle->set.httpreq == HTTPREQ_GET || handle->set.httpreq == HTTPREQ_HEAD) && handle->set.httpversion != CURL_HTTP_VERSION_1_0) @@ -2612,10 +2667,7 @@ static bool IsPipeliningPossible(const struct SessionHandle *handle, bool Curl_isPipeliningEnabled(const struct SessionHandle *handle) { - if(handle->multi && Curl_multi_canPipeline(handle->multi)) - return TRUE; - - return FALSE; + return Curl_multi_pipeline_enabled(handle->multi); } CURLcode Curl_addHandleToPipeline(struct SessionHandle *data, @@ -2623,6 +2675,7 @@ CURLcode Curl_addHandleToPipeline(struct SessionHandle *data, { if(!Curl_llist_insert_next(pipeline, pipeline->tail, data)) return CURLE_OUT_OF_MEMORY; + infof(data, "Curl_addHandleToPipeline: length: %d\n", pipeline->size); return CURLE_OK; } @@ -2682,8 +2735,6 @@ void Curl_getoff_all_pipelines(struct SessionHandle *data, conn->readchannel_inuse = FALSE; if(Curl_removeHandleFromPipeline(data, conn->send_pipe) && send_head) conn->writechannel_inuse = FALSE; - Curl_removeHandleFromPipeline(data, conn->pend_pipe); - Curl_removeHandleFromPipeline(data, conn->done_pipe); } static void signalPipeClose(struct curl_llist *pipeline, bool pipe_broke) @@ -2714,8 +2765,8 @@ static void signalPipeClose(struct curl_llist *pipeline, bool pipe_broke) } /* - * This function kills and removes an existing connection in the connection - * cache. The connection that has been unused for the longest time. + * This function finds the connection in the connection + * cache that has been unused for the longest time. * * Returns the pointer to the oldest idle connection, or NULL if none was * found. @@ -2766,6 +2817,47 @@ find_oldest_idle_connection(struct SessionHandle *data) } /* + * This function finds the connection in the connection + * bundle that has been unused for the longest time. + * + * Returns the pointer to the oldest idle connection, or NULL if none was + * found. + */ +static struct connectdata * +find_oldest_idle_connection_in_bundle(struct SessionHandle *data, + struct connectbundle *bundle) +{ + struct curl_llist_element *curr; + long highscore=-1; + long score; + struct timeval now; + struct connectdata *conn_candidate = NULL; + struct connectdata *conn; + + (void)data; + + now = Curl_tvnow(); + + curr = bundle->conn_list->head; + while(curr) { + conn = curr->ptr; + + if(!conn->inuse) { + /* Set higher score for the age passed since the connection was used */ + score = Curl_tvdiff(now, conn->now); + + if(score > highscore) { + highscore = score; + conn_candidate = conn; + } + } + curr = curr->next; + } + + return conn_candidate; +} + +/* * Given one filled in connection struct (named needle), this function should * detect if there already is one that has all the significant details * exactly the same and thus should be used instead. @@ -2773,11 +2865,15 @@ find_oldest_idle_connection(struct SessionHandle *data) * If there is a match, this function returns TRUE - and has marked the * connection as 'in-use'. It must later be called with ConnectionDone() to * return back to 'idle' (unused) state. + * + * The force_reuse flag is set if the connection must be used, even if + * the pipelining strategy wants to open a new connection instead of reusing. */ static bool ConnectionExists(struct SessionHandle *data, struct connectdata *needle, - struct connectdata **usethis) + struct connectdata **usethis, + bool *force_reuse) { struct connectdata *check; struct connectdata *chosen = 0; @@ -2786,14 +2882,30 @@ ConnectionExists(struct SessionHandle *data, (data->state.authhost.want==CURLAUTH_NTLM_WB) ? TRUE : FALSE; struct connectbundle *bundle; + *force_reuse = FALSE; + + /* We can't pipe if the site is blacklisted */ + if(canPipeline && Curl_pipeline_site_blacklisted(data, needle)) { + canPipeline = FALSE; + } + /* Look up the bundle with all the connections to this particular host */ bundle = Curl_conncache_find_bundle(data->state.conn_cache, needle->host.name); if(bundle) { + size_t max_pipe_len = Curl_multi_max_pipeline_length(data->multi); + size_t best_pipe_len = max_pipe_len; struct curl_llist_element *curr; - infof(data, "Found bundle for host %s: %p\n", needle->host.name, bundle); + infof(data, "Found bundle for host %s: %p\n", + needle->host.name, (void *)bundle); + + /* We can't pipe if we don't know anything about the server */ + if(canPipeline && !bundle->server_supports_pipelining) { + infof(data, "Server doesn't support pipelining\n"); + canPipeline = FALSE; + } curr = bundle->conn_list->head; while(curr) { @@ -2823,7 +2935,7 @@ ConnectionExists(struct SessionHandle *data, if(dead) { check->data = data; - infof(data, "Connection %d seems to be dead!\n", + infof(data, "Connection %ld seems to be dead!\n", check->connection_id); /* disconnect resources */ @@ -2844,12 +2956,6 @@ ConnectionExists(struct SessionHandle *data, if(!IsPipeliningPossible(rh, check)) continue; } -#ifdef DEBUGBUILD - if(pipeLen > MAX_PIPELINE_LENGTH) { - infof(data, "BAD! Connection #%ld has too big pipeline!\n", - check->connection_id); - } -#endif } else { if(pipeLen > 0) { @@ -2928,6 +3034,18 @@ ConnectionExists(struct SessionHandle *data, continue; } + if((needle->handler->protocol & CURLPROTO_FTP) || + ((needle->handler->protocol & CURLPROTO_HTTP) && wantNTLM)) { + /* This is FTP or HTTP+NTLM, verify that we're using the same name + and password as well */ + if(!strequal(needle->user, check->user) || + !strequal(needle->passwd, check->passwd)) { + /* one of them was different */ + continue; + } + credentialsMatch = TRUE; + } + if(!needle->bits.httpproxy || needle->handler->flags&PROTOPT_SSL || (needle->bits.httpproxy && check->bits.httpproxy && needle->bits.tunnel_proxy && check->bits.tunnel_proxy && @@ -2961,17 +3079,6 @@ ConnectionExists(struct SessionHandle *data, continue; } } - if((needle->handler->protocol & CURLPROTO_FTP) || - ((needle->handler->protocol & CURLPROTO_HTTP) && wantNTLM)) { - /* This is FTP or HTTP+NTLM, verify that we're using the same name - and password as well */ - if(!strequal(needle->user, check->user) || - !strequal(needle->passwd, check->passwd)) { - /* one of them was different */ - continue; - } - credentialsMatch = TRUE; - } match = TRUE; } } @@ -2988,26 +3095,60 @@ ConnectionExists(struct SessionHandle *data, } if(match) { - chosen = check; + /* If we are looking for an NTLM connection, check if this is already + authenticating with the right credentials. If not, keep looking so + that we can reuse NTLM connections if possible. (Especially we + must not reuse the same connection if partway through + a handshake!) */ + if(wantNTLM) { + if(credentialsMatch && check->ntlm.state != NTLMSTATE_NONE) { + chosen = check; + + /* We must use this connection, no other */ + *force_reuse = TRUE; + break; + } + else + continue; + } - /* If we are not looking for an NTLM connection, we can choose this one - immediately. */ - if(!wantNTLM) - break; + if(canPipeline) { + /* We can pipeline if we want to. Let's continue looking for + the optimal connection to use, i.e the shortest pipe that is not + blacklisted. */ + + if(pipeLen == 0) { + /* We have the optimal connection. Let's stop looking. */ + chosen = check; + break; + } + + /* We can't use the connection if the pipe is full */ + if(pipeLen >= max_pipe_len) + continue; - /* Otherwise, check if this is already authenticating with the right - credentials. If not, keep looking so that we can reuse NTLM - connections if possible. (Especially we must reuse the same - connection if partway through a handshake!) */ - if(credentialsMatch && chosen->ntlm.state != NTLMSTATE_NONE) + /* We can't use the connection if the pipe is penalized */ + if(Curl_pipeline_penalized(data, check)) + continue; + + if(pipeLen < best_pipe_len) { + /* This connection has a shorter pipe so far. We'll pick this + and continue searching */ + chosen = check; + best_pipe_len = pipeLen; + continue; + } + } + else { + /* We have found a connection. Let's stop searching. */ + chosen = check; break; + } } } } if(chosen) { - chosen->inuse = TRUE; /* mark this as being in use so that no other - handle in a multi stack may nick it */ *usethis = chosen; return TRUE; /* yes, we found one to use! */ } @@ -3080,6 +3221,9 @@ static CURLcode ConnectionStore(struct SessionHandle *data, */ CURLcode Curl_connected_proxy(struct connectdata *conn) { + if(!conn->bits.proxy) + return CURLE_OK; + switch(conn->proxytype) { #ifndef CURL_DISABLE_PROXY case CURLPROXY_SOCKS5: @@ -3471,7 +3615,7 @@ static struct connectdata *allocate_conn(struct SessionHandle *data) conn->response_header = NULL; #endif - if(data->multi && Curl_multi_canPipeline(data->multi) && + if(Curl_multi_pipeline_enabled(data->multi) && !conn->master_buffer) { /* Allocate master_buffer to be used for pipelining */ conn->master_buffer = calloc(BUFSIZE, sizeof (char)); @@ -3482,13 +3626,10 @@ static struct connectdata *allocate_conn(struct SessionHandle *data) /* Initialize the pipeline lists */ conn->send_pipe = Curl_llist_alloc((curl_llist_dtor) llist_dtor); conn->recv_pipe = Curl_llist_alloc((curl_llist_dtor) llist_dtor); - conn->pend_pipe = Curl_llist_alloc((curl_llist_dtor) llist_dtor); - conn->done_pipe = Curl_llist_alloc((curl_llist_dtor) llist_dtor); - if(!conn->send_pipe || !conn->recv_pipe || !conn->pend_pipe || - !conn->done_pipe) + if(!conn->send_pipe || !conn->recv_pipe) goto error; -#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI) +#ifdef HAVE_GSSAPI conn->data_prot = PROT_CLEAR; #endif @@ -3511,13 +3652,9 @@ static struct connectdata *allocate_conn(struct SessionHandle *data) Curl_llist_destroy(conn->send_pipe, NULL); Curl_llist_destroy(conn->recv_pipe, NULL); - Curl_llist_destroy(conn->pend_pipe, NULL); - Curl_llist_destroy(conn->done_pipe, NULL); conn->send_pipe = NULL; conn->recv_pipe = NULL; - conn->pend_pipe = NULL; - conn->done_pipe = NULL; Curl_safefree(conn->master_buffer); Curl_safefree(conn->localdev); @@ -3573,8 +3710,8 @@ static CURLcode findprotocol(struct SessionHandle *data, static CURLcode parseurlandfillconn(struct SessionHandle *data, struct connectdata *conn, bool *prot_missing, - char *user, - char *passwd) + char **userp, char **passwdp, + char **optionsp) { char *at; char *fragment; @@ -3584,6 +3721,7 @@ static CURLcode parseurlandfillconn(struct SessionHandle *data, char protobuf[16]; const char *protop; CURLcode result; + bool rebuild_url = FALSE; *prot_missing = FALSE; @@ -3690,6 +3828,10 @@ static CURLcode parseurlandfillconn(struct SessionHandle *data, protop = "LDAP"; else if(checkprefix("IMAP.", conn->host.name)) protop = "IMAP"; + else if(checkprefix("SMTP.", conn->host.name)) + protop = "smtp"; + else if(checkprefix("POP3.", conn->host.name)) + protop = "pop3"; else { protop = "http"; } @@ -3730,12 +3872,14 @@ static CURLcode parseurlandfillconn(struct SessionHandle *data, memcpy(path+1, query, hostlen); path[0]='/'; /* prepend the missing slash */ + rebuild_url = TRUE; *query=0; /* now cut off the hostname at the ? */ } else if(!path[0]) { /* if there's no path set, use a single slash */ strcpy(path, "/"); + rebuild_url = TRUE; } /* If the URL is malformatted (missing a '/' after hostname before path) we @@ -3748,13 +3892,70 @@ static CURLcode parseurlandfillconn(struct SessionHandle *data, is bigger than the path. Use +1 to move the zero byte too. */ memmove(&path[1], path, strlen(path)+1); path[0] = '/'; + rebuild_url = TRUE; + } + else { + /* sanitise paths and remove ../ and ./ sequences according to RFC3986 */ + char *newp = Curl_dedotdotify(path); + if(!newp) + return CURLE_OUT_OF_MEMORY; + + if(strcmp(newp, path)) { + rebuild_url = TRUE; + free(data->state.pathbuffer); + data->state.pathbuffer = newp; + data->state.path = newp; + path = newp; + } + else + free(newp); } - /************************************************************* - * Parse a user name and password in the URL and strip it out - * of the host name - *************************************************************/ - result = parse_url_userpass(data, conn, user, passwd); + /* + * "rebuild_url" means that one or more URL components have been modified so + * we need to generate an updated full version. We need the corrected URL + * when communicating over HTTP proxy and we don't know at this point if + * we're using a proxy or not. + */ + if(rebuild_url) { + char *reurl; + + size_t plen = strlen(path); /* new path, should be 1 byte longer than + the original */ + size_t urllen = strlen(data->change.url); /* original URL length */ + + size_t prefixlen = strlen(conn->host.name); + + if(!*prot_missing) + prefixlen += strlen(protop) + strlen("://"); + + reurl = malloc(urllen + 2); /* 2 for zerobyte + slash */ + if(!reurl) + return CURLE_OUT_OF_MEMORY; + + /* copy the prefix */ + memcpy(reurl, data->change.url, prefixlen); + + /* append the trailing piece + zerobyte */ + memcpy(&reurl[prefixlen], path, plen + 1); + + /* possible free the old one */ + if(data->change.url_alloc) { + Curl_safefree(data->change.url); + data->change.url_alloc = FALSE; + } + + infof(data, "Rebuilt URL to: %s\n", reurl); + + data->change.url = reurl; + data->change.url_alloc = TRUE; /* free this later */ + } + + /* + * Parse the login details from the URL and strip them out of + * the host name + */ + result = parse_url_login(data, conn, userp, passwdp, optionsp); if(result != CURLE_OK) return result; @@ -3839,18 +4040,31 @@ static CURLcode setup_range(struct SessionHandle *data) } -/*************************************************************** -* Setup connection internals specific to the requested protocol. -* This MUST get called after proxy magic has been figured out. -***************************************************************/ +/* + * setup_connection_internals() - + * + * Setup connection internals specific to the requested protocol in the + * SessionHandle. This is inited and setup before the connection is made but + * is about the particular protocol that is to be used. + * + * This MUST get called after proxy magic has been figured out. + */ static CURLcode setup_connection_internals(struct connectdata *conn) { const struct Curl_handler * p; CURLcode result; - conn->socktype = SOCK_STREAM; /* most of them are TCP streams */ + /* in some case in the multi state-machine, we go back to the CONNECT state + and then a second (or third or...) call to this function will be made + without doing a DISCONNECT or DONE in between (since the connection is + yet in place) and therefore this function needs to first make sure + there's no lingering previous data allocated. */ + Curl_free_request_state(conn->data); - /* Scan protocol handler table. */ + memset(&conn->data->req, 0, sizeof(struct SingleRequest)); + conn->data->req.maxdownload = -1; + + conn->socktype = SOCK_STREAM; /* most of them are TCP streams */ /* Perform setup complement if some. */ p = conn->handler; @@ -3868,11 +4082,26 @@ static CURLcode setup_connection_internals(struct connectdata *conn) /* we check for -1 here since if proxy was detected already, this was very likely already set to the proxy port */ conn->port = p->defport; - conn->remote_port = (unsigned short)conn->given->defport; + + /* only if remote_port was not already parsed off the URL we use the + default port number */ + if(!conn->remote_port) + conn->remote_port = (unsigned short)conn->given->defport; return CURLE_OK; } +/* + * Curl_free_request_state() should free temp data that was allocated in the + * SessionHandle for this single request. + */ + +void Curl_free_request_state(struct SessionHandle *data) +{ + Curl_safefree(data->req.protop); +} + + #ifndef CURL_DISABLE_PROXY /**************************************************************** * Checks if the host is in the noproxy list. returns true if it matches @@ -4078,34 +4307,37 @@ static CURLcode parse_proxy(struct SessionHandle *data, /* Is there a username and password given in this proxy url? */ atsign = strchr(proxyptr, '@'); if(atsign) { - char proxyuser[MAX_CURL_USER_LENGTH]; - char proxypasswd[MAX_CURL_PASSWORD_LENGTH]; - proxypasswd[0] = 0; - - if(1 <= sscanf(proxyptr, - "%" MAX_CURL_USER_LENGTH_TXT"[^:@]:" - "%" MAX_CURL_PASSWORD_LENGTH_TXT "[^@]", - proxyuser, proxypasswd)) { - CURLcode res = CURLE_OK; + CURLcode res = CURLE_OK; + char *proxyuser = NULL; + char *proxypasswd = NULL; + res = parse_login_details(proxyptr, atsign - proxyptr, + &proxyuser, &proxypasswd, NULL); + if(!res) { /* found user and password, rip them out. note that we are unescaping them, as there is otherwise no way to have a username or password with reserved characters like ':' in them. */ Curl_safefree(conn->proxyuser); - conn->proxyuser = curl_easy_unescape(data, proxyuser, 0, NULL); + if(proxyuser && strlen(proxyuser) < MAX_CURL_USER_LENGTH) + conn->proxyuser = curl_easy_unescape(data, proxyuser, 0, NULL); + else + conn->proxyuser = strdup(""); if(!conn->proxyuser) res = CURLE_OUT_OF_MEMORY; else { Curl_safefree(conn->proxypasswd); - conn->proxypasswd = curl_easy_unescape(data, proxypasswd, 0, NULL); + if(proxypasswd && strlen(proxypasswd) < MAX_CURL_PASSWORD_LENGTH) + conn->proxypasswd = curl_easy_unescape(data, proxypasswd, 0, NULL); + else + conn->proxypasswd = strdup(""); if(!conn->proxypasswd) res = CURLE_OUT_OF_MEMORY; } - if(CURLE_OK == res) { + if(!res) { conn->bits.proxy_user_passwd = TRUE; /* enable it */ atsign++; /* the right side of the @-letter */ @@ -4114,10 +4346,13 @@ static CURLcode parse_proxy(struct SessionHandle *data, else res = CURLE_OUT_OF_MEMORY; } - - if(res) - return res; } + + Curl_safefree(proxyuser); + Curl_safefree(proxypasswd); + + if(res) + return res; } /* start scanning for port number at this point */ @@ -4211,8 +4446,10 @@ static CURLcode parse_proxy_auth(struct SessionHandle *data, #endif /* CURL_DISABLE_PROXY */ /* + * parse_url_login() * - * Parse a user name and password in the URL and strip it out of the host name + * Parse the login details (user name, password and options) from the URL and + * strip them out of the host name * * Inputs: data->set.use_netrc (CURLOPT_NETRC) * conn->host.name @@ -4220,80 +4457,233 @@ static CURLcode parse_proxy_auth(struct SessionHandle *data, * Outputs: (almost :- all currently undefined) * conn->bits.user_passwd - non-zero if non-default passwords exist * user - non-zero length if defined - * passwd - ditto + * passwd - non-zero length if defined + * options - non-zero length if defined * conn->host.name - remove user name and password */ -static CURLcode parse_url_userpass(struct SessionHandle *data, - struct connectdata *conn, - char *user, char *passwd) +static CURLcode parse_url_login(struct SessionHandle *data, + struct connectdata *conn, + char **user, char **passwd, char **options) { + CURLcode result = CURLE_OK; + char *userp = NULL; + char *passwdp = NULL; + char *optionsp = NULL; + /* At this point, we're hoping all the other special cases have * been taken care of, so conn->host.name is at most - * [user[:password]]@]hostname + * [user[:password][;options]]@]hostname * * We need somewhere to put the embedded details, so do that first. */ - char *ptr=strchr(conn->host.name, '@'); - char *userpass = conn->host.name; + char *ptr = strchr(conn->host.name, '@'); + char *login = conn->host.name; + + DEBUGASSERT(!**user); + DEBUGASSERT(!**passwd); + DEBUGASSERT(!**options); - user[0] =0; /* to make everything well-defined */ - passwd[0]=0; + if(!ptr) + goto out; /* We will now try to extract the - * possible user+password pair in a string like: + * possible login information in a string like: * ftp://user:password@ftp.my.site:8021/README */ - if(ptr != NULL) { - /* there's a user+password given here, to the left of the @ */ + conn->host.name = ++ptr; + + /* So the hostname is sane. Only bother interpreting the + * results if we could care. It could still be wasted + * work because it might be overtaken by the programmatically + * set user/passwd, but doing that first adds more cases here :-( + */ - conn->host.name = ++ptr; + if(data->set.use_netrc == CURL_NETRC_REQUIRED) + goto out; - /* So the hostname is sane. Only bother interpreting the - * results if we could care. It could still be wasted - * work because it might be overtaken by the programmatically - * set user/passwd, but doing that first adds more cases here :-( - */ + /* We could use the login information in the URL so extract it */ + result = parse_login_details(login, ptr - login - 1, + &userp, &passwdp, &optionsp); + if(result != CURLE_OK) + goto out; + if(userp) { + char *newname; + + /* We have a user in the URL */ conn->bits.userpwd_in_url = TRUE; - if(data->set.use_netrc != CURL_NETRC_REQUIRED) { - /* We could use the one in the URL */ + conn->bits.user_passwd = TRUE; /* enable user+password */ - conn->bits.user_passwd = TRUE; /* enable user+password */ + /* Decode the user */ + newname = curl_easy_unescape(data, userp, 0, NULL); + if(!newname) { + result = CURLE_OUT_OF_MEMORY; + goto out; + } - if(*userpass != ':') { - /* the name is given, get user+password */ - sscanf(userpass, "%" MAX_CURL_USER_LENGTH_TXT "[^:@]:" - "%" MAX_CURL_PASSWORD_LENGTH_TXT "[^@]", - user, passwd); - } - else - /* no name given, get the password only */ - sscanf(userpass, ":%" MAX_CURL_PASSWORD_LENGTH_TXT "[^@]", passwd); - - if(user[0]) { - char *newname=curl_easy_unescape(data, user, 0, NULL); - if(!newname) - return CURLE_OUT_OF_MEMORY; - if(strlen(newname) < MAX_CURL_USER_LENGTH) - strcpy(user, newname); - - /* if the new name is longer than accepted, then just use - the unconverted name, it'll be wrong but what the heck */ - free(newname); - } - if(passwd[0]) { - /* we have a password found in the URL, decode it! */ - char *newpasswd=curl_easy_unescape(data, passwd, 0, NULL); - if(!newpasswd) - return CURLE_OUT_OF_MEMORY; - if(strlen(newpasswd) < MAX_CURL_PASSWORD_LENGTH) - strcpy(passwd, newpasswd); - - free(newpasswd); - } + free(*user); + *user = newname; + } + + if(passwdp) { + /* We have a password in the URL so decode it */ + char *newpasswd = curl_easy_unescape(data, passwdp, 0, NULL); + if(!newpasswd) { + result = CURLE_OUT_OF_MEMORY; + goto out; } + + free(*passwd); + *passwd = newpasswd; } - return CURLE_OK; + + if(optionsp) { + /* We have an options list in the URL so decode it */ + char *newoptions = curl_easy_unescape(data, optionsp, 0, NULL); + if(!newoptions) { + result = CURLE_OUT_OF_MEMORY; + goto out; + } + + free(*options); + *options = newoptions; + } + + + out: + + Curl_safefree(userp); + Curl_safefree(passwdp); + Curl_safefree(optionsp); + + return result; +} + +/* + * parse_login_details() + * + * This is used to parse a login string for user name, password and options in + * the following formats: + * + * user + * user:password + * user:password;options + * user;options + * user;options:password + * :password + * :password;options + * ;options + * ;options:password + * + * Parameters: + * + * login [in] - The login string. + * len [in] - The length of the login string. + * userp [in/out] - The address where a pointer to newly allocated memory + * holding the user will be stored upon completion. + * passdwp [in/out] - The address where a pointer to newly allocated memory + * holding the password will be stored upon completion. + * optionsp [in/out] - The address where a pointer to newly allocated memory + * holding the options will be stored upon completion. + * + * Returns CURLE_OK on success. + */ +static CURLcode parse_login_details(const char *login, const size_t len, + char **userp, char **passwdp, + char **optionsp) +{ + CURLcode result = CURLE_OK; + char *ubuf = NULL; + char *pbuf = NULL; + char *obuf = NULL; + const char *psep = NULL; + const char *osep = NULL; + size_t ulen; + size_t plen; + size_t olen; + + /* Attempt to find the password separator */ + if(passwdp) { + psep = strchr(login, ':'); + + /* Within the constraint of the login string */ + if(psep >= login + len) + psep = NULL; + } + + /* Attempt to find the options separator */ + if(optionsp) { + osep = strchr(login, ';'); + + /* Within the constraint of the login string */ + if(osep >= login + len) + osep = NULL; + } + + /* Calculate the portion lengths */ + ulen = (psep ? + (size_t)(osep && psep > osep ? osep - login : psep - login) : + (osep ? (size_t)(osep - login) : len)); + plen = (psep ? + (osep && osep > psep ? (size_t)(osep - psep) : + (size_t)(login + len - psep)) - 1 : 0); + olen = (osep ? + (psep && psep > osep ? (size_t)(psep - osep) : + (size_t)(login + len - osep)) - 1 : 0); + + /* Allocate the user portion buffer */ + if(userp && ulen) { + ubuf = malloc(ulen + 1); + if(!ubuf) + result = CURLE_OUT_OF_MEMORY; + } + + /* Allocate the password portion buffer */ + if(!result && passwdp && plen) { + pbuf = malloc(plen + 1); + if(!pbuf) { + Curl_safefree(ubuf); + result = CURLE_OUT_OF_MEMORY; + } + } + + /* Allocate the options portion buffer */ + if(!result && optionsp && olen) { + obuf = malloc(olen + 1); + if(!obuf) { + Curl_safefree(pbuf); + Curl_safefree(ubuf); + result = CURLE_OUT_OF_MEMORY; + } + } + + if(!result) { + /* Store the user portion if necessary */ + if(ubuf) { + memcpy(ubuf, login, ulen); + ubuf[ulen] = '\0'; + Curl_safefree(*userp); + *userp = ubuf; + } + + /* Store the password portion if necessary */ + if(pbuf) { + memcpy(pbuf, psep + 1, plen); + pbuf[plen] = '\0'; + Curl_safefree(*passwdp); + *passwdp = pbuf; + } + + /* Store the options portion if necessary */ + if(obuf) { + memcpy(obuf, osep + 1, olen); + obuf[olen] = '\0'; + Curl_safefree(*optionsp); + *optionsp = obuf; + } + } + + return result; } /************************************************************* @@ -4416,26 +4806,38 @@ static CURLcode parse_remote_port(struct SessionHandle *data, } /* - * Override a user name and password from the URL with that in the - * CURLOPT_USERPWD option or a .netrc file, if applicable. + * Override the login details from the URL with that in the CURLOPT_USERPWD + * option or a .netrc file, if applicable. */ -static void override_userpass(struct SessionHandle *data, - struct connectdata *conn, - char *user, char *passwd) +static CURLcode override_login(struct SessionHandle *data, + struct connectdata *conn, + char **userp, char **passwdp, char **optionsp) { - if(data->set.str[STRING_USERNAME] != NULL) { - strncpy(user, data->set.str[STRING_USERNAME], MAX_CURL_USER_LENGTH); - user[MAX_CURL_USER_LENGTH-1] = '\0'; /*To be on safe side*/ + if(data->set.str[STRING_USERNAME]) { + free(*userp); + *userp = strdup(data->set.str[STRING_USERNAME]); + if(!*userp) + return CURLE_OUT_OF_MEMORY; } - if(data->set.str[STRING_PASSWORD] != NULL) { - strncpy(passwd, data->set.str[STRING_PASSWORD], MAX_CURL_PASSWORD_LENGTH); - passwd[MAX_CURL_PASSWORD_LENGTH-1] = '\0'; /*To be on safe side*/ + + if(data->set.str[STRING_PASSWORD]) { + free(*passwdp); + *passwdp = strdup(data->set.str[STRING_PASSWORD]); + if(!*passwdp) + return CURLE_OUT_OF_MEMORY; + } + + if(data->set.str[STRING_OPTIONS]) { + free(*optionsp); + *optionsp = strdup(data->set.str[STRING_OPTIONS]); + if(!*optionsp) + return CURLE_OUT_OF_MEMORY; } conn->bits.netrc = FALSE; if(data->set.use_netrc != CURL_NETRC_IGNORED) { if(Curl_parsenetrc(conn->host.name, - user, passwd, + userp, passwdp, data->set.str[STRING_NETRC_FILE])) { infof(data, "Couldn't find host %s in the " DOT_CHAR "netrc file; using defaults\n", @@ -4450,37 +4852,55 @@ static void override_userpass(struct SessionHandle *data, conn->bits.user_passwd = TRUE; /* enable user+password */ } } + + return CURLE_OK; } /* * Set password so it's available in the connection. */ -static CURLcode set_userpass(struct connectdata *conn, - const char *user, const char *passwd) +static CURLcode set_login(struct connectdata *conn, + const char *user, const char *passwd, + const char *options) { - /* If our protocol needs a password and we have none, use the defaults */ - if((conn->handler->flags & PROTOPT_NEEDSPWD) && - !conn->bits.user_passwd) { + CURLcode result = CURLE_OK; + /* If our protocol needs a password and we have none, use the defaults */ + if((conn->handler->flags & PROTOPT_NEEDSPWD) && !conn->bits.user_passwd) { + /* Store the default user */ conn->user = strdup(CURL_DEFAULT_USER); + + /* Store the default password */ if(conn->user) conn->passwd = strdup(CURL_DEFAULT_PASSWORD); else conn->passwd = NULL; + /* This is the default password, so DON'T set conn->bits.user_passwd */ } else { - /* store user + password, zero-length if not set */ + /* Store the user, zero-length if not set */ conn->user = strdup(user); + + /* Store the password (only if user is present), zero-length if not set */ if(conn->user) conn->passwd = strdup(passwd); else conn->passwd = NULL; } + if(!conn->user || !conn->passwd) - return CURLE_OUT_OF_MEMORY; + result = CURLE_OUT_OF_MEMORY; - return CURLE_OK; + /* Store the options, null if not set */ + if(!result && options[0]) { + conn->options = strdup(options); + + if(!conn->options) + result = CURLE_OUT_OF_MEMORY; + } + + return result; } /************************************************************* @@ -4619,13 +5039,9 @@ static void reuse_conn(struct connectdata *old_conn, Curl_llist_destroy(old_conn->send_pipe, NULL); Curl_llist_destroy(old_conn->recv_pipe, NULL); - Curl_llist_destroy(old_conn->pend_pipe, NULL); - Curl_llist_destroy(old_conn->done_pipe, NULL); old_conn->send_pipe = NULL; old_conn->recv_pipe = NULL; - old_conn->pend_pipe = NULL; - old_conn->done_pipe = NULL; Curl_safefree(old_conn->master_buffer); } @@ -4650,15 +5066,20 @@ static CURLcode create_conn(struct SessionHandle *data, struct connectdata **in_connect, bool *async) { - CURLcode result=CURLE_OK; + CURLcode result = CURLE_OK; struct connectdata *conn; struct connectdata *conn_temp = NULL; size_t urllen; - char user[MAX_CURL_USER_LENGTH]; - char passwd[MAX_CURL_PASSWORD_LENGTH]; + char *user = NULL; + char *passwd = NULL; + char *options = NULL; bool reuse; char *proxy = NULL; bool prot_missing = FALSE; + bool no_connections_available = FALSE; + bool force_reuse; + size_t max_host_connections = Curl_multi_max_host_connections(data->multi); + size_t max_total_connections = Curl_multi_max_total_connections(data->multi); *async = FALSE; @@ -4666,8 +5087,10 @@ static CURLcode create_conn(struct SessionHandle *data, * Check input data *************************************************************/ - if(!data->change.url) - return CURLE_URL_MALFORMAT; + if(!data->change.url) { + result = CURLE_URL_MALFORMAT; + goto out; + } /* First, split up the current URL in parts so that we can use the parts for checking against the already present connections. In order @@ -4675,8 +5098,10 @@ static CURLcode create_conn(struct SessionHandle *data, connection data struct and fill in for comparison purposes. */ conn = allocate_conn(data); - if(!conn) - return CURLE_OUT_OF_MEMORY; + if(!conn) { + result = CURLE_OUT_OF_MEMORY; + goto out; + } /* We must set the return variable as soon as possible, so that our parent can cleanup any possible allocs we may have done before @@ -4706,23 +5131,35 @@ static CURLcode create_conn(struct SessionHandle *data, data->state.path = NULL; data->state.pathbuffer = malloc(urllen+2); - if(NULL == data->state.pathbuffer) - return CURLE_OUT_OF_MEMORY; /* really bad error */ + if(NULL == data->state.pathbuffer) { + result = CURLE_OUT_OF_MEMORY; /* really bad error */ + goto out; + } data->state.path = data->state.pathbuffer; conn->host.rawalloc = malloc(urllen+2); if(NULL == conn->host.rawalloc) { Curl_safefree(data->state.pathbuffer); data->state.path = NULL; - return CURLE_OUT_OF_MEMORY; + result = CURLE_OUT_OF_MEMORY; + goto out; } conn->host.name = conn->host.rawalloc; conn->host.name[0] = 0; - result = parseurlandfillconn(data, conn, &prot_missing, user, passwd); + user = strdup(""); + passwd = strdup(""); + options = strdup(""); + if(!user || !passwd || !options) { + result = CURLE_OUT_OF_MEMORY; + goto out; + } + + result = parseurlandfillconn(data, conn, &prot_missing, &user, &passwd, + &options); if(result != CURLE_OK) - return result; + goto out; /************************************************************* * No protocol part in URL was used, add it! @@ -4736,8 +5173,8 @@ static CURLcode create_conn(struct SessionHandle *data, reurl = aprintf("%s://%s", conn->handler->scheme, data->change.url); if(!reurl) { - Curl_safefree(proxy); - return CURLE_OUT_OF_MEMORY; + result = CURLE_OUT_OF_MEMORY; + goto out; } if(data->change.url_alloc) { @@ -4767,6 +5204,13 @@ static CURLcode create_conn(struct SessionHandle *data, } } + if(data->set.str[STRING_BEARER]) { + conn->xoauth2_bearer = strdup(data->set.str[STRING_BEARER]); + if(!conn->xoauth2_bearer) { + return CURLE_OUT_OF_MEMORY; + } + } + #ifndef CURL_DISABLE_PROXY /************************************************************* * Extract the user and password from the authentication string @@ -4774,7 +5218,7 @@ static CURLcode create_conn(struct SessionHandle *data, if(conn->bits.proxy_user_passwd) { result = parse_proxy_auth(data, conn); if(result != CURLE_OK) - return result; + goto out; } /************************************************************* @@ -4785,7 +5229,8 @@ static CURLcode create_conn(struct SessionHandle *data, /* if global proxy is set, this is it */ if(NULL == proxy) { failf(data, "memory shortage"); - return CURLE_OUT_OF_MEMORY; + result = CURLE_OUT_OF_MEMORY; + goto out; } } @@ -4813,16 +5258,17 @@ static CURLcode create_conn(struct SessionHandle *data, if(proxy) { result = parse_proxy(data, conn, proxy); - free(proxy); /* parse_proxy copies the proxy string */ + Curl_safefree(proxy); /* parse_proxy copies the proxy string */ if(result) - return result; + goto out; if((conn->proxytype == CURLPROXY_HTTP) || (conn->proxytype == CURLPROXY_HTTP_1_0)) { #ifdef CURL_DISABLE_HTTP /* asking for a HTTP proxy is a bit funny when HTTP is disabled... */ - return CURLE_UNSUPPORTED_PROTOCOL; + result = CURLE_UNSUPPORTED_PROTOCOL; + goto out; #else /* force this connection's protocol to become HTTP if not already compatible - if it isn't tunneling through */ @@ -4848,14 +5294,35 @@ static CURLcode create_conn(struct SessionHandle *data, #endif /* CURL_DISABLE_PROXY */ /************************************************************* + * If the protocol is using SSL and HTTP proxy is used, we set + * the tunnel_proxy bit. + *************************************************************/ + if((conn->given->flags&PROTOPT_SSL) && conn->bits.httpproxy) + conn->bits.tunnel_proxy = TRUE; + + /************************************************************* + * Figure out the remote port number and fix it in the URL + *************************************************************/ + result = parse_remote_port(data, conn); + if(result != CURLE_OK) + goto out; + + /* Check for overridden login details and set them accordingly so they + they are known when protocol->setup_connection is called! */ + result = override_login(data, conn, &user, &passwd, &options); + if(result != CURLE_OK) + goto out; + result = set_login(conn, user, passwd, options); + if(result != CURLE_OK) + goto out; + + /************************************************************* * Setup internals depending on protocol. Needs to be done after * we figured out what/if proxy to use. *************************************************************/ result = setup_connection_internals(conn); - if(result != CURLE_OK) { - Curl_safefree(proxy); - return result; - } + if(result != CURLE_OK) + goto out; conn->recv[FIRSTSOCKET] = Curl_recv_plain; conn->send[FIRSTSOCKET] = Curl_send_plain; @@ -4888,40 +5355,20 @@ static CURLcode create_conn(struct SessionHandle *data, DEBUGASSERT(conn->handler->done); /* we ignore the return code for the protocol-specific DONE */ (void)conn->handler->done(conn, result, FALSE); - return result; + goto out; } Curl_setup_transfer(conn, -1, -1, FALSE, NULL, /* no download */ -1, NULL); /* no upload */ } - return result; + /* since we skip do_init() */ + do_init(conn); + + goto out; } #endif - /************************************************************* - * If the protocol is using SSL and HTTP proxy is used, we set - * the tunnel_proxy bit. - *************************************************************/ - if((conn->given->flags&PROTOPT_SSL) && conn->bits.httpproxy) - conn->bits.tunnel_proxy = TRUE; - - /************************************************************* - * Figure out the remote port number and fix it in the URL - *************************************************************/ - result = parse_remote_port(data, conn); - if(result != CURLE_OK) - return result; - - /************************************************************* - * Check for an overridden user name and password, then set it - * for use - *************************************************************/ - override_userpass(data, conn, user, passwd); - result = set_userpass(conn, user, passwd); - if(result != CURLE_OK) - return result; - /* Get a cloned copy of the SSL config situation stored in the connection struct. But to get this going nicely, we must first make sure that the strings in the master copy are pointing to the correct @@ -4943,8 +5390,10 @@ static CURLcode create_conn(struct SessionHandle *data, data->set.ssl.password = data->set.str[STRING_TLSAUTH_PASSWORD]; #endif - if(!Curl_clone_ssl_config(&data->set.ssl, &conn->ssl_config)) - return CURLE_OUT_OF_MEMORY; + if(!Curl_clone_ssl_config(&data->set.ssl, &conn->ssl_config)) { + result = CURLE_OUT_OF_MEMORY; + goto out; + } /************************************************************* * Check the current list of connections to see if we can @@ -4959,7 +5408,25 @@ static CURLcode create_conn(struct SessionHandle *data, if(data->set.reuse_fresh && !data->state.this_is_a_follow) reuse = FALSE; else - reuse = ConnectionExists(data, conn, &conn_temp); + reuse = ConnectionExists(data, conn, &conn_temp, &force_reuse); + + /* If we found a reusable connection, we may still want to + open a new connection if we are pipelining. */ + if(reuse && !force_reuse && IsPipeliningPossible(data, conn_temp)) { + size_t pipelen = conn_temp->send_pipe->size + conn_temp->recv_pipe->size; + if(pipelen > 0) { + infof(data, "Found connection %ld, with requests in the pipe (%zu)\n", + conn_temp->connection_id, pipelen); + + if(conn_temp->bundle->num_connections < max_host_connections && + data->state.conn_cache->num_connections < max_total_connections) { + /* We want a new connection anyway */ + reuse = FALSE; + + infof(data, "We can reuse, but we want a new connection anyway\n"); + } + } + } if(reuse) { /* @@ -4968,6 +5435,8 @@ static CURLcode create_conn(struct SessionHandle *data, * just allocated before we can move along and use the previously * existing one. */ + conn_temp->inuse = TRUE; /* mark this as being in use so that no other + handle in a multi stack may nick it */ reuse_conn(conn, conn_temp); free(conn); /* we don't need this anymore */ conn = conn_temp; @@ -4981,14 +5450,67 @@ static CURLcode create_conn(struct SessionHandle *data, conn->proxy.name?conn->proxy.dispname:conn->host.dispname); } else { - /* - * This is a brand new connection, so let's store it in the connection - * cache of ours! - */ - conn->inuse = TRUE; - ConnectionStore(data, conn); + /* We have decided that we want a new connection. However, we may not + be able to do that if we have reached the limit of how many + connections we are allowed to open. */ + struct connectbundle *bundle; + + bundle = Curl_conncache_find_bundle(data->state.conn_cache, + conn->host.name); + if(max_host_connections > 0 && bundle && + (bundle->num_connections >= max_host_connections)) { + struct connectdata *conn_candidate; + + /* The bundle is full. Let's see if we can kill a connection. */ + conn_candidate = find_oldest_idle_connection_in_bundle(data, bundle); + + if(conn_candidate) { + /* Set the connection's owner correctly, then kill it */ + conn_candidate->data = data; + (void)Curl_disconnect(conn_candidate, /* dead_connection */ FALSE); + } + else + no_connections_available = TRUE; + } + + if(max_total_connections > 0 && + (data->state.conn_cache->num_connections >= max_total_connections)) { + struct connectdata *conn_candidate; + + /* The cache is full. Let's see if we can kill a connection. */ + conn_candidate = find_oldest_idle_connection(data); + + if(conn_candidate) { + /* Set the connection's owner correctly, then kill it */ + conn_candidate->data = data; + (void)Curl_disconnect(conn_candidate, /* dead_connection */ FALSE); + } + else + no_connections_available = TRUE; + } + + + if(no_connections_available) { + infof(data, "No connections available.\n"); + + conn_free(conn); + *in_connect = NULL; + + result = CURLE_NO_CONNECTION_AVAILABLE; + goto out; + } + else { + /* + * This is a brand new connection, so let's store it in the connection + * cache of ours! + */ + ConnectionStore(data, conn); + } } + /* Mark the connection as used */ + conn->inuse = TRUE; + /* Setup and init stuff before DO starts, in preparing for the transfer. */ do_init(conn); @@ -4997,7 +5519,7 @@ static CURLcode create_conn(struct SessionHandle *data, */ result = setup_range(data); if(result) - return result; + goto out; /* Continue connectdata initialization here. */ @@ -5015,6 +5537,12 @@ static CURLcode create_conn(struct SessionHandle *data, *************************************************************/ result = resolve_server(data, conn, async); + out: + + Curl_safefree(options); + Curl_safefree(passwd); + Curl_safefree(user); + Curl_safefree(proxy); return result; } @@ -5163,6 +5691,11 @@ CURLcode Curl_connect(struct SessionHandle *data, } } + if(code == CURLE_NO_CONNECTION_AVAILABLE) { + *in_connect = NULL; + return code; + } + if(code && *in_connect) { /* We're not allowed to return failure with memory left allocated in the connectdata struct, free those here */ @@ -5219,6 +5752,19 @@ CURLcode Curl_done(struct connectdata **connp, conn->dns_entry = NULL; } + switch(status) { + case CURLE_ABORTED_BY_CALLBACK: + case CURLE_READ_ERROR: + case CURLE_WRITE_ERROR: + /* When we're aborted due to a callback return code it basically have to + be counted as premature as there is trouble ahead if we don't. We have + many callbacks and protocols work differently, we could potentially do + this more fine-grained in the future. */ + premature = TRUE; + default: + break; + } + /* this calls the protocol-specific function pointer previously set */ if(conn->handler->done) result = conn->handler->done(conn, status, premature); @@ -5247,12 +5793,8 @@ CURLcode Curl_done(struct connectdata **connp, state it is for re-using, so we're forced to close it. In a perfect world we can add code that keep track of if we really must close it here or not, but currently we have no such detail knowledge. - - connection_id == -1 here means that the connection has not been added - to the connection cache (OOM) and thus we must disconnect it here. */ - if(data->set.reuse_forbid || conn->bits.close || premature || - (-1 == conn->connection_id)) { + if(data->set.reuse_forbid || conn->bits.close || premature) { CURLcode res2 = Curl_disconnect(conn, premature); /* close connection */ /* If we had an error already, make sure we return that one. But @@ -5278,6 +5820,7 @@ CURLcode Curl_done(struct connectdata **connp, this was either closed or handed over to the connection cache here, and therefore cannot be used from this point on */ + Curl_free_request_state(data); return result; } @@ -5310,9 +5853,6 @@ static CURLcode do_init(struct connectdata *conn) HTTP. */ data->set.httpreq = HTTPREQ_GET; - /* NB: the content encoding software depends on this initialization */ - Curl_easy_initHandleData(data); - k->start = Curl_tvnow(); /* start time */ k->now = k->start; /* current time is now */ k->header = TRUE; /* assume header */ @@ -5391,33 +5931,23 @@ CURLcode Curl_do(struct connectdata **connp, bool *done) * * TODO: A future libcurl should be able to work away this state. * + * 'complete' can return 0 for incomplete, 1 for done and -1 for go back to + * DOING state there's more work to do! */ -CURLcode Curl_do_more(struct connectdata *conn, bool *completed) +CURLcode Curl_do_more(struct connectdata *conn, int *complete) { CURLcode result=CURLE_OK; - *completed = FALSE; + *complete = 0; if(conn->handler->do_more) - result = conn->handler->do_more(conn, completed); + result = conn->handler->do_more(conn, complete); - if(!result && *completed) + if(!result && (*complete == 1)) /* do_complete must be called after the protocol-specific DO function */ do_complete(conn); return result; } -/* Called on connect, and if there's already a protocol-specific struct - allocated for a different connection, this frees it that it can be setup - properly later on. */ -void Curl_reset_reqproto(struct connectdata *conn) -{ - struct SessionHandle *data = conn->data; - if(data->state.proto.generic && data->state.current_conn != conn) { - free(data->state.proto.generic); - data->state.proto.generic = NULL; - } - data->state.current_conn = conn; -} diff --git a/plugins/FTPFileYM/curl/lib/url.h b/plugins/FTPFileYM/curl/lib/url.h index a026e90e85..418413c484 100644 --- a/plugins/FTPFileYM/curl/lib/url.h +++ b/plugins/FTPFileYM/curl/lib/url.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -37,7 +37,7 @@ CURLcode Curl_close(struct SessionHandle *data); /* opposite of curl_open() */ CURLcode Curl_connect(struct SessionHandle *, struct connectdata **, bool *async, bool *protocol_connect); CURLcode Curl_do(struct connectdata **, bool *done); -CURLcode Curl_do_more(struct connectdata *, bool *completed); +CURLcode Curl_do_more(struct connectdata *, int *completed); CURLcode Curl_done(struct connectdata **, CURLcode, bool premature); CURLcode Curl_disconnect(struct connectdata *, bool dead_connection); CURLcode Curl_protocol_connect(struct connectdata *conn, bool *done); @@ -45,6 +45,7 @@ CURLcode Curl_protocol_connecting(struct connectdata *conn, bool *done); CURLcode Curl_protocol_doing(struct connectdata *conn, bool *done); CURLcode Curl_setup_conn(struct connectdata *conn, bool *protocol_done); +void Curl_free_request_state(struct SessionHandle *data); int Curl_protocol_getsock(struct connectdata *conn, curl_socket_t *socks, @@ -65,11 +66,6 @@ void Curl_getoff_all_pipelines(struct SessionHandle *data, void Curl_close_connections(struct SessionHandle *data); -/* Called on connect, and if there's already a protocol-specific struct - allocated for a different connection, this frees it that it can be setup - properly later on. */ -void Curl_reset_reqproto(struct connectdata *conn); - #define CURL_DEFAULT_PROXY_PORT 1080 /* default proxy port unless specified */ #define CURL_DEFAULT_SOCKS5_GSSAPI_SERVICE "rcmd" /* default socks5 gssapi service */ diff --git a/plugins/FTPFileYM/curl/lib/urldata.h b/plugins/FTPFileYM/curl/lib/urldata.h index 7a275da5ee..ebaaf6ff4f 100644 --- a/plugins/FTPFileYM/curl/lib/urldata.h +++ b/plugins/FTPFileYM/curl/lib/urldata.h @@ -58,6 +58,8 @@ #define CURL_DEFAULT_USER "anonymous" #define CURL_DEFAULT_PASSWORD "ftp@example.com" +#define DEFAULT_CONNCACHE_SIZE 5 + /* length of longest IPv6 address string including the trailing null */ #define MAX_IPADR_LEN sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255") @@ -107,9 +109,15 @@ #endif #ifdef USE_POLARSSL -#include <polarssl/havege.h> #include <polarssl/ssl.h> -#endif +#include <polarssl/version.h> +#if POLARSSL_VERSION_NUMBER<0x01010000 +#include <polarssl/havege.h> +#else +#include <polarssl/entropy.h> +#include <polarssl/ctr_drbg.h> +#endif /* POLARSSL_VERSION_NUMBER<0x01010000 */ +#endif /* USE_POLARSSL */ #ifdef USE_CYASSL #undef OCSP_REQUEST /* avoid cyassl/openssl/ssl.h clash with wincrypt.h */ @@ -126,6 +134,10 @@ #include <qsossl.h> #endif +#ifdef USE_GSKIT +#include <gskssl.h> +#endif + #ifdef USE_AXTLS #include <axTLS/ssl.h> #undef malloc @@ -176,6 +188,7 @@ #include "http.h" #include "rtsp.h" #include "wildcard.h" +#include "multihandle.h" #ifdef HAVE_GSSAPI # ifdef HAVE_GSSGNU @@ -209,9 +222,9 @@ #define CURLMIN(x,y) ((x)<(y)?(x):(y)) -#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI) -/* Types needed for krb4/5-ftp connections */ -struct krb4buffer { +#ifdef HAVE_GSSAPI +/* Types needed for krb5-ftp connections */ +struct krb5buffer { void *data; size_t size; size_t index; @@ -235,6 +248,7 @@ struct curl_schannel_cred { CredHandle cred_handle; TimeStamp time_stamp; int refcount; + bool cached; }; struct curl_schannel_ctxt { @@ -282,7 +296,13 @@ struct ssl_connect_data { ssl_connect_state connecting_state; #endif /* USE_GNUTLS */ #ifdef USE_POLARSSL +#if POLARSSL_VERSION_NUMBER<0x01010000 havege_state hs; +#else + /* from v1.1.0, use ctr_drbg and entropy */ + ctr_drbg_context ctr_drbg; + entropy_context entropy; +#endif /* POLARSSL_VERSION_NUMBER<0x01010000 */ ssl_context ssl; ssl_session ssn; int server_fd; @@ -307,9 +327,15 @@ struct ssl_connect_data { #ifdef USE_QSOSSL SSLHandle *handle; #endif /* USE_QSOSSL */ +#ifdef USE_GSKIT + gsk_handle handle; + int iocport; + ssl_connect_state connecting_state; +#endif #ifdef USE_AXTLS SSL_CTX* ssl_ctx; SSL* ssl; + ssl_connect_state connecting_state; #endif /* USE_AXTLS */ #ifdef USE_SCHANNEL struct curl_schannel_cred *cred; @@ -326,6 +352,7 @@ struct ssl_connect_data { curl_socket_t ssl_sockfd; ssl_connect_state connecting_state; bool ssl_direction; /* true if writing, false if reading */ + size_t ssl_write_buffered_length; #endif /* USE_DARWINSSL */ }; @@ -550,7 +577,7 @@ struct Curl_async { /* These function pointer types are here only to allow easier typecasting within the source when we need to cast between data pointers (such as NULL) and function pointers. */ -typedef CURLcode (*Curl_do_more_func)(struct connectdata *, bool *); +typedef CURLcode (*Curl_do_more_func)(struct connectdata *, int *); typedef CURLcode (*Curl_done_func)(struct connectdata *, CURLcode, bool); @@ -665,6 +692,9 @@ struct SingleRequest { bool forbidchunk; /* used only to explicitly forbid chunk-upload for specific upload buffers. See readmoredata() in http.c for details. */ + + void *protop; /* Allocated protocol-specific data. Each protocol + handler makes sure this points to data it needs. */ }; /* @@ -844,6 +874,9 @@ struct connectdata { char *user; /* user name string, allocated */ char *passwd; /* password string, allocated */ + char *options; /* options string, allocated */ + + char *xoauth2_bearer; /* bearer token for xoauth2, allocated */ char *proxyuser; /* proxy user name string, allocated */ char *proxypasswd; /* proxy password string, allocated */ @@ -903,12 +936,12 @@ struct connectdata { } allocptr; int sec_complete; /* if kerberos is enabled for this connection */ -#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI) +#ifdef HAVE_GSSAPI enum protection_level command_prot; enum protection_level data_prot; enum protection_level request_data_prot; size_t buffer_size; - struct krb4buffer in_buffer; + struct krb5buffer in_buffer; void *app_data; const struct Curl_sec_client_mech *mech; struct sockaddr_in local_addr; @@ -922,17 +955,10 @@ struct connectdata { handle */ bool writechannel_inuse; /* whether the write channel is in use by an easy handle */ - bool server_supports_pipelining; /* TRUE if server supports pipelining, - set after first response */ struct curl_llist *send_pipe; /* List of handles waiting to send on this pipeline */ struct curl_llist *recv_pipe; /* List of handles waiting to read their responses on this pipeline */ - struct curl_llist *pend_pipe; /* List of pending handles on - this pipeline */ - struct curl_llist *done_pipe; /* Handles that are finished, but - still reference this connectdata */ -#define MAX_PIPELINE_LENGTH 5 char* master_buffer; /* The master buffer allocated on-demand; used for pipelining. */ size_t read_pos; /* Current read position in the master buffer */ @@ -975,13 +1001,14 @@ struct connectdata { union { struct ftp_conn ftpc; + struct http_conn httpc; struct ssh_conn sshc; struct tftp_state_data *tftpc; struct imap_conn imapc; struct pop3_conn pop3c; struct smtp_conn smtpc; struct rtsp_conn rtspc; - void *generic; + void *generic; /* RTMP and LDAP use this */ } proto; int cselect_bits; /* bitmask of socket events */ @@ -1009,8 +1036,7 @@ struct connectdata { TUNNEL_CONNECT, /* CONNECT has been sent off */ TUNNEL_COMPLETE /* CONNECT response received completely */ } tunnel_state[2]; /* two separate ones to allow FTP */ - - struct connectbundle *bundle; /* The bundle we are member of */ + struct connectbundle *bundle; /* The bundle we are member of */ }; /* The end of connectdata. */ @@ -1129,8 +1155,6 @@ typedef enum { * Session-data MUST be put in the connectdata struct and here. */ #define MAX_CURL_USER_LENGTH 256 #define MAX_CURL_PASSWORD_LENGTH 256 -#define MAX_CURL_USER_LENGTH_TXT "255" -#define MAX_CURL_PASSWORD_LENGTH_TXT "255" struct auth { unsigned long want; /* Bitmask set to the authentication methods wanted by @@ -1159,13 +1183,6 @@ struct UrlState { /* buffers to store authentication data in, as parsed from input options */ struct timeval keeps_speed; /* for the progress meter really */ - struct connectdata *pending_conn; /* This points to the connection we want - to open when we are waiting in the - CONNECT_PEND state in the multi - interface. This to avoid recreating it - when we enter the CONNECT state again. - */ - struct connectdata *lastconnect; /* The last connection, NULL if undefined */ char *headerbuff; /* allocated buffer to store headers in */ @@ -1262,30 +1279,6 @@ struct UrlState { long rtsp_next_server_CSeq; /* the session's next server CSeq */ long rtsp_CSeq_recv; /* most recent CSeq received */ - /* Protocol specific data. - * - ************************************************************************* - * Note that this data will be REMOVED after each request, so anything that - * should be kept/stored on a per-connection basis and thus live for the - * next request on the same connection MUST be put in the connectdata struct! - *************************************************************************/ - union { - struct HTTP *http; - struct HTTP *https; /* alias, just for the sake of being more readable */ - struct RTSP *rtsp; - struct FTP *ftp; - /* void *tftp; not used */ - struct FILEPROTO *file; - void *telnet; /* private for telnet.c-eyes only */ - void *generic; - struct SSHPROTO *ssh; - struct FTP *imap; - struct FTP *pop3; - struct FTP *smtp; - } proto; - /* current user of this SessionHandle instance, or NULL */ - struct connectdata *current_conn; - /* if true, force SSL connection retry (workaround for certain servers) */ bool ssl_connect_retry; }; @@ -1317,7 +1310,7 @@ struct DynamicStatic { * the 'DynamicStatic' struct. * Character pointer fields point to dynamic storage, unless otherwise stated. */ -struct Curl_one_easy; /* declared and used only in multi.c */ + struct Curl_multi; /* declared and used only in multi.c */ enum dupstring { @@ -1352,6 +1345,7 @@ enum dupstring { STRING_SSL_ISSUERCERT, /* issuer cert file to check certificate */ STRING_USERNAME, /* <username>, if used */ STRING_PASSWORD, /* <password>, if used */ + STRING_OPTIONS, /* <options>, if used */ STRING_PROXYUSERNAME, /* Proxy <username>, if used */ STRING_PROXYPASSWORD, /* Proxy <password>, if used */ STRING_NOPROXY, /* List of hosts which should not use the proxy, if @@ -1376,6 +1370,8 @@ enum dupstring { STRING_TLSAUTH_PASSWORD, /* TLS auth <password> */ #endif + STRING_BEARER, /* <bearer>, if used */ + /* -- end of strings -- */ STRING_LAST /* not used, just an end-of-list marker */ }; @@ -1416,7 +1412,8 @@ struct UserDefined { curl_read_callback fread_func; /* function that reads the input */ int is_fread_set; /* boolean, has read callback been set to non-NULL? */ int is_fwrite_set; /* boolean, has write callback been set to non-NULL? */ - curl_progress_callback fprogress; /* function for progress information */ + curl_progress_callback fprogress; /* OLD and deprecated progress callback */ + curl_xferinfo_callback fxferinfo; /* progress callback */ curl_debug_callback fdebug; /* function that write informational data */ curl_ioctl_callback ioctl_func; /* function for I/O control */ curl_sockopt_callback fsockopt; /* function for setting socket options */ @@ -1478,12 +1475,6 @@ struct UserDefined { long buffer_size; /* size of receive buffer to use */ void *private_data; /* application-private data */ - struct Curl_one_easy *one_easy; /* When adding an easy handle to a multi - handle, an internal 'Curl_one_easy' - struct is created and this is a pointer - to the particular struct associated with - this SessionHandle */ - struct curl_slist *http200aliases; /* linked list of aliases for http200 */ long ipver; /* the CURL_IPRESOLVE_* defines in the public header file @@ -1519,7 +1510,7 @@ struct UserDefined { bool include_header; /* include received protocol headers in data output */ bool http_set_referer; /* is a custom referer used */ bool http_auto_referer; /* set "correct" referer when following location: */ - bool opt_no_body; /* as set with CURLOPT_NO_BODY */ + bool opt_no_body; /* as set with CURLOPT_NOBODY */ bool set_port; /* custom port number used */ bool upload; /* upload request */ enum CURL_NETRC_OPTION @@ -1562,6 +1553,7 @@ struct UserDefined { long socks5_gssapi_nec; /* flag to support nec socks5 server */ #endif struct curl_slist *mail_rcpt; /* linked list of mail recipients */ + bool sasl_ir; /* Enable/disable SASL initial response */ /* Common RTSP header options */ Curl_RtspReq rtspreq; /* RTSP request type */ long rtspversion; /* like httpversion, for RTSP */ @@ -1605,6 +1597,24 @@ struct Names { */ struct SessionHandle { + /* first, two fields for the linked list of these */ + struct SessionHandle *next; + struct SessionHandle *prev; + + struct connectdata *easy_conn; /* the "unit's" connection */ + + CURLMstate mstate; /* the handle's state */ + CURLcode result; /* previous result */ + + struct Curl_message msg; /* A single posted message. */ + + /* Array with the plain socket numbers this handle takes care of, in no + particular order. Note that all sockets are added to the sockhash, where + the state etc are also kept. This array is mostly used to detect when a + socket is to be removed from the hash. See singlesocket(). */ + curl_socket_t sockets[MAX_SOCKSPEREASYHANDLE]; + int numsocks; + struct Names dns; struct Curl_multi *multi; /* if non-NULL, points to the multi handle struct to which this "belongs" when used by @@ -1612,9 +1622,6 @@ struct SessionHandle { struct Curl_multi *multi_easy; /* if non-NULL, points to the multi handle struct to which this "belongs" when used by the easy interface */ - struct Curl_one_easy *multi_pos; /* if non-NULL, points to its position - in multi controlling structure to assist - in removal. */ struct Curl_share *share; /* Share, handles global variable mutexing */ struct SingleRequest req; /* Request-specific data */ struct UserDefined set; /* values set by the libcurl user */ diff --git a/plugins/FTPFileYM/curl/lib/vc6libcurl_10.vcxproj b/plugins/FTPFileYM/curl/lib/vc6libcurl_10.vcxproj index bdda68844d..b72e10649e 100644 --- a/plugins/FTPFileYM/curl/lib/vc6libcurl_10.vcxproj +++ b/plugins/FTPFileYM/curl/lib/vc6libcurl_10.vcxproj @@ -178,6 +178,7 @@ <ClCompile Include="curl_threads.c" />
<ClCompile Include="cyassl.c" />
<ClCompile Include="dict.c" />
+ <ClCompile Include="dotdot.c" />
<ClCompile Include="easy.c" />
<ClCompile Include="escape.c" />
<ClCompile Include="file.c" />
@@ -224,6 +225,7 @@ <ClCompile Include="openldap.c" />
<ClCompile Include="parsedate.c" />
<ClCompile Include="pingpong.c" />
+ <ClCompile Include="pipeline.c" />
<ClCompile Include="polarssl.c" />
<ClCompile Include="pop3.c" />
<ClCompile Include="progress.c" />
@@ -297,6 +299,7 @@ <ClInclude Include="curlx.h" />
<ClInclude Include="cyassl.h" />
<ClInclude Include="dict.h" />
+ <ClInclude Include="dotdot.h" />
<ClInclude Include="easyif.h" />
<ClInclude Include="escape.h" />
<ClInclude Include="file.h" />
@@ -330,6 +333,7 @@ <ClInclude Include="nssg.h" />
<ClInclude Include="parsedate.h" />
<ClInclude Include="pingpong.h" />
+ <ClInclude Include="pipeline.h" />
<ClInclude Include="polarssl.h" />
<ClInclude Include="pop3.h" />
<ClInclude Include="progress.h" />
diff --git a/plugins/FTPFileYM/curl/lib/vc6libcurl_10.vcxproj.filters b/plugins/FTPFileYM/curl/lib/vc6libcurl_10.vcxproj.filters index a67028ea0f..ed5d184c6c 100644 --- a/plugins/FTPFileYM/curl/lib/vc6libcurl_10.vcxproj.filters +++ b/plugins/FTPFileYM/curl/lib/vc6libcurl_10.vcxproj.filters @@ -336,6 +336,12 @@ <ClCompile Include="wildcard.c">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="pipeline.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="dotdot.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="amigaos.h">
@@ -647,6 +653,12 @@ <ClInclude Include="wildcard.h">
<Filter>Header Files</Filter>
</ClInclude>
+ <ClInclude Include="pipeline.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="dotdot.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="libcurl.rc">
diff --git a/plugins/FTPFileYM/curl/lib/vc6libcurl_11.vcxproj b/plugins/FTPFileYM/curl/lib/vc6libcurl_11.vcxproj index d8339c8d61..e4aa8eac19 100644 --- a/plugins/FTPFileYM/curl/lib/vc6libcurl_11.vcxproj +++ b/plugins/FTPFileYM/curl/lib/vc6libcurl_11.vcxproj @@ -180,6 +180,7 @@ <ClCompile Include="curl_threads.c" />
<ClCompile Include="cyassl.c" />
<ClCompile Include="dict.c" />
+ <ClCompile Include="dotdot.c" />
<ClCompile Include="easy.c" />
<ClCompile Include="escape.c" />
<ClCompile Include="file.c" />
@@ -226,6 +227,7 @@ <ClCompile Include="openldap.c" />
<ClCompile Include="parsedate.c" />
<ClCompile Include="pingpong.c" />
+ <ClCompile Include="pipeline.c" />
<ClCompile Include="polarssl.c" />
<ClCompile Include="pop3.c" />
<ClCompile Include="progress.c" />
@@ -299,6 +301,7 @@ <ClInclude Include="curlx.h" />
<ClInclude Include="cyassl.h" />
<ClInclude Include="dict.h" />
+ <ClInclude Include="dotdot.h" />
<ClInclude Include="easyif.h" />
<ClInclude Include="escape.h" />
<ClInclude Include="file.h" />
@@ -332,6 +335,7 @@ <ClInclude Include="nssg.h" />
<ClInclude Include="parsedate.h" />
<ClInclude Include="pingpong.h" />
+ <ClInclude Include="pipeline.h" />
<ClInclude Include="polarssl.h" />
<ClInclude Include="pop3.h" />
<ClInclude Include="progress.h" />
diff --git a/plugins/FTPFileYM/curl/lib/vc6libcurl_11.vcxproj.filters b/plugins/FTPFileYM/curl/lib/vc6libcurl_11.vcxproj.filters index a67028ea0f..faaafe1652 100644 --- a/plugins/FTPFileYM/curl/lib/vc6libcurl_11.vcxproj.filters +++ b/plugins/FTPFileYM/curl/lib/vc6libcurl_11.vcxproj.filters @@ -336,6 +336,12 @@ <ClCompile Include="wildcard.c">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="dotdot.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="pipeline.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="amigaos.h">
@@ -647,6 +653,12 @@ <ClInclude Include="wildcard.h">
<Filter>Header Files</Filter>
</ClInclude>
+ <ClInclude Include="dotdot.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="pipeline.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="libcurl.rc">
diff --git a/plugins/FTPFileYM/curl/lib/vc6libcurl_12.vcxproj b/plugins/FTPFileYM/curl/lib/vc6libcurl_12.vcxproj index 6439b33a95..6fd48fd650 100644 --- a/plugins/FTPFileYM/curl/lib/vc6libcurl_12.vcxproj +++ b/plugins/FTPFileYM/curl/lib/vc6libcurl_12.vcxproj @@ -180,6 +180,7 @@ <ClCompile Include="curl_threads.c" />
<ClCompile Include="cyassl.c" />
<ClCompile Include="dict.c" />
+ <ClCompile Include="dotdot.c" />
<ClCompile Include="easy.c" />
<ClCompile Include="escape.c" />
<ClCompile Include="file.c" />
@@ -226,6 +227,7 @@ <ClCompile Include="openldap.c" />
<ClCompile Include="parsedate.c" />
<ClCompile Include="pingpong.c" />
+ <ClCompile Include="pipeline.c" />
<ClCompile Include="polarssl.c" />
<ClCompile Include="pop3.c" />
<ClCompile Include="progress.c" />
@@ -299,6 +301,7 @@ <ClInclude Include="curlx.h" />
<ClInclude Include="cyassl.h" />
<ClInclude Include="dict.h" />
+ <ClInclude Include="dotdot.h" />
<ClInclude Include="easyif.h" />
<ClInclude Include="escape.h" />
<ClInclude Include="file.h" />
@@ -332,6 +335,7 @@ <ClInclude Include="nssg.h" />
<ClInclude Include="parsedate.h" />
<ClInclude Include="pingpong.h" />
+ <ClInclude Include="pipeline.h" />
<ClInclude Include="polarssl.h" />
<ClInclude Include="pop3.h" />
<ClInclude Include="progress.h" />
diff --git a/plugins/FTPFileYM/curl/lib/vc6libcurl_12.vcxproj.filters b/plugins/FTPFileYM/curl/lib/vc6libcurl_12.vcxproj.filters index a67028ea0f..faaafe1652 100644 --- a/plugins/FTPFileYM/curl/lib/vc6libcurl_12.vcxproj.filters +++ b/plugins/FTPFileYM/curl/lib/vc6libcurl_12.vcxproj.filters @@ -336,6 +336,12 @@ <ClCompile Include="wildcard.c">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="dotdot.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="pipeline.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="amigaos.h">
@@ -647,6 +653,12 @@ <ClInclude Include="wildcard.h">
<Filter>Header Files</Filter>
</ClInclude>
+ <ClInclude Include="dotdot.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="pipeline.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="libcurl.rc">
diff --git a/plugins/FTPFileYM/curl/lib/version.c b/plugins/FTPFileYM/curl/lib/version.c index d39fe0c1d0..1f62131eba 100644 --- a/plugins/FTPFileYM/curl/lib/version.c +++ b/plugins/FTPFileYM/curl/lib/version.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -25,6 +25,7 @@ #include <curl/curl.h> #include "urldata.h" #include "sslgen.h" +#include "http2.h" #define _MPRINTF_REPLACE /* use the internal *printf() functions */ #include <curl/mprintf.h> @@ -122,6 +123,11 @@ char *curl_version(void) left -= len; ptr += len; #endif +#ifdef USE_NGHTTP2 + len = Curl_http2_ver(ptr, left); + left -= len; + ptr += len; +#endif #ifdef USE_LIBRTMP { char suff[2]; @@ -235,9 +241,6 @@ static curl_version_info_data version_info = { #ifdef ENABLE_IPV6 | CURL_VERSION_IPV6 #endif -#ifdef HAVE_KRB4 - | CURL_VERSION_KERBEROS4 -#endif #ifdef USE_SSL | CURL_VERSION_SSL #endif @@ -278,6 +281,9 @@ static curl_version_info_data version_info = { #if defined(USE_TLS_SRP) | CURL_VERSION_TLSAUTH_SRP #endif +#if defined(USE_NGHTTP2) + | CURL_VERSION_HTTP2 +#endif , NULL, /* ssl_version */ 0, /* ssl_version_num, this is kept at zero */ diff --git a/plugins/FTPFileYM/curl/lib/x509asn1.c b/plugins/FTPFileYM/curl/lib/x509asn1.c new file mode 100644 index 0000000000..94b89b2be0 --- /dev/null +++ b/plugins/FTPFileYM/curl/lib/x509asn1.c @@ -0,0 +1,1151 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "curl_setup.h" + +#if defined(USE_QSOSSL) || defined(USE_GSKIT) + +#include <curl/curl.h> +#include "urldata.h" +#include "strequal.h" +#include "hostcheck.h" +#include "sslgen.h" +#include "sendf.h" +#include "inet_pton.h" +#include "curl_base64.h" +#include "x509asn1.h" + +#define _MPRINTF_REPLACE /* use our functions only */ +#include <curl/mprintf.h> + +#include "curl_memory.h" +/* The last #include file should be: */ +#include "memdebug.h" + + +/* ASN.1 OIDs. */ +static const char cnOID[] = "2.5.4.3"; /* Common name. */ +static const char sanOID[] = "2.5.29.17"; /* Subject alternative name. */ + +static const curl_OID OIDtable[] = { + { "1.2.840.10040.4.1", "dsa" }, + { "1.2.840.10040.4.3", "dsa-with-sha1" }, + { "1.2.840.10045.2.1", "ecPublicKey" }, + { "1.2.840.10045.3.0.1", "c2pnb163v1" }, + { "1.2.840.10045.4.1", "ecdsa-with-SHA1" }, + { "1.2.840.10046.2.1", "dhpublicnumber" }, + { "1.2.840.113549.1.1.1", "rsaEncryption" }, + { "1.2.840.113549.1.1.2", "md2WithRSAEncryption" }, + { "1.2.840.113549.1.1.4", "md5WithRSAEncryption" }, + { "1.2.840.113549.1.1.5", "sha1WithRSAEncryption" }, + { "1.2.840.113549.1.1.10", "RSASSA-PSS" }, + { "1.2.840.113549.1.1.14", "sha224WithRSAEncryption" }, + { "1.2.840.113549.1.1.11", "sha256WithRSAEncryption" }, + { "1.2.840.113549.1.1.12", "sha384WithRSAEncryption" }, + { "1.2.840.113549.1.1.13", "sha512WithRSAEncryption" }, + { "1.2.840.113549.2.2", "md2" }, + { "1.2.840.113549.2.5", "md5" }, + { "1.3.14.3.2.26", "sha1" }, + { cnOID, "CN" }, + { "2.5.4.4", "SN" }, + { "2.5.4.5", "serialNumber" }, + { "2.5.4.6", "C" }, + { "2.5.4.7", "L" }, + { "2.5.4.8", "ST" }, + { "2.5.4.9", "streetAddress" }, + { "2.5.4.10", "O" }, + { "2.5.4.11", "OU" }, + { "2.5.4.12", "title" }, + { "2.5.4.13", "description" }, + { "2.5.4.17", "postalCode" }, + { "2.5.4.41", "name" }, + { "2.5.4.42", "givenName" }, + { "2.5.4.43", "initials" }, + { "2.5.4.44", "generationQualifier" }, + { "2.5.4.45", "X500UniqueIdentifier" }, + { "2.5.4.46", "dnQualifier" }, + { "2.5.4.65", "pseudonym" }, + { "1.2.840.113549.1.9.1", "emailAddress" }, + { "2.5.4.72", "role" }, + { sanOID, "subjectAltName" }, + { "2.5.29.18", "issuerAltName" }, + { "2.5.29.19", "basicConstraints" }, + { "2.16.840.1.101.3.4.2.4", "sha224" }, + { "2.16.840.1.101.3.4.2.1", "sha256" }, + { "2.16.840.1.101.3.4.2.2", "sha384" }, + { "2.16.840.1.101.3.4.2.3", "sha512" }, + { (const char *) NULL, (const char *) NULL } +}; + +/* + * Lightweight ASN.1 parser. + * In particular, it does not check for syntactic/lexical errors. + * It is intended to support certificate information gathering for SSL backends + * that offer a mean to get certificates as a whole, but do not supply + * entry points to get particular certificate sub-fields. + * Please note there is no pretention here to rewrite a full SSL library. + */ + + +const char * Curl_getASN1Element(curl_asn1Element * elem, + const char * beg, const char * end) +{ + unsigned char b; + unsigned long len; + curl_asn1Element lelem; + + /* Get a single ASN.1 element into `elem', parse ASN.1 string at `beg' + ending at `end'. + Returns a pointer in source string after the parsed element, or NULL + if an error occurs. */ + + if(beg >= end || !*beg) + return (const char *) NULL; + + /* Process header byte. */ + b = (unsigned char) *beg++; + elem->constructed = (b & 0x20) != 0; + elem->class = (b >> 6) & 3; + b &= 0x1F; + if(b == 0x1F) + return (const char *) NULL; /* Long tag values not supported here. */ + elem->tag = b; + + /* Process length. */ + if(beg >= end) + return (const char *) NULL; + b = (unsigned char) *beg++; + if(!(b & 0x80)) + len = b; + else if(!(b &= 0x7F)) { + /* Unspecified length. Since we have all the data, we can determine the + effective length by skipping element until an end element is found. */ + if(!elem->constructed) + return (const char *) NULL; + elem->beg = beg; + while(beg < end && *beg) { + beg = Curl_getASN1Element(&lelem, beg, end); + if(!beg) + return (const char *) NULL; + } + if(beg >= end) + return (const char *) NULL; + elem->end = beg; + return beg + 1; + } + else if(beg + b > end) + return (const char *) NULL; /* Does not fit in source. */ + else { + /* Get long length. */ + len = 0; + do { + if(len & 0xFF000000L) + return (const char *) NULL; /* Lengths > 32 bits are not supported. */ + len = (len << 8) | (unsigned char) *beg++; + } while(--b); + } + if((unsigned long) (end - beg) < len) + return (const char *) NULL; /* Element data does not fit in source. */ + elem->beg = beg; + elem->end = beg + len; + return elem->end; +} + +static const curl_OID * searchOID(const char * oid) +{ + const curl_OID * op; + + /* Search the null terminated OID or OID identifier in local table. + Return the table entry pointer or NULL if not found. */ + + for(op = OIDtable; op->numoid; op++) + if(!strcmp(op->numoid, oid) || curl_strequal(op->textoid, oid)) + return op; + + return (const curl_OID *) NULL; +} + +static const char * bool2str(const char * beg, const char * end) +{ + /* Convert an ASN.1 Boolean value into its string representation. + Return the dynamically allocated string, or NULL if source is not an + ASN.1 Boolean value. */ + + if(end - beg != 1) + return (const char *) NULL; + return strdup(*beg? "TRUE": "FALSE"); +} + +static const char * octet2str(const char * beg, const char * end) +{ + size_t n = end - beg; + char * buf; + + /* Convert an ASN.1 octet string to a printable string. + Return the dynamically allocated string, or NULL if an error occurs. */ + + buf = malloc(3 * n + 1); + if(buf) + for(n = 0; beg < end; n += 3) + snprintf(buf + n, 4, "%02x:", *(const unsigned char *) beg++); + return buf; +} + +static const char * bit2str(const char * beg, const char * end) + +{ + /* Convert an ASN.1 bit string to a printable string. + Return the dynamically allocated string, or NULL if an error occurs. */ + + if(++beg > end) + return (const char *) NULL; + return octet2str(beg, end); +} + +static const char * int2str(const char * beg, const char * end) +{ + long val = 0; + size_t n = end - beg; + + /* Convert an ASN.1 integer value into its string representation. + Return the dynamically allocated string, or NULL if source is not an + ASN.1 integer value. */ + + if(!n) + return (const char *) NULL; + + if(n > 4) + return octet2str(beg, end); + + /* Represent integers <= 32-bit as a single value. */ + if(*beg & 0x80) + val = ~val; + + do + val = (val << 8) | *(const unsigned char *) beg++; + while(beg < end); + return curl_maprintf("%s%lx", (val < 0 || val >= 10)? "0x": "", val); +} + +static ssize_t +utf8asn1str(char * * to, int type, const char * from, const char * end) +{ + size_t inlength = end - from; + int size = 1; + size_t outlength; + int chsize; + unsigned int wc; + char * buf; + + /* Perform a lazy conversion from an ASN.1 typed string to UTF8. Allocate the + destination buffer dynamically. The allocation size will normally be too + large: this is to avoid buffer overflows. + Terminate the string with a nul byte and return the converted + string length. */ + + *to = (char *) NULL; + switch (type) { + case CURL_ASN1_BMP_STRING: + size = 2; + break; + case CURL_ASN1_UNIVERSAL_STRING: + size = 4; + break; + case CURL_ASN1_NUMERIC_STRING: + case CURL_ASN1_PRINTABLE_STRING: + case CURL_ASN1_TELETEX_STRING: + case CURL_ASN1_IA5_STRING: + case CURL_ASN1_VISIBLE_STRING: + case CURL_ASN1_UTF8_STRING: + break; + default: + return -1; /* Conversion not supported. */ + } + + if(inlength % size) + return -1; /* Length inconsistent with character size. */ + buf = malloc(4 * (inlength / size) + 1); + if(!buf) + return -1; /* Not enough memory. */ + + if(type == CURL_ASN1_UTF8_STRING) { + /* Just copy. */ + outlength = inlength; + if(outlength) + memcpy(buf, from, outlength); + } + else { + for(outlength = 0; from < end;) { + wc = 0; + switch (size) { + case 4: + wc = (wc << 8) | *(const unsigned char *) from++; + wc = (wc << 8) | *(const unsigned char *) from++; + case 2: + wc = (wc << 8) | *(const unsigned char *) from++; + default: /* case 1: */ + wc = (wc << 8) | *(const unsigned char *) from++; + } + chsize = 1; + if(wc >= 0x00000080) { + if(wc >= 0x00000800) { + if(wc >= 0x00010000) { + if(wc >= 0x00200000) { + free(buf); + return -1; /* Invalid char. size for target encoding. */ + } + buf[outlength + 3] = (char) (0x80 | (wc & 0x3F)); + wc = (wc >> 6) | 0x00010000; + chsize++; + } + buf[outlength + 2] = (char) (0x80 | (wc & 0x3F)); + wc = (wc >> 6) | 0x00000800; + chsize++; + } + buf[outlength + 1] = (char) (0x80 | (wc & 0x3F)); + wc = (wc >> 6) | 0x000000C0; + chsize++; + } + buf[outlength] = (char) wc; + outlength += chsize; + } + } + buf[outlength] = '\0'; + *to = buf; + return outlength; +} + +static const char * string2str(int type, const char * beg, const char * end) +{ + char * buf; + + /* Convert an ASN.1 String into its UTF-8 string representation. + Return the dynamically allocated string, or NULL if an error occurs. */ + + if(utf8asn1str(&buf, type, beg, end) < 0) + return (const char *) NULL; + return buf; +} + +static int encodeUint(char * buf, int n, unsigned int x) +{ + int i = 0; + unsigned int y = x / 10; + + /* Decimal ASCII encode unsigned integer `x' in the `n'-byte buffer at `buf'. + Return the total number of encoded digits, even if larger than `n'. */ + + if(y) { + i += encodeUint(buf, n, y); + x -= y * 10; + } + if(i < n) + buf[i] = (char) ('0' + x); + i++; + if(i < n) + buf[i] = '\0'; /* Store a terminator if possible. */ + return i; +} + +static int encodeOID(char * buf, int n, const char * beg, const char * end) +{ + int i = 0; + unsigned int x; + unsigned int y; + + /* Convert an ASN.1 OID into its dotted string representation. + Store the result in th `n'-byte buffer at `buf'. + Return the converted string length, or -1 if an error occurs. */ + + /* Process the first two numbers. */ + y = *(const unsigned char *) beg++; + x = y / 40; + y -= x * 40; + i += encodeUint(buf + i, n - i, x); + if(i < n) + buf[i] = '.'; + i++; + i += encodeUint(buf + i, n - i, y); + + /* Process the trailing numbers. */ + while(beg < end) { + if(i < n) + buf[i] = '.'; + i++; + x = 0; + do { + if(x & 0xFF000000) + return -1; + y = *(const unsigned char *) beg++; + x = (x << 7) | (y & 0x7F); + } while(y & 0x80); + i += encodeUint(buf + i, n - i, x); + } + if(i < n) + buf[i] = '\0'; + return i; +} + +static const char * OID2str(const char * beg, const char * end, bool symbolic) +{ + char * buf = (char *) NULL; + const curl_OID * op; + int n; + + /* Convert an ASN.1 OID into its dotted or symbolic string representation. + Return the dynamically allocated string, or NULL if an error occurs. */ + + if(beg < end) { + n = encodeOID((char *) NULL, -1, beg, end); + if(n >= 0) { + buf = malloc(n + 1); + if(buf) { + encodeOID(buf, n, beg, end); + buf[n] = '\0'; + + if(symbolic) { + op = searchOID(buf); + if(op) { + free(buf); + buf = strdup(op->textoid); + } + } + } + } + } + return buf; +} + +static const char * GTime2str(const char * beg, const char * end) +{ + const char * tzp; + const char * fracp; + char sec1, sec2; + size_t fracl; + size_t tzl; + const char * sep = ""; + + /* Convert an ASN.1 Generalized time to a printable string. + Return the dynamically allocated string, or NULL if an error occurs. */ + + for(fracp = beg; fracp < end && *fracp >= '0' && *fracp <= '9'; fracp++) + ; + + /* Get seconds digits. */ + sec1 = '0'; + switch (fracp - beg - 12) { + case 0: + sec2 = '0'; + break; + case 2: + sec1 = fracp[-2]; + case 1: + sec2 = fracp[-1]; + break; + default: + return (const char *) NULL; + } + + /* Scan for timezone, measure fractional seconds. */ + tzp = fracp; + fracl = 0; + if(fracp < end && (*fracp == '.' || *fracp == ',')) { + fracp++; + do + tzp++; + while(tzp < end && *tzp >= '0' && *tzp <= '9'); + /* Strip leading zeroes in fractional seconds. */ + for(fracl = tzp - fracp - 1; fracl && fracp[fracl - 1] == '0'; fracl--) + ; + } + + /* Process timezone. */ + if(tzp >= end) + ; /* Nothing to do. */ + else if(*tzp == 'Z') { + tzp = " GMT"; + end = tzp + 4; + } + else { + sep = " "; + tzp++; + } + + tzl = end - tzp; + return curl_maprintf("%.4s-%.2s-%.2s %.2s:%.2s:%c%c%s%.*s%s%.*s", + beg, beg + 4, beg + 6, + beg + 8, beg + 10, sec1, sec2, + fracl? ".": "", fracl, fracp, + sep, tzl, tzp); +} + +static const char * UTime2str(const char * beg, const char * end) +{ + const char * tzp; + size_t tzl; + const char * sec; + + /* Convert an ASN.1 UTC time to a printable string. + Return the dynamically allocated string, or NULL if an error occurs. */ + + for(tzp = beg; tzp < end && *tzp >= '0' && *tzp <= '9'; tzp++) + ; + /* Get the seconds. */ + sec = beg + 10; + switch (tzp - sec) { + case 0: + sec = "00"; + case 2: + break; + default: + return (const char *) NULL; + } + + /* Process timezone. */ + if(tzp >= end) + return (const char *) NULL; + if(*tzp == 'Z') { + tzp = "GMT"; + end = tzp + 3; + } + else + tzp++; + + tzl = end - tzp; + return curl_maprintf("%u%.2s-%.2s-%.2s %.2s:%.2s:%.2s %.*s", + 20 - (*beg >= '5'), beg, beg + 2, beg + 4, + beg + 6, beg + 8, sec, + tzl, tzp); +} + +const char * Curl_ASN1tostr(curl_asn1Element * elem, int type) +{ + static const char zero = '\0'; + + /* Convert an ASN.1 element to a printable string. + Return the dynamically allocated string, or NULL if an error occurs. */ + + if(elem->constructed) + return (const char *) NULL; /* No conversion of structured elements. */ + + if(!type) + type = elem->tag; /* Type not forced: use element tag as type. */ + + switch (type) { + case CURL_ASN1_BOOLEAN: + return bool2str(elem->beg, elem->end); + case CURL_ASN1_INTEGER: + case CURL_ASN1_ENUMERATED: + return int2str(elem->beg, elem->end); + case CURL_ASN1_BIT_STRING: + return bit2str(elem->beg, elem->end); + case CURL_ASN1_OCTET_STRING: + return octet2str(elem->beg, elem->end); + case CURL_ASN1_NULL: + return strdup(&zero); + case CURL_ASN1_OBJECT_IDENTIFIER: + return OID2str(elem->beg, elem->end, TRUE); + case CURL_ASN1_UTC_TIME: + return UTime2str(elem->beg, elem->end); + case CURL_ASN1_GENERALIZED_TIME: + return GTime2str(elem->beg, elem->end); + case CURL_ASN1_UTF8_STRING: + case CURL_ASN1_NUMERIC_STRING: + case CURL_ASN1_PRINTABLE_STRING: + case CURL_ASN1_TELETEX_STRING: + case CURL_ASN1_IA5_STRING: + case CURL_ASN1_VISIBLE_STRING: + case CURL_ASN1_UNIVERSAL_STRING: + case CURL_ASN1_BMP_STRING: + return string2str(type, elem->beg, elem->end); + } + + return (const char *) NULL; /* Unsupported. */ +} + +static ssize_t encodeDN(char * buf, size_t n, curl_asn1Element * dn) +{ + curl_asn1Element rdn; + curl_asn1Element atv; + curl_asn1Element oid; + curl_asn1Element value; + size_t l = 0; + const char * p1; + const char * p2; + const char * p3; + const char * str; + + /* ASCII encode distinguished name at `dn' into the `n'-byte buffer at `buf'. + Return the total string length, even if larger than `n'. */ + + for(p1 = dn->beg; p1 < dn->end;) { + p1 = Curl_getASN1Element(&rdn, p1, dn->end); + for(p2 = rdn.beg; p2 < rdn.end;) { + p2 = Curl_getASN1Element(&atv, p2, rdn.end); + p3 = Curl_getASN1Element(&oid, atv.beg, atv.end); + Curl_getASN1Element(&value, p3, atv.end); + str = Curl_ASN1tostr(&oid, 0); + if(!str) + return -1; + + /* Encode delimiter. + If attribute has a short uppercase name, delimiter is ", ". */ + if(l) { + for(p3 = str; isupper(*p3); p3++) + ; + for(p3 = (*p3 || p3 - str > 2)? "/": ", "; *p3; p3++) { + if(l < n) + buf[l] = *p3; + l++; + } + } + + /* Encode attribute name. */ + for(p3 = str; *p3; p3++) { + if(l < n) + buf[l] = *p3; + l++; + } + free((char *) str); + + /* Generate equal sign. */ + if(l < n) + buf[l] = '='; + l++; + + /* Generate value. */ + str = Curl_ASN1tostr(&value, 0); + if(!str) + return -1; + for(p3 = str; *p3; p3++) { + if(l < n) + buf[l] = *p3; + l++; + } + free((char *) str); + } + } + + return l; +} + +const char * Curl_DNtostr(curl_asn1Element * dn) +{ + char * buf = (char *) NULL; + ssize_t n = encodeDN(buf, 0, dn); + + /* Convert an ASN.1 distinguished name into a printable string. + Return the dynamically allocated string, or NULL if an error occurs. */ + + if(n >= 0) { + buf = malloc(n + 1); + if(buf) { + encodeDN(buf, n + 1, dn); + buf[n] = '\0'; + } + } + return (const char *) buf; +} + +static const char * checkOID(const char * beg, const char * end, + const char * oid) +{ + curl_asn1Element e; + const char * ccp; + const char * p; + bool matched; + + /* Check if first ASN.1 element at `beg' is the given OID. + Return a pointer in the source after the OID if found, else NULL. */ + + ccp = Curl_getASN1Element(&e, beg, end); + if(!ccp || e.tag != CURL_ASN1_OBJECT_IDENTIFIER) + return (const char *) NULL; + + p = OID2str(e.beg, e.end, FALSE); + if(!p) + return (const char *) NULL; + + matched = !strcmp(p, oid); + free((char *) p); + return matched? ccp: (const char *) NULL; +} + + +/* + * X509 parser. + */ + +void Curl_parseX509(curl_X509certificate * cert, + const char * beg, const char * end) +{ + curl_asn1Element elem; + curl_asn1Element tbsCertificate; + const char * ccp; + static const char defaultVersion = 0; /* v1. */ + + /* ASN.1 parse an X509 certificate into structure subfields. + Syntax is assumed to have already been checked by the SSL backend. + See RFC 5280. */ + + cert->certificate.beg = beg; + cert->certificate.end = end; + + /* Get the sequence content. */ + Curl_getASN1Element(&elem, beg, end); + beg = elem.beg; + end = elem.end; + + /* Get tbsCertificate. */ + beg = Curl_getASN1Element(&tbsCertificate, beg, end); + /* Skip the signatureAlgorithm. */ + beg = Curl_getASN1Element(&cert->signatureAlgorithm, beg, end); + /* Get the signatureValue. */ + Curl_getASN1Element(&cert->signature, beg, end); + + /* Parse TBSCertificate. */ + beg = tbsCertificate.beg; + end = tbsCertificate.end; + /* Get optional version, get serialNumber. */ + cert->version.beg = &defaultVersion; + cert->version.end = &defaultVersion + sizeof defaultVersion;; + beg = Curl_getASN1Element(&elem, beg, end); + if(elem.tag == 0) { + Curl_getASN1Element(&cert->version, elem.beg, elem.end); + beg = Curl_getASN1Element(&elem, beg, end); + } + cert->serialNumber = elem; + /* Get signature algorithm. */ + beg = Curl_getASN1Element(&cert->signatureAlgorithm, beg, end); + /* Get issuer. */ + beg = Curl_getASN1Element(&cert->issuer, beg, end); + /* Get notBefore and notAfter. */ + beg = Curl_getASN1Element(&elem, beg, end); + ccp = Curl_getASN1Element(&cert->notBefore, elem.beg, elem.end); + Curl_getASN1Element(&cert->notAfter, ccp, elem.end); + /* Get subject. */ + beg = Curl_getASN1Element(&cert->subject, beg, end); + /* Get subjectPublicKeyAlgorithm and subjectPublicKey. */ + beg = Curl_getASN1Element(&elem, beg, end); + ccp = Curl_getASN1Element(&cert->subjectPublicKeyAlgorithm, + elem.beg, elem.end); + Curl_getASN1Element(&cert->subjectPublicKey, ccp, elem.end); + /* Get optional issuerUiqueID, subjectUniqueID and extensions. */ + cert->issuerUniqueID.tag = cert->subjectUniqueID.tag = 0; + cert->extensions.tag = elem.tag = 0; + cert->issuerUniqueID.beg = cert->issuerUniqueID.end = ""; + cert->subjectUniqueID.beg = cert->subjectUniqueID.end = ""; + cert->extensions.beg = cert->extensions.end = ""; + if(beg < end) + beg = Curl_getASN1Element(&elem, beg, end); + if(elem.tag == 1) { + cert->issuerUniqueID = elem; + if(beg < end) + beg = Curl_getASN1Element(&elem, beg, end); + } + if(elem.tag == 2) { + cert->subjectUniqueID = elem; + if(beg < end) + beg = Curl_getASN1Element(&elem, beg, end); + } + if(elem.tag == 3) + Curl_getASN1Element(&cert->extensions, elem.beg, elem.end); +} + +static size_t copySubstring(char * to, const char * from) +{ + size_t i; + + /* Copy at most 64-characters, terminate with a newline and returns the + effective number of stored characters. */ + + for(i = 0; i < 64; i++) { + to[i] = *from; + if(!*from++) + break; + } + + to[i++] = '\n'; + return i; +} + +static const char * dumpAlgo(curl_asn1Element * param, + const char * beg, const char * end) +{ + curl_asn1Element oid; + + /* Get algorithm parameters and return algorithm name. */ + + beg = Curl_getASN1Element(&oid, beg, end); + param->tag = 0; + param->beg = param->end = end; + if(beg < end) + Curl_getASN1Element(param, beg, end); + return OID2str(oid.beg, oid.end, TRUE); +} + +static void do_pubkey_field(struct SessionHandle *data, int certnum, + const char * label, curl_asn1Element * elem) +{ + const char * output; + + /* Generate a certificate information record for the public key. */ + + output = Curl_ASN1tostr(elem, 0); + if(output) { + Curl_ssl_push_certinfo(data, certnum, label, output); + infof(data, " %s: %s\n", label, output); + free((char *) output); + } +} + +static void do_pubkey(struct SessionHandle * data, int certnum, + const char * algo, curl_asn1Element * param, + curl_asn1Element * pubkey) +{ + curl_asn1Element elem; + curl_asn1Element pk; + const char * p; + const char * q; + unsigned long len; + unsigned int i; + + /* Generate all information records for the public key. */ + + /* Get the public key (single element). */ + Curl_getASN1Element(&pk, pubkey->beg + 1, pubkey->end); + + if(curl_strequal(algo, "rsaEncryption")) { + p = Curl_getASN1Element(&elem, pk.beg, pk.end); + /* Compute key length. */ + for(q = elem.beg; !*q && q < elem.end; q++) + ; + len = (elem.end - q) * 8; + if(len) + for(i = *(unsigned char *) q; !(i & 0x80); i <<= 1) + len--; + if(len > 32) + elem.beg = q; /* Strip leading zero bytes. */ + infof(data, " RSA Public Key (%lu bits)\n", len); + q = curl_maprintf("%lu", len); + if(q) { + Curl_ssl_push_certinfo(data, certnum, "RSA Public Key", q); + free((char *) q); + } + /* Generate coefficients. */ + do_pubkey_field(data, certnum, "rsa(n)", &elem); + Curl_getASN1Element(&elem, p, pk.end); + do_pubkey_field(data, certnum, "rsa(e)", &elem); + } + else if(curl_strequal(algo, "dsa")) { + p = Curl_getASN1Element(&elem, param->beg, param->end); + do_pubkey_field(data, certnum, "dsa(p)", &elem); + p = Curl_getASN1Element(&elem, p, param->end); + do_pubkey_field(data, certnum, "dsa(q)", &elem); + Curl_getASN1Element(&elem, p, param->end); + do_pubkey_field(data, certnum, "dsa(g)", &elem); + do_pubkey_field(data, certnum, "dsa(pub_key)", &pk); + } + else if(curl_strequal(algo, "dhpublicnumber")) { + p = Curl_getASN1Element(&elem, param->beg, param->end); + do_pubkey_field(data, certnum, "dh(p)", &elem); + Curl_getASN1Element(&elem, param->beg, param->end); + do_pubkey_field(data, certnum, "dh(g)", &elem); + do_pubkey_field(data, certnum, "dh(pub_key)", &pk); + } +#if 0 /* Patent-encumbered. */ + else if(curl_strequal(algo, "ecPublicKey")) { + /* Left TODO. */ + } +#endif +} + +CURLcode Curl_extract_certinfo(struct connectdata * conn, + int certnum, + const char * beg, + const char * end) +{ + curl_X509certificate cert; + struct SessionHandle * data = conn->data; + curl_asn1Element param; + const char * ccp; + char * cp1; + size_t cl1; + char * cp2; + CURLcode cc; + unsigned long version; + size_t i; + size_t j; + + /* Prepare the certificate information for curl_easy_getinfo(). */ + + /* Extract the certificate ASN.1 elements. */ + Curl_parseX509(&cert, beg, end); + + /* Subject. */ + ccp = Curl_DNtostr(&cert.subject); + if(!ccp) + return CURLE_OUT_OF_MEMORY; + Curl_ssl_push_certinfo(data, certnum, "Subject", ccp); + infof(data, "%2d Subject: %s\n", certnum, ccp); + free((char *) ccp); + + /* Issuer. */ + ccp = Curl_DNtostr(&cert.issuer); + if(!ccp) + return CURLE_OUT_OF_MEMORY; + Curl_ssl_push_certinfo(data, certnum, "Issuer", ccp); + infof(data, " Issuer: %s\n", ccp); + free((char *) ccp); + + /* Version (always fits in less than 32 bits). */ + version = 0; + for(ccp = cert.version.beg; ccp < cert.version.end; ccp++) + version = (version << 8) | *(const unsigned char *) ccp; + ccp = curl_maprintf("%lx", version); + if(!ccp) + return CURLE_OUT_OF_MEMORY; + Curl_ssl_push_certinfo(data, certnum, "Version", ccp); + free((char *) ccp); + infof(data, " Version: %lu (0x%lx)\n", version + 1, version); + + /* Serial number. */ + ccp = Curl_ASN1tostr(&cert.serialNumber, 0); + if(!ccp) + return CURLE_OUT_OF_MEMORY; + Curl_ssl_push_certinfo(data, certnum, "Serial Number", ccp); + infof(data, " Serial Number: %s\n", ccp); + free((char *) ccp); + + /* Signature algorithm .*/ + ccp = dumpAlgo(¶m, cert.signatureAlgorithm.beg, + cert.signatureAlgorithm.end); + if(!ccp) + return CURLE_OUT_OF_MEMORY; + Curl_ssl_push_certinfo(data, certnum, "Signature Algorithm", ccp); + infof(data, " Signature Algorithm: %s\n", ccp); + free((char *) ccp); + + /* Start Date. */ + ccp = Curl_ASN1tostr(&cert.notBefore, 0); + if(!ccp) + return CURLE_OUT_OF_MEMORY; + Curl_ssl_push_certinfo(data, certnum, "Start Date", ccp); + infof(data, " Start Date: %s\n", ccp); + free((char *) ccp); + + /* Expire Date. */ + ccp = Curl_ASN1tostr(&cert.notAfter, 0); + if(!ccp) + return CURLE_OUT_OF_MEMORY; + Curl_ssl_push_certinfo(data, certnum, "Expire Date", ccp); + infof(data, " Expire Date: %s\n", ccp); + free((char *) ccp); + + /* Public Key Algorithm. */ + ccp = dumpAlgo(¶m, cert.subjectPublicKeyAlgorithm.beg, + cert.subjectPublicKeyAlgorithm.end); + if(!ccp) + return CURLE_OUT_OF_MEMORY; + Curl_ssl_push_certinfo(data, certnum, "Public Key Algorithm", ccp); + infof(data, " Public Key Algorithm: %s\n", ccp); + do_pubkey(data, certnum, ccp, ¶m, &cert.subjectPublicKey); + free((char *) ccp); + +/* TODO: extensions. */ + + /* Signature. */ + ccp = Curl_ASN1tostr(&cert.signature, 0); + if(!ccp) + return CURLE_OUT_OF_MEMORY; + Curl_ssl_push_certinfo(data, certnum, "Signature", ccp); + infof(data, " Signature: %s\n", ccp); + free((char *) ccp); + + /* Generate PEM certificate. */ + cc = Curl_base64_encode(data, cert.certificate.beg, + cert.certificate.end - cert.certificate.beg, + &cp1, &cl1); + if(cc != CURLE_OK) + return cc; + /* Compute the number of charaters in final certificate string. Format is: + -----BEGIN CERTIFICATE-----\n + <max 64 base64 characters>\n + . + . + . + -----END CERTIFICATE-----\n + */ + i = 28 + cl1 + (cl1 + 64 - 1) / 64 + 26; + cp2 = malloc(i + 1); + if(!cp2) { + free(cp1); + return CURLE_OUT_OF_MEMORY; + } + /* Build the certificate string. */ + i = copySubstring(cp2, "-----BEGIN CERTIFICATE-----"); + for(j = 0; j < cl1; j += 64) + i += copySubstring(cp2 + i, cp1 + j); + i += copySubstring(cp2 + i, "-----END CERTIFICATE-----"); + cp2[i] = '\0'; + free(cp1); + Curl_ssl_push_certinfo(data, certnum, "Cert", cp2); + infof(data, "%s\n", cp2); + free(cp2); + return CURLE_OK; +} + + +CURLcode Curl_verifyhost(struct connectdata * conn, + const char * beg, const char * end) +{ + struct SessionHandle * data = conn->data; + curl_X509certificate cert; + curl_asn1Element dn; + curl_asn1Element elem; + curl_asn1Element ext; + curl_asn1Element name; + int i; + const char * p; + const char * q; + char * dnsname; + int matched = -1; + size_t addrlen = (size_t) -1; + ssize_t len; +#ifdef ENABLE_IPV6 + struct in6_addr addr; +#else + struct in_addr addr; +#endif + + /* Verify that connection server matches info in X509 certificate at + `beg'..`end'. */ + + if(!data->set.ssl.verifyhost) + return CURLE_OK; + + if(!beg) + return CURLE_PEER_FAILED_VERIFICATION; + Curl_parseX509(&cert, beg, end); + + /* Get the server IP address. */ +#ifdef ENABLE_IPV6 + if(conn->bits.ipv6_ip && Curl_inet_pton(AF_INET6, conn->host.name, &addr)) + addrlen = sizeof(struct in6_addr); + else +#endif + if(Curl_inet_pton(AF_INET, conn->host.name, &addr)) + addrlen = sizeof(struct in_addr); + + /* Process extensions. */ + for(p = cert.extensions.beg; p < cert.extensions.end && matched != 1;) { + p = Curl_getASN1Element(&ext, p, cert.extensions.end); + /* Check if extension is a subjectAlternativeName. */ + ext.beg = checkOID(ext.beg, ext.end, sanOID); + if(ext.beg) { + ext.beg = Curl_getASN1Element(&elem, ext.beg, ext.end); + /* Skip critical if present. */ + if(elem.tag == CURL_ASN1_BOOLEAN) + ext.beg = Curl_getASN1Element(&elem, ext.beg, ext.end); + /* Parse the octet string contents: is a single sequence. */ + Curl_getASN1Element(&elem, elem.beg, elem.end); + /* Check all GeneralNames. */ + for(q = elem.beg; matched != 1 && q < elem.end;) { + q = Curl_getASN1Element(&name, q, elem.end); + switch (name.tag) { + case 2: /* DNS name. */ + i = 0; + len = utf8asn1str(&dnsname, CURL_ASN1_IA5_STRING, + name.beg, name.end); + if(len > 0) + if(strlen(dnsname) == (size_t) len) + i = Curl_cert_hostcheck((const char *) dnsname, conn->host.name); + if(dnsname) + free(dnsname); + if(!i) + return CURLE_PEER_FAILED_VERIFICATION; + matched = i; + break; + + case 7: /* IP address. */ + matched = (size_t) (name.end - q) == addrlen && + !memcmp(&addr, q, addrlen); + break; + } + } + } + } + + switch (matched) { + case 1: + /* an alternative name matched the server hostname */ + infof(data, "\t subjectAltName: %s matched\n", conn->host.dispname); + return CURLE_OK; + case 0: + /* an alternative name field existed, but didn't match and then + we MUST fail */ + infof(data, "\t subjectAltName does not match %s\n", conn->host.dispname); + return CURLE_PEER_FAILED_VERIFICATION; + } + + /* Process subject. */ + name.beg = name.end = ""; + q = cert.subject.beg; + /* we have to look to the last occurrence of a commonName in the + distinguished one to get the most significant one. */ + while(q < cert.subject.end) { + q = Curl_getASN1Element(&dn, q, cert.subject.end); + for(p = dn.beg; p < dn.end;) { + p = Curl_getASN1Element(&elem, p, dn.end); + /* We have a DN's AttributeTypeAndValue: check it in case it's a CN. */ + elem.beg = checkOID(elem.beg, elem.end, cnOID); + if(elem.beg) + name = elem; /* Latch CN. */ + } + } + + /* Check the CN if found. */ + if(!Curl_getASN1Element(&elem, name.beg, name.end)) + failf(data, "SSL: unable to obtain common name from peer certificate"); + else { + len = utf8asn1str(&dnsname, elem.tag, elem.beg, elem.end); + if(len < 0) { + free(dnsname); + return CURLE_OUT_OF_MEMORY; + } + if(strlen(dnsname) != (size_t) len) /* Nul byte in string ? */ + failf(data, "SSL: illegal cert name field"); + else if(Curl_cert_hostcheck((const char *) dnsname, conn->host.name)) { + infof(data, "\t common name: %s (matched)\n", dnsname); + free(dnsname); + return CURLE_OK; + } + else + failf(data, "SSL: certificate subject name '%s' does not match " + "target host name '%s'", dnsname, conn->host.dispname); + free(dnsname); + } + + return CURLE_PEER_FAILED_VERIFICATION; +} + +#endif /* USE_QSOSSL or USE_GSKIT */ diff --git a/plugins/FTPFileYM/curl/lib/x509asn1.h b/plugins/FTPFileYM/curl/lib/x509asn1.h new file mode 100644 index 0000000000..2276b5b641 --- /dev/null +++ b/plugins/FTPFileYM/curl/lib/x509asn1.h @@ -0,0 +1,129 @@ +#ifndef HEADER_CURL_X509ASN1_H +#define HEADER_CURL_X509ASN1_H + +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "curl_setup.h" + +#if defined(USE_QSOSSL) || defined(USE_GSKIT) + +#include "urldata.h" + +/* + * Constants. + */ + +/* ASN.1 classes. */ +#define CURL_ASN1_UNIVERSAL 0 +#define CURL_ASN1_APPLICATION 1 +#define CURL_ASN1_CONTEXT_SPECIFIC 2 +#define CURL_ASN1_PRIVATE 3 + +/* ASN.1 types. */ +#define CURL_ASN1_BOOLEAN 1 +#define CURL_ASN1_INTEGER 2 +#define CURL_ASN1_BIT_STRING 3 +#define CURL_ASN1_OCTET_STRING 4 +#define CURL_ASN1_NULL 5 +#define CURL_ASN1_OBJECT_IDENTIFIER 6 +#define CURL_ASN1_OBJECT_DESCRIPTOR 7 +#define CURL_ASN1_INSTANCE_OF 8 +#define CURL_ASN1_REAL 9 +#define CURL_ASN1_ENUMERATED 10 +#define CURL_ASN1_EMBEDDED 11 +#define CURL_ASN1_UTF8_STRING 12 +#define CURL_ASN1_RELATIVE_OID 13 +#define CURL_ASN1_SEQUENCE 16 +#define CURL_ASN1_SET 17 +#define CURL_ASN1_NUMERIC_STRING 18 +#define CURL_ASN1_PRINTABLE_STRING 19 +#define CURL_ASN1_TELETEX_STRING 20 +#define CURL_ASN1_VIDEOTEX_STRING 21 +#define CURL_ASN1_IA5_STRING 22 +#define CURL_ASN1_UTC_TIME 23 +#define CURL_ASN1_GENERALIZED_TIME 24 +#define CURL_ASN1_GRAPHIC_STRING 25 +#define CURL_ASN1_VISIBLE_STRING 26 +#define CURL_ASN1_GENERAL_STRING 27 +#define CURL_ASN1_UNIVERSAL_STRING 28 +#define CURL_ASN1_CHARACTER_STRING 29 +#define CURL_ASN1_BMP_STRING 30 + + +/* + * Types. + */ + +/* ASN.1 parsed element. */ +typedef struct { + const char * beg; /* Pointer to element data. */ + const char * end; /* Pointer to 1st byte after element data. */ + unsigned char class; /* ASN.1 element class. */ + unsigned char tag; /* ASN.1 element tag. */ + bool constructed; /* Element is constructed. */ +} curl_asn1Element; + + +/* ASN.1 OID table entry. */ +typedef struct { + const char * numoid; /* Dotted-numeric OID. */ + const char * textoid; /* OID name. */ +} curl_OID; + + +/* X509 certificate: RFC 5280. */ +typedef struct { + curl_asn1Element certificate; + curl_asn1Element version; + curl_asn1Element serialNumber; + curl_asn1Element signatureAlgorithm; + curl_asn1Element signature; + curl_asn1Element issuer; + curl_asn1Element notBefore; + curl_asn1Element notAfter; + curl_asn1Element subject; + curl_asn1Element subjectPublicKeyAlgorithm; + curl_asn1Element subjectPublicKey; + curl_asn1Element issuerUniqueID; + curl_asn1Element subjectUniqueID; + curl_asn1Element extensions; +} curl_X509certificate; + + +/* + * Prototypes. + */ + +const char * Curl_getASN1Element(curl_asn1Element * elem, + const char * beg, const char * end); +const char * Curl_ASN1tostr(curl_asn1Element * elem, int type); +const char * Curl_DNtostr(curl_asn1Element * dn); +void Curl_parseX509(curl_X509certificate * cert, + const char * beg, const char * end); +CURLcode Curl_extract_certinfo(struct connectdata * conn, int certnum, + const char * beg, const char * end); +CURLcode Curl_verifyhost(struct connectdata * conn, + const char * beg, const char * end); + +#endif /* USE_QSOSSL or USE_GSKIT */ +#endif /* HEADER_CURL_X509ASN1_H */ |