web_add_cookie_ex

Adds a cookie with specified add behavior.

C Language

int web_add_cookie_ex( const char *Cookie , [const char *Insert,][ const char *AllowEmptyDomain,] [ENDITEM, Cookie, [Insert,] [AllowEmptyDomain,] ] [ENDITEM...] LAST );
Argument
Description
Cookie
Defines the cookie to add or modify. The elements in the Cookie parameter are the same as the elements in the Set–Cookie HTTP Response Header.
Insert
The Insert parameter has one of the two values: "Default" or "Alt". When the value is Alt, the cookie is inserted as the first in the cookie table. Otherwise, it is inserted at the default location. The default value of Insert is "Default".
AllowEmptyDomain
The values are "yes" and "no". When the value is "yes", the domain element in the cookie can be empty. The default is "no".
ENDITEM
A delimiter that separates one set of cookie definitions from the next. Do not pass ENDITEM except to separate definitions.
LAST
Required marker for the end of the argument list.

Return Values

This function returns LR_PASS (0) on success, and LR_FAIL (1) on failure.

Parameterization

The following argument(s) can be parameterized using standard parameterization: Cookie

General Information

The web_add_cookie_ex function adds a new cookie with the option to place the cookie at the beginning of the cookie table, and to allow an empty domain. If the name and path match an existing cookie, the existing cookie is overwritten with the new one. If the "expires" date has past, the cookie is deleted.

The set of arguments, Cookie, and optionally , Insert, and AllowEmptyDomain, define one cookie. More than one definition can be passed in a single call to web_add_cookie_ex. Separate sets of cookie definitions with ENDITEM. A call with more than one set is equivalent to separate web_add_cookie_ex calls, each defining one cookie.

Although scripts handle cookies automatically, there may be cases when you need to manually control the cookies.

Note: Scripts do not use (access or modify) the cookies that are stored by your browser. Instead, each script uses the cookies that are sent to the Vuser by the server host at runtime. These cookies are maintained only temporarily while the script runs. The web–cookie functions (web_add_cookie, web_add_cookie_ex, web_remove_cookie, and web_cleanup_cookies) manipulate these temporary cookies only.

The intended use of web_add_cookie_ex is to add cookies usually stored in the browser, prior to starting the run.

This function is supported for all web scripts.