From 700427bd89263b22f46b7b587b984ee6b6ce40dd Mon Sep 17 00:00:00 2001 From: Timm Friebe Date: Fri, 7 Jul 2017 01:45:35 +0200 Subject: [PATCH] Switch off keep-alive semantics by setting NO_KEEPALIVE=true in environment --- ChangeLog.md | 6 ++++++ src/main/php/xp/web/HttpProtocol.class.php | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog.md b/ChangeLog.md index 4d02f891..d2515cf8 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -3,6 +3,12 @@ Web change log ## ?.?.? / ????-??-?? +## 0.6.1 / 2017-07-07 + +* Added `NO_KEEPALIVE` environment variable to switch off keep-alive + semantics. This might be causing problems with certain proxy setups + (@thekid) + ## 0.6.0 / 2017-07-07 * Changed logging to contain full stack trace of exceptions - @thekid diff --git a/src/main/php/xp/web/HttpProtocol.class.php b/src/main/php/xp/web/HttpProtocol.class.php index aca24540..0a0ae827 100755 --- a/src/main/php/xp/web/HttpProtocol.class.php +++ b/src/main/php/xp/web/HttpProtocol.class.php @@ -113,7 +113,7 @@ public function handleData($socket) { } finally { $response->flushed() || $response->flush(); - if ('Keep-Alive' === $request->header('Connection')) { + if ('Keep-Alive' === $request->header('Connection') && !getenv('NO_KEEPALIVE')) { $request->consume(); } else { $socket->close();