From f0e60b8fb297cf16446e1bf5f4ee623f57945be1 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Sat, 3 Dec 2011 14:19:50 +1300 Subject: [PATCH] Use supplied content_type even on zero-length requests. --- inc/CalDAVRequest.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/inc/CalDAVRequest.php b/inc/CalDAVRequest.php index 52649da3..b6463f38 100644 --- a/inc/CalDAVRequest.php +++ b/inc/CalDAVRequest.php @@ -182,11 +182,11 @@ class CalDAVRequest $_SERVER['REQUEST_METHOD'] = $_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE']; } $this->method = $_SERVER['REQUEST_METHOD']; + $this->content_type = (isset($_SERVER['CONTENT_TYPE']) ? $_SERVER['CONTENT_TYPE'] : null); + if ( preg_match( '{^(\S+/\S+)\s*(;.*)?$}', $this->content_type, $matches ) ) { + $this->content_type = $matches[1]; + } if ( isset($_SERVER['CONTENT_LENGTH']) && $_SERVER['CONTENT_LENGTH'] > 7 ) { - $this->content_type = (isset($_SERVER['CONTENT_TYPE']) ? $_SERVER['CONTENT_TYPE'] : null); - if ( preg_match( '{^(\S+/\S+)\s*(;.*)?$}', $this->content_type, $matches ) ) { - $this->content_type = $matches[1]; - } if ( $this->method == 'PROPFIND' || $this->method == 'REPORT' ) { if ( !preg_match( '{^(text|application)/xml$}', $this->content_type ) ) { @dbg_error_log( "LOG request", 'Request is "%s" but client set content-type to "%s". Assuming they meant XML!',