HTTP/2 response processing
After the z/TPF HTTP server calls a z/TPF program to process an HTTP/2 request (segment CHT3), the z/TPF application (which might be a different ECB from the server) uses the tpf_httpSendResponse function to send the HTTP response to the client.
The application must provide the following parameters on the tpf_httpSendResponse function:
Note: The PORT parameter has no effect on enhanced QDIO OSA-Express connections.
- The z/TPF HTTP client connection token, which identifies the HTTP client connection that the HTTP response is sent to. This token is passed by program CHT3 to the z/TPF program that was originally called by program CHT3, and must be passed to the application program that is issuing the tpf_httpSendResponse function.
- A pointer to the tpf_httpsvr_resp structure (defined in c_https.h). This structure contains information that is needed by the HTTP server to build the HTTP response message.
After the z/TPF application issues the tpf_httpSendResponse function, program CHTS is entered. The CHTS program
performs the following processing to send the HTTP response message:
- The CHTS program uses the client connection token that was passed by the caller to retrieve the client connection information needed to send the HTTP response. If the token is not valid, the errno value is set to ETPF_HTTPSENDRSP_TOKEN_ERR, and -1 is returned to the caller.
- If REST message handlers are defined, REST response message handlers are entered.
- If required headers (such as server: and date:) are not provided in the HTTP response structure, they are added to the list of headers to send in the HTTP response.
- The body might be compressed according to the specification in the request if the body is provided in the HTTP response structure.
- The list of response headers is compressed into a HEADERS field block by using header compression for HTTP/2 (HPACK). Any error in compression results in a connection error of type COMPRESSION_ERROR.
- The HEADERS frame is sent (as well as any subsequent CONTINUATION frames) to send the full HEADERS field block.
- If the body was provided in the HTTP response structure, the body is sent by using as many DATA frames as required to send the entire body. If sending of a DATA frame results in an HTTP/2 connection window block condition, the remainder of the body will be written to an available system heap area as defined by HTTP2WINBUF. The remaining data can be sent later by the CHTQ program when the window block condition is resolved. If insufficient system heap is available for writing the remainder of the body, the errno value is set to ETPF_HTTPSENDRSP_WINBUF_ERR, and -1 is returned to the caller.
- The HTTP server request/reply for logging user exit is entered to enable the HTTP response message to be logged.
