Topic Path: Symbol Reference > Classes > TIdCustomHTTP Class > TIdCustomHTTP Properties > HandleRedirects Property
ContentsIndexHome
PreviousUpNext
TIdCustomHTTP.HandleRedirects Property

Indicates if the HTTP client can handle redirections to an alternate resource location.

property HandleRedirects: Boolean;

HandleRedirects is a Boolean property that indicates if the HTTP client should handle redirects in a response from the HTTP server. Redirects are indicated by the HTTP Response having a response code in the range 300 to 307, and requires further action by the HTTP Client to fulfill the request. 

Redirection Response codes include the following: 

 

Code 
Meaning 
300 
Multiple Choices. The request can be fulfilled with one of a set of resources, each with its own specific location. The HTTP client can select a preferred representation and redirect its request to that location. 
301 
Moved Permanently. The requested resource has been assigned a new permanent URI and any future references to this resource should use the new location specified in the Response
302 
Found. The requested resource resides temporarily under a different URI. Since the redirection might be altered on occasion, the client should continue to use the URI in the Request for future requests. 
304 
Not Modified. If the client has performed a conditional GET request and access is allowed, but the document has not been modified, the server should respond with this status code. The 304 response should not contain a message body, and is always terminated by the first empty line after the header fields, and must include a Date header. 
305 
Use Proxy. The requested resource must be accessed through the proxy given by the Location header in the HTTP Response containing the URI of the Proxy. 
307 
Temporary Redirect. The requested resource resides temporarily under a different URI. Since the redirection may be altered on occasion, the HTTP client should continue to use the URI in the RequestI for future requests. 

 

HandleRedirects is used with RedirectMaximum when performing the request to detect and prevent infinite redirection loops. HandleRedirects limits the number of active redirections for the client to the value specified in RedirectMaximum

When HandleRedirects is True, the HTTP Client will trigger the OnRedirect event handler to determine if the client can accept the redirection location found in an HTTP response. When accepted, the redirect causes a new HTTP request with the new location to be issued to fulfill the original request. 

When HandleRedirects is False, the OnRedirect event handler will be triggered, and an EIdProtocolReplyError exception will be raised when the redirect cannot be handled by the HTTP client. 

The default value for HandleRedirects is Id_TIdHTTP_HandleRedirects, as assigned during initialization of the component.

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