protected function processHeaders($headers)
    {
        $out = array();

        $headers = explode("\r\n", trim($headers));

        foreach ($headers as $header) {
            if (strpos($header, ':') !== false) {
                $tmp = explode(':', $header);

                $out[reset($tmp)] = end($tmp);
            } else {
                if (!isset($out['http-code'])) {
                    $out['http-code'] = $header;
                }
            }
        }

        unset($headers, $header, $tmp);

        return $out;
    }