WordPress.org

Make WordPress Core

Ticket #16855: 16855.patch

File 16855.patch, 1.4 KB (added by hakre, 7 years ago)

introducting followlocation argument for WP_Http_Curl transport

  • wp-includes/class-http.php

    ### Eclipse Workspace Patch 1.0
    #P wordpress-trunk
     
    13041304        function request($url, $args = array()) {
    13051305                $defaults = array(
    13061306                        'method' => 'GET', 'timeout' => 5,
    1307                         'redirection' => 5, 'httpversion' => '1.0',
    1308                         'blocking' => true,
     1307                        'redirection' => 5, 'followlocation' => true,
     1308                        'httpversion' => '1.0', 'blocking' => true,
    13091309                        'headers' => array(), 'body' => null, 'cookies' => array()
    13101310                );
    13111311
     
    13671367                curl_setopt( $handle, CURLOPT_SSL_VERIFYPEER, $ssl_verify );
    13681368                curl_setopt( $handle, CURLOPT_USERAGENT, $r['user-agent'] );
    13691369                curl_setopt( $handle, CURLOPT_MAXREDIRS, $r['redirection'] );
     1370                curl_setopt( $handle, CURLOPT_FOLLOWLOCATION, $r['followlocation'] );
    13701371
    13711372                switch ( $r['method'] ) {
    13721373                        case 'HEAD':
     
    14481449                curl_close( $handle );
    14491450
    14501451                // See #11305 - When running under safe mode, redirection is disabled above. Handle it manually.
    1451                 if ( !empty($theHeaders['headers']['location']) && (ini_get('safe_mode') || ini_get('open_basedir')) ) {
     1452                if ( $r['followlocation'] && !empty($theHeaders['headers']['location']) && (ini_get('safe_mode') || ini_get('open_basedir')) ) {
    14521453                        if ( $r['redirection']-- > 0 ) {
    14531454                                return $this->request($theHeaders['headers']['location'], $r);
    14541455                        } else {