Booleans Numeric Strings Filenames Lists FormData Callbacks Events

tCurl properties

Note: Most of the properties below are actually wrappers around the various curl_easy_setopt() library calls.

Because libcurl does not provide a "read" interface to option settings, the underlying library options are effectively "write-only"

The tCurl wrapper maintains a copy of your settings to emulate read/write access, and although it tries to initialize its private fields
to reasonable defaults, you should consider that read-access to a property might be "undefined" unless you explicitly assign it a value.

For example, even though reading the unset tCurl.Port property returns zero, an http transfer will still attempt to use port 80, unless otherwise specified.

Boolean Properties
AutoReferer: boolean
TRUE if we want the referer field sent automatically when following redirects.
Note that tCurl automatically sets this property to TRUE, contrary to the library's default.
CookieSession: boolean
TRUE will mark this transfer as the start of a cookie session.
CrLf: boolean
TRUE to convert Unix newlines to DOS newlines on FTP uploads. ( LF to CRLF )
DnsUseGlobalCache: boolean
TRUE tells curl to use a global DNS cache that will survive between easy handle creations and deletions.
This is not thread-safe, it uses a global variable.
FailOnError: boolean
TRUE tells the library to abort the transfer if the HTTP response code is equal to or larger than 300.
The default action would be to retrieve the document ( probably an error page ) normally, ignoring that code.
FollowLocation: boolean
TRUE tells the library to follow any Location: header that the server sends as part of a HTTP header.
This means we continue to follow new Location: headers all the way until no more such headers are returned.
Note that tCurl automatically sets this property to TRUE, contrary to the library's default.
tCurl.MaxRedirs can be used to limit the number of redirects libcurl will follow.
ForbidReuse: boolean
TRUE to make the next transfer explicitly close the connection when done. Normally, libcurl keeps all connections alive when done with one transfer in case there comes a succeeding one that can re-use them. This option should be used with caution and only if you understand what it does. Set to FALSE to have libcurl keep the connection open for possibly later re-use (default behavior).
FreshConnect: boolean
TRUE 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 FALSE to have libcurl attempt re-using an existing connection (default behavior).
FtpAppend: boolean
TRUE tells the library to append to the remote file instead of overwrite it. This is only useful when uploading to a ftp site.
FtpListOnly: boolean
TRUE tells the library to just list the names of an ftp directory, instead of doing a full directory listing that would include file sizes, dates etc.
FtpSkipPasvIp: boolean
TRUE 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 still use the port number from the 227-response.
This option has no effect if PORT, EPRT or EPSV is used instead of PASV.
FtpUseEprt: boolean
TRUE tells libcurl to use the EPRT (and LPRT) command when doing active FTP downloads
(which is enabled by tCurl.FtpPort).
Using EPRT means that it will first attempt to use EPRT and then LPRT before using PORT,
but if you set FtpUseEprt to FALSE, it will not try using EPRT or LPRT, only plain PORT.
FtpUseEpsv: boolean
TRUE to tell 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 FALSE to this option, it will not try using EPSV, only plain PASV.
Header: boolean
TRUE 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).
HttpGet: boolean
TRUE to force the HTTP request to get back to GET. Only really usable if POST, PUT or a custom request have been used previously using the same tCurl instance.
HttpProxyTunnel: boolean
TRUE to get the library to tunnel all operations through a given HTTP proxy. Note that 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.
IgnoreContentLength: boolean
TRUE tells the library to ignore the Content-Length header in HTTP responses.
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.
NoBody: boolean
TRUE 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.
NoProgress: boolean
TRUE tells the library to shut off the built-in progress meter completely. NOTE: future versions of libcurl is likely to not have any built-in progress meter at all.
NoSignal: boolean
If TRUE, 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.
Post: boolean
Obsolete, Don't use!
  ( This is now set automatically by tCurl.PostFields )
RequestFileTime: boolean
TRUE tells libcurl to 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 tCurl.FileTime function can be used after a transfer to extract the received time (if any).
SslEngineDefault: boolean
Sets the actual crypto engine as the default for (asymetric) crypto operations.
NOTE: If the crypto device cannot be set, tCurl.ResultCode will be set to CURLE_SSL_ENGINE_SETFAILED.
SslVerifyPeer: boolean
FALSE will stop curl from verifying the peer's certificate.
( Libcurl version 7.10 started setting this option to TRUE by default ).
Alternate certificates to verify against can be specified with the tCurl.CAInfo property,
or a certificate directory can be specified with the tCurl.CAPath property.
Libcurl version 7.10 and later installs its own default certificate bundle.
SslVerifyHost may also need to be set to CURL_VERIFY_NONE or CURL_VERIFY_EXIST if SslVerifyPeer is set to FALSE.
( SslVerifyHost defaults to CURL_VERIFY_MATCH )
TcpNoDelay: boolean
TRUE 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.
Changing this setting after the connection has been established will have no effect.
TransferText: boolean
TRUE 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 useful when transferring text data between systems with different views on certain characters, such as newlines or similar.

