Class THTTPSend
Unit
httpsend
Declaration
type THTTPSend = class(TSynaClient)
Description
abstract(Implementation of HTTP protocol.)
Hierarchy
Overview
Methods
Properties
|
property Headers: TStringList read FHeaders; |
|
property Cookies: TStringList read FCookies; |
|
property Document: TMemoryStream read FDocument; |
|
property RangeStart: integer read FRangeStart Write FRangeStart; |
|
property RangeEnd: integer read FRangeEnd Write FRangeEnd; |
|
property MimeType: string read FMimeType Write FMimeType; |
|
property Protocol: string read FProtocol Write FProtocol; |
|
property KeepAlive: Boolean read FKeepAlive Write FKeepAlive; |
|
property KeepAliveTimeout: integer read FKeepAliveTimeout Write FKeepAliveTimeout; |
|
property Status100: Boolean read FStatus100 Write FStatus100; |
|
property ProxyHost: string read FProxyHost Write FProxyHost; |
|
property ProxyPort: string read FProxyPort Write FProxyPort; |
|
property ProxyUser: string read FProxyUser Write FProxyUser; |
|
property ProxyPass: string read FProxyPass Write FProxyPass; |
|
property UserAgent: string read FUserAgent Write FUserAgent; |
|
property ResultCode: Integer read FResultCode; |
|
property ResultString: string read FResultString; |
|
property DownloadSize: integer read FDownloadSize; |
|
property UploadSize: integer read FUploadSize; |
|
property Sock: TTCPBlockSocket read FSock; |
|
property AddPortNumberToHost: Boolean read FAddPortNumberToHost write FAddPortNumberToHost; |
Description
Methods
|
constructor Create; |
|
destructor Destroy; override; |
|
procedure Clear; |
Reset headers and document and Mimetype.
|
procedure DecodeStatus(const Value: string); |
Decode ResultCode and ResultString from Value.
|
function HTTPMethod(const Method, URL: string): Boolean; |
Connects to host define in URL and access to resource defined in URL by method. If Document is not empty, send it to server as part of HTTP request. Server response is in Document and headers. Connection may be authorised by username and password in URL. If you define proxy properties, connection is made by this proxy. If all OK, result is True
, else result is False
.
If you use in URL 'https:' instead only 'http:', then your request is made by SSL/TLS connection (if you not specify port, then port 443 is used instead standard port 80). If you use SSL/TLS request and you have defined HTTP proxy, then HTTP-tunnel mode is automaticly used .
|
procedure Abort; |
You can call this method from OnStatus event for break current data transfer. (or from another thread.)
Properties
|
property Headers: TStringList read FHeaders; |
Before HTTP operation you may define any non-standard headers for HTTP request, except of: 'Expect: 100-continue', 'Content-Length', 'Content-Type', 'Connection', 'Authorization', 'Proxy-Authorization' and 'Host' headers. After HTTP operation contains full headers of returned document.
|
property Cookies: TStringList read FCookies; |
This is stringlist with name-value stringlist pairs. Each this pair is one cookie. After HTTP request is returned cookies parsed to this stringlist. You can leave this cookies untouched for next HTTP request. You can also save this stringlist for later use.
|
property Document: TMemoryStream read FDocument; |
Stream with document to send (before request, or with document received from HTTP server (after request).
|
property RangeStart: integer read FRangeStart Write FRangeStart; |
If you need download only part of requested document, here specify possition of subpart begin. If here 0, then is requested full document.
|
property RangeEnd: integer read FRangeEnd Write FRangeEnd; |
If you need download only part of requested document, here specify possition of subpart end. If here 0, then is requested document from rangeStart to end of document. (for broken download restoration, for example.)
|
property MimeType: string read FMimeType Write FMimeType; |
Mime type of sending data. Default is: 'text/html'.
|
property Protocol: string read FProtocol Write FProtocol; |
Define protocol version. Possible values are: '1.1', '1.0' (default) and '0.9'.
|
property KeepAlive: Boolean read FKeepAlive Write FKeepAlive; |
If True
(default value), keepalives in HTTP protocol 1.1 is enabled.
|
property KeepAliveTimeout: integer read FKeepAliveTimeout Write FKeepAliveTimeout; |
Define timeout for keepalives in seconds!
|
property Status100: Boolean read FStatus100 Write FStatus100; |
if True
, then server is requested for 100status capability when uploading data. Default is False
(off).
|
property ProxyHost: string read FProxyHost Write FProxyHost; |
Address of proxy server (IP address or domain name) where you want to connect in HTTPMethod method.
|
property ProxyPort: string read FProxyPort Write FProxyPort; |
Port number for proxy connection. Default value is 8080.
|
property ProxyUser: string read FProxyUser Write FProxyUser; |
Username for connect to proxy server where you want to connect in HTTPMethod method.
|
property ProxyPass: string read FProxyPass Write FProxyPass; |
Password for connect to proxy server where you want to connect in HTTPMethod method.
|
property UserAgent: string read FUserAgent Write FUserAgent; |
Here you can specify custom User-Agent indentification. By default is used: 'Mozilla/4.0 (compatible; Synapse)'
|
property ResultCode: Integer read FResultCode; |
After successful HTTPMethod method contains result code of operation.
|
property ResultString: string read FResultString; |
After successful HTTPMethod method contains string after result code.
|
property DownloadSize: integer read FDownloadSize; |
if this value is not 0, then data download pending. In this case you have here total sice of downloaded data. It is good for draw download progressbar from OnStatus event.
|
property UploadSize: integer read FUploadSize; |
if this value is not 0, then data upload pending. In this case you have here total sice of uploaded data. It is good for draw upload progressbar from OnStatus event.
Socket object used for TCP/IP operation. Good for seting OnStatus hook, etc.
|
property AddPortNumberToHost: Boolean read FAddPortNumberToHost write FAddPortNumberToHost; |
To have possibility to switch off port number in 'Host:' HTTP header, by default True
. Some buggy servers not like port informations in this header.
Generated by PasDoc 0.9.0 on 2012-04-23 21:38:50