From b491d914ea7c9fafa1af937b7fab06f02c56af30 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Thu, 12 Jan 2012 18:44:28 +1300 Subject: [PATCH] Allow for silly programs that send content-type XML with a GET request. --- inc/CalDAVRequest.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/inc/CalDAVRequest.php b/inc/CalDAVRequest.php index 46ef5799..20ac9e85 100644 --- a/inc/CalDAVRequest.php +++ b/inc/CalDAVRequest.php @@ -187,7 +187,7 @@ class CalDAVRequest $this->content_type = $matches[1]; } if ( isset($_SERVER['CONTENT_LENGTH']) && $_SERVER['CONTENT_LENGTH'] > 7 ) { - if ( $this->method == 'PROPFIND' || $this->method == 'REPORT' ) { + 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!', $request->method, $this->content_type ); @@ -198,6 +198,13 @@ 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'; + } + } $this->user_agent = ((isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : "Probably Mulberry")); /** -- 2.11.4.GIT