Registers a search for a text string and adds a cookie if the text is found.
int web_reg_add_cookie( const char *cookie, const char *searchstring, LAST );
<name>=VALUE; (required)
domain=DOMAIN_NAME; (required) expires=DATE; path=PATH; (the default path is "/") secure |
|
This function returns LR_PASS (0) on success, and LR_FAIL (1) on failure.
All arguments can be parameterized using standard parameterization.
The web_reg_add_cookie function registers a search for the text string specified by the searchstring argument. If the searchstring is found on the Web page retrieved by the next action function, the specifed cookie is added.
Note that, although web_reg_add_cookie is functionally similar to an HTTP Set_Cookie header, there is a significant difference. According to the HTTP standard, the domain attribute is optional in a Set–Cookie header from a server . If not specified, the default value of domain is the host name of the server that generated the cookie response. Since this information is not available to the load generator host when web_reg_add_cookie is called, the domain attribute is required.
This function can be used for both HTML–based and URL–based scripts (see Recording Options > Recording tab). It registers the search request before the buffers arrive, so the buffers are scanned as they come. This results in a more efficient script with better performance.
web_reg_add_cookie is added to the script by the user. It is not recorded.