Sending an HTTP request or response with chunked transfer-coding
You can set up chunked transfer-coding for an HTTP request by CICS® as an HTTP client or for an HTTP response from CICS as an HTTP server.
Before you begin
- The HTTP headers to be used at the beginning of the message. CICS supplies its usual message headers, which are listed in HTTP header reference for CICS web support . For a chunked message, CICS supplies the proper headers for chunked transfer-coding, including the Transfer-Encoding: chunked header. If any additional headers are required at the beginning of the message, the application can write them before the first WEB SEND command.
- Any headers to be sent in the trailer at the end of the message. These headers are known as trailing headers. The HTTP/1.1 specification sets requirements for the use of trailing headers, including that it must not matter if the recipient ignores them.
- How the message will be divided. Divide it in whatever way is most convenient for the application program. For example, the output from a number of other application programs might be sent as it is produced, or data from each row of a table might be read and sent individually.
- The length of each chunk of data that will be sent. Do not include the length of any trailing headers.
About this task
Use this procedure to create a correctly constructed chunked message, as defined in the HTTP/1.1 specification. See The HTTP protocol for more information. If the chunked message is not correctly constructed, the recipient might discard it.
Sending an HTTP response from CICS as an HTTP server is the main set of instructions for writing an application program to send a server response. Making HTTP requests through CICS as an HTTP client is the main set of instructions for writing an application program to make a client request. You can use the instructions in the present topic with either of those sets of instructions.
You cannot form the body of a chunked message directly from CICS documents, so you cannot use the DOCTOKEN option. You must use the FROM option to specify data to form the body of a chunked message.
When you have begun sending the parts of a chunked message, you cannot send any different messages or receive any items until the final empty chunk is sent and the chunked message is complete.