summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRobin Appelman <icewind1991@gmail.com>2011-10-13 16:31:01 +0200
committerRobin Appelman <icewind1991@gmail.com>2011-10-13 16:31:01 +0200
commitffb9a0475e046d2cf88bbc5801905358fe4ce1e0 (patch)
treea305a81163a34b9dab52bea4d21d0a47608f2fbe /lib
parent9ba384b9a4ebf0e553e01c4450dec4273dc5a707 (diff)
downloadnextcloud-server-ffb9a0475e046d2cf88bbc5801905358fe4ce1e0.tar.gz
nextcloud-server-ffb9a0475e046d2cf88bbc5801905358fe4ce1e0.zip
webdav workaround for apache+php-cgi
Diffstat (limited to 'lib')
-rw-r--r--lib/base.php8
-rw-r--r--lib/setup.php4
2 files changed, 12 insertions, 0 deletions
diff --git a/lib/base.php b/lib/base.php
index 0156febe231..57a3ae8669b 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -81,6 +81,14 @@ class OC{
date_default_timezone_set('Europe/Berlin');
ini_set('arg_separator.output','&amp;');
+ //set http auth headers for apache+php-cgi work around
+ if (preg_match('/Basic\s+(.*)$/i', $_SERVER['HTTP_AUTHORIZATION'], $matches))
+ {
+ list($name, $password) = explode(':', base64_decode($matches[1]));
+ $_SERVER['PHP_AUTH_USER'] = strip_tags($name);
+ $_SERVER['PHP_AUTH_PW'] = strip_tags($password);
+ }
+
// calculate the documentroot
OC::$DOCUMENTROOT=realpath($_SERVER['DOCUMENT_ROOT']);
OC::$SERVERROOT=str_replace("\\",'/',substr(__FILE__,0,-13));
diff --git a/lib/setup.php b/lib/setup.php
index 355d979dc65..252eaaeea18 100644
--- a/lib/setup.php
+++ b/lib/setup.php
@@ -273,6 +273,10 @@ class OC_Setup {
$content.= "php_value post_max_size 512M\n";
$content.= "SetEnv htaccessWorking true\n";
$content.= "</IfModule>\n";
+ $content.= "<IfModule !mod_php5.c>\n";
+ $content.= "RewriteEngine on\n";
+ $content.= "RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization},last]\n";
+ $content.= "</IfModule>\n";
$content.= "Options -Indexes\n";
@file_put_contents(OC::$SERVERROOT.'/.htaccess', $content); //supress errors in case we don't have permissions for it