From 3d55f164e2292a1ccf24fc803c738327d170d920 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Mon, 23 Jan 2012 09:43:33 +1300 Subject: [PATCH] Clean up content-type checking so it's not so noisy on null content. --- inc/CalDAVRequest.php | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/inc/CalDAVRequest.php b/inc/CalDAVRequest.php index 20ac9e85..e0963fae 100644 --- a/inc/CalDAVRequest.php +++ b/inc/CalDAVRequest.php @@ -186,7 +186,7 @@ class CalDAVRequest if ( preg_match( '{^(\S+/\S+)\s*(;.*)?$}', $this->content_type, $matches ) ) { $this->content_type = $matches[1]; } - if ( isset($_SERVER['CONTENT_LENGTH']) && $_SERVER['CONTENT_LENGTH'] > 7 ) { + if ( strlen($c->raw_post) > 0 ) { if ( $this->method == 'PROPFIND' || $this->method == 'REPORT' || $this->method == 'PROPPATCH' || $this->method == 'BIND' || $this->method == 'MKTICKET' || $this->method == 'ACL' ) { 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!', @@ -198,12 +198,8 @@ class CalDAVRequest $this->CoerceContentType(); } } - else if ( !preg_match( '{^(text|application)/xml$}', $this->content_type ) ) { - if ( $this->method == 'GET' || $this->method == 'HEAD' || $this->method == 'OPTIONS' || $this->method == 'MKCALENDAR' || $this->method == 'MKCOL' ) { - @dbg_error_log( "LOG request", '%s Request specified %s content type but none is present. Assuming null content-type.', - $request->method, $this->content_type ); - $this->content_type = 'text/plain'; - } + else { + $this->content_type = 'text/plain'; } $this->user_agent = ((isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : "Probably Mulberry"));