HTTP API: Add browser compatibility hook for 3xx redirects.
WordPress erroneously follows browser-style behaviour with 3xx redirects, where a POST to 302 becomes a GET. Requests instead follows the specification and keeps the same method. Requests also exposes a hook to allow changing the behaviour. [37428] used the wrong method of adding this hook, now corrected. See #33055. Built from https://develop.svn.wordpress.org/trunk@37429 git-svn-id: http://core.svn.wordpress.org/trunk@37395 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
37f6e6813a
commit
dee1d583a7
|
@ -304,8 +304,12 @@ class WP_Http {
|
|||
'timeout' => $r['timeout'],
|
||||
'useragent' => $r['user-agent'],
|
||||
'blocking' => $r['blocking'],
|
||||
'hooks' => new Requests_Hooks(),
|
||||
);
|
||||
|
||||
// Ensure redirects follow browser behaviour.
|
||||
$options['hooks']->register( 'requests.before_redirect', array( get_class(), 'browser_redirect_compatibility' ) );
|
||||
|
||||
if ( $r['stream'] ) {
|
||||
$options['filename'] = $r['filename'];
|
||||
}
|
||||
|
|
|
@ -206,8 +206,7 @@ add_filter( 'pingback_ping_source_uri', 'pingback_ping_source_uri' );
|
|||
add_filter( 'xmlrpc_pingback_error', 'xmlrpc_pingback_error' );
|
||||
add_filter( 'title_save_pre', 'trim' );
|
||||
|
||||
add_filter( 'http_request_host_is_external', 'allowed_http_request_hosts', 10, 2 );
|
||||
add_action( 'requests-requests.before_redirect', array( 'WP_Http', 'browser_redirect_compatibility' ), 10, 5 );
|
||||
add_filter( 'http_request_host_is_external', 'allowed_http_request_hosts', 10, 2 );
|
||||
|
||||
// REST API filters.
|
||||
add_action( 'xmlrpc_rsd_apis', 'rest_output_rsd' );
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.6-alpha-37428';
|
||||
$wp_version = '4.6-alpha-37429';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue