|
Persistent connections |
|
|
Persistent connections are the default behaviour for XCICS Web support. Before XCICS TS 3.1, the connection behavior was that XCICS would normally close the connection when data had been received from the Web client, unless the Web client sent a Connection: Keep-Alive header. Now, when a connection is made between a Web client and XCICS as an HTTP server, or between XCICS as an HTTP client and a server, XCICS attempts to keep the connection open by default. When XCICS is the HTTP server, the persistent connection is closed if:
Otherwise, XCICS leaves the persistent connection open for the Web client to send further requests. If there is a persistent connection with the client, XCICS does not keep the connection open after an error response is sent through a Web error program. When XCICS is the HTTP client, the persistent connection is closed if:
If the application program needs to test whether the server has requested termination of the connection, the READ HTTPHEADER command can be used to look for the Connection: close header in the last message from the server. If the server requests closure of the connection, but the application program has not yet issued a WEB CLOSE command, XCICS closes the connection but maintains the data relating to the connection (including the last response received from the server and its HTTP headers). The application program can continue to use that data until it issues a WEB CLOSE command or end of task is reached. The WEB CLOSE command for XCICS as an HTTP client does not cause XCICS to notify the server that the persistent connection should be terminated. It only makes XCICS close the connection. It is good behavior to include a Connection: close header on the final request that you make to the server. Using this header means that the server can close its persistent connection immediately after sending the final response, rather than waiting to see if XCICS sends further requests and then timing out. To include this header, specify the CLOSESTATUS(CLOSE) option on the WEB SEND or WEB CONVERSE command. If XCICS as an HTTP client is communicating with an HTTP/1.0 server, XCICS automatically sends Connection: Keep-Alive headers on HTTP messages. The application program that requested the connection does not need to provide these. Keep-Alive informs the server that a persistent connection is desired. |