HTTP/1.x request processing
A z/TPF HTTP server processes
HTTP/1.x
requests
after a client connects to the server.
After a client connects to a z/TPF HTTP server, it sends an
HTTP/1.x
request that is handled by segment
CHT3 as follows:
HTTP/1.x
request that is handled by segment
CHT3 as follows:- The
HTTP/1.x
request is received on the client connection. - Data in the start line and headers is converted from ASCII to EBCDIC.
- 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
The 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.
The 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.
- 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.
- 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.
- 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).
- 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.
- The HTTP server request/reply for logging user exit is entered to enable the HTTP request to be logged.
- If needed, an instance of the z/TPF HTTP request sweeper is started.
If REST message handlers are defined, REST request message
handlers are entered.
- The z/TPF program is called as follows:
- Running in problem state
- Running in key 1
- EBROUT = client connection socket descriptor
- 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.
void CSOH(tpf_httpsvr_req*, tpf_httpsvr_token);