Clean up content-type checking so it's not so noisy on null content.

This commit is contained in:
Andrew McMillan 2012-01-23 09:43:33 +13:00
parent 9b5554eac8
commit 3d55f164e2

View File

@ -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"));