Os_http_request::content_type, Os_http_request::content_length, Example – Brocade Virtual ADX OpenScript API Guide (Supporting ADX v03.1.00) User Manual
Page 67: Context, Usage, Input parameters, Return values

Brocade Virtual ADX OpenScript API Guide
55
53-1003243-01
Methods
5
Example
OS_HTTP_REQUEST::content_type
Returns request content type if the content-type header is present otherwise it returns NULL.
Context
TTP request event. If called in the HTTP response context, undefined will be returned.
Usage
Can be used to perform load-balancing based on the content type.
Input Parameters
None.
Return Values
The following table contains the return values.
Example
OS_HTTP_REQUEST::content_length
Returns request content length if a content-length header is present otherwise it returns
undefined.
Context
HTTP request event. If called in the HTTP response context, undefined will be returned.
TABLE 53
Return Values
Name
Type
Description
string
Value of the HTTP header.
use OS_HTTP_REQUEST;
sub HTTP_REQUEST{
OS_HTTP_REQUEST::remove_all_headers("X-forwarded-for");
}
use OS_HTTP_REQUEST;
use OS_SLB;
sub HTTP_REQUEST{
my $content_type = OS_HTTP_REQUEST::content_type;
if ($content_type && $content_type eq "html") {
OS_SLB::forward(1);
}
}