Difference between revisions of "THttpCli"
Jump to navigation
Jump to search
(→Events) |
|||
(46 intermediate revisions by 7 users not shown) | |||
Line 1: | Line 1: | ||
+ | [[Main_Page | Main page]] -> [[ICS_Components_Reference | ICS components reference]] | ||
+ | -> [[THttpCli]] | ||
== Overview == | == Overview == | ||
− | THttpCli component is implementing the HTTP protocol described in RFC [http://rfc.net/rfc1945.html 1945] and RFC [http://rfc.net/rfc2068.html 2068]. HTTP protocol is the standard protocol for browsing the World Wide Web. | + | *'''unit''' HttpProt.pas |
+ | *'''inheritance''' THttpCli - TComponent | ||
+ | |||
+ | THttpCli component is implementing the client side HTTP protocol described in RFC [http://rfc.net/rfc1945.html 1945] and RFC [http://rfc.net/rfc2068.html 2068]. HTTP protocol is the standard protocol for browsing the World Wide Web. If you need an encrypted connection, use the SslHTTPCli component instead. | ||
+ | |||
+ | == Properties == | ||
+ | |||
+ | {| | ||
+ | | valign="top" width="150" | [[THttpCli.Accept | Accept]] |||| Mime types accepted in the reply. | ||
+ | |- | ||
+ | | valign="top" width="150" | [[THttpCli.AcceptLanguage | AcceptLanguage]] |||| Languages accepted in the reply. | ||
+ | |- | ||
+ | | valign="top" width="150" | [[THttpCli.AcceptRanges | AcceptRanges]] |||| Ranges accepted. | ||
+ | |- | ||
+ | | valign="top" width="150" | [[THttpCli.Agent | Agent]] |||| User agent sent to server. | ||
+ | |- | ||
+ | | valign="top" width="150" | [[THttpCli.AuthorizationRequest | AuthorizationRequest]] |||| List of authentication methods. | ||
+ | |- | ||
+ | | valign="top" width="150" | [[THttpCli.Connection | Connection]] |||| Connection type for keep-alive. | ||
+ | |- | ||
+ | | valign="top" width="150" | [[THttpCli.ContentLength | ContentLength]] |||| Received document length. | ||
+ | |- | ||
+ | | valign="top" width="150" | [[THttpCli.ContentRangeBegin | ContentRangeBegin]] |||| Start of requested range. | ||
+ | |- | ||
+ | | valign="top" width="150" | [[THttpCli.ContentRangeEnd | ContentRangeEnd]] |||| End of requested range. | ||
+ | |- | ||
+ | | valign="top" width="150" | [[THttpCli.ContentType | ContentType]] |||| Received document mime type. | ||
+ | |- | ||
+ | | valign="top" width="150" | [[THttpCli.ContentTypePost | ContentTypePost]] |||| Sent document mime type. | ||
+ | |- | ||
+ | | valign="top" width="150" | [[THttpCli.Cookie | Cookie]] |||| Cookies to be sent. | ||
+ | |- | ||
+ | | valign="top" width="150" | [[TWSocket | CtrlSocket]] |||| {{CtrlSocket}} | ||
+ | |- | ||
+ | | valign="top" width="150" | [[THttpCli.DnsResult | DnsResult]] |||| Result of DNS request. | ||
+ | |- | ||
+ | | valign="top" width="150" | [[THttpCli.DocName | DocName]] |||| Received document name. | ||
+ | |- | ||
+ | | valign="top" width="150" | [[THttpCli.FollowRelocation | FollowRelocation]] |||| Tell the component o follow or not the relocations. | ||
+ | |- | ||
+ | | valign="top" width="150" | [[THttpCli.Handle | Handle]] |||| Hidden window handle. | ||
+ | |- | ||
+ | | valign="top" width="150" | [[THttpCli.Hostname | Hostname]] |||| Hostname to which the URL point. | ||
+ | |- | ||
+ | | valign="top" width="150" | [[THttpCli.LastResponse | LastResponse]] |||| Last response from server. | ||
+ | |- | ||
+ | | valign="top" width="150" | [[THttpCli.LocalAddr | LocalAddr]] |||| Local address to which underlying socket is bound. | ||
+ | |- | ||
+ | | valign="top" width="150" | [[THttpCli.Location | Location]] |||| Where the relocation will take place. | ||
+ | |- | ||
+ | | valign="top" width="150" | [[THttpCli.ModifiedSince | ModifiedSince]] |||| Requested modification datetime. | ||
+ | |- | ||
+ | | valign="top" width="150" | [[THttpCli.MultiThreaded | MultiThreaded]] |||| To tell the component it runs within a thread. | ||
+ | |- | ||
+ | | valign="top" width="150" | [[THttpCli.NoCache | NoCache]] |||| Tell the server to not cache the request. | ||
+ | |- | ||
+ | | valign="top" width="150" | [[THttpCli.Options | Options]] |||| Options. | ||
+ | |- | ||
+ | | valign="top" width="150" | [[THttpCli.Protocol | Protocol]] |||| Protocol extracted from the URL. | ||
+ | |- | ||
+ | | valign="top" width="150" | [[THttpCli.Proxy | Proxy]] |||| Proxy to traverse to before connecting. The IP address or hostname of the proxy server. | ||
+ | |- | ||
+ | | valign="top" width="150" | [[THttpCli.ProxyConnection | ProxyConnection]] |||| Type of proxy connection. "Keep-Alive" or blank. | ||
+ | |- | ||
+ | | valign="top" width="150" | [[THttpCli.ProxyPort | ProxyPort]] |||| Port to be used to connect to proxy. | ||
+ | |- | ||
+ | | valign="top" width="150" | [[THttpCli.ProxyURL | ProxyURL]] |||| Combines four proxy properties as a URL for simplicity, i.e. http://[user[:password]@]host:port. Set ProxyAuth if that is required. | ||
+ | |- | ||
+ | | valign="top" width="150" | [[THttpCli.RcvdCount | RcvdCount]] |||| Bytes received. | ||
+ | |- | ||
+ | | valign="top" width="150" | [[THttpCli.RcvdHeader | RcvdHeader]] |||| Received header. | ||
+ | |- | ||
+ | | valign="top" width="150" | [[THttpCli.RcvdStream | RcvdStream]] |||| Stream to receive a document. | ||
+ | |- | ||
+ | | valign="top" width="150" | [[THttpCli.ReasonPhrase | ReasonPhrase]] |||| Status returned by server. | ||
+ | |- | ||
+ | | valign="top" width="150" | [[THttpCli.Reference | Reference]] |||| To send the referrer to the server. | ||
+ | |- | ||
+ | | valign="top" width="150" | [[THttpCli.RequestVer | RequestVer]] |||| HTTP version to be used in the request. | ||
+ | |- | ||
+ | | valign="top" width="150" | [[THttpCli.Sender | Sender]] |||| Sender to be sent to server. | ||
+ | |- | ||
+ | | valign="top" width="150" | [[THttpCli.SendStream | SendStream]] |||| Stream to be posted. | ||
+ | |- | ||
+ | | valign="top" width="150" | [[THttpCli.SentCount | SentCount]] |||| Bytes sent. | ||
+ | |- | ||
+ | | valign="top" width="150" | [[THttpCli.SocksAuthentication | SocksAuthentication]] |||| Socks server authentication type. | ||
+ | |- | ||
+ | | valign="top" width="150" | [[THttpCli.SocksLevel | SocksLevel]] |||| Sockers server protocol level. | ||
+ | |- | ||
+ | | valign="top" width="150" | [[THttpCli.SocksPassword | SocksPassword]] |||| Socks server password. | ||
+ | |- | ||
+ | | valign="top" width="150" | [[THttpCli.SocksPort | SocksPort]] |||| Socks server port. | ||
+ | |- | ||
+ | | valign="top" width="150" | [[THttpCli.SocksServer | SocksServer]] |||| Socks server hostname or IP. | ||
+ | |- | ||
+ | | valign="top" width="150" | [[THttpCli.SocksUsercode | SocksUsercode]] |||| Socks server usercode. | ||
+ | |- | ||
+ | | valign="top" width="150" | [[THttpCli.State | State]] |||| Component state. | ||
+ | |- | ||
+ | | valign="top" width="150" | [[THttpCli.StatusCode | StatusCode]] |||| Server status code. | ||
+ | |- | ||
+ | | valign="top" width="150" | [[THttpCli.TransferEncoding | TransferEncoding]] |||| Received document transfer encoding. | ||
+ | |- | ||
+ | | valign="top" width="150" | [[THttpCli.URL | URL]] |||| Complete URL to act on | ||
+ | |} | ||
== Methods == | == Methods == | ||
− | + | {| | |
− | + | | valign="top" width="150" | [[THttpCli.Abort | Abort]] |||| Abort the current operation. | |
− | + | |- | |
− | + | | [[THttpCli.Close | Close]] |||| Close the current connection (synchronous). | |
− | + | |- | |
− | + | | [[THttpCli.CloseAsync | CloseAsync]] |||| Close the current connection (asynchronous). | |
− | + | |- | |
− | + | | [[THttpCli.Create | Create]] |||| Create a new component instance. | |
− | + | |- | |
− | + | | [[THttpCli.Destroy | Destroy]] |||| Destroy the current component instance. | |
− | + | |- | |
− | + | | [[THttpCli.Get | Get]] |||| Request an URL using GET method (synchronous). | |
− | + | |- | |
+ | | [[THttpCli.GetASync | GetASync]] |||| Request an URL using GET method (asynchronous). | ||
+ | |- | ||
+ | | [[THttpCli.Head | Head]] |||| Request the header for an URL (synchronous). | ||
+ | |- | ||
+ | | [[THttpCli.HeadASync | HeadASync]] |||| Request the header for an URL (asynchronous). | ||
+ | |- | ||
+ | | [[THttpCli.Post | Post]] |||| Request an URL using the POST method (synchronous). | ||
+ | |- | ||
+ | | [[THttpCli.PostASync | PostASync]] |||| Request an URL using the POST method (asynchronous). | ||
+ | |- | ||
+ | | [[THttpCli.Put | Put]] |||| Request an URL using the PUT method (synchronous). | ||
+ | |- | ||
+ | | [[THttpCli.PutASync | PutASync]] |||| Request an URL using the PUT method (asynchronous). | ||
+ | |} | ||
+ | |||
+ | == Events == | ||
+ | |||
+ | {| | ||
+ | | valign="top" width="150" | [[THttpCli.OnBeforeHeaderSend | OnBeforeHeaderSend]] |||| Triggered before the header is sent. | ||
+ | |- | ||
+ | | [[THttpCli.OnCommand | OnCommand]] |||| Triggered for each command sent. | ||
+ | |- | ||
+ | | [[THttpCli.OnCookie | OnCookie]] |||| Triggered when a cookie has been received. | ||
+ | |- | ||
+ | | [[THttpCli.OnDataPush | OnDataPush]] |||| Received data outside of any request. | ||
+ | |- | ||
+ | | [[THttpCli.OnDataPush2 | OnDataPush2]] |||| Received data outside of a header. | ||
+ | |- | ||
+ | | [[THttpCli.OnDocBegin | OnDocBegin]] |||| Triggered when the document part is about to be received. | ||
+ | |- | ||
+ | | [[THttpCli.OnDocData | OnDocData]] |||| Triggered for each packet of the document part. | ||
+ | |- | ||
+ | | [[THttpCli.OnDocEnd | OnDocEnd]] |||| Triggered when the document is complete. | ||
+ | |- | ||
+ | | [[THttpCli.OnHeaderBegin | OnHeaderBegin]] |||| Triggered when the first header line is about to be received. | ||
+ | |- | ||
+ | | [[THttpCli.OnHeaderData | OnHeaderData]] |||| Triggered for each received header line. | ||
+ | |- | ||
+ | | [[THttpCli.OnHeaderEnd | OnHeaderEnd]] |||| Triggered when the header has been completely received. | ||
+ | |- | ||
+ | | [[THttpCli.OnLocationChange | OnLocationChange]] |||| Triggered whenever the server sent a location change. | ||
+ | |- | ||
+ | | [[THttpCli.OnRequestDone | OnRequestDone]] |||| Triggered when a request is completed. | ||
+ | |- | ||
+ | | [[THttpCli.OnRequestHeaderBegin | OnRequestHeaderBegin]] |||| Triggered when the first header line is about to be sent. | ||
+ | |- | ||
+ | | [[THttpCli.OnRequestHeaderEnd | OnRequestHeaderEnd]] |||| Triggered when the last header line has been sent. | ||
+ | |- | ||
+ | | [[THttpCli.OnSendBegin | OnSendBegin]] |||| Triggered before sending document part. | ||
+ | |- | ||
+ | | [[THttpCli.OnSendData | OnSendData]] |||| Triggered when sending document part. | ||
+ | |- | ||
+ | | [[THttpCli.OnSendEnd | OnSendEnd]] |||| Triggered when document has been sent completely. | ||
+ | |- | ||
+ | | [[THttpCli.OnSessionClosed | OnSessionClosed]] |||| Triggered when the current connection has been closed. | ||
+ | |- | ||
+ | | [[THttpCli.OnSessionConnected | OnSessionConnected]] |||| Triggered when the connection has been openend. | ||
+ | |- | ||
+ | | [[THttpCli.OnSocketError | OnSocketError]] |||| Triggered when a socket error occured. | ||
+ | |- | ||
+ | | [[THttpCli.OnSocksConnected | OnSocksConnected]] |||| Triggered when connected to socks server. | ||
+ | |- | ||
+ | | [[THttpCli.OnSocksError | OnSocksError]] |||| Triggered when a error occurs with the socks server. | ||
+ | |- | ||
+ | | [[THttpCli.OnStateChange | OnStateChange]] |||| Triggered when component state change. | ||
+ | |} | ||
− | == | + | == How to == |
+ | |||
+ | [[THttpCli.FAQ.Timeout | How to implement a timeout for THttpCli in my application?]] | ||
− | + | [[THttpCli.FAQ.Progress | How to implement a progress for THttpCli in my application?]] | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | [[THttpCli.FAQ.SizeLimit | How to implement a download size limitation for THttpCli in my application?]] | |
− | + | {{Components_Footer}} | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− |
Latest revision as of 15:45, 5 December 2019
Main page -> ICS components reference -> THttpCli
Contents
Overview
- unit HttpProt.pas
- inheritance THttpCli - TComponent
THttpCli component is implementing the client side HTTP protocol described in RFC 1945 and RFC 2068. HTTP protocol is the standard protocol for browsing the World Wide Web. If you need an encrypted connection, use the SslHTTPCli component instead.
Properties
Accept | Mime types accepted in the reply. | |
AcceptLanguage | Languages accepted in the reply. | |
AcceptRanges | Ranges accepted. | |
Agent | User agent sent to server. | |
AuthorizationRequest | List of authentication methods. | |
Connection | Connection type for keep-alive. | |
ContentLength | Received document length. | |
ContentRangeBegin | Start of requested range. | |
ContentRangeEnd | End of requested range. | |
ContentType | Received document mime type. | |
ContentTypePost | Sent document mime type. | |
Cookie | Cookies to be sent. | |
CtrlSocket | The underlying instance of TWSocket handles the connection and raw data exchange. | |
DnsResult | Result of DNS request. | |
DocName | Received document name. | |
FollowRelocation | Tell the component o follow or not the relocations. | |
Handle | Hidden window handle. | |
Hostname | Hostname to which the URL point. | |
LastResponse | Last response from server. | |
LocalAddr | Local address to which underlying socket is bound. | |
Location | Where the relocation will take place. | |
ModifiedSince | Requested modification datetime. | |
MultiThreaded | To tell the component it runs within a thread. | |
NoCache | Tell the server to not cache the request. | |
Options | Options. | |
Protocol | Protocol extracted from the URL. | |
Proxy | Proxy to traverse to before connecting. The IP address or hostname of the proxy server. | |
ProxyConnection | Type of proxy connection. "Keep-Alive" or blank. | |
ProxyPort | Port to be used to connect to proxy. | |
ProxyURL | Combines four proxy properties as a URL for simplicity, i.e. http://[user[:password]@]host:port. Set ProxyAuth if that is required. | |
RcvdCount | Bytes received. | |
RcvdHeader | Received header. | |
RcvdStream | Stream to receive a document. | |
ReasonPhrase | Status returned by server. | |
Reference | To send the referrer to the server. | |
RequestVer | HTTP version to be used in the request. | |
Sender | Sender to be sent to server. | |
SendStream | Stream to be posted. | |
SentCount | Bytes sent. | |
SocksAuthentication | Socks server authentication type. | |
SocksLevel | Sockers server protocol level. | |
SocksPassword | Socks server password. | |
SocksPort | Socks server port. | |
SocksServer | Socks server hostname or IP. | |
SocksUsercode | Socks server usercode. | |
State | Component state. | |
StatusCode | Server status code. | |
TransferEncoding | Received document transfer encoding. | |
URL | Complete URL to act on |
Methods
Abort | Abort the current operation. | |
Close | Close the current connection (synchronous). | |
CloseAsync | Close the current connection (asynchronous). | |
Create | Create a new component instance. | |
Destroy | Destroy the current component instance. | |
Get | Request an URL using GET method (synchronous). | |
GetASync | Request an URL using GET method (asynchronous). | |
Head | Request the header for an URL (synchronous). | |
HeadASync | Request the header for an URL (asynchronous). | |
Post | Request an URL using the POST method (synchronous). | |
PostASync | Request an URL using the POST method (asynchronous). | |
Put | Request an URL using the PUT method (synchronous). | |
PutASync | Request an URL using the PUT method (asynchronous). |
Events
OnBeforeHeaderSend | Triggered before the header is sent. | |
OnCommand | Triggered for each command sent. | |
OnCookie | Triggered when a cookie has been received. | |
OnDataPush | Received data outside of any request. | |
OnDataPush2 | Received data outside of a header. | |
OnDocBegin | Triggered when the document part is about to be received. | |
OnDocData | Triggered for each packet of the document part. | |
OnDocEnd | Triggered when the document is complete. | |
OnHeaderBegin | Triggered when the first header line is about to be received. | |
OnHeaderData | Triggered for each received header line. | |
OnHeaderEnd | Triggered when the header has been completely received. | |
OnLocationChange | Triggered whenever the server sent a location change. | |
OnRequestDone | Triggered when a request is completed. | |
OnRequestHeaderBegin | Triggered when the first header line is about to be sent. | |
OnRequestHeaderEnd | Triggered when the last header line has been sent. | |
OnSendBegin | Triggered before sending document part. | |
OnSendData | Triggered when sending document part. | |
OnSendEnd | Triggered when document has been sent completely. | |
OnSessionClosed | Triggered when the current connection has been closed. | |
OnSessionConnected | Triggered when the connection has been openend. | |
OnSocketError | Triggered when a socket error occured. | |
OnSocksConnected | Triggered when connected to socks server. | |
OnSocksError | Triggered when a error occurs with the socks server. | |
OnStateChange | Triggered when component state change. |
How to
How to implement a timeout for THttpCli in my application?
How to implement a progress for THttpCli in my application?
How to implement a download size limitation for THttpCli in my application?