HTTP API: All non-GET/HEAD requests should put the arguments in the form body.

Requests defaults to _GET/query for HEAD/GET/DELETE and _POST/body for POST/PUT/OPTIONS/PATCH. For backward compatibility `WP_HTTP` needs to force `data_format` to 'body' for all non-GET/HEAD requests.

Props dd32.
Fixes #37456.
Built from https://develop.svn.wordpress.org/trunk@38165


git-svn-id: http://core.svn.wordpress.org/trunk@38106 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Dominik Schilling 2016-07-27 15:52:28 +00:00
parent b2607f8d78
commit 7e49f103be
2 changed files with 8 additions and 5 deletions

View File

@ -315,8 +315,7 @@ class WP_Http {
} }
if ( empty( $r['redirection'] ) ) { if ( empty( $r['redirection'] ) ) {
$options['follow_redirects'] = false; $options['follow_redirects'] = false;
} } else {
else {
$options['redirects'] = $r['redirection']; $options['redirects'] = $r['redirection'];
} }
@ -333,11 +332,15 @@ class WP_Http {
// SSL certificate handling // SSL certificate handling
if ( ! $r['sslverify'] ) { if ( ! $r['sslverify'] ) {
$options['verify'] = false; $options['verify'] = false;
} } else {
else {
$options['verify'] = $r['sslcertificates']; $options['verify'] = $r['sslcertificates'];
} }
// All non-GET/HEAD requests should put the arguments in the form body.
if ( 'HEAD' !== $type && 'GET' !== $type ) {
$options['data_format'] = 'body';
}
/** /**
* Filters whether SSL should be verified for non-local requests. * Filters whether SSL should be verified for non-local requests.
* *

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.6-beta4-38164'; $wp_version = '4.6-beta4-38165';
/** /**
* 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.