HttpRequest Response Properties

After the completion of a Get, Post, Put, or Delete request, the following properties are available on the returned HttpRequest object:

Property

Description

CONTENT

A byte array containing the raw data from the response body. If a CURL error occurred then CONTENT will be a scalar 0.

HEADERS

An OrderedHash containing the response headers as key/value pairs. If a CURL error occurred then HEADERS will be an empty OrderedHash.

OK A boolean (true/false) that indicates whether the request was successful (status code ≥ 100 and < 400).

STATUS_CODE

An integer containing the HTTP status code, such as 200, 302, 401, etc. If a CURL error occurred then STATUS_CODE will be less than 100.

TEXT

A scalar string containing the request result. If STATUS_CODE ≥ 100 then TEXT will contain the server response body. If STATUS_CODE < 100 then TEXT will contain the CURL error message.

URL

A scalar string containing the final URL, including any parameters or possible redirects.

JSON()

Call this method to return the parsed JSON response. See HttpRequest::Json for details.

Other Properties

In addition to the "primary" properties, the following additional properties are available:

Property

Description

CERTINFO

A string array containing the certificate information used during the SSL connection. If there is no certificate information or it was a non-secure connection, then a null string is returned. To retrieve this value you must pass options={CERTINFO:1} in your request.

CONTENT_TYPE A string giving the value of the Content-Type: header, or an empty string if unknown.
COOKIELIST A string array giving the cookies returned from the server, or an empty string if there are no cookies. To retrieve this value you must pass either COOKIEFILE, COOKIEJAR, or COOKIELIST as options in your request.

EFFECTIVE_METHOD

A string giving the final method (GET, POST, PUT, etc) used for the request, including any redirects.

FILETIME

An integer giving the remote time of the retrieved file, in seconds since 1-1-1970 GMT. To retrieve this value you must pass options={FILETIME:1} in your request. Returns –1 if unable to retrieve the filetime.

HTTP_CONNECTCODE

An integer containing the status code for the last received HTTP proxy response.

HTTP_VERSION

An integer giving the HTTP protocol version that was used. 1=HTTP/1.0, 2=HTTP/1.1, 3=HTTP/2, 4=HTTP/2 TLS (1.1 fallback), 5=HTTP/2 (no 1.1 fallback), 30=HTTP/3, 31=HTTP/3 (no fallback)

HTTPAUTH_AVAIL

An integer containing a bitmask indicating which authentication methods are available on the server. See HttpRequest Options for the bitmask values.
LOCAL_IP A string giving the local IP address.
LOCAL_PORT An integer giving the local port number.
NUM_CONNECTS An integer giving the number of new connections that were needed for the transfer.
PRIMARY_IP A string giving the server IP address.
PRIMARY_PORT An integer giving the server port number.
PROXY_ERROR An integer giving the detailed error code for any proxy errors. Consult the libcurl documentation for a list of CURLproxycode errors.
PROXYAUTH_AVAIL An integer containing a bitmask indicating which authentication methods are available on the proxy server. See HttpRequest Options for the bitmask values.
REDIRECT_COUNT An integer giving the total number of redirects that were followed.
REDIRECT_URL A string giving the URL that would have been followed for a redirect. Since redirects are enabled by default, this will normally be empty. To disable redirects, set options={FOLLOWLOCATION:0} in your request.
REFERER A string giving the URL in the Referer: header.
SCHEME A string giving the URL scheme used for the connection, such as HTTP or HTTPS.

Size, Speed, and Time Properties

In addition to the "primary" properties, the following additional properties are available:

Property

Description

RETRY_AFTER An integer giving the value of the Retry-After: header, which is the number of seconds that the client should wait until the next request is issued.
CONTENT_LENGTH_DOWNLOAD An integer giving the value from the Content-Length: field from a download, or –1 if the length is unknown.
CONTENT_LENGTH_UPLOAD An integer giving the specified size of the upload, or –1 if the length is unknown.
HEADER_SIZE An integer giving the total size in bytes of all headers received.
REQUEST_SIZE An integer giving the total number of bytes sent in the HTTP requests.
SIZE_DOWNLOAD An integer giving the number of bytes downloaded.
SIZE_UPLOAD An integer giving the number of bytes uploaded.
SPEED_DOWNLOAD An integer giving the average download speed in bytes/second.
SPEED_UPLOAD An integer giving the average upload speed in bytes/second.
APPCONNECT_TIME An integer giving the total time in microseconds until SSL/SSH handshaking was completed.
CONNECT_TIME An integer giving the total time in microseconds until the connection to the remote host (or proxy) was completed.
NAMELOOKUP_TIME An integer giving the total time in microseconds for name resolving to be complete.
PRETRANSFER_TIME An integer giving the total time in microseconds from the start until just before transfer begins.
REDIRECT_TIME An integer giving the total time in microseconds taken for all redirect steps before the final transfer.
STARTTRANSFER_TIME An integer giving the total time in microseconds from the start until just when the first byte is received.
TOTAL_TIME An integer giving the total time in microseconds for the transfer, including name resolving, TCP connect, and any redirects.

Version History

9.0

Introduced