summaryrefslogtreecommitdiff
path: root/lib/Kolab/Utils/DAVLogger.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Kolab/Utils/DAVLogger.php')
-rw-r--r--lib/Kolab/Utils/DAVLogger.php28
1 files changed, 27 insertions, 1 deletions
diff --git a/lib/Kolab/Utils/DAVLogger.php b/lib/Kolab/Utils/DAVLogger.php
index c1c3067..4cbbcb2 100644
--- a/lib/Kolab/Utils/DAVLogger.php
+++ b/lib/Kolab/Utils/DAVLogger.php
@@ -100,7 +100,7 @@ class DAVLogger extends DAV\ServerPlugin
// catch all headers
$http_headers = array();
- foreach (apache_request_headers() as $hdr => $value) {
+ foreach ($this->get_request_headers() as $hdr => $value) {
if (strtolower($hdr) == 'authorization') {
$method = preg_match('/^((basic|digest)\s+)/i', $value, $m) ? $m[1] : '';
$value = $method . str_repeat('*', strlen($value) - strlen($method));
@@ -118,6 +118,32 @@ class DAVLogger extends DAV\ServerPlugin
}
}
+ /*
+ * Wrapper function in case apache_request_headers() is not available
+ *
+ * @return array
+ */
+ public function get_request_headers()
+ {
+ if (function_exists('apache_request_headers')) {
+ return apache_request_headers();
+ }
+
+ $return = array();
+ foreach ($_SERVER as $key => $value) {
+ if (preg_match('/^HTTP_(.*)/',$key,$regs)) {
+ // restore original letter case
+ $key = str_replace('_',' ',$regs[1]);
+ $key = ucwords(strtolower($key));
+ $key = str_replace(' ','-',$key);
+
+ // build return array
+ $return[$key] = $value;
+ }
+ }
+ return $return;
+ }
+
/**
* Handler for 'exception' events
*/