#9037 closed defect (bug) (fixed)
HTTP API only allows one instance of a particular header
Reported by: | beaulebens | Owned by: | |
---|---|---|---|
Milestone: | 2.8 | Priority: | normal |
Severity: | normal | Version: | |
Component: | HTTP API | Keywords: | |
Focuses: | Cc: |
Description
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.
e.g.
Array ( [set-cookie] => Array ( [0] => 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 [1] => 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 )
Attachments (1)
Change History (4)
Note: See
TracTickets for help on using
tickets.
Allows multiple appearances of headers in response handling.