public function getResponseHeaders()
    {
        $headers = array();

        $header_text = substr($this->result, 0, $this->headerSize);

        foreach (explode("\r\n", $header_text) as $i => $line)
            if (strlen($line) > 4 && substr($line, 0, 4) === "HTTP") {
                $headers['http_code'] = $line;
            } else {
                list ($key, $value) = array_pad(explode(': ', $line, 2), 2, null);
                $headers[$key] = $value;
            }

        return $headers;
    }