[wp-trac] [WordPress Trac] #37503: Request API doesn't pass through custom methods
WordPress Trac
noreply at wordpress.org
Thu Jul 28 20:17:10 UTC 2016
#37503: Request API doesn't pass through custom methods
--------------------------+-----------------------------
Reporter: Ipstenu | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: HTTP API | Version: trunk
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
Passing custom methods through wp_remote_request is defaulting to GET
instead of whatever the method actually is.
This code:
{{{
$response = wp_remote_request($purgeme, array('method' => 'PURGE',
'headers' => array( 'host' => $p['host'], 'X-Purge-Method' =>
$varnish_x_purgemethod ) ) );
}}}
Would output a GET instead of a PURGE for example. It's a method used by
quite a lot of Varnish related plugins and would break caching for them.
Or rather, it would make caching stop flushing. (There's a saving water in
California joke in there somewhere.)
Thanks to @ocean90 for pointing out that this:
https://github.com/rmccue/Requests/blob/125746209802f03316a3ee2d872df19044735a13/library/Requests/Transport/cURL.php#L331-L350
was missing the defaults found here:
https://core.trac.wordpress.org/browser/trunk/src/wp-includes/class-wp-
http-curl.php?rev=37492&marks=163-167#L158
Attached is a patch that adds a default back. If I use a method of PURGE,
PURGE is sent. If I do not specify a method, GET is sent.
Looking at it, perhaps lines 336-342 could be removed, as that is the same
as the default?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/37503>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list