private function parseHeaders($headers)
    {
        $result = [];

        foreach (preg_split("/\\r\\n|\\r|\\n/", $headers) as $row) {
            $header = explode(':', $row, 2);

            if (count($header) == 2) {
                $result[$header[0]] = trim($header[1]);
            }
            else {
                $result[] = $header[0];
            }
        }

        return $result;
    }