MaxRedirects (HttpRequest property): Difference between revisions

From m204wiki
Jump to navigation Jump to search
Line 1: Line 1:
{{Template:HTTPRequest:MaxRedirects subtitle}}
{{Template:HttpRequest:MaxRedirects subtitle}}


This method lets you request automatic handling of redirects that a
This method lets you request automatic handling of redirects that a
Line 8: Line 8:
times a redirect is followed when it is returned from a web server.
times a redirect is followed when it is returned from a web server.
==Syntax==
==Syntax==
{{Template:HTTPRequest:MaxRedirects syntax}}
{{Template:HttpRequest:MaxRedirects syntax}}
===Syntax terms===
===Syntax terms===
<table class="syntaxTable">
<table class="syntaxTable">
Line 28: Line 28:
moved and that the client process should fetch it from a new location.
moved and that the client process should fetch it from a new location.
A server indicates this case by returning a response code in the 300s and
A server indicates this case by returning a response code in the 300s and
by returning a response header named &amp;amp;ldquo;location&amp;amp;rdquo; that indicates the new
by returning a response header named &amp;amp;amp;ldquo;location&amp;amp;amp;rdquo; that indicates the new
location of the page or resource.
location of the page or resource.
The <var class="product">HTTP Helper</var> returns such a response code
The <var class="product">HTTP Helper</var> returns such a response code
Line 56: Line 56:
</ul>
</ul>
==See also==
==See also==
{{Template:HTTPRequest:MaxRedirects footer}}
{{Template:HttpRequest:MaxRedirects footer}}

Revision as of 20:16, 16 June 2011

Automatically handle redirects (HttpRequest class)


This method lets you request automatic handling of redirects that a Get, Post, or Send method call receives from the server. Since redirects may be chained, that is, the location to which a redirect leads can also return a redirect, MaxRedirects specifies the maximum number of times a redirect is followed when it is returned from a web server.

Syntax

%currentNumber = httpRequest:MaxRedirects httpRequest:MaxRedirects = newNumber

Syntax terms

%httpreq An instantiated HTTPRequest object.
value A numeric expression that evaluates to an integer from 0 through 100, which indicates the maximum number of times a redirect is followed on one Get, Post, or Send call.

If an invalid or out of range value is specified, the request is canceled. A value of 0 (the default) means redirects are not automatically handled.

%curr The numeric variable for the assignment of the current value of MaxRedirects.

Usage notes

  • An HTTP server may return an indication that a page has moved and that the client process should fetch it from a new location. A server indicates this case by returning a response code in the 300s and by returning a response header named &amp;amp;ldquo;location&amp;amp;rdquo; that indicates the new location of the page or resource. The HTTP Helper returns such a response code to the application and takes no further action.
  • If the maximum number of redirections have been followed, and the last response is still a redirection response code, the last redirection response code is returned to the HTTP Helper application.
  • When MaxRedirects is set to a value greater than zero, the following HTTP redirection response codes are automatically handled:
    301
    Moved Permanently
    302
    Found
    303
    See Other
    307
    Temporary Redirect

    For more details concerning HTTP Response codes, see http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html.

  • To facilitate working with redirects, the Url method of the HTTPResponse object returns the actual URL from which a response was obtained.

See also