Ticket #17490: 17490-2.diff
File 17490-2.diff, 1.7 KB (added by , 13 years ago) |
---|
-
wp-includes/class-http.php
1042 1042 curl_setopt( $handle, CURLOPT_SSL_VERIFYHOST, ( $ssl_verify === true ) ? 2 : false ); 1043 1043 curl_setopt( $handle, CURLOPT_SSL_VERIFYPEER, $ssl_verify ); 1044 1044 curl_setopt( $handle, CURLOPT_USERAGENT, $r['user-agent'] ); 1045 curl_setopt( $handle, CURLOPT_MAXREDIRS, $r['redirection']);1045 curl_setopt( $handle, CURLOPT_MAXREDIRS, 0 ); 1046 1046 1047 1047 switch ( $r['method'] ) { 1048 1048 case 'HEAD': … … 1074 1074 curl_setopt( $handle, CURLOPT_FILE, $stream_handle ); 1075 1075 } 1076 1076 1077 // The option doesn't work with safe mode or when open_basedir is set .1078 if ( !ini_get('safe_mode') && !ini_get('open_basedir') && 0 !== $r['_redirection'] )1079 curl_setopt( $handle, CURLOPT_FOLLOWLOCATION, true );1077 // The option doesn't work with safe mode or when open_basedir is set, and there's a 1078 // bug #17490 with redirected POST requests, so handle redirections outside Curl. 1079 curl_setopt( $handle, CURLOPT_FOLLOWLOCATION, false ); 1080 1080 1081 1081 if ( !empty( $r['headers'] ) ) { 1082 1082 // cURL expects full header strings in each element … … 1130 1130 fclose( $stream_handle ); 1131 1131 1132 1132 // See #11305 - When running under safe mode, redirection is disabled above. Handle it manually. 1133 if ( ! empty( $theHeaders['headers']['location'] ) && ( ini_get( 'safe_mode' ) || ini_get( 'open_basedir' ) ) &&0 !== $r['_redirection'] ) {1133 if ( ! empty( $theHeaders['headers']['location'] ) && 0 !== $r['_redirection'] ) { 1134 1134 if ( $r['redirection']-- > 0 ) { 1135 1135 return $this->request( $theHeaders['headers']['location'], $r ); 1136 1136 } else {