Class THTTPSend

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type THTTPSend = class(TSynaClient)

Description

abstract(Implementation of HTTP protocol.)

Hierarchy

Overview

Methods

Public constructor Create;
Public destructor Destroy; override;
Public procedure Clear;
Public procedure DecodeStatus(const Value: string);
Public function HTTPMethod(const Method, URL: string): Boolean;
Public procedure Abort;

Properties

Published property Headers: TStringList read FHeaders;
Published property Cookies: TStringList read FCookies;
Published property Document: TMemoryStream read FDocument;
Published property RangeStart: integer read FRangeStart Write FRangeStart;
Published property RangeEnd: integer read FRangeEnd Write FRangeEnd;
Published property MimeType: string read FMimeType Write FMimeType;
Published property Protocol: string read FProtocol Write FProtocol;
Published property KeepAlive: Boolean read FKeepAlive Write FKeepAlive;
Published property KeepAliveTimeout: integer read FKeepAliveTimeout Write FKeepAliveTimeout;
Published property Status100: Boolean read FStatus100 Write FStatus100;
Published property ProxyHost: string read FProxyHost Write FProxyHost;
Published property ProxyPort: string read FProxyPort Write FProxyPort;
Published property ProxyUser: string read FProxyUser Write FProxyUser;
Published property ProxyPass: string read FProxyPass Write FProxyPass;
Published property UserAgent: string read FUserAgent Write FUserAgent;
Published property ResultCode: Integer read FResultCode;
Published property ResultString: string read FResultString;
Published property DownloadSize: integer read FDownloadSize;
Published property UploadSize: integer read FUploadSize;
Published property Sock: TTCPBlockSocket read FSock;
Published property AddPortNumberToHost: Boolean read FAddPortNumberToHost write FAddPortNumberToHost;

Description

Methods

Public constructor Create;
 
Public destructor Destroy; override;
 
Public procedure Clear;

Reset headers and document and Mimetype.

Public procedure DecodeStatus(const Value: string);

Decode ResultCode and ResultString from Value.

Public 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 .

Public procedure Abort;

You can call this method from OnStatus event for break current data transfer. (or from another thread.)

Properties

Published 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.

Published 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.

Published property Document: TMemoryStream read FDocument;

Stream with document to send (before request, or with document received from HTTP server (after request).

Published 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.

Published 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.)

Published property MimeType: string read FMimeType Write FMimeType;

Mime type of sending data. Default is: 'text/html'.

Published property Protocol: string read FProtocol Write FProtocol;

Define protocol version. Possible values are: '1.1', '1.0' (default) and '0.9'.

Published property KeepAlive: Boolean read FKeepAlive Write FKeepAlive;

If True (default value), keepalives in HTTP protocol 1.1 is enabled.

Published property KeepAliveTimeout: integer read FKeepAliveTimeout Write FKeepAliveTimeout;

Define timeout for keepalives in seconds!

Published property Status100: Boolean read FStatus100 Write FStatus100;

if True, then server is requested for 100status capability when uploading data. Default is False (off).

Published property ProxyHost: string read FProxyHost Write FProxyHost;

Address of proxy server (IP address or domain name) where you want to connect in HTTPMethod method.

Published property ProxyPort: string read FProxyPort Write FProxyPort;

Port number for proxy connection. Default value is 8080.

Published property ProxyUser: string read FProxyUser Write FProxyUser;

Username for connect to proxy server where you want to connect in HTTPMethod method.

Published property ProxyPass: string read FProxyPass Write FProxyPass;

Password for connect to proxy server where you want to connect in HTTPMethod method.

Published property UserAgent: string read FUserAgent Write FUserAgent;

Here you can specify custom User-Agent indentification. By default is used: 'Mozilla/4.0 (compatible; Synapse)'

Published property ResultCode: Integer read FResultCode;

After successful HTTPMethod method contains result code of operation.

Published property ResultString: string read FResultString;

After successful HTTPMethod method contains string after result code.

Published 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.

Published 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.

Published property Sock: TTCPBlockSocket read FSock;

Socket object used for TCP/IP operation. Good for seting OnStatus hook, etc.

Published 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:57