Vinelab / http

A smart, simple and fault-tolerant HTTP client for sending and receiving JSON and XML
57 stars 30 forks source link

Get cookie values #16

Open matthijs-neijenhuijs opened 9 years ago

matthijs-neijenhuijs commented 9 years ago

I have a api where there are duplicated header keys. Is it possible to extract the headers with ignoring parseHeaders?

I changed the function:

protected function parseHeaders($response, $headerSize)
{
    $headers = substr($response, 0, $headerSize);
    $parsedHeaders = [];

    foreach (explode("\r\n",$headers) as $header)
    {
        if (strpos($header, ':'))
        {
            $nestedHeader = explode(':', $header);
            $parsedHeaders[$nestedHeader[0]][] = trim($nestedHeader[1]);
        }
    }

    return $parsedHeaders;
}
Mulkave commented 6 years ago

Can you please elaborate on this functionality? If you still remember since it's been years 😄