OpenSTA logo OpenSTA SCL Reference
GET Command

GET Command

This command issues an HTTP GET request for a specified resource. It is only valid within a Script that has been defined as MODE HTTP.

The optional PRIMARY keyword denotes primary HTTP requests such as those referred to by the "referer" header in secondary requests. For example: If a request returns a HTML page from a Web server this can be followed by requests for the images whose URLs are contained in the specified page.

The request header fields are obtained from the HEADER clause. These can be modified using the WITH and WITHOUT clauses.

The HTTP GET request is asynchronous. Immediately after the request is issued, the next command in the Script is processed - it does not wait for a response message to be received.

A client certificate may be specified in a request either by file or name using the CERTIFICATE FILE and CERTIFICATE NAME clauses.

There is an optional RESPONSE TIMER clause, which can be used to specify that a pair of response timer records are to be written to the statistics log. The first record is written when the request message is sent, and the second is written on receipt of the response request message from the server.

The response code in the response message can be retrieved by using the optional RETURNING CODE http-code clause to specify the integer variable to hold the response code. The variable is loaded when the response message is received from the server. In addition, the optional RETURNING STATUS get-status clause can be used to specify the integer variable to hold a value indicating whether the request succeeded or failed. There is an SCL include file "response_codes.inc" supplied with the OpenSTA toolset, which defines SCL integer constants for both the response code and response status values. When RETURNING STATUS is specified, the ON ERROR action is disabled.

The size of the response message can be retrieved by using the optional RETURNING BODYSIZE body-size clause to specify the integer variable to hold the message size. The variable is loaded when the response message is received from the server.

On failure, the HTTP GET request can be retried by using the optional WITH RETRY retry-number.

The TCP connection used for the request depends upon whether a connection has already been established for the specified Connection ID using the CONNECT command. If it has, the request uses that connection. If it has not, a TCP connection will be established to the host identified by the uri-httpversion, on port 80.

By default, if an error occurs while establishing the TCP connection or issuing the request, an error message will be written to the audit log and the virtual user will continue. However, if error trapping is enabled, control will be transferred to the error-handling code.

Command Definition:

{PRIMARY} GET [ URI | URL ] uri-httpversion ON conid
	 HEADER http-header
	{,WITH header-value}
	{,WITHOUT header-field}
	{,CERTIFICATE FILE cert-filename}
	{,CERTIFICATE NAME cert-name}
	{,RESPONSE TIMER timer-name}
	{,RETURNING STATUS get-status}
	{,RETURNING CODE http-code}
	{,RETURNING BODYSIZE body-size}
	{,WITH RETRY retry-number}

uri-httpversion

A character variable, quoted character string or character expression, containing the URI (Uniform Resource Identifier) of the resource upon which to apply the request, and the HTTP Version, separated by a single space character. The HTTP Version indicates the format of the message and the sender's capacity for understanding further HTTP communication.

conid

An integer variable, integer value or integer expression identifying the Connection ID of the TCP connection on which to issue the request.

http-header

A character variable, quoted character string, character expression or character value list containing the request header fields.

header-value

A character variable, quoted character string, character expression or character value list containing zero or more request header fields. These request-header fields are added to those specified in http-header. If a request-header field appears in both http-header and header-value, the field specified here overrides that specified in http-header.

header-field

A character variable, quoted character string, character expression or character value list containing the request header field names of fields to be excluded from the request.

cert-filename

A character variable, quoted character string, character expression, containing the name of a file. The file contains a client certificate.

cert-name

A character variable, quoted character string, character expression, containing a client certificate name.

timer-name

The name of a timer declared in the Definitions section of the Script.

get-status

An integer variable into which the status of the SCL GET command is loaded when the request completes. Success returns zero.

http-code

An integer variable into which the response code of the HTTP response message is loaded when the HTTP response message is received.

body-size

An integer variable into which the size of the HTTP response message is loaded when the HTTP response message is received.

retry-number

An integer variable containing the number of times the request should be retried.

Examples:

GET URL "http://osta.lan/~~dansut/test.html HTTP/1.0" ON Conid &
	HEADER Sub-Head &
	,WITH ("Host: osta.lan", "Referer: http://osta.lan/")

GET URI "http://osta.lan/~~dansut/test.html HTTP/1.0" ON 2 &
	HEADER Sub-Head &
	,WITH "Host: osta.lan" &
	,WITHOUT "Referer Accept-Language"

<<<
prev page
^^^
section start
>>>
next page