This is a 4D plugin implementation of libcurl and cURL.
This plugin project is a forked subset of what was published as OAuth.
Existing cURL@ commands have the same name and functionality, but their tokens (internal IDs) have changed.
To migrate existing methods, do the following:
- Comment the code that calls cURL@ plugin commands.
- Close 4DB.
- Replace the plugin.
- Uncomment the code.
cURL Get executable
Returns the path to the curl executable embedded in the plugin. You can use this with LAUNCH EXTERNAL PROCESS.
version
$version:=cURL Get version
//libcurl/7.40.0 OpenSSL/1.0.1j zlib/1.2.8 libidn/1.29 libssh2/1.4.3
$path:=cURL Get executable
$stdOut:=""
$stdIn:=""
$stdErr:=""
LAUNCH EXTERNAL PROCESS($path+" -V";$stdIn;$stdOut;$stdErr);
//curl 7.40.0 (x86_64-apple-darwin14.0.0) libcurl/7.40.0 OpenSSL/1.0.1j zlib/1.2.8 libidn/1.29 libssh2/1.4.3\nProtocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp \nFeatures: IDN IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP UnixSockets \n
https
C_BLOB($in;$out)
C_LONGINT($err)
ARRAY LONGINT($tNomOption;0)
ARRAY TEXT($tValOption;0)
APPEND TO ARRAY($tNomOption;CURLOPT_SSL_VERIFYHOST)
APPEND TO ARRAY($tValOption;"1")
APPEND TO ARRAY($tNomOption;CURLOPT_SSL_VERIFYPEER)
APPEND TO ARRAY($tValOption;"1")
APPEND TO ARRAY($tNomOption;CURLOPT_CAINFO)
APPEND TO ARRAY($tValOption;Convert path system to POSIX(Get 4D folder(Current resources folder)+"cacert.pem"))
APPEND TO ARRAY($tNomOption;CURLOPT_DEBUGFUNCTION)
APPEND TO ARRAY($tValOption;"CB_DEBUG")
$err:=cURL ("https://github.com/";$tNomOption;$tValOption;$in;$out)
- v14 is for v14 and above, Windows & OS X 10.8+ 32/64 bits.
- v11 is for v11 and above, Windows 32/64 bits, OS X 10.6+ 32 bits (Intel only)
Mac OS X
- libcurl/7.40.0
- OpenSSL/1.0.1j
- zlib/1.2.8
- libidn/1.29
- libssh2/1.4.3
Windows
- libcurl/7.40.0
- OpenSSL/1.0.1j
- zlib/1.2.8
- libidn/1.29
- libssh2/1.4.3
Protocol | Mac OS X | Windows |
---|---|---|
dict | ◯ | ◯ |
file | ◯ | ◯ |
ftp | ◯ | ◯ |
ftps | ◯ | ◯ |
gopher | ◯ | ◯ |
http | ◯ | ◯ |
https | ◯ | ◯ |
imap | ◯ | ◯ |
imaps | ◯ | ◯ |
ldap | ◯ | ◯ |
ldaps | ◯ | ◯ |
pop3 | ◯ | ◯ |
pop3s | ◯ | ◯ |
rtsp | ◯ | ◯ |
scp | ◯ | ◯ |
sftp | ◯ | ◯ |
smtp | ◯ | ◯ |
smtps | ◯ | ◯ |
telnet | ◯ | ◯ |
tftp | ◯ | ◯ |
Feature | Mac OS X | Windows |
---|---|---|
IDN | ◯ | ◯ |
IPv6 | ◯ | ◯ |
Largefile | ◯ | ◯ |
NTLM | ◯ | ◯ |
SSL | ◯ | ◯ |
libz | ◯ | ◯ |
On Mac, SSH2 is linked to the system OpenSSL located at /usr/lib/, not the one embedded in the plugin. This is to avoid crash with SFTP.
On Windows, OPENSSL (LIBEAY and LIBSSL) and LIBSSH2 are statically linked to LIBCURL, to avoid collision with the DLL included in 4D itself.
LIBCURL is modified so that it will yield to 4D during a long operation (easy.c).