[Pkg-owncloud-commits] [owncloud] 25/75: webdav workaround for apache+php-cgi

David Prévot taffit at alioth.debian.org
Fri Nov 8 23:08:32 UTC 2013


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to annotated tag v3.0.1
in repository owncloud.

commit 536a39e21f92002a80c110ec2bb6ce292914098c
Author: Robin Appelman <icewind1991 at gmail.com>
Date:   Thu Oct 13 16:31:01 2011 +0200

    webdav workaround for apache+php-cgi
---
 .htaccess     |    4 ++++
 lib/base.php  |    8 ++++++++
 lib/setup.php |    4 ++++
 3 files changed, 16 insertions(+)

diff --git a/.htaccess b/.htaccess
index 8763a8b..dd49442 100644
--- a/.htaccess
+++ b/.htaccess
@@ -5,4 +5,8 @@ php_value post_max_size 512M
 php_value memory_limit 128M
 SetEnv htaccessWorking true
 </IfModule>
+<IfModule !mod_php5.c>
+RewriteEngine on
+RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization},last]
+</IfModule>
 Options -Indexes
diff --git a/lib/base.php b/lib/base.php
index 0156feb..57a3ae8 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','&');
 
+		//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 551d4e2..e2d56dd 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
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list