WEB READ HTTPHEADER

Extract HTTP header information.

WEB READ HTTPHEADER

Read syntax diagramSkip visual syntax diagramWEBREADHTTPHEADER( data-area)NAMELENGTH( data-value)SESSTOKEN( data-area)VALUE( data-area)VALUELENGTH( data-area)

Conditions: INVREQ, LENGERR, NOTFND, NOTOPEN

This command is threadsafe.

Description

WEB READ HTTPHEADER enables an application to extract HTTP header information from a message. When CICS® is an HTTP server, the message is a request from a Web client. When CICS is an HTTP client, the message is a response from a server, and the SESSTOKEN option is specified.

For CICS as an HTTP server, you can use the WEB READ HTTPHEADER command either before, or after, you use the WEB RECEIVE command to receive the body of the message. For CICS as an HTTP client, you must first receive the message using the WEB RECEIVE command, and then you can read the headers using the WEB READ HTTPHEADER command.

HTTP header reference for CICS Web support lists HTTP/1.1 headers that you are likely to receive, and gives guidance for the actions that you might take in response to them.

The HTTP header browsing commands (WEB STARTBROWSE HTTPHEADER, WEB READNEXT HTTPHEADER, WEB ENDBROWSE HTTPHEADER) can be used to browse through all the HTTP header information for a message.

Options

HTTPHEADER(data-area)
specifies the name of the HTTP header to be extracted.
NAMELENGTH(data-value)
specifies the length, as a fullword binary value, of the HTTP header name.
SESSTOKEN(data-value)
For CICS as an HTTP client, this option is required. It specifies the session token, an 8-byte binary value that uniquely identifies a connection between CICS and a server. This value is returned by a WEB OPEN command for CICS as an HTTP client. Session tokens explains the use of the session token.
VALUE(data-area)
specifies the buffer to contain the value of the HTTP header being extracted.
VALUELENGTH(data-area)
specifies the length of the buffer supplied on the VALUE option, as a fullword binary variable, and is set to the actual length of the data returned to the application. If the data exceeds the buffer length, a LENGERR condition is raised and the data is truncated.

Conditions

16 INVREQ
RESP2 values are:
1
The command is being issued in a non-CICS Web support application.
3
The command is being issued for a non-HTTP request.
43
No HTTP headers found.
22 LENGERR
RESP2 values are:
1
The length in VALUELENGTH is not greater than zero (CICS as an HTTP server).
2
The header value has been truncated because the receiving buffer is too small (CICS as an HTTP server).
35
The length in NAMELENGTH is not greater than zero (CICS as an HTTP client).
52
The header value has been truncated because the receiving buffer is too small (CICS as an HTTP client).
55
The length in VALUELENGTH is not greater than zero (CICS as an HTTP client).
13 NOTFND
RESP2 value is:
1
The header with the given name could not be found.
19 NOTOPEN
RESP2 value is:
27
Invalid session token.