original_string: protected function _send(Request $request)
      {
          $deadline = false;
          if (isset($this->_contextOptions['timeout']) && $this->_contextOptions['timeout'] > 0) {
              $deadline = time() + $this->_contextOptions['timeout'];
          }
  
          $url = $request->getUri();
          $this->_open($url);
          $content = '';
          $timedOut = false;
  
          while (!feof($this->_stream)) {
              if ($deadline !== false) {
                  stream_set_timeout($this->_stream, max($deadline - time(), 1));
              }
  
              $content .= fread($this->_stream, 8192);
  
              $meta = stream_get_meta_data($this->_stream);
              if ($meta['timed_out'] || ($deadline !== false && time() > $deadline)) {
                  $timedOut = true;
                  break;
              }
          }
          $meta = stream_get_meta_data($this->_stream);
          fclose($this->_stream);
  
          if ($timedOut) {
              throw new HttpException('Connection timed out ' . $url, 504);
          }
  
          $headers = $meta['wrapper_data'];
          if (isset($headers['headers']) && is_array($headers['headers'])) {
              $headers = $headers['headers'];
          }
  
          return $this->createResponses($headers, $content);
      }
code: protected function _send(Request $request)
      {
          $deadline = false;
          if (isset($this->_contextOptions['timeout']) && $this->_contextOptions['timeout'] > 0) {
              $deadline = time() + $this->_contextOptions['timeout'];
          }
  
          $url = $request->getUri();
          $this->_open($url);
          $content = '';
          $timedOut = false;
  
          while (!feof($this->_stream)) {
              if ($deadline !== false) {
                  stream_set_timeout($this->_stream, max($deadline - time(), 1));
              }
  
              $content .= fread($this->_stream, 8192);
  
              $meta = stream_get_meta_data($this->_stream);
              if ($meta['timed_out'] || ($deadline !== false && time() > $deadline)) {
                  $timedOut = true;
                  break;
              }
          }
          $meta = stream_get_meta_data($this->_stream);
          fclose($this->_stream);
  
          if ($timedOut) {
              throw new HttpException('Connection timed out ' . $url, 504);
          }
  
          $headers = $meta['wrapper_data'];
          if (isset($headers['headers']) && is_array($headers['headers'])) {
              $headers = $headers['headers'];
          }
  
          return $this->createResponses($headers, $content);
      }
code_tokens: protected function _send ( Request $ request ) { $ deadline = false ; if ( isset ( $ this -> _contextOptions [ 'timeout' ] ) && $ this -> _contextOptions [ 'timeout' ] > 0 ) { $ deadline = time ( ) + $ this -> _contextOptions [ 'timeout' ] ; } $ url = $ request -> getUri ( ) ; $ this -> _open ( $ url ) ; $ content = '' ; $ timedOut = false ; while ( ! feof ( $ this -> _stream ) ) { if ( $ deadline !== false ) { stream_set_timeout ( $ this -> _stream , max ( $ deadline - time ( ) , 1 ) ) ; } $ content .= fread ( $ this -> _stream , 8192 ) ; $ meta = stream_get_meta_data ( $ this -> _stream ) ; if ( $ meta [ 'timed_out' ] || ( $ deadline !== false && time ( ) > $ deadline ) ) { $ timedOut = true ; break ; } } $ meta = stream_get_meta_data ( $ this -> _stream ) ; fclose ( $ this -> _stream ) ; if ( $ timedOut ) { throw new HttpException ( 'Connection timed out ' . $ url , 504 ) ; } $ headers = $ meta [ 'wrapper_data' ] ; if ( isset ( $ headers [ 'headers' ] ) && is_array ( $ headers [ 'headers' ] ) ) { $ headers = $ headers [ 'headers' ] ; } return $ this -> createResponses ( $ headers , $ content ) ; }
docstring: Open the stream and send the request.
  
  @param \Cake\Http\Client\Request $request The request object.
  @return array Array of populated Response objects
  @throws \Cake\Http\Exception\HttpException
docstring_tokens: Open the stream and send the request .