diff options
author | Dries Buytaert <dries@buytaert.net> | 2010-03-31 15:56:53 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2010-03-31 15:56:53 +0000 |
commit | d054bfaa01a6018ab6305806143dffe91ce8fb92 (patch) | |
tree | 81347e0703bc0e8961a39126e90cec24c45f2c82 /modules | |
parent | 108011af8b9e5c28f90d807b6e69297f8500ad80 (diff) | |
download | brdo-d054bfaa01a6018ab6305806143dffe91ce8fb92.tar.gz brdo-d054bfaa01a6018ab6305806143dffe91ce8fb92.tar.bz2 |
- Patch #265973 by Damien Tournoud, mr.baileys, dixon_, clemens.tolboom: XML-RPC chokes with long server response.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/simpletest/tests/xmlrpc.test | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/modules/simpletest/tests/xmlrpc.test b/modules/simpletest/tests/xmlrpc.test index 2212bfd1a..a9e8bca40 100644 --- a/modules/simpletest/tests/xmlrpc.test +++ b/modules/simpletest/tests/xmlrpc.test @@ -41,6 +41,34 @@ class XMLRPCBasicTestCase extends DrupalWebTestCase { $this->assertEqual($count, count($minimum), 'system.listMethods returned at least the minimum listing'); } + + /** + * Ensure that XML-RPC correctly handles invalid messages when parsing. + */ + protected function testInvalidMessageParsing() { + $invalid_messages = array( + array( + 'message' => xmlrpc_message(''), + 'assertion' => t('Empty message correctly rejected during parsing.'), + ), + array( + 'message' => xmlrpc_message('<?xml version="1.0" encoding="ISO-8859-1"?>'), + 'assertion' => t('Empty message with XML declaration correctly rejected during parsing.'), + ), + array( + 'message' => xmlrpc_message('<?xml version="1.0"?><params><param><value><string>value</string></value></param></params>'), + 'assertion' => t('Non-empty message without a valid message type is rejected during parsing.'), + ), + array( + 'message' => xmlrpc_message('<methodResponse><params><param><value><string>value</string></value></param></methodResponse>'), + 'assertion' => t('Non-empty malformed message is rejected during parsing.'), + ), + ); + + foreach ($invalid_messages as $assertion) { + $this->assertFalse(xmlrpc_message_parse($assertion['message']), $assertion['assertion']); + } + } } class XMLRPCValidator1IncTestCase extends DrupalWebTestCase { |