lithium\net\http\Response::_parseMessage PHP Méthode

_parseMessage() protected méthode

Accepts an entire HTTP message including headers and body, and parses it into a message body an array of headers, and the HTTP status.
protected _parseMessage ( string $body ) : After
$body string The full body of the message.
Résultat After parsing out other message components, returns just the message body.
    protected function _parseMessage($body)
    {
        if (!($parts = explode("\r\n\r\n", $body, 2)) || count($parts) === 1) {
            return trim($body);
        }
        list($headers, $body) = $parts;
        $headers = str_replace("\r", "", explode("\n", $headers));
        if (array_filter($headers) === array()) {
            return trim($body);
        }
        preg_match('/HTTP\\/(\\d+\\.\\d+)\\s+(\\d+)(?:\\s+(.*))?/i', array_shift($headers), $match);
        $this->headers($headers, false);
        if (!$match) {
            return trim($body);
        }
        list($line, $this->version, $code) = $match;
        if (isset($this->_statuses[$code])) {
            $message = $this->_statuses[$code];
        }
        if (isset($match[3])) {
            $message = $match[3];
        }
        $this->status = compact('code', 'message') + $this->status;
        $this->protocol = "HTTP/{$this->version}";
        return $body;
    }