|
For dynamic responses created by application programs, XCICS automatically provides the HTTP headers that are required for basic messages, depending on the HTTP protocol version used for the message. You might need to add further HTTP headers to your response.
Some HTTP headers are created automatically by XCICS if the message requires them. Your application does not need to write these headers. The
full list of headers created by XCICS is:
The headers that XCICS provides when a response is sent are the ones that should normally be written for a basic message to be compliant with the appropriate HTTP protocol specification. You might want to add further HTTP headers to the response for purposes such as:
| • | Control of caching and document expiry (for example, Cache-Control, Expires, Last-Modified) |
| • | Content negotiation (for example, Accept-Ranges, Vary) |
| • | Information for the Web client (for example, Title, Warning, further Content headers) |
If your application program is performing complex actions, or if you select certain status codes for your response, the HTTP specification to which you are working is likely to require the use of particular HTTP headers for your message. When you add any HTTP headers to a response, check the HTTP specification to which you are working for any important requirements that apply to those headers.
Write additional HTTP headers for a message before you issue the WEB SEND command to send the message. The exception to this rule is if you are writing headers to be sent as trailing headers on a chunked message, in which case the special process mentioned below applies.
When writing HTTP headers for a response:
| • | Use the WEB WRITE HTTPHEADER command for each header that you want to add to the message. Make sure that you specify the name and value for each header in the format described by the HTTP specification to which you are working (XCICS does not validate the content of HTTP headers). The command adds a single header, and you can repeat the command to add further headers. If you write a header that you have already written, XCICS overwrites the previous header to the request or response in addition to the
existing header. |
| • | If you want to produce a date and time stamp for use in one of your HTTP headers (for example, the Last-Modified header), you can use the FORMATTIME command. The command converts the current date and time (in ABSTIME format), or a date and time produced by the application program, into the RFC 1123 format. The RFC 1123 format is the only date and time stamp format that XCICS creates for use on the Web. Other date and time stamp formats might not be accepted by some Web clients or servers with which XCICS is communicating. |
| • | If you are using chunked transfer-coding to send an HTTP request or response, and you want to include trailing headers at the end of the chunked message, follow the special instructions in "Using chunked transfer-coding to send an HTTP request or response". You need to write a Trailer header before sending the first chunk of the message. All the HTTP headers written after the WEB SEND command for the first chunk are treated as trailing headers. |
| • | Make sure that your application program carries out any actions that are implied by your user-written headers. For example, if you have written content-negotiation headers, your application program needs to provide different versions of the resource. |
|