Content-Type header should be 'charset' not 'encoding'.

This commit is contained in:
Andrew McMillan 2013-02-16 22:23:51 +13:00
parent 9e774b295a
commit b1eb2bdc5a

View File

@ -12,29 +12,29 @@
require_once('XMLDocument.php'); require_once('XMLDocument.php');
/** /**
* A class for holding basic calendar information * A class for holding basic calendar information
* @package awl * @package awl
*/ */
class CalendarInfo { class CalendarInfo {
public $url; public $url;
public $displayname; public $displayname;
public $getctag; public $getctag;
function __construct( $url, $displayname = null, $getctag = null ) {
$this->url = $url;
$this->displayname = $displayname;
$this->getctag = $getctag;
}
function __toString() {
return( '(URL: '.$this->url.' Ctag: '.$this->getctag.' Displayname: '.$this->displayname .')'. "\n" );
}
}
if(!defined("_FSOCK_TIMEOUT")){ function __construct( $url, $displayname = null, $getctag = null ) {
define("_FSOCK_TIMEOUT", 10); $this->url = $url;
} $this->displayname = $displayname;
$this->getctag = $getctag;
}
function __toString() {
return( '(URL: '.$this->url.' Ctag: '.$this->getctag.' Displayname: '.$this->displayname .')'. "\n" );
}
}
if(!defined("_FSOCK_TIMEOUT")){
define("_FSOCK_TIMEOUT", 10);
}
/** /**
* A class for accessing DAViCal via CalDAV, as a client * A class for accessing DAViCal via CalDAV, as a client
@ -224,7 +224,7 @@ class CalDAVClient {
$this->httpParsedHeaders = array(); $this->httpParsedHeaders = array();
$headers = str_replace("\r\n", "\n", $this->httpResponseHeaders); $headers = str_replace("\r\n", "\n", $this->httpResponseHeaders);
$ar_headers = explode("\n", $headers); $ar_headers = explode("\n", $headers);
$last_header = ''; $last_header = '';
foreach ($ar_headers as $cur_headers) { foreach ($ar_headers as $cur_headers) {
if( preg_match( '{^\s*\S}', $cur_headers) ) $header_name = $last_header; if( preg_match( '{^\s*\S}', $cur_headers) ) $header_name = $last_header;
else if ( preg_match( '{^(\S*):', $cur_headers, $matches) ) { else if ( preg_match( '{^(\S*):', $cur_headers, $matches) ) {
@ -232,10 +232,10 @@ class CalDAVClient {
$last_header = $header_name; $last_header = $header_name;
if ( empty($this->httpParsedHeaders[$header_name]) ) $this->httpParsedHeaders[$header_name] = array(); if ( empty($this->httpParsedHeaders[$header_name]) ) $this->httpParsedHeaders[$header_name] = array();
} }
$this->httpParsedHeaders[$header_name][] = $cur_headers; $this->httpParsedHeaders[$header_name][] = $cur_headers;
} }
} }
return $this->httpParsedHeaders; return $this->httpParsedHeaders;
} }
/** /**
@ -448,7 +448,7 @@ class CalDAVClient {
if ( $etag != null ) { if ( $etag != null ) {
$this->SetMatch( ($etag != '*'), $etag ); $this->SetMatch( ($etag != '*'), $etag );
} }
$this->SetContentType('text/calendar; encoding="utf-8"'); $this->SetContentType('text/calendar; charset="utf-8"');
$this->DoRequest($url); $this->DoRequest($url);
$etag = null; $etag = null;