Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

ZF-1897 XmlRpc Resolved issue with leading/trailing whitespace in chu…

…nked HTTP response

sync svn r24150
  • Loading branch information...
commit 3511807a26cdcf63b2d9b48a046f9ec264cc4523 1 parent 100a390
@sasezaki sasezaki authored
View
2  library/Zend/XmlRpc/Client.php
@@ -256,7 +256,7 @@ public function doRequest($request, $response = null)
}
$this->_lastResponse = $response;
- $this->_lastResponse->loadXml($httpResponse->getBody());
+ $this->_lastResponse->loadXml(trim($httpResponse->getBody()));
}
/**
View
18 tests/Zend/XmlRpc/ClientTest.php
@@ -655,6 +655,24 @@ public function testCallSelectsCorrectSignatureIfMoreThanOneIsAvailable()
);
}
+ /**
+ * @group ZF-1897
+ */
+ public function testHandlesLeadingOrTrailingWhitespaceInChunkedResponseProperly()
+ {
+ $baseUri = "http://foo:80";
+ $this->httpAdapter = new Adapter\Test();
+ $this->httpClient = new Http\Client(null, array('adapter' => $this->httpAdapter));
+
+ $respBody = file_get_contents(dirname(__FILE__) . "/_files/ZF1897-response-chunked.txt");
+ $this->httpAdapter->setResponse($respBody);
+
+ $this->xmlrpcClient = new Client($baseUri);
+ $this->xmlrpcClient->setHttpClient($this->httpClient);
+
+ $this->assertEquals('FOO', $this->xmlrpcClient->call('foo'));
+ }
+
// Helpers
public function setServerResponseTo($nativeVars)
{
View
22 tests/Zend/XmlRpc/_files/ZF1897-response-chunked.txt
@@ -0,0 +1,22 @@
+HTTP/1.1 200 OK
+Date: Thu, 06 Sep 2007 14:58:44 GMT
+Server: Apache/2.0.54 (Debian GNU/Linux) DAV/2 SVN/1.1.4 mod_python/3.1.3 Python/2.3.5 mod_ssl/2.0.54 OpenSSL/0.9.7e PHP/5.1.6
+X-Powered-By: PHP/5.1.6
+Connection: close
+Transfer-Encoding: chunked
+Content-Type: text/html; charset=iso-8859-1
+
+92
+
+
+<?xml version="1.0"?>
+<methodResponse>
+ <params>
+ <param>
+ <value>FOO</value>
+ </param>
+ </params>
+</methodResponse>
+
+0
+
Please sign in to comment.
Something went wrong with that request. Please try again.