From e705e0b63d32608b81ed0fd14cdd15b138a3d6b4 Mon Sep 17 00:00:00 2001 From: Timandes White Date: Sun, 16 Feb 2014 23:27:05 +0800 Subject: [PATCH] throw ForbiddenException when client is not in server's listen.allowed_clients. --- src/Adoy/FastCGI/Client.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Adoy/FastCGI/Client.php b/src/Adoy/FastCGI/Client.php index 0a7d8a5..a5a946e 100644 --- a/src/Adoy/FastCGI/Client.php +++ b/src/Adoy/FastCGI/Client.php @@ -10,6 +10,7 @@ namespace Adoy\FastCGI; class TimedOutException extends \Exception {} +class ForbiddenException extends \Exception {} /** * Handles communication with a FastCGI application @@ -547,6 +548,12 @@ public function wait_for_response($requestId, $timeoutMs = 0) { throw new TimedOutException('Read timed out'); } + if ($info['unread_bytes'] == 0 + && $info['blocked'] + && $info['eof']) { + throw new ForbiddenException('Not in white list. Check listen.allowed_clients.'); + } + throw new \Exception('Read failed'); }