[wp-trac] [WordPress Trac] #39687: Request headers sent incorrectly from `WP_Http` to `Requests`

WordPress Trac noreply at wordpress.org
Fri Jan 27 02:10:14 UTC 2017


#39687: Request headers sent incorrectly from `WP_Http` to `Requests`
-----------------------------------+------------------------------
 Reporter:  flixos90               |       Owner:
     Type:  defect (bug)           |      Status:  new
 Priority:  normal                 |   Milestone:  Awaiting Review
Component:  HTTP API               |     Version:
 Severity:  normal                 |  Resolution:
 Keywords:  has-patch 2nd-opinion  |     Focuses:
-----------------------------------+------------------------------
Changes (by dd32):

 * keywords:  has-patch => has-patch 2nd-opinion


Comment:

 We've never really supported passing multiple header values as an array
 when explicitly using array syntax, and it's definately never been
 supported when passing a multiple-header string (which is a edgecase we
 support).

 For comparison, Here's the code in 4.4 which definately didnt' support it:
 https://core.trac.wordpress.org/browser/branches/4.4/src/wp-includes
 /class-wp-http-curl.php?marks=195-199#L192
 https://core.trac.wordpress.org/browser/branches/4.4/src/wp-includes
 /class-wp-http-streams.php?marks=191-196#L188

 `WP_Http::processHeaders()` was originally intended to be used for return-
 value purposes, returning duplicate headers from the server to the caller
 in an array format instead of the standard comma-separated format. We
 could change that, but I fear others may be using the method in
 plugins/etc and expecting that format.

 Looking at [attachment:39687.diff] I think I'm willing to suggest
 `wontfix` here, or perhaps just an extra parameter to be added..

 If you want to pass multiple header values, pass an array with a properly
 formatted value, don't send a string with multiple headers ie. pass `[
 'Header' => 'Value1,Value2' ]` rather than `Header: Value1\nHeader:Value2`

 @rmccue thoughts?

--
Ticket URL: <https://core.trac.wordpress.org/ticket/39687#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list