WordPress.org

Make WordPress Core

Changeset 37429


Ignore:
Timestamp:
05/13/2016 05:10:52 AM (4 years ago)
Author:
rmccue
Message:

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.

Location:
trunk/src/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-http.php

    r37428 r37429  
    305305            'useragent' => $r['user-agent'],
    306306            'blocking' => $r['blocking'],
     307            'hooks' => new Requests_Hooks(),
    307308        );
     309
     310        // Ensure redirects follow browser behaviour.
     311        $options['hooks']->register( 'requests.before_redirect', array( get_class(), 'browser_redirect_compatibility' ) );
    308312
    309313        if ( $r['stream'] ) {
  • trunk/src/wp-includes/default-filters.php

    r37428 r37429  
    207207add_filter( 'title_save_pre',           'trim'                                );
    208208
    209 add_filter( 'http_request_host_is_external',    'allowed_http_request_hosts',                          10, 2 );
    210 add_action( 'requests-requests.before_redirect', array( 'WP_Http', 'browser_redirect_compatibility' ), 10, 5 );
     209add_filter( 'http_request_host_is_external',    'allowed_http_request_hosts', 10, 2 );
    211210
    212211// REST API filters.
Note: See TracChangeset for help on using the changeset viewer.