Ticket #17416: 17416.2.diff
| File 17416.2.diff, 12.1 KB (added by , 15 years ago) |
|---|
-
wp-admin/includes/dashboard.php
1208 1208 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' ) 1209 1209 ); 1210 1210 1211 $r aw_response = wp_remote_post( 'http://api.wordpress.org/core/browse-happy/1.0/', $options );1211 $response = wp_remote_post( 'http://api.wordpress.org/core/browse-happy/1.0/', $options ); 1212 1212 1213 if ( is_wp_error( $r aw_response ) || 200 != $raw_response['response']['code'])1214 return ;1213 if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) 1214 return false; 1215 1215 1216 1216 /** 1217 1217 * Response should be an array with: … … 1224 1224 * 'img_src' - string - An image representing the browser 1225 1225 * 'img_src_ssl' - string - An image (over SSL) representing the browser 1226 1226 */ 1227 $response = unserialize( $raw_response['body']);1227 $response = unserialize( wp_remote_retrieve_body( $response ) ); 1228 1228 1229 1229 if ( ! $response ) 1230 1230 return; -
wp-admin/includes/file.php
490 490 return $response; 491 491 } 492 492 493 if ( $response['response']['code'] != '200'){493 if ( 200 != wp_remote_retrieve_response_code( $response ) ){ 494 494 unlink( $tmpfname ); 495 return new WP_Error( 'http_404', trim( $response['response']['message']) );495 return new WP_Error( 'http_404', trim( wp_remote_retrieve_response_message( $response ) ) ); 496 496 } 497 497 498 498 return $tmpfname; -
wp-admin/includes/plugin-install.php
45 45 if ( is_wp_error($request) ) { 46 46 $res = new WP_Error('plugins_api_failed', __('An Unexpected HTTP Error occurred during the API request.'), $request->get_error_message() ); 47 47 } else { 48 $res = unserialize( $request['body']);48 $res = unserialize( wp_remote_retrieve_body( $request ) ); 49 49 if ( false === $res ) 50 $res = new WP_Error('plugins_api_failed', __('An unknown error occurred.'), $request['body']);50 $res = new WP_Error('plugins_api_failed', __('An unknown error occurred.'), wp_remote_retrieve_body( $request ) ); 51 51 } 52 52 } elseif ( !is_wp_error($res) ) { 53 53 $res->external = true; … … 367 367 exit; 368 368 } 369 369 add_action('install_plugins_pre_plugin-information', 'install_plugin_information'); 370 -
wp-admin/includes/schema.php
762 762 $page = wp_remote_get( 'http://' . $hostname, array( 'timeout' => 5, 'httpversion' => '1.1' ) ); 763 763 if ( is_wp_error( $page ) ) 764 764 $errstr = $page->get_error_message(); 765 elseif ( 200 == $page['response']['code'])765 elseif ( 200 == wp_remote_retrieve_response_code( $page ) ) 766 766 $vhost_ok = true; 767 767 768 768 if ( ! $vhost_ok ) { -
wp-admin/includes/theme.php
396 396 if ( is_wp_error($request) ) { 397 397 $res = new WP_Error('themes_api_failed', __('An Unexpected HTTP Error occurred during the API request.'), $request->get_error_message() ); 398 398 } else { 399 $res = unserialize( $request['body']);399 $res = unserialize( wp_remote_retrieve_body( $request ) ); 400 400 if ( ! $res ) 401 $res = new WP_Error('themes_api_failed', __('An unknown error occurred.'), $request['body']);401 $res = new WP_Error('themes_api_failed', __('An unknown error occurred.'), wp_remote_retrieve_body( $request ) ); 402 402 } 403 403 } 404 404 //var_dump(array($args, $res)); -
wp-includes/class-feed.php
80 80 $this->error = 'WP HTTP Error: ' . $res->get_error_message(); 81 81 $this->success = false; 82 82 } else { 83 $this->headers = $res['headers'];84 $this->body = $res['body'];85 $this->status_code = $res['response']['code'];83 $this->headers = wp_remote_retrieve_headers( $res ); 84 $this->body = wp_remote_retrieve_body( $res ); 85 $this->status_code = wp_remote_retrieve_response_code( $res ); 86 86 } 87 87 } else { 88 88 if ( ! $this->body = file_get_contents($url) ) { … … 91 91 } 92 92 } 93 93 } 94 } 95 No newline at end of file 94 } -
wp-includes/class-wp-http-ixr-client.php
64 64 return false; 65 65 } 66 66 67 if ( $response['response']['code'] != 200) {68 $this->error = new IXR_Error(-32301, "transport error - HTTP status code was not 200 ({$response['response']['code']})");67 if ( 200 != wp_remote_retrieve_response_code( $response ) ) { 68 $this->error = new IXR_Error(-32301, 'transport error - HTTP status code was not 200 (' . wp_remote_retrieve_response_code( $response ) . ')'); 69 69 return false; 70 70 } 71 71 72 72 if ( $this->debug ) 73 echo '<pre class="ixr_response">' . htmlspecialchars( $response['body']) . "\n</pre>\n\n";73 echo '<pre class="ixr_response">' . htmlspecialchars( wp_remote_retrieve_body( $response ) ) . "\n</pre>\n\n"; 74 74 75 75 // Now parse what we've got back 76 $this->message = new IXR_Message( $response['body']);76 $this->message = new IXR_Message( wp_remote_retrieve_body( $response ) ); 77 77 if ( ! $this->message->parse() ) { 78 78 // XML error 79 79 $this->error = new IXR_Error(-32700, 'parse error. not well formed'); … … 90 90 return true; 91 91 } 92 92 } 93 ?> 94 No newline at end of file 93 ?> -
wp-includes/comment.php
1619 1619 if ( is_wp_error( $response ) ) 1620 1620 return false; 1621 1621 1622 if ( isset( $response['headers']['x-pingback']) )1623 return $response['headers']['x-pingback'];1622 if ( wp_remote_retrieve_header( $response, 'x-pingback' ) ) 1623 return wp_remote_retrieve_header( $response, 'x-pingback' ); 1624 1624 1625 1625 // Not an (x)html, sgml, or xml page, no use going further. 1626 if ( isset( $response['headers']['content-type'] ) && preg_match('#(image|audio|video|model)/#is', $response['headers']['content-type']) )1626 if ( preg_match('#(image|audio|video|model)/#is', wp_remote_retrieve_header( $response, 'content-type' )) ) 1627 1627 return false; 1628 1628 1629 1629 // Now do a GET since we're going to look in the html headers (and we're sure its not a binary file) … … 1632 1632 if ( is_wp_error( $response ) ) 1633 1633 return false; 1634 1634 1635 $contents = $response['body'];1635 $contents = wp_remote_retrieve_body( $response ); 1636 1636 1637 1637 $pingback_link_offset_dquote = strpos($contents, $pingback_str_dquote); 1638 1638 $pingback_link_offset_squote = strpos($contents, $pingback_str_squote); -
wp-includes/functions.php
600 600 601 601 wp_protect_special_option( $option ); 602 602 603 /* 603 /* 604 604 * FIXME the next two lines of code are not necessary and should be removed. 605 605 * @see http://core.trac.wordpress.org/ticket/13480 606 606 */ … … 1305 1305 return false; 1306 1306 1307 1307 $headers = wp_remote_retrieve_headers( $response ); 1308 $headers['response'] = $response['response']['code'];1308 $headers['response'] = wp_remote_retrieve_response_code( $response ); 1309 1309 1310 1310 // WP_HTTP no longer follows redirects for HEAD requests. 1311 1311 if ( 'HEAD' == $options['method'] && in_array($headers['response'], array(301, 302)) && isset( $headers['location'] ) ) { … … 1320 1320 if ( !$out_fp ) 1321 1321 return $headers; 1322 1322 1323 fwrite( $out_fp, $response['body']);1323 fwrite( $out_fp, wp_remote_retrieve_body( $response ) ); 1324 1324 fclose($out_fp); 1325 1325 clearstatcache(); 1326 1326 … … 1556 1556 if ( is_wp_error( $response ) ) 1557 1557 return false; 1558 1558 1559 return $response['body'];1559 return wp_remote_retrieve_body( $response ); 1560 1560 } 1561 1561 1562 1562 /** … … 2876 2876 * @param string $title Error title. 2877 2877 * @param string|array $args Optional arguements to control behaviour. 2878 2878 */ 2879 function _xmlrpc_wp_die_handler( $message, $title = '', $args = array() ) { 2879 function _xmlrpc_wp_die_handler( $message, $title = '', $args = array() ) { 2880 2880 global $wp_xmlrpc_server; 2881 2881 $defaults = array( 'response' => 500 ); 2882 2882 2883 2883 $r = wp_parse_args($args, $defaults); 2884 2884 2885 if ( $wp_xmlrpc_server ) { 2886 $error = new IXR_Error( $r['response'] , $message); 2887 $wp_xmlrpc_server->output( $error->getXml() ); 2885 if ( $wp_xmlrpc_server ) { 2886 $error = new IXR_Error( $r['response'] , $message); 2887 $wp_xmlrpc_server->output( $error->getXml() ); 2888 2888 } 2889 2889 die(); 2890 2890 } 2891 2891 2892 2892 /** 2893 2893 * Filter to enable special wp_die handler for xmlrpc requests. 2894 * 2894 * 2895 2895 * @since 3.2.0 2896 2896 * @access private 2897 2897 */ 2898 function _xmlrpc_wp_die_filter() { 2898 function _xmlrpc_wp_die_filter() { 2899 2899 return '_xmlrpc_wp_die_handler'; 2900 2900 } 2901 2901 -
wp-includes/rss.php
555 555 // Snoopy returns headers unprocessed. 556 556 // Also note, WP_HTTP lowercases all keys, Snoopy did not. 557 557 $return_headers = array(); 558 foreach ( $resp['headers']as $key => $value ) {558 foreach ( wp_remote_retrieve_headers( $resp ) as $key => $value ) { 559 559 if ( !is_array($value) ) { 560 560 $return_headers[] = "$key: $value"; 561 561 } else { … … 565 565 } 566 566 567 567 $response = new stdClass; 568 $response->status = $resp['response']['code'];569 $response->response_code = $resp['response']['code'];568 $response->status = wp_remote_retrieve_response_code( $resp ); 569 $response->response_code = wp_remote_retrieve_response_code( $resp ); 570 570 $response->headers = $return_headers; 571 $response->results = $resp['body'];571 $response->results = wp_remote_retrieve_body( $resp ); 572 572 573 573 return $response; 574 574 } -
wp-includes/update.php
71 71 72 72 $response = wp_remote_get($url, $options); 73 73 74 if ( is_wp_error( $response ) )74 if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) 75 75 return false; 76 76 77 if ( 200 != $response['response']['code'] ) 78 return false; 79 80 $body = trim( $response['body'] ); 77 $body = trim( wp_remote_retrieve_body( $response ) ); 81 78 $body = str_replace(array("\r\n", "\r"), "\n", $body); 82 79 $new_options = array(); 83 80 foreach ( explode( "\n\n", $body ) as $entry ) { … … 175 172 176 173 $raw_response = wp_remote_post('http://api.wordpress.org/plugins/update-check/1.0/', $options); 177 174 178 if ( is_wp_error( $raw_response ) )175 if ( is_wp_error( $raw_response ) || 200 != wp_remote_retrieve_response_code( $raw_response ) ) 179 176 return false; 180 177 181 if ( 200 != $raw_response['response']['code'] ) 182 return false; 178 $response = unserialize( wp_remote_retrieve_body( $raw_response ) ); 183 179 184 $response = unserialize( $raw_response['body'] );185 186 180 if ( false !== $response ) 187 181 $new_option->response = $response; 188 182 else … … 273 267 274 268 $raw_response = wp_remote_post( 'http://api.wordpress.org/themes/update-check/1.0/', $options ); 275 269 276 if ( is_wp_error( $raw_response ) )270 if ( is_wp_error( $raw_response ) || 200 != wp_remote_retrieve_response_code( $raw_response ) ) 277 271 return false; 278 272 279 if ( 200 != $raw_response['response']['code'] )280 return false;281 282 273 $new_update = new stdClass; 283 274 $new_update->last_checked = time( ); 284 275 $new_update->checked = $checked; 285 276 286 $response = unserialize( $raw_response['body']);277 $response = unserialize( wp_remote_retrieve_body( $raw_response ) ); 287 278 if ( false !== $response ) 288 279 $new_update->response = $response; 289 280