Changeset 20208
- Timestamp:
- 03/18/2012 05:00:05 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/class-http.php
r20207 r20208 1039 1039 curl_setopt( $handle, CURLOPT_SSL_VERIFYPEER, $ssl_verify ); 1040 1040 curl_setopt( $handle, CURLOPT_USERAGENT, $r['user-agent'] ); 1041 curl_setopt( $handle, CURLOPT_MAXREDIRS, $r['redirection'] ); 1041 // The option doesn't work with safe mode or when open_basedir is set, and there's a 1042 // bug #17490 with redirected POST requests, so handle redirections outside Curl. 1043 curl_setopt( $handle, CURLOPT_FOLLOWLOCATION, false ); 1042 1044 1043 1045 switch ( $r['method'] ) { … … 1076 1078 } 1077 1079 1078 // The option doesn't work with safe mode or when open_basedir is set.1079 if ( !ini_get('safe_mode') && !ini_get('open_basedir') && 0 !== $r['_redirection'] )1080 curl_setopt( $handle, CURLOPT_FOLLOWLOCATION, true );1081 1082 1080 if ( !empty( $r['headers'] ) ) { 1083 1081 // cURL expects full header strings in each element … … 1112 1110 $theBody = $theResponse; 1113 1111 1114 // If no response , and It's not a HEAD request with valid headers returned1115 if ( 0 == strlen($theResponse) && ('HEAD' != $r['method'] || empty($this->headers)) ) {1112 // If no response 1113 if ( 0 == strlen($theResponse) && empty( $theHeaders ) ) { 1116 1114 if ( $curl_error = curl_error($handle) ) 1117 1115 return new WP_Error('http_request_failed', $curl_error); … … 1132 1130 1133 1131 // See #11305 - When running under safe mode, redirection is disabled above. Handle it manually. 1134 if ( ! empty( $theHeaders['headers']['location'] ) && ( ini_get( 'safe_mode' ) || ini_get( 'open_basedir' ) ) && 0 !== $r['_redirection'] ) {1132 if ( ! empty( $theHeaders['headers']['location'] ) && 0 !== $r['_redirection'] ) { // _redirection: The requested number of redirections 1135 1133 if ( $r['redirection']-- > 0 ) { 1136 1134 return $this->request( $theHeaders['headers']['location'], $r );
Note: See TracChangeset
for help on using the changeset viewer.