Ticket #17490: 17490.diff
File 17490.diff, 1.2 KB (added by , 14 years ago) |
---|
-
wp-includes/class-http.php
1074 1074 } 1075 1075 1076 1076 // The option doesn't work with safe mode or when open_basedir is set. 1077 if ( !ini_get('safe_mode') && !ini_get('open_basedir') && 0 !== $r['_redirection'] )1077 if ( !ini_get('safe_mode') && !ini_get('open_basedir') && 0 !== $r['_redirection'] && $r['method'] !== 'POST' ) 1078 1078 curl_setopt( $handle, CURLOPT_FOLLOWLOCATION, true ); 1079 1079 1080 1080 if ( !empty( $r['headers'] ) ) { … … 1103 1103 } 1104 1104 1105 1105 $theResponse = curl_exec( $handle ); 1106 1106 1107 $theBody = ''; 1107 1108 $theHeaders = WP_Http::processHeaders( $this->headers ); 1108 1109 1110 if ( in_array( curl_getinfo( $handle, CURLINFO_HTTP_CODE ), array( 301, 302) ) && $r['method'] == 'POST' ) { 1111 $r['method'] = 'GET'; 1112 $r['body'] = ''; 1113 $r['headers'] = ''; 1114 $url = $theHeaders['headers']['location']; 1115 return wp_remote_get($url, $r); 1116 } 1117 1109 1118 if ( strlen($theResponse) > 0 && ! is_bool( $theResponse ) ) // is_bool: when using $args['stream'], curl_exec will return (bool)true 1110 1119 $theBody = $theResponse; 1111 1120