Topic Path: Symbol Reference > Classes > TIdRequestHeaderInfo Class > TIdRequestHeaderInfo Properties > Host Property
ContentsIndexHome
PreviousUpNext
TIdRequestHeaderInfo.Host Property

Represents the Internet host name or address for the resource accessed by the HTTP request.

property Host: String;

Host is a string property used to generate the Host header, as defined in RFC 2616, and indicates the Internet host and port number of the resource accessed in a HTTP request. 

Host normally contains a value derived from the URI indicated in TIdHTTP.URL, and allows identification of the server to differentiate requests that might use an ambiguous or relative URI on a HTTP server that provides multiple host names using a single IP address. 

When Host does not contain a trailing port number, it is implied that the default TIdHTTP.Port number will be used for the service requested. For example, a request to the origin server for http://www.w3.org/pub/WWW/ could include the following value in Host: 

 

   Host: www.w3.org:80

 

A value must be included in Host for all HTTP/1.1 request messages. If the requested URI in TIdHTTP.URL does not include an Internet host name for the service being requested, then the Host property for the request must be given with an empty value. 

The most common form of Request-URI is that used to identify a resource on an origin server or gateway using a relative path specifier. In this case the path in TIdHTTP.URL would contain the absolute path, and the Host property for the request must include the network location or server identity. For example, a client wishing to retrieve the resource identitifed using the path 'www.w3.org/pub/WWW/TheProject.html' would result in a request containg the following: 

 

Property 
Value 
IdHTTP.URL.URI 
'/pub/WWW/TheProject.html' 
IdHTTP.Request.Host 
'www.w3.org' 

 

Host is updated when TIdHTTP prepares the HTTP request for transmission to the remote server.

Copyright 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Post feedback to the Indy Docs Newsgroup.