Classe THTTPSend

Unit

Declaração

type THTTPSend = class(TSynaClient)

Descrição

abstract(Implementation of HTTP protocol.)

Hierarquia

Visão Geral

Campos

Protected FSock: TTCPBlockSocket;
Protected FTransferEncoding: TTransferEncoding;
Protected FAliveHost: string;
Protected FAlivePort: string;
Protected FHeaders: TStringList;
Protected FDocument: TMemoryStream;
Protected FMimeType: string;
Protected FProtocol: string;
Protected FKeepAlive: Boolean;
Protected FKeepAliveTimeout: integer;
Protected FStatus100: Boolean;
Protected FProxyHost: string;
Protected FProxyPort: string;
Protected FProxyUser: string;
Protected FProxyPass: string;
Protected FResultCode: Integer;
Protected FResultString: string;
Protected FUserAgent: string;
Protected FCookies: TStringList;
Protected FDownloadSize: int64;
Protected FUploadSize: int64;
Protected FRangeStart: int64;
Protected FRangeEnd: int64;
Protected FAddPortNumberToHost: Boolean;
Protected FInputStream: TStream;
Protected FOutputStream: TStream;

Métodos

Protected function ReadUnknown: Boolean; virtual;
Protected function ReadIdentity(Size: int64): Boolean; virtual;
Protected function ReadChunked: Boolean; virtual;
Protected procedure ParseCookies;
Protected function PrepareHeaders: AnsiString;
Protected function InternalDoConnect(needssl: Boolean): Boolean;
Protected function InternalConnect(needssl: Boolean): Boolean;
Protected function InputDocument: TStream;
Protected function OutputDocument: TStream;
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;

Propriedades

Published property Headers: TStringList read FHeaders;
Published property Cookies: TStringList read FCookies;
Published property Document: TMemoryStream read FDocument;
Published property RangeStart: int64 read FRangeStart Write FRangeStart;
Published property RangeEnd: int64 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: int64 read FDownloadSize;
Published property UploadSize: int64 read FUploadSize;
Published property Sock: TTCPBlockSocket read FSock;
Published property AddPortNumberToHost: Boolean read FAddPortNumberToHost write FAddPortNumberToHost;
Public property InputStream: TStream read FInputStream write FInputStream;
Public property OutputStream: TStream read FOutputStream write FOutputStream;

Descrição

Campos

Protected FSock: TTCPBlockSocket;
 
Protected FTransferEncoding: TTransferEncoding;
 
Protected FAliveHost: string;
 
Protected FAlivePort: string;
 
Protected FHeaders: TStringList;
 
Protected FDocument: TMemoryStream;
 
Protected FMimeType: string;
 
Protected FProtocol: string;
 
Protected FKeepAlive: Boolean;
 
Protected FKeepAliveTimeout: integer;
 
Protected FStatus100: Boolean;
 
Protected FProxyHost: string;
 
Protected FProxyPort: string;
 
Protected FProxyUser: string;
 
Protected FProxyPass: string;
 
Protected FResultCode: Integer;
 
Protected FResultString: string;
 
Protected FUserAgent: string;
 
Protected FCookies: TStringList;
 
Protected FDownloadSize: int64;
 
Protected FUploadSize: int64;
 
Protected FRangeStart: int64;
 
Protected FRangeEnd: int64;
 
Protected FAddPortNumberToHost: Boolean;
 
Protected FInputStream: TStream;
 
Protected FOutputStream: TStream;
 

Métodos

Protected function ReadUnknown: Boolean; virtual;
 
Protected function ReadIdentity(Size: int64): Boolean; virtual;
 
Protected function ReadChunked: Boolean; virtual;
 
Protected procedure ParseCookies;
 
Protected function PrepareHeaders: AnsiString;
 
Protected function InternalDoConnect(needssl: Boolean): Boolean;
 
Protected function InternalConnect(needssl: Boolean): Boolean;
 
Protected function InputDocument: TStream;
 
Protected function OutputDocument: TStream;
 
Public constructor Create;
 
Public destructor Destroy; override;
 
Public procedure Clear;

Reset headers, 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 defined in URL and accesses resource defined in URL by method. If Document is not empty, send it to the server as part of the 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 'https:' instead of 'http:' in the URL, your request is made by SSL/TLS connection (if you do not specify port, then port 443 is used instead of standard port 80). If you use SSL/TLS request and you have defined HTTP proxy, then HTTP-tunnel mode is automatically used .

Public procedure Abort;

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

Propriedades

Published property Headers: TStringList read FHeaders;

Before HTTP operation you may define any non-standard headers for HTTP request, except: 'Expect: 100-continue', 'Content-Length', 'Content-Type', 'Connection', 'Authorization', 'Proxy-Authorization' and 'Host' headers. After HTTP operation, it contains full headers of the returned document.

Published property Cookies: TStringList read FCookies;

Stringlist with name-value stringlist pairs. Each pair is one cookie. After the HTTP request is returned, cookies are parsed to this stringlist. You can leave these cookies untouched for next HTTP requests. 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: int64 read FRangeStart Write FRangeStart;

If you need to download only part of a requested document, specify here the position of subpart begin. If 0, the full document is requested.

Published property RangeEnd: int64 read FRangeEnd Write FRangeEnd;

If you need to download only part of a requested document, specify here the position of subpart end. If 0, the document from rangeStart to end of document is requested. (Useful for resuming broken downloads, 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 the 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 connection to proxy server used in HTTPMethod method.

Published property ProxyPass: string read FProxyPass Write FProxyPass;

Password for connection to proxy server used in HTTPMethod method.

Published property UserAgent: string read FUserAgent Write FUserAgent;

Here you can specify custom User-Agent identification. Default: 'Mozilla/4.0 (compatible; Synapse)'

Published property ResultCode: Integer read FResultCode;

Operation result code after successful HTTPMethod method.

Published property ResultString: string read FResultString;

Operation result string after successful HTTPMethod method.

Published property DownloadSize: int64 read FDownloadSize;

if this value is not 0, then data download is pending. In this case you have here the total size of downloaded data. Useful for drawing download progressbar from OnStatus event.

Published property UploadSize: int64 read FUploadSize;

if this value is not 0, then data upload is pending. In this case you have here the total size of uploaded data. Useful for drawing upload progressbar from OnStatus event.

Published property Sock: TTCPBlockSocket read FSock;

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

Published property AddPortNumberToHost: Boolean read FAddPortNumberToHost write FAddPortNumberToHost;

Allows to switch off port number in 'Host:' HTTP header. By default True. Some buggy servers do not like port informations in this header.

Public property InputStream: TStream read FInputStream write FInputStream;

for direct sending from any TStream. Defalut nil = use Document property instead.

Public property OutputStream: TStream read FOutputStream write FOutputStream;

for direct dovnloading into any TStream. Defalut nil = use Document property instead.


Gerado por PasDoc 0.16.0.