|
Each HTTP header for a request or response message consists of a header name and header value. XCICS stores this information for the application to access if required. An application can receive the value of a specified header, or browse through the names and values of all the headers for a request or response. You can also convert an architected date and time stamp string taken from a header into the ABSTIME format.
Your application might need to examine information in the headers in order to process a request or response, and construct subsequent messages. For example:
| • | The TE header tells the application whether or not trailing headers are permitted in a chunked response message. |
| • | Conditional headers can provide instructions to the application, such as to reply only if the response document has changed. |
Bear in mind that unless you know the exact format of the HTTP request or response, your application should not rely on the presence of any particular header, as Web clients and servers can be inconsistent in the headers they send.
Some HTTP headers contain date and time stamps. XCICS provides the CONVERTTIME command to convert common formats for architected date and time stamp strings into the ABSTIME format, for use by the application.
The standard HTTP headers are described in the HTTP/1.1 specification (RFC 2616) and the HTTP/1.0 specification (RFC 1945). Some HTTP headers are ignored by XCICS, and it is up to the user application to take appropriate action in response to these. Check the HTTP specification to which you are working for detailed guidance and requirements about the meaning and correct use of each HTTP header.
If the message includes any trailing headers, you can read these using the EXEC CICS WEB commands in the same way as for standard headers. The Trailer header on the message specifies the names of all the HTTP headers that were sent as trailing headers.
| • | To examine the contents of a particular HTTP header, use the WEB READ HTTPHEADER command. Your application program needs to provide a buffer that receives the contents of the header. XCICS returns a NOTFND condition if the header is not present in the request. |
| • | To browse all the headers in a request or response: |
| 2. | Use the WEB READNEXT HTTPHEADER command to retrieve the header name and header value for each line. Your application program needs to provide two buffers: one receives the name of the header, and one receives its contents. XCICS returns an ENDFILE condition when all headers have been read. |
| 3. | Use the WEB ENDBROWSE HTTPHEADER command to end the browse when your program has retrieved all the header information of interest. |
| • | To convert an architected date and time stamp string that is provided in a HTTP header, receive it into a buffer using the WEB READ HTTPHEADER command, and then process it using the CONVERTTIME command. You do not need to identify the format of the date and time stamp; the CONVERTTIME command recognizes and converts three different date and time stamp formats which are commonly used on the Internet. These are RFC 1123 format (the Web standard), RFC 850 format (an older format), and ASCtime format (output from C function). The ABSTIME can be converted to other formats by the application, using the FORMATTIME command. |
|