NOTE: 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.
UnrestrictedAuth: boolean
TRUE tells the library it can continue to send authentication (user+password) when
following locations, even when the hostname changes.
Note that this is meaningful only when tCurl.FollowLocation is also set to TRUE
Upload: boolean
TRUE tells the library to prepare for an upload.
The tCurl.Inputfile and tCurl.InfileSize properties 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 as documented in the tCurl.HttpHeader property.

If you use PUT to a HTTP/1.1 server using chunked encoding, you can upload data without knowing the size before starting the transfer.
You enable this by adding a header like 'Transfer-Encoding: chunked' in the tCurl.HttpHeader property.

With HTTP/1.0   ( or 1.1 without chunked transfer )   you must specify tCurl.Inputfile and/or tCurl.InfileSize.
Verbose: boolean
TRUE tells the library to display a lot of verbose information about its operations.
Very useful for libcurl and/or protocol debugging and understanding.
You hardly ever want this set in production use, you will almost always want this when you debug/report problems.
Assigning an event handler to the OnDebug event automatically sets Verbose to TRUE.


Numeric and Enumerated Properties
BufferSize: LongInt
Specifies your prefered size 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.
ClosePolicy: curl_closepolicy
This option sets what libcurl should do when the connection cache is filled, and an open connection has to be closed to allow for a new connection.
This must be one of the following constants:
CURLCLOSEPOLICY_LEAST_RECENTLY_USED causes tCurl to close the connection that was least recently used, that connection is also least likely to be capable of reuse.
CURLCLOSEPOLICY_OLDEST causes tCurl to close the oldest connection, the one that was created first among the ones in the connection cache.
The other close policies are not supported yet.
ConnectTimeout: LongInt
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 disable connection timeout (it will then only timeout on the system's internal timeouts).
See also the tCurl.Timeout property.
NOTE: this is not recommended to use in unix multi-threaded programs, as it uses signals.
( Unless tCurl.NoSignal is set to TRUE )
DnsCacheTimeout: LongInt
Name resolves will be kept in memory for this number of seconds.
Set to zero (0) to completely disable caching, or set to -1 to make the cached entries remain forever.
By default, libcurl caches info for 60 seconds.
Encoding: CurlEncoding
Requests that the server encode its response. Two encodings are supported:
  CURL_ENCODING_DEFLATE: will request the server to compress its response using the zlib algorithm,
  CURL_ENCODING_IDENTITY: does nothing.
This is not an order, the server may or may not do it.
See the special file lib/README.encoding in the libcurl sources for details.
FtpResponseTimeout: LongInt
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.
Note that while curl is waiting for a response, this value overrides the tCurl.Timeout property.
It is recommended that if used in conjunction with tCurl.Timeout, you set tCurl.FtpResonseTimeout to a value smaller than tCurl.Timeout.
FtpAuth: curl_ftpauth
Alters the way libcurl issues "AUTH TLS" or "AUTH SSL" when FTP over SSL is activated.
   CURLFTPAUTH_DEFAULT: Allow libcurl to decide.
   CURLFTPAUTH_SSL:      Try "AUTH SSL", if it fails try "AUTH TLS"
   CURLFTPAUTH_TLS:      Try "AUTH TLS", if it fails try "AUTH SSL"
(see also: tCurl.FtpSsl:)
FtpSsl: curl_ftpssl
Causes libcurl to use your desired level of SSL for an ftp transfer.
Set to one of the following values:
   CURLFTPSSL_NONE:    Don't attempt to use SSL.
   CURLFTPSSL_TRY:     Try using SSL, proceed as normal otherwise.
   CURLFTPSSL_CONTROL: Require SSL for control connection or fail with CURLE_FTP_SSL_FAILED.
   CURLFTPSSL_ALL:     Require SSL for all communication or fail with CURLE_FTP_SSL_FAILED.

Handle: pCURL
Read-only handle to the CURL session.
This is the same value that would be returned if you called curl_easy_init() manually.
Access to this handle should rarely be needed, use with caution!
HttpVersion: curl_http_version
Forces libcurl to use a specific HTTP version.
This is not sensible to do unless you have a good reason.
Possible values are:
  CURL_HTTP_VERSION_NONE:  The library will use whatever it thinks is best.
  CURL_HTTP_VERSION_1_0:  Enforce HTTP 1.0 requests.
  CURL_HTTP_VERSION_1_1:  Enforce HTTP 1.1 requests.
InfileSize: LongInt
When uploading a file to a remote site, this option can be used to tell libcurl what the expected size of the infile is.
The value is set automatically when you specify a filename using  tCurl.InputFile
LowSpeedLimit: LongInt
The transfer speed in bytes per second that the transfer should be below during tCurl.LowSpeedTime seconds for the library to consider it too slow and abort.
LowSpeedTime: LongInt
The time in seconds that the transfer should be below tCurl.LowSpeedLimit for the library to consider it too slow and abort.
MaxConnects: LongInt
The set number will be the persistant connection cache size.
This will be the maximum amount of simultaneous connections that libcurl may cache between file transfers.
Default is 5, and there isn't much point in changing this value unless you are perfectly aware of how this work and changes libcurl's behaviour.
NOTE: if you already have performed transfers with this instance of tCurl, setting a smaller MaxConnects than before may cause open connections to get closed unnecessarily.
MaxRedirs: LongInt
The set number will be the redirection limit.
If that many redirections have been followed, the next redirect will cause an error (CURLE_TOO_MANY_REDIRECTS).
This option only makes sense if tCurl.FollowLocation is set to TRUE.
Note that unless specified, tCurl automatically sets MaxRedirs to 25.
Netrc: CURL_NETRC_OPTION
This parameter controls the preference of libcurl between using user names and passwords from your ~/.netrc file, relative to user names and passwords in the URL supplied with CURLOPT_URL.
The value must be one of the following:
CURL_NETRC_OPTIONAL
The use of your ~/.netrc file is optional, and information in the URL is to be preferred. The file will be scanned with the host and user name (to find the password only) or with the host only, to find the first user name and password after that machine, which ever information is not specified in the URL. Undefined values of the option will have this effect.
CURL_NETRC_IGNORED
The library will ignore the file and use only the information in the URL. This is the default.
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 with the host only.

Notes:
libcurl uses a user name (and supplied or prompted password) supplied with CURLOPT_USERPWD in preference to any of the options controlled by this parameter.
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.
PostFieldSize: LongInt
Obsolete, Don't use!
The purpose of the underlying CURLOPT_POSTFIELDSIZE option is to allow for C-style strings to contain embedded NULL bytes.
Since the Pascal ansistring type can legally contain the #0 character without being truncated,
tCurl will handle this option for you, automatically setting it to Length(PostFields).
ProxyPort: LongInt
Pass a long with this option to set the proxy port to connect to unless it is specified in the proxy string tCurl.Proxy.
ProxyType: curl_proxytype
Sets the type of proxy.
Available options for this are CURLPROXY_HTTP and CURLPROXY_SOCKS5, with the HTTP one being default.
ResultCode: CurlCODE
Read-only result of the last option setting or transfer request.
Note: If an attempt to set a property fails, subsequent property settings and method calls will be ignored.
Reading the ResultCode property clears any previous errors, and resets the internal value to CURLE_OK.
( This behavior is similar to system error codes such as IOResult )
See also: tCurl.ErrorString
ResumeFrom: LongInt
The offset in number of bytes that you want the transfer to start from.
( Note that not all servers support this feature )
SslCertType: CurlCertType
The format of your certificate.
Supported values are CURL_CERT_PEM and CURL_CERT_DER.
SslKeyType: CurlKeyType
The format of your private key.
Possible values are:
  CURL_KEY_PEM
  CURL_KEY_DER
  CURL_KEY_ENG
NOTE: The CURL_KEY_ENG enables you to load the private key from a crypto engine. in this case CURLOPT_SSLKEY is used as an identifier passed to the engine. You have to set the crypto engine with CURLOPT_SSL_ENGINE.
SslVerifyHost: CurlHostVerify
Set if we should verify the Common name from the peer certificate in the SSL handshake.
Possible values are:
  CURL_VERIFY_NONE: The host will not be verified.
  CURL_VERIFY_EXIST: Checks the existence of the host.
  CURL_VERIFY_MATCH: Checks to ensure that the name from the peer certificate matches the hostname.
SslVersion: curl_sslversion
Set what version of SSL to attempt to use. By default, the SSL library will try to solve this by itself although some servers make this difficult why you at times may have to use this option.
Possible values are:
  CURL_SSLVERSION_DEFAULT
  CURL_SSLVERSION_TLSv1
  CURL_SSLVERSION_SSLv2
  CURL_SSLVERSION_SSLv3
TimeCondition: Curl_TimeCond
This defines how tCurl.TimeValue is treated.
You can set this parameter to CURL_TIMECOND_IFMODSINCE or CURL_TIMECOND_IFUNMODSINCE.
This is a HTTP-only feature. (TBD)
Timeout: LongInt
The maximum time in seconds that you allow the 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.
NOTE: this is not recommended to use in unix multi-threaded programs, as it uses signals.
( Unless tCurl.NoSignal is set to TRUE )
TimeValue: LongInt
This should be the time in seconds since 1 jan 1970, and the time will be used as specified in tCurl.TimeCondition or if that isn't used, it will be TIMECOND_IFMODSINCE by default.
PrivateData: pointer
A generic pointer to any data that you wish to associate with this tCurl instance.

Historical Note:
Earlier versions of tCurl used this property to access the underlying CURLOPT_PRIVATE library option.
However, this version of tCurl uses CURLOPT_PRIVATE internally to provide tighter integration with tCurlMulti.

Thus, the CURLOPT_PRIVATE library option is now officially "off limits" from the outside,
and tCurl.PrivateData is simply a "pointer to nothing" that you can use however you like.


String Properties
Note:
The tCurl object actually stores strings internally as pchar types.
Property read/write access is provided through protected methods.

Be aware that if you write code like this:
  for i:= 1 to length(SomeCurl.URL) do SomethingWith(SomeCurl.URL[i]);
- The internal routines will convert the entire pchar to a string, each time you read a single character!
It would be far better to say:
  Temp:=SomeCurl.URL;
  for i:= 1 to length(Temp) do SomethingWith(Temp[i]);

CaInfo: string
File name holding one or more certificates to verify the peer with.
This only makes sense if the SslVerifyPeer property is set to TRUE.

Note to Win32 users:
  tCurl attempts to initialize this to something sane by searching for a file named 'curl-ca-bundle.crt'.
  The order of the directories it searches is:
  1. The application's directory.
  2. The current working directory.
  3. The Windows System directory ( e.g. c:\windows\system32 )
  4. The Windows Directory ( e.g. c:\windows )
  5. All directories along the environment %PATH%
CaPath: string
The name of the directory holding multiple CA certificates to verify the peer with.
The certificate directory must be prepared using the openssl c_rehash utility.
This only makes sense when the SslVerifyPeer property is set to TRUE.
The CaPath property apparently does not work in Windows, due to some limitation in OpenSSL.
Cookie: string
Used to set a cookie in the http request.
The format of the string should be [NAME]=[CONTENTS]; Where NAME is the cookie name.
CustomRequest: string
Used instead of GET or HEAD when doing the HTTP request.
This is useful for doing DELETE or other more or less obscure HTTP requests.
Don't do this at will, make sure your server supports the command first.
EgdSocket: string
Path name to the Entropy Gathering Daemon socket. It will be used to seed the random engine for SSL.
ErrorString: string
Read-only human readable error message.
This may be more helpful than just the return code from the library.
If the library does not return an error, the string will simply contain the word "success".
FtpAccount: string
When an FTP server asks for "account data" after user name and password has been provided, this string is sent off using the ACCT command.
FtpPort: string
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, an network interface name (under Unix) or just a '-' letter to let the library use your systems default IP address.
Default FTP operations are passive, and thus won't use PORT.
NetInterface: string
The interface name to use as outgoing network interface.
This can be an interface name, an IP address or a host name.
NetRcFile: string
Set this to the full path name to the file you want libcurl to use as a  .netrc  file.
If this option is omitted, and tCurl.NetRc is TRUE, libcurl will attempt to find the  .netrc  file in the current user's home directory.
Krb4Level: string
Set the krb4 security level, this also enables krb4 awareness.
This can be one the strings:   "clear"   "safe"   "confidential"  or  "private".
If the string is set but doesn't match one of these, "private" will be used.
Set this property to an empty string to disable kerberos4.
The kerberos support only works for FTP.
PostFields: string
The full data to post in a HTTP post operation.
This is a normal application/x-www-form-urlencoded kind, which is the most commonly used one by HTML forms.

Setting this property implies that you want to do a HTTP POST request ( even if you set it to an empty string ).
To revert back to the HTTP GET method after setting PostFields, you should set HttpGet := TRUE.

You must make sure that the data is formatted the way you want the server to receive it.
( Most web servers will assume this data to be url-encoded. )
Take note that although tCurl will not automatically convert or encode it for you,
you can use the class function tCurl.Escape(string) for this task.

To make multipart/formdata posts (aka rfc1867-posts), check out the tCurl.HttpPost property.
Proxy: string
Set HTTP proxy to use.
The parameter should be a host name or dotted IP address.
The proxy string may be prefixed with [protocol]:// since any such prefix will be ignored.
To specify a port number, append :[port] to the end of the string, or use the ProxyPort property.
To specify a login, prepend username:password@ to the start of the string, or use ProxyUserPwd

When you tell the library to use an HTTP proxy, libcurl will transparently convert operations to HTTP,
even if you specify 'ftp://' etc. in the URL.

This may have an impact on what other features of the library you can use, for instance,
tCurl.Quote and similar FTP specifics don't work unless you tunnel through the HTTP proxy.
Such tunneling is activated with tCurl.HttpProxyTunnel.

NOTE: libcurl respects the following environment variables:
    http_proxy, HTTPS_PROXY, FTP_PROXY, GOPHER_PROXY, ALL_PROXY, NO_PROXY
If any of those is set, they they will be used by the library for the appropriate protocols.
The tCurl.Proxy property, if set, overrides the environment variables.
Note also that reading this property does not reflect the state of environment.
ProxyUserPwd: string
'username:password' to use for the connection to the HTTP proxy.
See tCurl.ProxyAuth to determine authentication method.
RandomFile: string
File name to read from to seed the random engine for SSL.
The more random the specified file is, the more secure will the SSL connection become.
Range: string
Specify the range of bytes you want to retrieve.
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 "X-Y,N-M".
Using multiple intervals will cause the server to send the document in pieces, using standard MIME separation techniques.
Note: Not all servers support this!
Referer: string
Used to set the Referer: header in the http request sent to the remote server.
This can be useful to fool servers that require a request from a specific web page or domain.
SourceURL: string
When set, this will enable a FTP third-party transfer, using tCurl.SourceURL as the source, and tCurl.URL as the target.
SourceUserPwd: string
Set to the  'username:password'  to use for the source connection when doing FTP third-party transfers.
( Use tCurl.UserPwd for the target connection. )
SslCert: string
The file name of your SSL certificate.
The default format is "PEM" and can be changed with the SslCertType property.
SslCipherList: string
String holding the list of ciphers to use for the SSL connection.
The list must be syntactly 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. 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 at: http://www.openssl.org/docs/apps/ciphers.html
SslEngine: string
This is used as the identifier for the crypto engine you want to use for your private key.
If the crypto device cannot be loaded, CURLE_SSL_ENGINE_NOTFOUND is returned.
SslKey: string
The file name of your private key. The default format is "PEM" and can be changed by setting the SslKeyType property.
SslKeyPassword: string
Password required to use the SslKey property.
URL: string
The actual URL to deal with.
NOTE: This property must be set before tCurl.Perform is called.
UserAgent: string
Used to set the User-Agent: header in the http request sent to the remote server.
This can be useful for servers that require a specific web browser or return browser-specific documents.
For instance, to make tCurl look like IE5 on Win 2000, use:
  UserAgent:='Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)';
UserPwd: string
'username:password' to use for the connection.


Filename / Filestream Properties
Be sure to read the SPECIAL NOTES on callbacks, events, filenames and streams.
CookieFile: string
The name of your file holding cookie data.
The cookie data may be in Netscape / Mozilla cookie data format or just regular HTTP style headers dumped to a file.
Note that setting this property automatically sets tCurl.CookieJar to the same filename, unless you specify a different name for each.
For more fine-grained control over your cookies, see tCurl.CookieList
CookieJar: string
This will make libcurl dump all internally known cookies to the specified file name when tCurl.Destroy is called.
If no cookies are known, no file will be created. Specify "-" to instead have the cookies written to stdout.
For more fine-grained control over your cookies, see tCurl.CookieList
ErrorFile: string
Filename to write error output to.
If the filename is empty (or unassigned) the data will be written to stderr.
OutputFile: string
Filename to write downloaded data to.
If the filename is empty (or unassigned) the data will be written to standard output.
Note: Line breaks on Win32 systems are NOT automatically adjusted.
OutputStream: pointer   - See   tCurl.WriteFunction
InputFile: string
Filename to read uploaded data from.
InputStream: pointer   - See   tCurl.ReadFunction
HeaderFile: string
Filename to write http headers to.
HeaderStream: pointer   - See   tCurl.HeaderFunction


Linked-List Properties
NOTES:
Use the  Add(string) method to append strings to a tCurlRWList property.
Clear the entire list with the  Clear method.
(Curl will ignore the option if the list is empty).
Http200Aliases: tCurlRWList
A list of custom header responses to be treated as a valid HTTP 200 (OK) response.
For example, IceCast servers respond with "ICY 200 OK", so:
  Http200Aliases.Add('ICY 200 OK');
will cause the response to be treated as a successful HTTP response.
HttpHeader: tCurlRWList
A list of HTTP headers to pass to the server in your HTTP request.
Using this option you can add new headers, replace internal headers and remove internal headers.

If you add a header that is normally generated by libcurl, your header will be used instead:
  HttpHeader.Add('Accept: audio/mpeg, audio/x-mpegurl, */*');

If you add a header with no contents, the internally used header will be disabled:
  HttpHeader.Add('Accept:');

If you add a custom header, it will be sent along with the other headers:
  HttpHeader.Add('Foo: bar/baz');

NOTE: The most commonly replaced headers have their own properties: Cookie, UserAgent and Referer.
Quote: tCurlRWList
A list of FTP commands that will be passed to the server BEFORE your ftp transfer.
PostQuote: tCurlRWList
A list of FTP commands that will be passed to the server AFTER the ftp transfer is complete.
( Note that the property value should be set before calling  tCurl.Perform )
PreQuote: tCurlRWList
A list of FTP commands to pass to the server after the transfer type is set.
( Note that the property value should be set before calling  tCurl.Perform )
SourceQuote: tCurlRWList
Exactly like tCurl.Quote, but for the source host.
SourcePostQuote: tCurlRWList
Exactly like tCurl.PostQuote, but for the source host.
SourcePreQuote: tCurlRWList
Exactly like tCurl.PreQuote, but for the source host.
TelnetOptions: tCurlRWList
A list of 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.
SslEnginesList: tCurlROList
Read-only 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.
To iterate through all items on the list, you can do something like:
 for i:=0 to SslEnginesList.Count-1 do ShowMessage(SslEnginesList[i]);


HttpPost/FormData Properties
NOTE: The HttpPost and FormData properties are essentially two different means to the same end.
To ensure that all internal pointers remain valid, you should choose one means or the other, but not both.
HttpPost: pcurl_httppost
Pass a pointer to a valid tHttpPost record to tell libcurl you want a multipart/formdata HTTP POST to be made and to describe the data to pass on to the server.

The data in this list must remain intact until you close the CURL handle with tCurl.Destroy.

To generate complex tHttpPost structures, use the curl_formadd() library call, as documented in the libcurl man pages.
For simpler structures, see the tCurl.FormData.Add() method, below.
FormData: tMultiPartFormData
Use the FormData.Add() method of this property to describe the data you want libcurl to use in a multipart/formdata HTTP POST request. The syntax of this method is:
...
tCurl.FormData.Add(Name, Contents, ContentType: string; PostType: tCurlPostType);
...
Where:
Name is the field name of the post data.
Contents can be the data itself, or the name of the file containing the data, depending on the value of PostType.
ContentType is a string representing the MIME type of the data, for example "text/html" or "image/jpeg"
PostType should be one of the following constants:
POST_TYPE_PLAIN : "Contents" is sent to the server as a plain string.
POST_TYPE_FILEDATA : "Contents" is a filename, the content of the file will be read into the contents field.
POST_TYPE_ATTACHMENT : "Contents" is a filename, the file will be sent as an attachment, with the filename stored in the contents field.

You can call this method repeatedly, until all form-data has been added.
To clear the contents of the form, use FormData.Clear;
.


Callback Properties (and associated data pointers)
Be sure to read the SPECIAL NOTES on callbacks, events, filenames and streams.
ProgressData: pointer
Pass a pointer that will be passed as the first argument in the progress callback set with tCurl.ProgressFunction.
ProgressFunction: curl_progress_callback
Function pointer that should match the prototype:
...
type curl_progress_callback =
  function( clientp: pointer; dltotal, dlnow, ultotal, ulnow: double ): LongInt;

...
This function gets called by libcurl instead of its internal equivalent with a frequent interval during data transfer.
Unknown/unused argument values 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 CURLE_ABORTED_BY_CALLBACK.
NOTE:   You must set  tCurl.NoProgress:=FALSE  in order to enable your callback!
ReadFunction: curl_read_callback
Function pointer that should match the following prototype:
...
type curl_read_callback =
  function(ptr: pointer; size, nmemb:dword; stream:pointer):dword; cdecl;

...
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 ptr may be filled with at most ( size * nmemb ) 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.
Set the stream argument with the tCurl.InputStream property.
Note: You can also use stream for other data types, for instance: pChar( stream )
WriteFunction: curl_write_callback
Function pointer that should match the following prototype:
...
type curl_write_callback =
  function(ptr: pointer; size, nmemb:dword; stream:pointer):dword; cdecl;

...
This function gets called by libcurl as soon as there is data available that needs to be saved.
The size of the data pointed to by ptr is ( size * nmemb ).
Return the number of bytes actually taken care of. If that amount differs from the amount passed to your function,
it will signal an error to the library and it will abort the transfer and return CURLE_WRITE_ERROR.
Set the stream argument with the tCurl.OutputStream property.
You can also use stream for other data types, for instance: pChar( stream )
NOTE: you 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!
HeaderFunction: curl_write_callback
Function pointer that should match the following prototype:
...
type tCurlHeaderFunction =
  function(ptr: pChar; size, nmemb:dword; stream:pointer):dword; cdecl;

...
This function gets called as soon as there is received header data that needs to be written down.
The headers are guaranteed to be written one-by-one and only complete lines are written.
Parsing headers should be easy enough using this.
The size of the data pointed to by ptr is ( size * nmemb ).
The pointer named stream will be the one you set with the tCurl.HeaderStream property.
Return the number of bytes actually written or return zero to signal an error to the library
(it will cause it to abort the transfer with a CURLE_WRITE_ERROR return code).
DebugFunction: curl_debug_callback
Pointer to a function that will receive the debug information normally written to the console when tCurl.Verbose is enabled.
The function should match the following prototype:
...
type curl_debug_callback = function (handle: pCurl; infotype: curl_infotype;
        data: pChar; size:dword; userp:pointer): LongInt; cdecl;

...
Libcurl will pass one of the following constants to the curl_infotype argument:
  CURLINFO_TEXT,
  CURLINFO_HEADER_IN,    CURLINFO_HEADER_OUT,
  CURLINFO_DATA_IN,      CURLINFO_DATA_OUT,
  CURLINFO_SSL_DATA_IN,  CURLINFO_SSL_DATA_OUT.

Note: This function must return 0.
DebugData: pointer
Pass a pointer whatever data you want.
The passed pointer will be the last argument sent to the function specifed in the tCurl.DebugFunction property.
IoCtlFunction: curl_ioctl_callback
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.

Your callback should match the following prototype:
curl_ioctl_callback =
    function (handle:pCURL; cmd:longint; clientp:pointer):curlioerr; cdecl;

IoCtlData: pointer
Pass a pointer whatever data you want.
The passed pointer will be the third argument sent to the function specifed in the tCurl.IoCtlFunction property.
SslCtxFunction: curl_ssl_ctx_callback

Function pointer that should match the following prototype:
  curl_ssl_ctx_callback = function (curl:pCURL; ssl_ctx:pointer; userptr:pointer):CURLcode; cdecl;

This function gets called by libcurl just before the initialization of an SSL connection after having processed all other SSL related options.
Its purpose is to give the application a last chance to modify the behaviour of the OpenSSL initialization.

The ssl_ctx parameter is actually a pointer to an openssl SSL_CTX.
Set the userptr argument with the SslCtxData property.

If an error is returned, no attempt to establish a connection is made, and the ResultCode property will contain the error code from this callback.

Using this function allows for example to use openssl callbacks to add additional validation code for certificates,
and even to change the actual URI of an HTTPS request.

NOTE: To use this properly, a non-trivial amount of knowledge of the openssl libraries is necessary.

Refer to the libcurl and openssl documentation for more info.

SslCtxData: pointer
Data pointer to pass to the ssl context callback set by the SslCtxFunction property.
This is the pointer you'll get as the third parameter, otherwise NIL.


tCurl events

Note:
  The event properties below are wrappers around the callbacks listed above. Depending on your programming model, you should probably choose to use an event or a callback, mixing the two may have strange results!   In general, events are suitable for component-based gui-style applications, and callbacks are for console-based applications, where a "parent" object is not available.


Events
OnDebug: tCurlDebugEvent
Provides read-only access to data and information about about the connection.
Pass a pointer to a method that matches the prototype:
...
type tCurlDebugEvent =
 procedure( Sender:tObject; infotype:CurlInfoType; data:pChar; len:dword; var bContinue:boolean );

...
Libcurl will pass one of the following constants as the infotype parameter:
  CURLINFO_TEXT :   Informative text about the library's current operation.
  CURLINFO_HEADER_IN :   A single response header received from the connection.
  CURLINFO_HEADER_OUT :   All request headers transmitted to the connection.
  CURLINFO_DATA_IN :   Received data.
  CURLINFO_DATA_OUT :   Transmitted data.
  CURLINFO_SSL_DATA_IN :   Trace SSL data received from the connection.
  CURLINFO_SSL_DATA_OUT:   Trace SSL data transmitted to the connection.

Assigning this event automatically sets  tCurl.Verbose to TRUE.

OnProgress: tCurlProgressEvent
Pass a pointer to a method that matches the prototype:
...
type tCurlProgressEvent =
  procedure(Sender:tObject; BytesTotal, BytesNow:longint; var bContinue:Boolean);

...
Since one or the other of the value-pairs ( dl_total/dl_now ) or ( ul_total/ul_now ) in the tCurl.ProgressFunction will
generally return zero/zero, the OnProgress procedure only returns the pair that is actually valid, depending on the
direction of data flow.
Setting the value of bContinue to FALSE will cause libcurl to abort the transfer and return CURLE_ABORTED_BY_CALLBACK.

Assigning this event automatically sets  tCurl.NoProgress to FALSE.

OnHeader: tCurlHeaderEvent
This event will be fired each time libcurl receives a response header.
Pass a pointer to a method that matches the prototype:
...
type tCurlHeaderEvent =
  procedure(Sender:tObject; data:string; var bContinue:Boolean);

...
The headers are returned one per event, and are stripped of trailing carriage returns and line feeds.
( The last header in an HTTP response will be an empty string. )

Setting bContinue to FALSE will cause the library to abort the transfer and return CURLE_WRITE_ERROR.

Be sure to read the SPECIAL NOTES on callbacks, events, filenames and streams.
OnReceive: tCurlReceiveEvent
This event will be fired whenever libcurl receives incoming data that your procedure should handle.
Pass a pointer to a method that matches the prototype:
...
type tCurlReceiveEvent =
  procedure(Sender:tObject; data:pointer; len:dword; var bContinue:Boolean);

...
You 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!

Setting bContinue to FALSE will cause the library to abort the transfer and return CURLE_WRITE_ERROR.

Be sure to read the SPECIAL NOTES on callbacks, events, filenames and streams.
OnTransmit: tCurlTransmitEvent
This event will be fired as soon as libcurl needs to read data in order to send it to the peer.
Pass a pointer to a method that matches the prototype:
...
type tCurlTransmitEvent =
  procedure(Sender:tObject; data:pointer; var len:dword);

...
The data area pointed at by the data pointer may be filled with at most len bytes.
Setting len to ZERO will signal end-of-file to the library and cause it to stop the current transfer.

Be sure to read the SPECIAL NOTES on callbacks, events, filenames and streams.
OnListCookies: tCurlListCookiesEvent
The ListCookies procedure reads the tCurl.CookieList, invoking OnListCookies once for each cookie.

The Sender parameter will be set to the tCurl object that invoked the procedure,
and the Data parameter contains the text of the current cookie.

If you set the bContinue variable to FALSE from within your event handler,
it will cancel iteration of the remaining cookies.

Note:
For reasons beyond the scope of this document, it is simply not practical to provide
random-access to the list, for instance through a TStringList or similar.
The only efficient and reliable way to access the cookie list is sequentially, starting at the top.
This type of cookie support is relatively new to both CurlPas and libcurl,
and might be subject to change in the not-so-distant future.


Support This Project  
Get CurlPas and TidyPas at SourceForge.net. Fast, secure and Free Open Source software downloads