ZF-97: Zend_Http_Response: to support a status line without Reason-Phrase

Description

At the incubator version of Zend_Http_Client, Zend_Http_Response::extractCode method uses following regular expression code.

http://framework.zend.com/fisheye/browse/… preg_match("|^HTTP/[\d.x]+ (\d+) |", $response_str, $m);

But some web servers return a status line without Reason-Phrase field. ex) HTTP/1.1 301 see: wget -S http://amazon.co.jp/exec/obidos/…

To support these servers, it will be changed like this. Zend_Http_Response::extractCode - preg_match("|^HTTP/[\d.x]+ (\d+) |", $response_str, $m); + preg_match("|^HTTP/[\d.x]+ (\d+)|", $response_str, $m);

Zend_Http_Response::extractVersion - preg_match("|^HTTP/([\d.x]+) \d+ |", $response_str, $m); + preg_match("|^HTTP/([\d.x]+) \d+|", $response_str, $m);

Comments

I was not able to get a code-only response from the server you sent - but I followed your suggestion and fixed it.

Please test again with revision 694

Thank you :)

I tested with revision 707(sorry, I'm late), and the problem with the response without Reason-Pharse is fixed.

But I found another bug in Zend_Http_Client revision 707 at line 327.

  • ((! $this->doStrictRedirects) && ($response->getStatus() == 302 || $response->getStatus == 301))) {
  • ((! $this->doStrictRedirects) && ($response->getStatus() == 302 || $response->getStatus() == 301))) {

Please check it.

Please check again with revision 710 - let me know if it is fixed.

I tested with revision 710, and it is fixed. Thank you.

Fixed in revision 710