Requests: Merge handling for custom HTTP methods.

This merges the latest changes to Requests from upstream to add support for custom HTTP methods.
See 1b5ffd8501

Props Ipstenu, ocean90.
Merges [38191] to the 4.6 branch.
Fixes #37503 for 4.6.

Built from https://develop.svn.wordpress.org/branches/4.6@38192


git-svn-id: http://core.svn.wordpress.org/branches/4.6@38133 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Dion Hulse 2016-08-04 07:22:35 +00:00
parent 1a6b25088a
commit a72eb16e91
2 changed files with 10 additions and 8 deletions

View File

@ -333,13 +333,6 @@ class Requests_Transport_cURL implements Requests_Transport {
curl_setopt($this->handle, CURLOPT_POST, true); curl_setopt($this->handle, CURLOPT_POST, true);
curl_setopt($this->handle, CURLOPT_POSTFIELDS, $data); curl_setopt($this->handle, CURLOPT_POSTFIELDS, $data);
break; 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: case Requests::HEAD:
curl_setopt($this->handle, CURLOPT_CUSTOMREQUEST, $options['type']); curl_setopt($this->handle, CURLOPT_CUSTOMREQUEST, $options['type']);
curl_setopt($this->handle, CURLOPT_NOBODY, true); curl_setopt($this->handle, CURLOPT_NOBODY, true);
@ -347,6 +340,15 @@ class Requests_Transport_cURL implements Requests_Transport {
case Requests::TRACE: case Requests::TRACE:
curl_setopt($this->handle, CURLOPT_CUSTOMREQUEST, $options['type']); curl_setopt($this->handle, CURLOPT_CUSTOMREQUEST, $options['type']);
break; 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 // cURL requires a minimum timeout of 1 second when using the system

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.6-RC1-38190'; $wp_version = '4.6-RC1-38192';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.