proxylib.php
protected function _parseResponse()
    {
        /**
         * According to the HTTP spec, we have to respect \n\n too
         *  @todo: Respect \n\n
         */
        $break_1 = strpos($this->_rawResponse, "\r\n\r\n");
        $break_2 = strpos($this->_rawResponse, "\n\n");
        $break   = 0;

        if    ($break_1 && $break_2 === FALSE) $break = $break_1;
        elseif($break_2 && $break_1 === FALSE) $break = $break_2;
        elseif($break_1 < $break_2) $break = $break_1;
        else $break = $break_2;

        # Let's check to see if we recieved a header but no body
        if($break === FALSE)
        {
            if(strpos($this->_rawResponse, 'HTTP/') !== FALSE)
            {
                $break = strlen($this->_rawResponse);
            }
            else
            {
                throw new Exception("A valid response was not received from the host");
            }
        }

        $header = substr($this->_rawResponse, 0, $break);
        $this->_responseHeaders = $this->_parseResponseHeaders($header);
        $this->_responseBody    = substr($this->_rawResponse, $break + 3);
    }
protected function _parseResponse()
    {
        /**
         * According to the HTTP spec, we have to respect \n\n too
         *  @todo: Respect \n\n
         */
        $break_1 = strpos($this->_rawResponse, "\r\n\r\n");
        $break_2 = strpos($this->_rawResponse, "\n\n");
        $break   = 0;

        if    ($break_1 && $break_2 === FALSE) $break = $break_1;
        elseif($break_2 && $break_1 === FALSE) $break = $break_2;
        elseif($break_1 < $break_2) $break = $break_1;
        else $break = $break_2;

        # Let's check to see if we recieved a header but no body
        if($break === FALSE)
        {
            if(strpos($this->_rawResponse, 'HTTP/') !== FALSE)
            {
                $break = strlen($this->_rawResponse);
            }
            else
            {
                throw new Exception("A valid response was not received from the host");
            }
        }

        $header = substr($this->_rawResponse, 0, $break);
        $this->_responseHeaders = $this->_parseResponseHeaders($header);
        $this->_responseBody    = substr($this->_rawResponse, $break + 3);
    }
protected function _parseResponse ( ) { /**
         * According to the HTTP spec, we have to respect \n\n too
         *  @todo: Respect \n\n
         */ $ break_1 = strpos ( $ this -> _rawResponse , "\r\n\r\n" ) ; $ break_2 = strpos ( $ this -> _rawResponse , "\n\n" ) ; $ break = 0 ; if ( $ break_1 && $ break_2 === FALSE ) $ break = $ break_1 ; elseif ( $ break_2 && $ break_1 === FALSE ) $ break = $ break_2 ; elseif ( $ break_1 < $ break_2 ) $ break = $ break_1 ; else $ break = $ break_2 ; # Let's check to see if we recieved a header but no body
 if ( $ break === FALSE ) { if ( strpos ( $ this -> _rawResponse , 'HTTP/' ) !== FALSE ) { $ break = strlen ( $ this -> _rawResponse ) ; } else { throw new Exception ( "A valid response was not received from the host" ) ; } } $ header = substr ( $ this -> _rawResponse , 0 , $ break ) ; $ this -> _responseHeaders = $ this -> _parseResponseHeaders ( $ header ) ; $ this -> _responseBody = substr ( $ this -> _rawResponse , $ break + 3 ) ; }
Parse the headers and the body out of the raw response sent back by the
server. Store them in _responseHeaders and _responseBody.
@throws Exception When the server does not give us a valid response
Parse the headers and the body out of the raw response sent back by the server . Store them in _responseHeaders and _responseBody .