Reputation: 1
How to tell if a HTTP request is a Keep-Alive connection?
Is it possible to detect via PHP if a HTTP request is Keep-Alive?
If a connection is not Keep-Alive I want to return an error as a part of the API protocol to reduce the use of resources at each SSL handshake and to speed up the communication between server and client
Upvotes: 0
Views: 983
Reputation: 265
You can check it with:
function isConnectionKeepAlive() {
if(getallheaders()["Connection"] == "Keep-Alive") {
return true;
} else {
return false;
}
}
Upvotes: 1