private function createHeaders($headers)
    {
        if (is_string($headers)) {
            return $this->createHeaders(explode("\r\n", $headers));
        }

        $fixedHeaders = array();

        foreach ($headers as $key => $header) {
            if (is_int($key)) {
                if (($pos = strpos($header, ':')) === false) {
                    continue;
                }

                $fixedHeaders[substr($header, 0, $pos)] = substr($header, $pos + 1);
            } else {
                $fixedHeaders[$key] = $this->createHeader($header);
            }
        }

        return $fixedHeaders;
    }