[wp-trac] [WordPress Trac] #9037: HTTP API only allows once instance of a particular header

WordPress Trac wp-trac at lists.automattic.com
Wed Feb 4 01:16:18 GMT 2009


#9037: HTTP API only allows once instance of a particular header
--------------------------+-------------------------------------------------
 Reporter:  beaulebens    |       Owner:     
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  2.8
Component:  HTTP          |     Version:     
 Severity:  normal        |    Keywords:     
--------------------------+-------------------------------------------------
 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
 )

 }}}

-- 
Ticket URL: <http://trac.wordpress.org/ticket/9037>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list