Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAndreas Fischer <bantu@owncloud.com>2014-07-19 04:16:28 +0400
committerThomas Müller <thomas.mueller@tmit.eu>2014-07-22 17:43:47 +0400
commit6fb60e9d4abaa12dadf6e17656fe3d10de38e209 (patch)
tree635acb489d702cfdbfb046941b8a6aa041b34923 /lib
parente8be18a8d871792c95ea9983db392c4cce2ac5b1 (diff)
Extract Auth Header logic into new function handleAuthHeaders().
Conflicts: lib/base.php
Diffstat (limited to 'lib')
-rw-r--r--lib/base.php41
1 files changed, 21 insertions, 20 deletions
diff --git a/lib/base.php b/lib/base.php
index 9c2f4c180ea..ac3ad098c9a 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -482,26 +482,7 @@ class OC {
@ini_set('post_max_size', '10G');
@ini_set('file_uploads', '50');
- //copy http auth headers for apache+php-fcgid work around
- if (isset($_SERVER['HTTP_XAUTHORIZATION']) && !isset($_SERVER['HTTP_AUTHORIZATION'])) {
- $_SERVER['HTTP_AUTHORIZATION'] = $_SERVER['HTTP_XAUTHORIZATION'];
- }
-
- // Extract PHP_AUTH_USER/PHP_AUTH_PW from other headers if necessary.
- $httpAuthHeaderServerVars = array(
- 'HTTP_AUTHORIZATION', // apache+php-cgi work around
- 'REDIRECT_HTTP_AUTHORIZATION', // apache+php-cgi alternative
- );
- foreach ($httpAuthHeaderServerVars as $httpAuthHeaderServerVar) {
- if (isset($_SERVER[$httpAuthHeaderServerVar])
- && preg_match('/Basic\s+(.*)$/i', $_SERVER[$httpAuthHeaderServerVar], $matches)
- ) {
- list($name, $password) = explode(':', base64_decode($matches[1]), 2);
- $_SERVER['PHP_AUTH_USER'] = strip_tags($name);
- $_SERVER['PHP_AUTH_PW'] = strip_tags($password);
- break;
- }
- }
+ self::handleAuthHeaders();
self::initPaths();
if (OC_Config::getValue('instanceid', false)) {
@@ -855,6 +836,26 @@ class OC {
$minimizer->output(array($info), $filepath);
}
}
+ protected static function handleAuthHeaders() {
+ //copy http auth headers for apache+php-fcgid work around
+ if (isset($_SERVER['HTTP_XAUTHORIZATION']) && !isset($_SERVER['HTTP_AUTHORIZATION'])) {
+ $_SERVER['HTTP_AUTHORIZATION'] = $_SERVER['HTTP_XAUTHORIZATION'];
+ }
+
+ // Extract PHP_AUTH_USER/PHP_AUTH_PW from other headers if necessary.
+ $vars = array(
+ 'HTTP_AUTHORIZATION', // apache+php-cgi work around
+ 'REDIRECT_HTTP_AUTHORIZATION', // apache+php-cgi alternative
+ );
+ foreach ($vars as $var) {
+ if (isset($_SERVER[$var]) && preg_match('/Basic\s+(.*)$/i', $_SERVER[$var], $matches)) {
+ list($name, $password) = explode(':', base64_decode($matches[1]), 2);
+ $_SERVER['PHP_AUTH_USER'] = strip_tags($name);
+ $_SERVER['PHP_AUTH_PW'] = strip_tags($password);
+ break;
+ }
+ }
+ }
protected static function handleLogin() {
OC_App::loadApps(array('prelogin'));