From 2d860ae3d65e837ef8a3556b6ab8469f2f2bf598 Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Thu, 4 Aug 2016 07:14:31 +0000 Subject: [PATCH] Requests: Merge handling for custom HTTP methods. This merges the latest changes to Requests from upstream to add support for custom HTTP methods. See https://github.com/rmccue/Requests/commit/1b5ffd8501503e0641b7fa0c555ccf99973135e2 Props Ipstenu, ocean90. Fixes #37503 for trunk. Built from https://develop.svn.wordpress.org/trunk@38191 git-svn-id: http://core.svn.wordpress.org/trunk@38132 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/Requests/Transport/cURL.php | 16 +++++++++------- wp-includes/version.php | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/wp-includes/Requests/Transport/cURL.php b/wp-includes/Requests/Transport/cURL.php index 36cba510c7..453f73b730 100644 --- a/wp-includes/Requests/Transport/cURL.php +++ b/wp-includes/Requests/Transport/cURL.php @@ -333,13 +333,6 @@ class Requests_Transport_cURL implements Requests_Transport { curl_setopt($this->handle, CURLOPT_POST, true); curl_setopt($this->handle, CURLOPT_POSTFIELDS, $data); break; - case Requests::PATCH: - case Requests::PUT: - case Requests::DELETE: - case Requests::OPTIONS: - curl_setopt($this->handle, CURLOPT_CUSTOMREQUEST, $options['type']); - curl_setopt($this->handle, CURLOPT_POSTFIELDS, $data); - break; case Requests::HEAD: curl_setopt($this->handle, CURLOPT_CUSTOMREQUEST, $options['type']); curl_setopt($this->handle, CURLOPT_NOBODY, true); @@ -347,6 +340,15 @@ class Requests_Transport_cURL implements Requests_Transport { case Requests::TRACE: curl_setopt($this->handle, CURLOPT_CUSTOMREQUEST, $options['type']); break; + case Requests::PATCH: + case Requests::PUT: + case Requests::DELETE: + case Requests::OPTIONS: + default: + curl_setopt($this->handle, CURLOPT_CUSTOMREQUEST, $options['type']); + if (!empty($data)) { + curl_setopt( $this->handle, CURLOPT_POSTFIELDS, $data ); + } } // cURL requires a minimum timeout of 1 second when using the system diff --git a/wp-includes/version.php b/wp-includes/version.php index 9347d137ee..9c2c6ead62 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.7-alpha-38189'; +$wp_version = '4.7-alpha-38191'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.