| 1 | ### Eclipse Workspace Patch 1.0 |
|---|
| 2 | #P wordpress-trunk |
|---|
| 3 | Index: wp-includes/class-http.php |
|---|
| 4 | =================================================================== |
|---|
| 5 | --- wp-includes/class-http.php (revision 17521) |
|---|
| 6 | +++ wp-includes/class-http.php (working copy) |
|---|
| 7 | @@ -981,7 +981,8 @@ |
|---|
| 8 | function request($url, $args = array()) { |
|---|
| 9 | $defaults = array( |
|---|
| 10 | 'method' => 'GET', 'timeout' => 5, |
|---|
| 11 | - 'redirection' => 5, 'httpversion' => '1.0', |
|---|
| 12 | + 'redirection' => 5, 'followlocation' => true, |
|---|
| 13 | + 'httpversion' => '1.0', |
|---|
| 14 | 'blocking' => true, |
|---|
| 15 | 'headers' => array(), 'body' => null, 'cookies' => array() |
|---|
| 16 | ); |
|---|
| 17 | @@ -1027,6 +1028,7 @@ |
|---|
| 18 | 'method' => strtoupper($r['method']), |
|---|
| 19 | 'user_agent' => $r['user-agent'], |
|---|
| 20 | 'max_redirects' => $r['redirection'] + 1, // See #11557 |
|---|
| 21 | + 'follow_location' => (int) $r['followlocation'], |
|---|
| 22 | 'protocol_version' => (float) $r['httpversion'], |
|---|
| 23 | 'header' => $strHeaders, |
|---|
| 24 | 'ignore_errors' => true, // Return non-200 requests. |
|---|
| 25 | @@ -1304,8 +1306,8 @@ |
|---|
| 26 | function request($url, $args = array()) { |
|---|
| 27 | $defaults = array( |
|---|
| 28 | 'method' => 'GET', 'timeout' => 5, |
|---|
| 29 | - 'redirection' => 5, 'httpversion' => '1.0', |
|---|
| 30 | - 'blocking' => true, |
|---|
| 31 | + 'redirection' => 5, 'followlocation' => !(ini_get('safe_mode') || ini_get('open_basedir')), |
|---|
| 32 | + 'httpversion' => '1.0', 'blocking' => true, |
|---|
| 33 | 'headers' => array(), 'body' => null, 'cookies' => array() |
|---|
| 34 | ); |
|---|
| 35 | |
|---|
| 36 | @@ -1367,6 +1369,7 @@ |
|---|
| 37 | curl_setopt( $handle, CURLOPT_SSL_VERIFYPEER, $ssl_verify ); |
|---|
| 38 | curl_setopt( $handle, CURLOPT_USERAGENT, $r['user-agent'] ); |
|---|
| 39 | curl_setopt( $handle, CURLOPT_MAXREDIRS, $r['redirection'] ); |
|---|
| 40 | + curl_setopt( $handle, CURLOPT_FOLLOWLOCATION, $r['followlocation'] ); |
|---|
| 41 | |
|---|
| 42 | switch ( $r['method'] ) { |
|---|
| 43 | case 'HEAD': |
|---|
| 44 | @@ -1448,7 +1451,7 @@ |
|---|
| 45 | curl_close( $handle ); |
|---|
| 46 | |
|---|
| 47 | // See #11305 - When running under safe mode, redirection is disabled above. Handle it manually. |
|---|
| 48 | - if ( !empty($theHeaders['headers']['location']) && (ini_get('safe_mode') || ini_get('open_basedir')) ) { |
|---|
| 49 | + if ( $r['followlocation'] && !empty($theHeaders['headers']['location']) && (ini_get('safe_mode') || ini_get('open_basedir')) ) { |
|---|
| 50 | if ( $r['redirection']-- > 0 ) { |
|---|
| 51 | return $this->request($theHeaders['headers']['location'], $r); |
|---|
| 52 | } else { |
|---|