beautypg.com

Os_http_request::path, Os_http_request::path($val), Context – Brocade Virtual ADX OpenScript API Guide (Supporting ADX v03.1.00) User Manual

Page 53: Usage, Input parameters, Return values, Example

background image

Brocade Virtual ADX OpenScript API Guide

41

53-1003243-01

Methods

5

OS_HTTP_REQUEST::path

Returns URL path specified in HTTP request header if it exists, otherwise it will return NULL.

Context

HTTP request event. If called in the HTTP response context, undefined will be returned.

Usage

Can be used to perform load-balancing based on the url path.

Input Parameters

None.

Return Values

The following table contains the return values.

Example

OS_HTTP_REQUEST::path($val)

Sets the value of the url path to the value specified in $val.

Context

HTTP request event. This function called in http response context will have no effect.

Usage

Used to rewrite a url path.

TABLE 33

Return Values

Name

Type

Description

string

Value of the url. If not present,
undefined is returned.

use OS_HTTP_REQUEST;

use OS_SLB;

sub HTTP_REQUEST{

my $path = OS_HTTP_REQUEST::path;

my $method = OS_HTTP_REQUEST::method;

if (defined $path && $path eq "/cgi-bin/") {

OS_SLB::forward(1);

} elsif ( defined $method && $method eq "GET") {

OS_SLB::forward(2);

}

}