Skip to content

TSession class

Ivan Semenkov edited this page Nov 10, 2019 · 3 revisions

Class peresent cURL session to assign request params.

Constructor

Create a new session class.

public constructor Create;

Properties

Opened

Check if session opened and correctly.

public property Opened : Boolean; { Access : ReadOnly }
Url

The parameter should be a string which must be URL-encoded in the following format: scheme://host:port/path libcurl doesn't validate the syntax or use this variable until the transfer is issued.

If the given URL is missing a scheme name (such as "http://" or "ftp://" etc) then libcurl will make a guess based on the host. If the outermost sub-domain name matches DICT, FTP, IMAP, LDAP, POP3 or SMTP then that protocol will be used, otherwise HTTP will be used.

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.

[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, password and any supported login options as part of the host, for the following protocols, when connecting to servers that require authentication:

[http://user:[email protected]]

[ftp://user:[email protected]]

[smb://domain%2fuser:[email protected]]

[imap://user:password;[email protected]]

[pop3://user:password;[email protected]]

[smtp://user:password;[email protected]]

public property Url : string; { Access : WriteOnly }
Port

Set local port number to use for socket. This sets the local port number of the socket used for the connection. 0, disabled - use whatever the system thinks is fine.

public property Port : Word; { Access : WriteOnly }
PortRange

Number of additional local ports to try.

Pass a long. The range argument is the number of attempts libcurl will make to find a working local port number. It starts with the given LocalPort and adds one to the number for each retry. Setting this option 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.

public property PortRange : Longint default 1; { Access : WriteOnly }
ErrorStack

Stack which contains all curl_easy_setopt function errors.

public property ErrorStack : TErrorStack; { Access : ReadWrite }
Clone this wiki locally