<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[17928] trunk: Use wp_remote_retrieve_* helper functions instead of the raw HTTP response array.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg > ul, #logmsg > ol { margin-left: 0; margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/17928">17928</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2011-05-14 19:45:07 +0000 (Sat, 14 May 2011)</dd>
</dl>

<h3>Log Message</h3>
<pre>Use wp_remote_retrieve_* helper functions instead of the raw HTTP response array. props aaroncampbell, fixes <a href="http://trac.wordpress.org/ticket/17416">#17416</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminincludesdashboardphp">trunk/wp-admin/includes/dashboard.php</a></li>
<li><a href="#trunkwpadminincludesfilephp">trunk/wp-admin/includes/file.php</a></li>
<li><a href="#trunkwpadminincludesplugininstallphp">trunk/wp-admin/includes/plugin-install.php</a></li>
<li><a href="#trunkwpadminincludesschemaphp">trunk/wp-admin/includes/schema.php</a></li>
<li><a href="#trunkwpadminincludesthemephp">trunk/wp-admin/includes/theme.php</a></li>
<li><a href="#trunkwpincludesclassfeedphp">trunk/wp-includes/class-feed.php</a></li>
<li><a href="#trunkwpincludesclasswphttpixrclientphp">trunk/wp-includes/class-wp-http-ixr-client.php</a></li>
<li><a href="#trunkwpincludescommentphp">trunk/wp-includes/comment.php</a></li>
<li><a href="#trunkwpincludesfunctionsphp">trunk/wp-includes/functions.php</a></li>
<li><a href="#trunkwpincludesrssphp">trunk/wp-includes/rss.php</a></li>
<li><a href="#trunkwpincludesupdatephp">trunk/wp-includes/update.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminincludesdashboardphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/dashboard.php (17927 => 17928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/dashboard.php        2011-05-14 19:41:42 UTC (rev 17927)
+++ trunk/wp-admin/includes/dashboard.php        2011-05-14 19:45:07 UTC (rev 17928)
</span><span class="lines">@@ -1208,10 +1208,10 @@
</span><span class="cx">                         'user-agent'        =&gt; 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' )
</span><span class="cx">                 );
</span><span class="cx"> 
</span><del>-                $raw_response = wp_remote_post( 'http://api.wordpress.org/core/browse-happy/1.0/', $options );
</del><ins>+                $response = wp_remote_post( 'http://api.wordpress.org/core/browse-happy/1.0/', $options );
</ins><span class="cx"> 
</span><del>-                if ( is_wp_error( $raw_response ) || 200 != $raw_response['response']['code'] )
-                        return;
</del><ins>+                if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) )
+                        return false;
</ins><span class="cx"> 
</span><span class="cx">                 /**
</span><span class="cx">                  * Response should be an array with:
</span><span class="lines">@@ -1224,7 +1224,7 @@
</span><span class="cx">                  *  'img_src' - string - An image representing the browser
</span><span class="cx">                  *  'img_src_ssl' - string - An image (over SSL) representing the browser
</span><span class="cx">                  */
</span><del>-                $response = unserialize( $raw_response['body'] );
</del><ins>+                $response = unserialize( wp_remote_retrieve_body( $response ) );
</ins><span class="cx"> 
</span><span class="cx">                 if ( ! $response )
</span><span class="cx">                         return;
</span></span></pre></div>
<a id="trunkwpadminincludesfilephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/file.php (17927 => 17928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/file.php        2011-05-14 19:41:42 UTC (rev 17927)
+++ trunk/wp-admin/includes/file.php        2011-05-14 19:45:07 UTC (rev 17928)
</span><span class="lines">@@ -490,9 +490,9 @@
</span><span class="cx">                 return $response;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        if ( $response['response']['code'] != '200' ){
</del><ins>+        if ( 200 != wp_remote_retrieve_response_code( $response ) ){
</ins><span class="cx">                 unlink( $tmpfname );
</span><del>-                return new WP_Error( 'http_404', trim( $response['response']['message'] ) );
</del><ins>+                return new WP_Error( 'http_404', trim( wp_remote_retrieve_response_message( $response ) ) );
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         return $tmpfname;
</span></span></pre></div>
<a id="trunkwpadminincludesplugininstallphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/plugin-install.php (17927 => 17928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/plugin-install.php        2011-05-14 19:41:42 UTC (rev 17927)
+++ trunk/wp-admin/includes/plugin-install.php        2011-05-14 19:45:07 UTC (rev 17928)
</span><span class="lines">@@ -45,9 +45,9 @@
</span><span class="cx">                 if ( is_wp_error($request) ) {
</span><span class="cx">                         $res = new WP_Error('plugins_api_failed', __('An Unexpected HTTP Error occurred during the API request.'), $request-&gt;get_error_message() );
</span><span class="cx">                 } else {
</span><del>-                        $res = unserialize($request['body']);
</del><ins>+                        $res = unserialize( wp_remote_retrieve_body( $request ) );
</ins><span class="cx">                         if ( false === $res )
</span><del>-                                $res = new WP_Error('plugins_api_failed', __('An unknown error occurred.'), $request['body']);
</del><ins>+                                $res = new WP_Error('plugins_api_failed', __('An unknown error occurred.'), wp_remote_retrieve_body( $request ) );
</ins><span class="cx">                 }
</span><span class="cx">         } elseif ( !is_wp_error($res) ) {
</span><span class="cx">                 $res-&gt;external = true;
</span><span class="lines">@@ -367,4 +367,3 @@
</span><span class="cx">         exit;
</span><span class="cx"> }
</span><span class="cx"> add_action('install_plugins_pre_plugin-information', 'install_plugin_information');
</span><del>-
</del></span></pre></div>
<a id="trunkwpadminincludesschemaphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/schema.php (17927 => 17928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/schema.php        2011-05-14 19:41:42 UTC (rev 17927)
+++ trunk/wp-admin/includes/schema.php        2011-05-14 19:45:07 UTC (rev 17928)
</span><span class="lines">@@ -762,7 +762,7 @@
</span><span class="cx">                 $page = wp_remote_get( 'http://' . $hostname, array( 'timeout' =&gt; 5, 'httpversion' =&gt; '1.1' ) );
</span><span class="cx">                 if ( is_wp_error( $page ) )
</span><span class="cx">                         $errstr = $page-&gt;get_error_message();
</span><del>-                elseif ( 200 == $page['response']['code'] )
</del><ins>+                elseif ( 200 == wp_remote_retrieve_response_code( $page ) )
</ins><span class="cx">                                 $vhost_ok = true;
</span><span class="cx"> 
</span><span class="cx">                 if ( ! $vhost_ok ) {
</span></span></pre></div>
<a id="trunkwpadminincludesthemephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/theme.php (17927 => 17928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/theme.php        2011-05-14 19:41:42 UTC (rev 17927)
+++ trunk/wp-admin/includes/theme.php        2011-05-14 19:45:07 UTC (rev 17928)
</span><span class="lines">@@ -396,9 +396,9 @@
</span><span class="cx">                 if ( is_wp_error($request) ) {
</span><span class="cx">                         $res = new WP_Error('themes_api_failed', __('An Unexpected HTTP Error occurred during the API request.'), $request-&gt;get_error_message() );
</span><span class="cx">                 } else {
</span><del>-                        $res = unserialize($request['body']);
</del><ins>+                        $res = unserialize( wp_remote_retrieve_body( $request ) );
</ins><span class="cx">                         if ( ! $res )
</span><del>-                        $res = new WP_Error('themes_api_failed', __('An unknown error occurred.'), $request['body']);
</del><ins>+                        $res = new WP_Error('themes_api_failed', __('An unknown error occurred.'), wp_remote_retrieve_body( $request ) );
</ins><span class="cx">                 }
</span><span class="cx">         }
</span><span class="cx">         //var_dump(array($args, $res));
</span></span></pre></div>
<a id="trunkwpincludesclassfeedphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/class-feed.php (17927 => 17928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/class-feed.php        2011-05-14 19:41:42 UTC (rev 17927)
+++ trunk/wp-includes/class-feed.php        2011-05-14 19:45:07 UTC (rev 17928)
</span><span class="lines">@@ -80,9 +80,9 @@
</span><span class="cx">                                 $this-&gt;error = 'WP HTTP Error: ' . $res-&gt;get_error_message();
</span><span class="cx">                                 $this-&gt;success = false;
</span><span class="cx">                         } else {
</span><del>-                                $this-&gt;headers = $res['headers'];
-                                $this-&gt;body = $res['body'];
-                                $this-&gt;status_code = $res['response']['code'];
</del><ins>+                                $this-&gt;headers = wp_remote_retrieve_headers( $res );
+                                $this-&gt;body = wp_remote_retrieve_body( $res );
+                                $this-&gt;status_code = wp_remote_retrieve_response_code( $res );
</ins><span class="cx">                         }
</span><span class="cx">                 } else {
</span><span class="cx">                         if ( ! $this-&gt;body = file_get_contents($url) ) {
</span><span class="lines">@@ -91,4 +91,4 @@
</span><span class="cx">                         }
</span><span class="cx">                 }
</span><span class="cx">         }
</span><del>-}
</del><span class="cx">\ No newline at end of file
</span><ins>+}
</ins></span></pre></div>
<a id="trunkwpincludesclasswphttpixrclientphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/class-wp-http-ixr-client.php (17927 => 17928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/class-wp-http-ixr-client.php        2011-05-14 19:41:42 UTC (rev 17927)
+++ trunk/wp-includes/class-wp-http-ixr-client.php        2011-05-14 19:45:07 UTC (rev 17928)
</span><span class="lines">@@ -64,16 +64,16 @@
</span><span class="cx">                         return false;
</span><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                if ( $response['response']['code'] != 200 ) {
-                        $this-&gt;error = new IXR_Error(-32301, &quot;transport error - HTTP status code was not 200 ({$response['response']['code']})&quot;);
</del><ins>+                if ( 200 != wp_remote_retrieve_response_code( $response ) ) {
+                        $this-&gt;error = new IXR_Error(-32301, 'transport error - HTTP status code was not 200 (' . wp_remote_retrieve_response_code( $response ) . ')');
</ins><span class="cx">                         return false;
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 if ( $this-&gt;debug )
</span><del>-                        echo '&lt;pre class=&quot;ixr_response&quot;&gt;' . htmlspecialchars($response['body']) . &quot;\n&lt;/pre&gt;\n\n&quot;;
</del><ins>+                        echo '&lt;pre class=&quot;ixr_response&quot;&gt;' . htmlspecialchars( wp_remote_retrieve_body( $response ) ) . &quot;\n&lt;/pre&gt;\n\n&quot;;
</ins><span class="cx"> 
</span><span class="cx">                 // Now parse what we've got back
</span><del>-                $this-&gt;message = new IXR_Message( $response['body'] );
</del><ins>+                $this-&gt;message = new IXR_Message( wp_remote_retrieve_body( $response ) );
</ins><span class="cx">                 if ( ! $this-&gt;message-&gt;parse() ) {
</span><span class="cx">                         // XML error
</span><span class="cx">                         $this-&gt;error = new IXR_Error(-32700, 'parse error. not well formed');
</span><span class="lines">@@ -90,4 +90,4 @@
</span><span class="cx">                 return true;
</span><span class="cx">         }
</span><span class="cx"> }
</span><del>-?&gt;
</del><span class="cx">\ No newline at end of file
</span><ins>+?&gt;
</ins></span></pre></div>
<a id="trunkwpincludescommentphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/comment.php (17927 => 17928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/comment.php        2011-05-14 19:41:42 UTC (rev 17927)
+++ trunk/wp-includes/comment.php        2011-05-14 19:45:07 UTC (rev 17928)
</span><span class="lines">@@ -1619,11 +1619,11 @@
</span><span class="cx">         if ( is_wp_error( $response ) )
</span><span class="cx">                 return false;
</span><span class="cx"> 
</span><del>-        if ( isset( $response['headers']['x-pingback'] ) )
-                return $response['headers']['x-pingback'];
</del><ins>+        if ( wp_remote_retrieve_header( $response, 'x-pingback' ) )
+                return wp_remote_retrieve_header( $response, 'x-pingback' );
</ins><span class="cx"> 
</span><span class="cx">         // Not an (x)html, sgml, or xml page, no use going further.
</span><del>-        if ( isset( $response['headers']['content-type'] ) &amp;&amp; preg_match('#(image|audio|video|model)/#is', $response['headers']['content-type']) )
</del><ins>+        if ( preg_match('#(image|audio|video|model)/#is', wp_remote_retrieve_header( $response, 'content-type' )) )
</ins><span class="cx">                 return false;
</span><span class="cx"> 
</span><span class="cx">         // Now do a GET since we're going to look in the html headers (and we're sure its not a binary file)
</span><span class="lines">@@ -1632,7 +1632,7 @@
</span><span class="cx">         if ( is_wp_error( $response ) )
</span><span class="cx">                 return false;
</span><span class="cx"> 
</span><del>-        $contents = $response['body'];
</del><ins>+        $contents = wp_remote_retrieve_body( $response );
</ins><span class="cx"> 
</span><span class="cx">         $pingback_link_offset_dquote = strpos($contents, $pingback_str_dquote);
</span><span class="cx">         $pingback_link_offset_squote = strpos($contents, $pingback_str_squote);
</span></span></pre></div>
<a id="trunkwpincludesfunctionsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/functions.php (17927 => 17928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/functions.php        2011-05-14 19:41:42 UTC (rev 17927)
+++ trunk/wp-includes/functions.php        2011-05-14 19:45:07 UTC (rev 17928)
</span><span class="lines">@@ -600,7 +600,7 @@
</span><span class="cx"> 
</span><span class="cx">         wp_protect_special_option( $option );
</span><span class="cx"> 
</span><del>-        /* 
</del><ins>+        /*
</ins><span class="cx">          * FIXME the next two lines of code are not necessary and should be removed.
</span><span class="cx">          * @see http://core.trac.wordpress.org/ticket/13480
</span><span class="cx">          */
</span><span class="lines">@@ -1305,7 +1305,7 @@
</span><span class="cx">                 return false;
</span><span class="cx"> 
</span><span class="cx">         $headers = wp_remote_retrieve_headers( $response );
</span><del>-        $headers['response'] = $response['response']['code'];
</del><ins>+        $headers['response'] = wp_remote_retrieve_response_code( $response );
</ins><span class="cx"> 
</span><span class="cx">         // WP_HTTP no longer follows redirects for HEAD requests.
</span><span class="cx">         if ( 'HEAD' == $options['method'] &amp;&amp; in_array($headers['response'], array(301, 302)) &amp;&amp; isset( $headers['location'] ) ) {
</span><span class="lines">@@ -1320,7 +1320,7 @@
</span><span class="cx">         if ( !$out_fp )
</span><span class="cx">                 return $headers;
</span><span class="cx"> 
</span><del>-        fwrite( $out_fp,  $response['body']);
</del><ins>+        fwrite( $out_fp,  wp_remote_retrieve_body( $response ) );
</ins><span class="cx">         fclose($out_fp);
</span><span class="cx">         clearstatcache();
</span><span class="cx"> 
</span><span class="lines">@@ -1556,7 +1556,7 @@
</span><span class="cx">         if ( is_wp_error( $response ) )
</span><span class="cx">                 return false;
</span><span class="cx"> 
</span><del>-        return $response['body'];
</del><ins>+        return wp_remote_retrieve_body( $response );
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><span class="lines">@@ -2876,26 +2876,26 @@
</span><span class="cx">  * @param string $title Error title.
</span><span class="cx">  * @param string|array $args Optional arguements to control behaviour.
</span><span class="cx">  */
</span><del>-function _xmlrpc_wp_die_handler( $message, $title = '', $args = array() ) { 
</del><ins>+function _xmlrpc_wp_die_handler( $message, $title = '', $args = array() ) {
</ins><span class="cx">         global $wp_xmlrpc_server;
</span><span class="cx">         $defaults = array( 'response' =&gt; 500 );
</span><span class="cx"> 
</span><span class="cx">         $r = wp_parse_args($args, $defaults);
</span><span class="cx"> 
</span><del>-        if ( $wp_xmlrpc_server ) { 
-                $error = new IXR_Error( $r['response'] , $message); 
-                $wp_xmlrpc_server-&gt;output( $error-&gt;getXml() ); 
</del><ins>+        if ( $wp_xmlrpc_server ) {
+                $error = new IXR_Error( $r['response'] , $message);
+                $wp_xmlrpc_server-&gt;output( $error-&gt;getXml() );
</ins><span class="cx">         }
</span><span class="cx">         die();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><span class="cx">  * Filter to enable special wp_die handler for xmlrpc requests.
</span><del>- * 
</del><ins>+ *
</ins><span class="cx">  * @since 3.2.0
</span><span class="cx">  * @access private
</span><span class="cx">  */
</span><del>-function _xmlrpc_wp_die_filter() { 
</del><ins>+function _xmlrpc_wp_die_filter() {
</ins><span class="cx">         return '_xmlrpc_wp_die_handler';
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkwpincludesrssphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/rss.php (17927 => 17928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/rss.php        2011-05-14 19:41:42 UTC (rev 17927)
+++ trunk/wp-includes/rss.php        2011-05-14 19:45:07 UTC (rev 17928)
</span><span class="lines">@@ -555,7 +555,7 @@
</span><span class="cx">         // Snoopy returns headers unprocessed.
</span><span class="cx">         // Also note, WP_HTTP lowercases all keys, Snoopy did not.
</span><span class="cx">         $return_headers = array();
</span><del>-        foreach ( $resp['headers'] as $key =&gt; $value ) {
</del><ins>+        foreach ( wp_remote_retrieve_headers( $resp ) as $key =&gt; $value ) {
</ins><span class="cx">                 if ( !is_array($value) ) {
</span><span class="cx">                         $return_headers[] = &quot;$key: $value&quot;;
</span><span class="cx">                 } else {
</span><span class="lines">@@ -565,10 +565,10 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         $response = new stdClass;
</span><del>-        $response-&gt;status = $resp['response']['code'];
-        $response-&gt;response_code = $resp['response']['code'];
</del><ins>+        $response-&gt;status = wp_remote_retrieve_response_code( $resp );
+        $response-&gt;response_code = wp_remote_retrieve_response_code( $resp );
</ins><span class="cx">         $response-&gt;headers = $return_headers;
</span><del>-        $response-&gt;results = $resp['body'];
</del><ins>+        $response-&gt;results = wp_remote_retrieve_body( $resp );
</ins><span class="cx"> 
</span><span class="cx">         return $response;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkwpincludesupdatephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/update.php (17927 => 17928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/update.php        2011-05-14 19:41:42 UTC (rev 17927)
+++ trunk/wp-includes/update.php        2011-05-14 19:45:07 UTC (rev 17928)
</span><span class="lines">@@ -71,13 +71,10 @@
</span><span class="cx"> 
</span><span class="cx">         $response = wp_remote_get($url, $options);
</span><span class="cx"> 
</span><del>-        if ( is_wp_error( $response ) )
</del><ins>+        if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) )
</ins><span class="cx">                 return false;
</span><span class="cx"> 
</span><del>-        if ( 200 != $response['response']['code'] )
-                return false;
-
-        $body = trim( $response['body'] );
</del><ins>+        $body = trim( wp_remote_retrieve_body( $response ) );
</ins><span class="cx">         $body = str_replace(array(&quot;\r\n&quot;, &quot;\r&quot;), &quot;\n&quot;, $body);
</span><span class="cx">         $new_options = array();
</span><span class="cx">         foreach ( explode( &quot;\n\n&quot;, $body ) as $entry ) {
</span><span class="lines">@@ -175,14 +172,11 @@
</span><span class="cx"> 
</span><span class="cx">         $raw_response = wp_remote_post('http://api.wordpress.org/plugins/update-check/1.0/', $options);
</span><span class="cx"> 
</span><del>-        if ( is_wp_error( $raw_response ) )
</del><ins>+        if ( is_wp_error( $raw_response ) || 200 != wp_remote_retrieve_response_code( $raw_response ) )
</ins><span class="cx">                 return false;
</span><span class="cx"> 
</span><del>-        if ( 200 != $raw_response['response']['code'] )
-                return false;
</del><ins>+        $response = unserialize( wp_remote_retrieve_body( $raw_response ) );
</ins><span class="cx"> 
</span><del>-        $response = unserialize( $raw_response['body'] );
-
</del><span class="cx">         if ( false !== $response )
</span><span class="cx">                 $new_option-&gt;response = $response;
</span><span class="cx">         else
</span><span class="lines">@@ -273,17 +267,14 @@
</span><span class="cx"> 
</span><span class="cx">         $raw_response = wp_remote_post( 'http://api.wordpress.org/themes/update-check/1.0/', $options );
</span><span class="cx"> 
</span><del>-        if ( is_wp_error( $raw_response ) )
</del><ins>+        if ( is_wp_error( $raw_response ) || 200 != wp_remote_retrieve_response_code( $raw_response ) )
</ins><span class="cx">                 return false;
</span><span class="cx"> 
</span><del>-        if ( 200 != $raw_response['response']['code'] )
-                return false;
-
</del><span class="cx">         $new_update = new stdClass;
</span><span class="cx">         $new_update-&gt;last_checked = time( );
</span><span class="cx">         $new_update-&gt;checked = $checked;
</span><span class="cx"> 
</span><del>-        $response = unserialize( $raw_response['body'] );
</del><ins>+        $response = unserialize( wp_remote_retrieve_body( $raw_response ) );
</ins><span class="cx">         if ( false !== $response )
</span><span class="cx">                 $new_update-&gt;response = $response;
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>