web/index.php

Jeroen van Meeuwen vanmeeuwen at kolabsys.com
Thu Feb 7 20:19:30 CET 2013


 web/index.php |   13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

New commits:
commit ae54d15c6083425a3f6795828f8f9318d55fc044
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Thu Feb 7 19:14:53 2013 +0000

    $_SERVER["REDIRECT_URL"] is only of value when the Free/Busy information is not directly requested.

diff --git a/web/index.php b/web/index.php
index 9d7cc37..f62c420 100644
--- a/web/index.php
+++ b/web/index.php
@@ -48,7 +48,16 @@ if ($config->isValid()) {
 	$trusted_ip = $config->trustednetworks ? Utils::checkIPRange($remote_ip, $config->trustednetworks['allow']) : false;
 
 	$log = Logger::get('web');
-	$log->addDebug('Request: ' . $_SERVER['REDIRECT_URL'], array('ip' => $remote_ip, 'trusted' => $trusted_ip));
+
+	$uri = $_SERVER['REDIRECT_URL'];
+
+	// we're not always redirected here
+	if (empty($uri)) {
+		$uri = $_SERVER['REQUEST_URI'];
+		$log->addDebug('Request (direct): ' . $uri, array('ip' => $remote_ip, 'trusted' => $trusted_ip));
+	} else {
+		$log->addDebug('Request (redirect): ' . $uri, array('ip' => $remote_ip, 'trusted' => $trusted_ip));
+	}
 
 	// check HTTP authentication
 	if (!$trusted_ip && $config->httpauth) {
@@ -64,7 +73,7 @@ if ($config->isValid()) {
 	header('Content-type: text/plain; charset=utf-8', true);
 
 	// analyse request
-	$url = array_filter(explode('/', $_SERVER['REDIRECT_URL']));
+	$url = array_filter(explode('/', $uri));
 	$user = strtolower(array_pop($url));
 	$action = strtolower(array_pop($url));
 	$extended = false;





More information about the commits mailing list