Catch missing-xml in request separately from invalid-xml.

This commit is contained in:
Andrew McMillan 2011-12-14 22:18:14 +13:00
parent 1d424693ad
commit e641ed0876
2 changed files with 7 additions and 4 deletions

View File

@ -515,6 +515,9 @@ EOSQL;
* should reasonably expect to see either text/xml or application/xml
*/
if ( isset($this->content_type) && preg_match( '#(application|text)/xml#', $this->content_type ) ) {
if ( !isset($this->raw_post) || $this->raw_post == '' ) {
$this->XMLResponse( 400, new XMLElement( 'error', new XMLElement('missing-xml'), array( 'xmlns' => 'DAV:') ) );
}
$xml_parser = xml_parser_create_ns('UTF-8');
$this->xml_tags = array();
xml_parser_set_option ( $xml_parser, XML_OPTION_SKIP_WHITE, 1 );

View File

@ -2,13 +2,13 @@ HTTP/1.1 400 Bad Request
Date: Dow, 01 Jan 2000 00:00:00 GMT
DAV: 1, 2, 3, access-control, calendar-access, calendar-schedule
DAV: extended-mkcol, calendar-proxy, bind, addressbook, calendar-auto-schedule
ETag: "7bc3d8a76fb705dfff8a6654bb8d7fb8"
Content-Length: 155
ETag: "4ec54351d43b4404acdf28263d694a2b"
Content-Length: 86
Content-Type: text/xml; charset="utf-8"
<?xml version="1.0" encoding="utf-8" ?>
<error xmlns="DAV:" xmlns:T="http://www.xythos.com/namespaces/StorageServer">
<missing-xml-for-request/>
<error xmlns="DAV:">
<missing-xml/>
</error>
dav_owner_id: >1002<