beautypg.com

Os_http_response::headers($name), Os_http_response::collect, Example – Brocade Virtual ADX OpenScript API Guide (Supporting ADX v03.1.00) User Manual

Page 80: Context, Input parameters, Return values

background image

68

Brocade Virtual ADX OpenScript API Guide

53-1003243-01

Methods

6

Example

OS_HTTP_RESPONSE::headers($name)

Gets the HTTP headers with the same name as a array.

Context

This function called in context other than http response will have no effect.

Input Parameters

The following table contains the input values.

Return Values

The following table contains the return values.

Example

OS_HTTP_RESPONSE::collect

Starts collecting an HTTP response payload.

An “HTTP_RESPONSE_DATA” event will be triggered once the collect condition is satisfied.

If more data is needed after the “HTTP_RESPONSE_DATA” event is triggered, the collect
function should be called again to start anew data collection sequence.

TABLE 69

Input Values

Name

Type

Description

$name

string

A string representing the value
of the header name.

TABLE 70

Return Values

Name

Type

Description

array

Headers with the same name
are returned as an array

use OS_HTTP_RESPONSE;

sub HTTP_RESPONSE{

if ( defined $version && version eq "1.0") {

OS_HTTP_RESPONSE::header("Set-Cookie", "ServerID=1101");

}

}

use OS_HTTP_RESPONSE;

sub HTTP_RESPONSE{

@cookies = OS_HTTP_RESPONSE::headers("Cookie");

}