Spirent Avalanche 5.46 February 29, 2024
Use SETCOOKIE to allow runtime control of cookie values. This feature is especially useful for cookies that are created or stored by JavaScript.
To use this feature, you search for a value that is returned by a server response and then use SETCOOKIE to set the value. You can then use a GET or POST request to reply with the cookie value.
When you use this action, you assign the following variables:
Name—The name attribute is a sequence of characters excluding semi-colon, comma and white space. This is the only required attribute on the Set-Cookie header.
Value—The name of the header in the file that contains the cookie.
Date—A date that defines the valid lifetime of the cookie. After the expiration date occurs, the cookie is no longer stored or given out.
Path—The subset of URLs in a domain for which the cookie is valid. If you don't specify the path, it is assumed to be the same path as the document being described by the attribute that contains the cookie.
Domain—The default value is the host name of the server that generated the cookie response. Only domains within the specified domain can set a cookie for that domain.
Secure—If a cookie is marked secure it is only transmitted if communications with the host is secured. If secure is not specified, a cookie is considered safe to be sent over unsecured channels.
SETCOOKIE<name,value,date,path,domain,secure>
Additional information about the Internet Standards for Set-Cookie is included in RFC 2109.
# request page which has cookie set via a JavaScript function.
1 GET http://192.168.42.11/talk/index.html
# assign using response data specified by the search criteria cookie_part
ASSIGN VARIABLE<Value cookie_part 1 >
# assign value from database cookie_name column 1
ASSIGN VARIABLE<Name cookie_name.$1>
# set the date
ASSIGN VARIABLE<Date "09 Feb 2010 21:18:00 GMT">
# set the path
ASSIGN VARIABLE<Path "/talk">
# set the domain
ASSIGN VARIABLE<Domain "192.168.42.11">
# set the secure flag
ASSIGN VARIABLE<Secure "false">
SETCOOKIE<name,value,date,path,domain,secure>
# connect to another page to verify the cookie is being sent with the request.
1 GET http://192.168.42.11/talk/musthavecookiepage.html
© 2024 Spirent Communications, Inc. All Rights Reserved.