ZF-9006: Zend_Http_Client_Adapter_Socket Read timeout not work in In some cases

Description

I have a case that timeout not work. I found this should happen during the reading header. There is no check timeout. And after add check, the issue is resolved.


    public function read() {
...
        while (($line = @fgets($this->socket)) !== false) {
            //<-- there is no check 
            $gotStatus = $gotStatus || (strpos($line, 'HTTP') !== false);
            if ($gotStatus) {
                $response .= $line;
                if (rtrim($line) === '') break;
            }
        }

        $this->_checkSocketReadTimeout(); //<-- check timeout here

-- patch ---

@@ -319,6 +319,7 @@


         $stream = !empty($this->config['stream']);
 
         while (($line = @fgets($this->socket)) !== false) {
+            $this->_checkSocketReadTimeout();
             $gotStatus = $gotStatus || (strpos($line, 'HTTP') !== false);
             if ($gotStatus) {
                 $response .= $line;

Comments

No comments to display