Web Vuser Functions (WEB) > Alphabetical List of Web Vuser Functions > web_save_header


Saves request and response headers to a parameter.

C Language

int web_save_header( constchar *type, const char *param ); 

Java Language

int object.save_header( String type, String param ); 
An expression evaluating to an object of type WebApi. Usually web for Java. See also Function and Constant Prefixes.
The type of header: REQUEST or RESPONSE
The parameter name.

Return Values

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


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

General Information

The web_save_header function saves request and response headers of the primary URL of all ensuing Action Functions to the parameter param. Each header is delimited by "\r\n" (or just "\n"). Each new request header replaces the existing value of the parameter.

If type is REQUEST, web_save_header saves all subsequent request headers to param.

If type is RESPONSE, web_save_header saves all subsequent response headers to param.

To instruct a script to stop saving headers, insert a web_save_header function and specify an empty string ("") for the parameter, for example, web_save_header(RESPONSE,"");. After this call, subsequent headers are not saved. The last value of param remains unchanged unless some other function uses it.

1. It is inefficient to use web_save_header to extract information, like cookies, from headers. Instead, use web_reg_save_param specifying "Search=Headers"

2. When a script accesses a URL, the web_save_header function saves only the original user request and server response. While displaying a page, additional requests and responses are generated when the HTML code requires data about images and frames that are contained inside the Web page. The web_save_header function does not save these subsequent requests and responses.

3. If the server redirects the request to access another URL and the redirection is explicitly recorded, then the web_save_header function saves only the header of the last (redirected) request. If redirection is not explicitly recorded, only the first header is saved.

4. Saving headers is not supported for scripts including concurrent groups.

This function is supported for all Web scripts.