HTTP API only allows one instance of a particular header
|Reported by:||beaulebens||Owned by:|
When the WP_Http() API parses a response from a request that it's made, it parses the headers into an associative array, using the header name as the key.
This is normally fine, but there are some headers (e.g. Set-Cookie) which are allowed to be set more than once. In this case, each instance of the header encountered overwrites the previous one, so that the headers you get back end up only showing the last instance of that header.
This patch allows it to handle multiple appearances of each header, converting that array entry into an array of values for that header if there are more than one seen.
Array ( [set-cookie] => Array (  => SC=RV=99624-702292-13606-284784-700373-665639-658887-358464-700145; expires=Sun, 17-Jan-2038 19:14:07 GMT; path=/finance; domain=.google.com  => PREF=ID=d8c01cf54463c45f:TM=1233709869:LM=1233709870:S=lh-ZtpcyTb0Cu1Vh; expires=Fri, 04-Feb-2011 01:11:10 GMT; path=/; domain=.google.com ) [date] => Wed, 04 Feb 2009 01:11:10 GMT [expires] => Wed, 04 Feb 2009 01:11:10 GMT [cache-control] => private, max-age=0 [content-type] => text/html; charset=ISO-8859-1 [server] => SFE/0.8 [connection] => Close )
Change History (4)
comment:1 beaulebens — 5 years ago
- Summary changed from HTTP API only allows once instance of a particular header to HTTP API only allows one instance of a particular header