Indy 9 | Content | Index | Reference

TIdRequestHeaderInfo
Hierarchy, Properties, Methods, See Also, Unit: IdHTTPHeaderInfo
Implements message headers for an HTTP request.

    TIdRequestHeaderInfo = class(TIdEntityHeaderInfo)

Unit
IdHTTPHeaderInfo
Description
TIdRequestHeaderInfo is a TIdEntityHeaderInfo descendant that implements properties and methods needed to represent message headers for a HTTP request, as described in the Internet Standards document:

- RFC 2616 - Hypertext Transfer Protocol version 1.1 [HTTP/1.1] (http://www.rfc-editor.org/rfc/rfc2616.txt)

The request headers allow the client to pass additional information about the request, or the request client, to the server.

TIdRequestHeaderInfo.Accept
TIdRequestHeaderInfo, Example
Specifies the media types accepted in a HTTP response.

    property Accept: string;

Description
Accept is a String property that specifies the media types that are acceptable in a resulting HTTP response, and can be used to limit the request to a small set of desired types. If no Accept header field is present, then it is assumed that the client accepts all media types.

Accept is composed of the media type, subtype, and optional parameters. The asterisk "*" character is used to group media types into ranges, with "*/*" indicating all media types and "type/*" indicating all subtypes of that type.

Each media type and subtype may include one or more parameters, beginning with the "q" parameter that indicates the relative quality factor. Quality factors allow the user agent to determine the relative degree of preference for that media type and subtype, using the qvalue scale from 0 to 1. The default value is q=1.

Accept is updated in the ProcessHeaders method. Accept is used in SetHeaders to read the header values for the request.

The default value for Accept is set to 'text/html, */*' when the Clear method is called.

TIdRequestHeaderInfo.AcceptCharSet
TIdRequestHeaderInfo, Example
Indicates the character sets accepted in a HTTP response.

    property AcceptCharSet: string;

Description
AcceptCharSet is a String property that indicates the character sets accepted in a resulting HTTP response. AcceptCharSet may contain any valid Character set value as described in the Internet Standards document:

- RFC 1700, Assigned Numbers

Each charset value may have an associated quality value which represents the user's preference for that charset. The default value is q=1. For example:

      iso-8859-5, unicode-1-1; q=0.8

The special value "*" in Accept-CharSet matches every character set including ISO-8859-1. If no "*" is present in AcceptCharSet, then all character sets not explicitly mentioned get a quality value of 0, except for ISO-8859-1, which gets a quality value of 1 if not explicitly mentioned.

If no AcceptCharSet header is present, the default is that any character set is acceptable.

TIdRequestHeaderInfo.AcceptEncoding
TIdRequestHeaderInfo, See Also, Example
Indicates the content encodings accepted in a HTTP response.

    property AcceptEncoding: string;

Description
AcceptEncoding is a String property that indicates the content encodings accepted in a resulting HTTP response. An AcceptEncoding value is composed of one or more content encoding scheme and an optional realtive quality factor for the encoding. AcceptEncoding permits the same values as permitted in ContentEncoding. The special "*" symbol in AcceptEncoding matches any available content encoding not explicitly listed in the header field.

TIdRequestHeaderInfo.AcceptLanguage
TIdRequestHeaderInfo, See Also
Indicates languages accepted in a HTTP response.

    property AcceptLanguage: string;

Description
AcceptLanguage is a String property that indicates the languages preferred in a HTTP response. AcceptLanguage can contain the same valid values as the ContentLanguage property.

Each language specified may have an associated quality value which represents an estimate of the user preference for the languages specified by that range. The quality value defaults to "q=1". For example:

      da, en-gb;q=0.8, en;q=0.7

The special character "*" matches every tag not matched by any other language specifier in AcceptLanguage. If no AcceptLanguage header is present in the request, the server assumes that all languages are equally acceptable.

TIdRequestHeaderInfo.BasicAuthentication
TIdRequestHeaderInfo, See Also
Indicates that HTTP Basic Access authentication should be used.

    property BasicAuthentication: boolean;

Description
BasicAuthentication is a Boolean property that indicates if the HTTP Basic Access authentication algorithm should be used to calculate authorization credentials for the HTTP request. Set BasicAuthentication to True to allow TIdBasicAuthentication to be assigned to Authentication in SetHeaders.

TIdRequestHeaderInfo.From
TIdRequestHeaderInfo, See Also
Indicates the email address for the requesting user.

    property From: string;

Description
From is a String property that contains an optional RFC 1123-complaint Internet email address for the person controlling the requesting user agent. For example:

          webmaster@w3.org

From may be used for server logging and as a means for identifying the source of invalid or unwanted requests. From should not be used as an insecure form of access protection.

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

    property Host: string;

Description
Host is a string property that represents 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:

        IdHTTP.URL.URI contains '/pub/WWW/TheProject.html';
        IdHTTP.Request.Host contains 'www.w3.org';

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

TIdRequestHeaderInfo.Password
TIdRequestHeaderInfo, See Also
Represents the password used in construction of authorization credentials.

    property Password: String;

Description
Password is a String property used in conjunction with Username to construct authorization credentials during Authentiction of HTTP connection. Username and Password are suppied to the TIdAuthentication class instance in Authentication, when BasicAuthentication is True, in the SetHeaders method.

TIdRequestHeaderInfo.ProxyConnection
TIdRequestHeaderInfo, See Also
Indicates the action to perform for a proxied connection.

    property ProxyConnection: string;

Description
ProxyConnection is a String property that represents the value to be used in an HTTP request for the 'Proxy-connection' header. ProxyConnection indicates that an HTTP request using a proxied connection should attempt to use the indicated action during connection to the proxy host. ProxyConnection can contain one of the values:

- KEEP—ALIVE - The connection should be maintained for subsequent use.

- CLOSE - The connection should be closed.

TIdRequestHeaderInfo.Referer
TIdRequestHeaderInfo, Example
Specifies the address where a request URI was obtained.

    property Referer: string;

Description
Referer is a String property that allows the client to specify, to the server, the address of the resource from which the Request URI was obtained. The Referer header allows a server to generate lists of links used to access the resource, and may be used for logging or caching purposes.

If the Referer value is a relative URI, it should be interpreted relative to the URI for the RequestI, and may not include a fragment.

TIdRequestHeaderInfo.UserAgent
TIdRequestHeaderInfo
Identifies the user agent (program) issuing the HTTP request.

    property UserAgent: string;

Description
UserAgent is a String property that contains information about the user agent originating the HTTP request. UserAgent is used for statistical purposes, the tracing of protocol violations, and automated recognition of user agents for the sake of tailoring responses to avoid particular user agent limitations.

UserAgent can contain multiple product identifiers and comments identifying the agent and any subproducts which form a significant part of the user agent.

UserAgent should be provided for all HTTP requests.

UserAgent will be reset to its default value in the Clear method.

TIdRequestHeaderInfo.Username
TIdRequestHeaderInfo, See Also
Represents the Username used in construction of authorization credentials.

    property Username: String;

Description
Username is a String property used in conjunction with Password to construct authorization credentials during Authentiction of HTTP connection. Username and Password are suppied to the TIdAuthentication class instance in Authentication, when BasicAuthentication is True, in the SetHeaders method.

TIdRequestHeaderInfo.Clear
TIdRequestHeaderInfo, See Also
Resets request headers to their default values.

    procedure Clear; override;

Description
Clear is an overriden procedure that clears values assigned to object properties. Clear also resets the following object properties to their default values:

- Accept - 'text/html, */*'

- AcceptCharSet - '' (Empty string)

- UserAgent - DefaultUserAgent

- BasicAuthentication - False

Clear also resets any values in ProxyParams, when the object property has been assigned, prior to calling the inherited Clear method.

TIdRequestHeaderInfo.ProcessHeaders
TIdRequestHeaderInfo, See Also
Loads headers values into their object properties.

    procedure ProcessHeaders; override;

Parameters
Headers
Header names and values to be processed.
Description
ProcessHeaders is an overridden procedure that load the header names and values in Headers into their corresponding object properties. RawHeaders is updated to contain the initial data in Headers. Values in Headers are assigned to the corresponding property, and subsequently removed the TIdHeaderList. ProcessHeaders also determines the values for ContentRangeStart and ContentRangeEnd when Headers contains the 'Range' header.

ProcessHeaders callls the inherited ProcessHeaders method to allow handing of Entity headers, and headers that are stored in ExtraHeaders.

TIdRequestHeaderInfo.SetHeaders
TIdRequestHeaderInfo, See Also
Stores header properties in the specified list of header names and values.

    procedure SetHeaders; override;

Parameters
Headers
Destination for the header property values.
Description
SetHeaders is an overriden procedure that populates the TIdHeaderList specified in Headers. SetHeaders calls the inherited method to process Entity headers and ExtraHeaders. SetHeaders then adds non-blank HTTP request property values to the list of header names and values.

SetHeaders also constructs the 'Range' header using the values in ContentRangeStart and ContentRangeEnd. If Authentication has been assigned, or BasicAuthentication is True, SetHeaders will construct an 'Authorization' header using the credentials returned by the TIdAuthentication object instance.

SetHeaders also calls ProxyParams.SetHeaders to allow construction of Proxy-specific header names and values.

Created with Doc-O-Matic 2 donated to Project JEDI. Commercial license available from the Doc-O-Matic site.