Start of changeHTTP/1.x request processingEnd of change

A z/TPF HTTP server processes Start of changeHTTP/1.xEnd of change requests after a client connects to the server.

After a client connects to a z/TPF HTTP server, it sends an Start of changeHTTP/1.xEnd of change request that is handled by segment CHT3 as follows:
  1. The Start of changeHTTP/1.xEnd of change request is received on the client connection.
  2. Data in the start line and headers is converted from ASCII to EBCDIC.
  3. If request validation detects an error in the request, status codes that identify the error are sent to the client in the HTTP response. The following request characteristics are validated:
    • DELETE, GET, HEAD, OPTIONS, POST, or PUT method required
    • HTTP/1.0 or HTTP/1.1 required
    • Mismatch between Content-length: header and supplied body
    • Host: header required for HTTP/1.1 requests
    • HTTP request size not exceeding the maximum message size defined for this server
  4. Start of changeThe URL that is specified in the HTTP request is used to search the server-specific URL mappings and the subsystem-wide URL program-mapping file. If the URL is not found, a 404 status is returned to the client. The mapping entry for the URL identifies the z/TPF program to call for the HTTP request with the timeout value for processing the request or the OpenAPI descriptor that contains information on how to process the request.End of change
  5. Start of changeThe request is checked to determine whether it should be throttled (reject or timeout) according to the REST throttling properties that are specified in the z/TPF service descriptor.End of change
  6. For HTTP/1.1 requests containing the Expect: 100-continue header, the z/TPF HTTP server responds with status 100 and continues processing when it receives the body.
  7. HTTP clients can use the Accept-Encoding: header to request compression of the entity body for the HTTP response. Depending on the compression options that are specified in the z/TPF HTTP server configuration file, the z/TPF HTTP server determines the compression option that can be used to compress the entity body for the HTTP response, if any.
  8. HTTP clients can use the Transfer-Encoding: chunked header to construct and send HTTP requests in chunks. The z/TPF HTTP server processes each chunk and constructs the entity body. The total size of the entity body is passed in the tpf_httpsvr_req structure (defined in c_https.h).
  9. Trailers on chunked HTTP requests are processed. The number of trailers and a pointer to the array of trailers are passed in the tpf_httpsvr_req structure.
  10. The HTTP server request/reply for logging user exit is entered to enable the HTTP request to be logged.
  11. If needed, an instance of the z/TPF HTTP request sweeper is started.
  12. Start of changeIf REST message handlers are defined, REST request message handlers are entered.End of change
  13. The z/TPF program is called as follows:
    • Running in problem state
    • Running in key 1
    • EBROUT = client connection socket descriptor
    The following input parameters must be specified for the program:
    • Pointer to the tpf_httpsvr_req structure. This structure holds all required information for the HTTP request.
    • Client connection entry token. The token must be supplied on the subsequent tpf_httpSendResponse call to send the HTTP response to the client.
    For example:
    void CSOH(tpf_httpsvr_req*, tpf_httpsvr_token);