From c42b18da05bce672b0231eb0b85490837b9864eb Mon Sep 17 00:00:00 2001 From: aKorczak Date: Wed, 8 Feb 2012 10:28:14 +0000 Subject: [PATCH] [*] WS : From 1.4 (PHP as CGI management) --- webservice/dispatcher.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/webservice/dispatcher.php b/webservice/dispatcher.php index f6eafcc6c..fa7cdc5af 100644 --- a/webservice/dispatcher.php +++ b/webservice/dispatcher.php @@ -29,6 +29,20 @@ ob_start(); require_once(dirname(__FILE__).'/../config/config.inc.php'); +//set http auth headers for apache+php-cgi work around +if (isset($_SERVER['HTTP_AUTHORIZATION']) && preg_match('/Basic\s+(.*)$/i', $_SERVER['HTTP_AUTHORIZATION'], $matches)) +{ + list($name, $password) = explode(':', base64_decode($matches[1])); + $_SERVER['PHP_AUTH_USER'] = strip_tags($name); +} + +//set http auth headers for apache+php-cgi work around if variable gets renamed by apache +if (isset($_SERVER['REDIRECT_HTTP_AUTHORIZATION']) && preg_match('/Basic\s+(.*)$/i', $_SERVER['REDIRECT_HTTP_AUTHORIZATION'], $matches)) +{ + list($name, $password) = explode(':', base64_decode($matches[1])); + $_SERVER['PHP_AUTH_USER'] = strip_tags($name); +} + // Use for image management (using the POST method of the browser to simulate the PUT method) $method = isset($_REQUEST['ps_method']) ? $_REQUEST['ps_method'] : $_SERVER['REQUEST_METHOD'];