ZF-3199: Zend_Http_Response::fromString($response->asString()) breaks for chunked/compressed responses
Description
Hi there,
It would be nice if the fromString() and asString() methods were symmetrical, so that a response serialized a string could be expected to unserialize correctly (and that the string-representation of the response itself is valid).
The problem is simply that asString() returns the decoded body - however the headers may still indicate content chunking or compression - so that when the text is fed back to fromString(), it expects the body to be chunked or compressed.
The fix is:
--- Response.php (revision 3800)
+++ Response.php (working copy)
@@ -394,7 +394,7 @@
*/
public function asString($br = "\n")
{
- return $this->getHeadersAsString(true, $br) . $br . $this->getBody();
+ return $this->getHeadersAsString(true, $br) . $br . $this->getRawBody();
}
/**
Would be nice if there was another method that did this, or an optional argument, if you don't want to change asString() for backwards compat reasons.
Thanks, Keith
Comments
Posted by old of Satoru Yoshida (yoshida@zend.co.jp) on 2008-09-01T01:40:08.000+0000
Solved in SVN r11175