error processing duplicated headers from server
gemunet opened this issue · 3 comments
When a request is made to the server, it may respond with repeated headers. eg multiple set-cookie. But httpful to parse the headers in "$response->headers" places them in an associative array, which does not allow duplication, losing headers.
this is a mistake. reference, php.net at "$http_response_header" places them in a non-associative array.
example dump multiple set-cookie from server where JSESSIONID in $raw_headers is lost in $headers:
`var_dump($response->raw_headers);
var_dump($response->headers);
string(773) "HTTP/1.1 200 OK
Date: Mon, 03 Oct 2016 19:21:18 GMT
Server: Apache-Coyote/1.1
X-Powered-By: Servlet 2.5; JBoss-5.0/JBossWeb-2.1
X-Powered-By: JSF/2.0
Content-Type: text/html;charset=UTF-8
Set-Cookie: JSESSIONID=400A019481E0AB7EE0ABB6C6F1BC3171; Path=/Certificados
Vary: Accept-Encoding
Cache-Control: no-store
Cache-Control: no-cache
X-Mag: A0C7921228AE131C;1daf8b40;37267143;usrLkup->0;usrBase->0;getPRBefFind->0;PRAfterFind->0;publicURL->0;default;SH;FF1End->0;FP2->0;WS=c83b9971;default;FP4->8;C005;
Set-Cookie: ZNPCQ003-31303900=c83b9971; Path=/Certificados; Domain=.com
Via: 1.1 portatest.com (Access Gateway-ag-A0C7921228AE131C-37267143)
Transfer-Encoding: chunked"
object(Httpful\Response\Headers)#8 (1) {
["headers":"Httpful\Response\Headers":private]=>
array(10) {
["date"]=>
string(29) "Mon, 03 Oct 2016 19:21:18 GMT"
["server"]=>
string(17) "Apache-Coyote/1.1"
["x-powered-by"]=>
string(7) "JSF/2.0"
["content-type"]=>
string(23) "text/html;charset=UTF-8"
["set-cookie"]=>
string(80) "ZNPCQ003-31303900=c83b9971; Path=/Certificados; Domain=.com"
["vary"]=>
string(15) "Accept-Encoding"
["cache-control"]=>
string(8) "no-cache"
["x-mag"]=>
string(198) "A0C7921228AE131C;1daf8b40;37267143;usrLkup->0;usrBase->0;getPRBefFind->0;PRAfterFind->0;publicURL->0;default;SH;FF1End->0;FP2->0;WS=c83b9971;default;FP4->8;C005;"
["via"]=>
string(81) "1.1 portatest.com (Access Gateway-ag-A0C7921228AE131C-37267143)"
["transfer-encoding"]=>
string(7) "chunked"
}
}`
no solution yet ??
it's really painful to parse raw_headers to get all the cookies ;-(
Feel free to make a PR :-)