Generic network client based on libcurl-7.62.0
Note: a newer version is available
Mac version is now 64-bit only!
- Extract either the cURL.DMG or the cURL.zip archives
- Add the cURL.bundle to your database's Plugins folder.
error:=cURL(options;request;response{;callbackMethod{;transferInfo{;headerInfo}}})
Parameter | Type | Description |
---|---|---|
options | TEXT | JSON object |
request | BLOB | |
response | BLOB | out |
callbackMethod | TEXT | |
transferInfo | TEXT | out, JSON curl_easy_getinfo |
headerInfo | TEXT | out |
error | LONGINT | Error code |
Signature of callbackMethod
abort:=method(transferInfo;userInfo)
Parameter | Type | Description |
---|---|---|
transferInfo | TEXT | out, JSON curl_easy_getinfo |
userInfo | TEXT | out, the text passed as the PRIVATE property of option |
abort | BOOLEAN |
CURLcode
is returned in error
. when True
is returned from the callback method, CURLE_ABORTED_BY_CALLBACK (42)
is returned. Same if the process has been aborted via the runtime explorer. aborting the debugger will not kill the process immediately.
Properties of curlInfo
conditionUnmet
contentLengthUpload
rtspClientCseq
rtspServerCseq
rtspCseqRecv
lastSocket
primaryPort
localPort
contentLengthDownload
connectCode
fileTime
totalTime
requestSize
headerSize
speedUpload
speedDownload
sizeDownload
sizeUpload
httpAuthAvail
proxyAuthAvail
osErrNo
numConnects
responseCode
nameLookupTime
connectTime
appConnectTime
preTransferTime
startTransferTime
redirectTime
sslVerifyResult
redirectCount
effectiveUrl
localIp
contentType
primaryIp
redirectUrl
ftpEntryPath
rtspSessionId
Special options
Value | Type | Description |
---|---|---|
PRIVATE | TEXT | context info passed to callbackMethod |
READDATA | TEXT | use file path instead of request |
WRITEDATA | TEXT | use file path instead of response |
AUTOPROXY | LONGINT | 1 to use libproxy |
ATOMIC | LONGINT | 1 to use simple (as opposed to multiple) API |
DEBUG | TEXT | folder path to create log paths |
Standard options
Standard options
with constant support
Value | Type | Description |
---|---|---|
USE_SSL | TEXT | USESSL_NONE, USESSL_TRY, USESSL_CONTROL, USESSL_ALL |
SSLVERSION | TEXT | SSLVERSION_TLSv1, SSLVERSION_SSLv2, SSLVERSION_SSLv3, SSLVERSION_TLSv1_0, SSLVERSION_TLSv1_1, SSLVERSION_TLSv1_2, SSLVERSION_TLSv1_3 |
HTTP_VERSION | TEXT | HTTP_VERSION_1_0, HTTP_VERSION_1_1, HTTP_VERSION_2_0, HTTP_VERSION_2TLS, HTTP_VERSION_2_PRIOR_KNOWLEDGE |
PROXY_SSLVERSION | TEXT | SSLVERSION_TLSv1, SSLVERSION_SSLv2, SSLVERSION_SSLv3, SSLVERSION_TLSv1_0, SSLVERSION_TLSv1_1, SSLVERSION_TLSv1_2, SSLVERSION_TLSv1_3 |
TIMECONDITION | TEXT | TIMECOND_IFMODSINCE, TIMECOND_IFUNMODSINCE, TIMECOND_LASTMOD |
PROXYTYPE | TEXT | PROXY_HTTPS, PROXY_SOCKS4, PROXY_SOCKS4A, PROXY_SOCKS5 |
FTPSSLAUTH | TEXT | FTPAUTH_SSL, FTPAUTH_TLS |
HEADEROPT | TEXT | HEADER_UNIFIED, HEADER_SEPARATE |
Standard options
with collection support
Value | Type | Description |
---|---|---|
CONNECT_TO | COLLECTION | text array |
PROXYHEADER | COLLECTION | text array |
HTTPHEADER | COLLECTION | text array |
HTTP200ALIASES | COLLECTION | text array |
RESOLVE | COLLECTION | text array |
MAIL_RCPT | COLLECTION | text array |
MAIL_FROM | TEXT | |
PREQUOTE | COLLECTION | text array |
POSTQUOTE | COLLECTION | text array |
QUOTE | COLLECTION | text array |
TELNETOPTIONS | COLLECTION | text array |
Not supported
POSTFIELDSIZE_LARGE
(automatic)
INFILESIZE_LARGE
(automatic)
POSTFIELDS
VERBOSE
NOPROGRESS
READFUNCTION
WRITEFUNCTION
ERRORBUFFER
READDATA
WRITEDATA
OBSOLETE72
PROGRESSDATA
PROGRESSFUNCTION
TRANSFERTEXT
OBSOLETE40
STDERR
HEADERDATA
HTTPPOST
IOCTLDATA
IOCTLFUNCTION
TCP_NODELAY
SSL_CTX_DATA
SSL_CTX_FUNCTION
SHARE
NOSIGNAL
DEBUGDATA
DEBUGFUNCTION
DNS_USE_GLOBAL_CACHE
SSLENGINE_DEFAULT
SSLENGINE
HEADERFUNCTION
SEEKDATA
SEEKFUNCTION
COPYPOSTFIELDS
OPENSOCKETDATA
OPENSOCKETFUNCTION
SOCKOPTDATA
SOCKOPTFUNCTION
CONV_FROM_UTF8_FUNCTION
CONV_TO_NETWORK_FUNCTION
CONV_FROM_NETWORK_FUNCTION
GSSAPI_DELEGATION
SOCKS5_GSSAPI_NEC
SOCKS5_GSSAPI_SERVICE
CLOSESOCKETDATA
CLOSESOCKETFUNCTION
FNMATCH_DATA
CHUNK_DATA
FNMATCH_FUNCTION
CHUNK_END_FUNCTION
CHUNK_BGN_FUNCTION
INTERLEAVEFUNCTION
INTERLEAVEDATA
SSH_KEYDATA
SSH_KEYFUNCTION
STREAM_DEPENDS_E
STREAM_DEPENDS
UNIX_SOCKET_PATH
XFERINFOFUNCTION
SSL_OPTIONS
ABSTRACT_UNIX_SOCKET
MIMEPOST
RESOLVER_START_FUNCTION
RESOLVER_START_DATA
- SMTP
You might want to enable FORBID_REUSE
if your plan is to use different credentials in a batch process. By default, cURL re-uses the TCP connection, which may not be what you want.
You can pass a collection or string to MAIL_TO
. But you can only pass string to MAIL_FROM
.
You must pass a simple email adress to MAIL_FROM
. You can NOT pass the email address with a display name, as you would do for the SMTP header. (It is your responsibility to include a well-formatted From
header in the SMTP request.
- Any
By default, cURL has a very tolerant timeout setting. In production, you might want to explicitly set all the timeout options.
escape:=cURL_Escape(url)
Parameter | Type | Description |
---|---|---|
url | TEXT | |
escape | TEXT | curl_easy_escape |
unescape:=cURL_Unescape(url)
Parameter | Type | Description |
---|---|---|
url | TEXT | |
unescape | TEXT | [curl_easy_unescape ] |
versionInfo:=cURL_VersionInfo
Parameter | Type | Description |
---|---|---|
version | TEXT | curl_version_info |
{
"version": "7.62.0",
"version_num": 474624,
"host": "Darwin",
"features": 2687645,
"ssl_version": "OpenSSL/1.1.0g",
"ssl_version_num": 0,
"libz_version": "1.2.11",
"protocols": [
"dict",
"file",
"ftp",
"ftps",
"gopher",
"http",
"https",
"imap",
"imaps",
"ldap",
"pop3",
"pop3s",
"rtsp",
"scp",
"sftp",
"smb",
"smbs",
"smtp",
"smtps",
"telnet",
"tftp"
],
"libssh_version": "libssh2/1.8.0"
}
seconds:=cURL_GetDate(dateString{;secondsString})
Parameter | Type | Description |
---|---|---|
dateString | TEXT | |
seconds | LONGINT | curl_getdate |
secondsString | TEXT | out |
$seconds_32:=cURL_GetDate ("1994 Nov 6 08:49:37";$seconds_64) //784111777, "784111777"
$seconds_32:=cURL_GetDate ("1970 Nov 6 08:49:37";$seconds_64) //26729377, "26729377"
$seconds_32:=cURL_GetDate ("2038 Nov 6 08:49:37";$seconds_64) //-1, "2172646177"
$seconds_32:=cURL_GetDate ("1583 Nov 6 08:49:37";$seconds_64) //-1, "-12185824223"
$seconds_32:=cURL_GetDate ("1582 Nov 6 08:49:37";$seconds_64) //-1, ""
Note: dates after 2038 or before 1970 seems to return different values on windows.
DEBUG
example
C_OBJECT($options)
OB SET($options;"URL";"https://github.com/miyako/4d-plugin-curl-v2/blob/master/curl/4DPlugin.cpp")
$options.DEBUG:=Get 4D folder(Logs folder)
$options.SSL_VERIFYPEER:=0
$options.SSL_VERIFYHOST:=0
$callback:=""
C_TEXT($transferInfo;$headerInfo)
C_BLOB($request;$response)
$error:=cURL (JSON Stringify($options);$requests;$response;$callback;$transferInfo;$headerInfo)
SHOW ON DISK(Get 4D folder(Logs folder);*)