keep-alive

Discussions related to HTTPAPI (An HTTP Client Package for RPG programming.) http://www.scottklement.com/httpapi/
Post Reply
Alan5432
Posts: 5
Joined: Mon Sep 26, 2022 10:03 pm

keep-alive

Post by Alan5432 »

What would it take to have the ability to SetOption for 'Connection'. Either setting it to 'Keep-Alive' or 'Close'.
Scott Klement
Site Admin
Posts: 636
Joined: Sun Jul 04, 2021 5:12 am

Re: keep-alive

Post by Scott Klement »

This is already possible to do.

Technically, it should not be necessary. The HTTP/1.1 spec is such that keep-alive is the default, and close is really not needed, since you can just close the connection.

But, if you have an unusual circumstances (for example, if communicating with an HTTP/1.0 server) you can define the Connection: header by using an http_xproc with the HTTP_POINT_ADDL_HEADER exit point.

then, in order for this values to be meaningful, you need to use the http_persist_xxx set of routines. If you telling it to keep the connection alive, there's no point in calling the non-persistent routines since they close the connection every time. But with the persist routines, you can keep it active between calls.
Post Reply