Make WordPress Core

Changeset 24846


Ignore:
Timestamp:
07/29/2013 02:11:46 AM (12 years ago)
Author:
dd32
Message:

WP_HTTP: When multiple location headers are specified, use the last specified location url as the redirect location. Fixes #16890

File:
1 edited

Legend:

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

    r24845 r24846  
    618618            return new WP_Error( 'http_request_failed', __('Too many redirects.') );
    619619
    620         $redirect_location = WP_HTTP::make_absolute_url( $response['headers']['location'], $url );
     620        $redirect_location = $response['headers']['location'];
     621
     622        // If there were multiple Location headers, use the last header specified
     623        if ( is_array( $redirect_location ) )
     624            $redirect_location = array_pop( $redirect_location );
     625
     626        $redirect_location = WP_HTTP::make_absolute_url( $redirect_location, $url );
    621627
    622628        // POST requests should not POST to a redirected location
Note: See TracChangeset for help on using the changeset viewer.