<!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>[29229] trunk/src/wp-includes/class-http.php: Fix syntax for single- and multi-line comments in wp-includes/class-http.php.</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 { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { 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://core.trac.wordpress.org/changeset/29229">29229</a></dd>
<dt>Author</dt> <dd>DrewAPicture</dd>
<dt>Date</dt> <dd>2014-07-18 21:46:24 +0000 (Fri, 18 Jul 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Fix syntax for single- and multi-line comments in wp-includes/class-http.php.

See <a href="http://core.trac.wordpress.org/ticket/28943">#28943</a> and <a href="http://core.trac.wordpress.org/ticket/28931">#28931</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludesclasshttpphp">trunk/src/wp-includes/class-http.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludesclasshttpphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/class-http.php (29228 => 29229)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/class-http.php     2014-07-18 21:04:27 UTC (rev 29228)
+++ trunk/src/wp-includes/class-http.php        2014-07-18 21:46:24 UTC (rev 29229)
</span><span class="lines">@@ -177,11 +177,13 @@
</span><span class="cx">          if ( $this->block_request( $url ) )
</span><span class="cx">                  return new WP_Error( 'http_request_failed', __( 'User has blocked requests through HTTP.' ) );
</span><span class="cx"> 
</span><del>-               // Determine if this is a https call and pass that on to the transport functions
-               // so that we can blacklist the transports that do not support ssl verification
</del><ins>+                /*
+                * Determine if this is a https call and pass that on to the transport functions
+                * so that we can blacklist the transports that do not support ssl verification
+                */
</ins><span class="cx">           $r['ssl'] = $arrURL['scheme'] == 'https' || $arrURL['scheme'] == 'ssl';
</span><span class="cx"> 
</span><del>-               // Determine if this request is to OUR install of WordPress
</del><ins>+                // Determine if this request is to OUR install of WordPress.
</ins><span class="cx">           $homeURL = parse_url( get_bloginfo( 'url' ) );
</span><span class="cx">          if ( isset( $homeURL['host'] ) ) {
</span><span class="cx">                  $r['local'] = ( $homeURL['host'] == $arrURL['host'] || 'localhost' == $arrURL['host'] );
</span><span class="lines">@@ -190,12 +192,17 @@
</span><span class="cx">          }
</span><span class="cx">          unset( $homeURL );
</span><span class="cx"> 
</span><del>-               // If we are streaming to a file but no filename was given drop it in the WP temp dir
-               // and pick its name using the basename of the $url
</del><ins>+                /*
+                * If we are streaming to a file but no filename was given drop it in the WP temp dir
+                * and pick its name using the basename of the $url.
+                */
</ins><span class="cx">           if ( $r['stream']  && empty( $r['filename'] ) )
</span><span class="cx">                  $r['filename'] = get_temp_dir() . basename( $url );
</span><span class="cx"> 
</span><del>-               // Force some settings if we are streaming to a file and check for existence and perms of destination directory
</del><ins>+                /*
+                * Force some settings if we are streaming to a file and check for existence and perms
+                * of destination directory.
+                */
</ins><span class="cx">           if ( $r['stream'] ) {
</span><span class="cx">                  $r['blocking'] = true;
</span><span class="cx">                  if ( ! wp_is_writable( dirname( $r['filename'] ) ) )
</span><span class="lines">@@ -224,10 +231,10 @@
</span><span class="cx">                  $r['headers']['connection'] = 'close';
</span><span class="cx">          }
</span><span class="cx"> 
</span><del>-               // Construct Cookie: header if any cookies are set
</del><ins>+                // Construct Cookie: header if any cookies are set.
</ins><span class="cx">           WP_Http::buildCookieHeader( $r );
</span><span class="cx"> 
</span><del>-               // Avoid issues where mbstring.func_overload is enabled
</del><ins>+                // Avoid issues where mbstring.func_overload is enabled.
</ins><span class="cx">           mbstring_binary_safe_encoding();
</span><span class="cx"> 
</span><span class="cx">          if ( ! isset( $r['headers']['Accept-Encoding'] ) ) {
</span><span class="lines">@@ -294,11 +301,11 @@
</span><span class="cx">           */
</span><span class="cx">          $request_order = apply_filters( 'http_api_transports', array( 'curl', 'streams' ), $args, $url );
</span><span class="cx"> 
</span><del>-               // Loop over each transport on each HTTP request looking for one which will serve this request's needs
</del><ins>+                // Loop over each transport on each HTTP request looking for one which will serve this request's needs.
</ins><span class="cx">           foreach ( $request_order as $transport ) {
</span><span class="cx">                  $class = 'WP_HTTP_' . $transport;
</span><span class="cx"> 
</span><del>-                       // Check to see if this transport is a possibility, calls the transport statically
</del><ins>+                        // Check to see if this transport is a possibility, calls the transport statically.
</ins><span class="cx">                   if ( !call_user_func( array( $class, 'test' ), $args, $url ) )
</span><span class="cx">                          continue;
</span><span class="cx"> 
</span><span class="lines">@@ -450,20 +457,25 @@
</span><span class="cx">   *                                      Then a numbered array is returned as the value of that header-key.
</span><span class="cx">   */
</span><span class="cx">  public static function processHeaders( $headers, $url = '' ) {
</span><del>-               // split headers, one per array element
</del><ins>+                // Split headers, one per array element.
</ins><span class="cx">           if ( is_string($headers) ) {
</span><del>-                       // tolerate line terminator: CRLF = LF (RFC 2616 19.3)
</del><ins>+                        // Tolerate line terminator: CRLF = LF (RFC 2616 19.3).
</ins><span class="cx">                   $headers = str_replace("\r\n", "\n", $headers);
</span><del>-                       // unfold folded header fields. LWS = [CRLF] 1*( SP | HT ) <US-ASCII SP, space (32)>, <US-ASCII HT, horizontal-tab (9)> (RFC 2616 2.2)
</del><ins>+                        /*
+                        * Unfold folded header fields. LWS = [CRLF] 1*( SP | HT ) <US-ASCII SP, space (32)>,
+                        * <US-ASCII HT, horizontal-tab (9)> (RFC 2616 2.2).
+                        */
</ins><span class="cx">                   $headers = preg_replace('/\n[ \t]/', ' ', $headers);
</span><del>-                       // create the headers array
</del><ins>+                        // Create the headers array.
</ins><span class="cx">                   $headers = explode("\n", $headers);
</span><span class="cx">          }
</span><span class="cx"> 
</span><span class="cx">          $response = array('code' => 0, 'message' => '');
</span><span class="cx"> 
</span><del>-               // If a redirection has taken place, The headers for each page request may have been passed.
-               // In this case, determine the final HTTP header and parse from there.
</del><ins>+                /*
+                * If a redirection has taken place, The headers for each page request may have been passed.
+                * In this case, determine the final HTTP header and parse from there.
+                */
</ins><span class="cx">           for ( $i = count($headers)-1; $i >= 0; $i-- ) {
</span><span class="cx">                  if ( !empty($headers[$i]) && false === strpos($headers[$i], ':') ) {
</span><span class="cx">                          $headers = array_splice($headers, $i);
</span><span class="lines">@@ -518,7 +530,7 @@
</span><span class="cx">   */
</span><span class="cx">  public static function buildCookieHeader( &$r ) {
</span><span class="cx">          if ( ! empty($r['cookies']) ) {
</span><del>-                       // Upgrade any name => value cookie pairs to WP_HTTP_Cookie instances
</del><ins>+                        // Upgrade any name => value cookie pairs to WP_HTTP_Cookie instances.
</ins><span class="cx">                   foreach ( $r['cookies'] as $name => $value ) {
</span><span class="cx">                          if ( ! is_object( $value ) )
</span><span class="cx">                                  $r['cookies'][ $name ] = new WP_HTTP_Cookie( array( 'name' => $name, 'value' => $value ) );
</span><span class="lines">@@ -554,8 +566,10 @@
</span><span class="cx">                  return $body;
</span><span class="cx"> 
</span><span class="cx">          $parsed_body = '';
</span><del>-               $body_original = $body; // We'll be altering $body, so need a backup in case of error
</del><span class="cx"> 
</span><ins>+               // We'll be altering $body, so need a backup in case of error.
+               $body_original = $body;
+
</ins><span class="cx">           while ( true ) {
</span><span class="cx">                  $has_chunk = (bool) preg_match( '/^([0-9a-f]+)[^\r\n]*\r\n/i', $body, $match );
</span><span class="cx">                  if ( ! $has_chunk || empty( $match[1] ) )
</span><span class="lines">@@ -564,13 +578,13 @@
</span><span class="cx">                  $length = hexdec( $match[1] );
</span><span class="cx">                  $chunk_length = strlen( $match[0] );
</span><span class="cx"> 
</span><del>-                       // Parse out the chunk of data
</del><ins>+                        // Parse out the chunk of data.
</ins><span class="cx">                   $parsed_body .= substr( $body, $chunk_length, $length );
</span><span class="cx"> 
</span><del>-                       // Remove the chunk from the raw data
</del><ins>+                        // Remove the chunk from the raw data.
</ins><span class="cx">                   $body = substr( $body, $length + $chunk_length );
</span><span class="cx"> 
</span><del>-                       // End of document
</del><ins>+                        // End of the document.
</ins><span class="cx">                   if ( '0' === trim( $body ) )
</span><span class="cx">                          return $parsed_body;
</span><span class="cx">          }
</span><span class="lines">@@ -606,7 +620,7 @@
</span><span class="cx"> 
</span><span class="cx">          $home = parse_url( get_option('siteurl') );
</span><span class="cx"> 
</span><del>-               // Don't block requests back to ourselves by default
</del><ins>+                // Don't block requests back to ourselves by default.
</ins><span class="cx">           if ( $check['host'] == 'localhost' || $check['host'] == $home['host'] ) {
</span><span class="cx">                  /**
</span><span class="cx">                   * Filter whether to block local requests through the proxy.
</span><span class="lines">@@ -646,7 +660,7 @@
</span><span class="cx">          if ( empty( $url ) )
</span><span class="cx">                  return $maybe_relative_path;
</span><span class="cx"> 
</span><del>-               // Check for a scheme
</del><ins>+                // Check for a scheme.
</ins><span class="cx">           if ( false !== strpos( $maybe_relative_path, '://' ) )
</span><span class="cx">                  return $maybe_relative_path;
</span><span class="cx"> 
</span><span class="lines">@@ -660,31 +674,31 @@
</span><span class="cx">          if ( isset( $url_parts['port'] ) )
</span><span class="cx">                  $absolute_path .= ':' . $url_parts['port'];
</span><span class="cx"> 
</span><del>-               // Start off with the Absolute URL path
</del><ins>+                // Start off with the Absolute URL path.
</ins><span class="cx">           $path = ! empty( $url_parts['path'] ) ? $url_parts['path'] : '/';
</span><span class="cx"> 
</span><del>-               // If it's a root-relative path, then great
</del><ins>+                // If it's a root-relative path, then great.
</ins><span class="cx">           if ( ! empty( $relative_url_parts['path'] ) && '/' == $relative_url_parts['path'][0] ) {
</span><span class="cx">                  $path = $relative_url_parts['path'];
</span><span class="cx"> 
</span><del>-               // Else it's a relative path
</del><ins>+                // Else it's a relative path.
</ins><span class="cx">           } elseif ( ! empty( $relative_url_parts['path'] ) ) {
</span><del>-                       // Strip off any file components from the absolute path
</del><ins>+                        // Strip off any file components from the absolute path.
</ins><span class="cx">                   $path = substr( $path, 0, strrpos( $path, '/' ) + 1 );
</span><span class="cx"> 
</span><del>-                       // Build the new path
</del><ins>+                        // Build the new path.
</ins><span class="cx">                   $path .= $relative_url_parts['path'];
</span><span class="cx"> 
</span><del>-                       // Strip all /path/../ out of the path
</del><ins>+                        // Strip all /path/../ out of the path.
</ins><span class="cx">                   while ( strpos( $path, '../' ) > 1 ) {
</span><span class="cx">                          $path = preg_replace( '![^/]+/\.\./!', '', $path );
</span><span class="cx">                  }
</span><span class="cx"> 
</span><del>-                       // Strip any final leading ../ from the path
</del><ins>+                        // Strip any final leading ../ from the path.
</ins><span class="cx">                   $path = preg_replace( '!^/(\.\./)+!', '', $path );
</span><span class="cx">          }
</span><span class="cx"> 
</span><del>-               // Add the Query string
</del><ins>+                // Add the Query string.
</ins><span class="cx">           if ( ! empty( $relative_url_parts['query'] ) )
</span><span class="cx">                  $path .= '?' . $relative_url_parts['query'];
</span><span class="cx"> 
</span><span class="lines">@@ -706,29 +720,29 @@
</span><span class="cx">          if ( ! isset( $response['headers']['location'] ) || 0 === $args['_redirection'] )
</span><span class="cx">                  return false;
</span><span class="cx"> 
</span><del>-               // Only perform redirections on redirection http codes
</del><ins>+                // Only perform redirections on redirection http codes.
</ins><span class="cx">           if ( $response['response']['code'] > 399 || $response['response']['code'] < 300 )
</span><span class="cx">                  return false;
</span><span class="cx"> 
</span><del>-               // Don't redirect if we've run out of redirects
</del><ins>+                // Don't redirect if we've run out of redirects.
</ins><span class="cx">           if ( $args['redirection']-- <= 0 )
</span><span class="cx">                  return new WP_Error( 'http_request_failed', __('Too many redirects.') );
</span><span class="cx"> 
</span><span class="cx">          $redirect_location = $response['headers']['location'];
</span><span class="cx"> 
</span><del>-               // If there were multiple Location headers, use the last header specified
</del><ins>+                // If there were multiple Location headers, use the last header specified.
</ins><span class="cx">           if ( is_array( $redirect_location ) )
</span><span class="cx">                  $redirect_location = array_pop( $redirect_location );
</span><span class="cx"> 
</span><span class="cx">          $redirect_location = WP_HTTP::make_absolute_url( $redirect_location, $url );
</span><span class="cx"> 
</span><del>-               // POST requests should not POST to a redirected location
</del><ins>+                // POST requests should not POST to a redirected location.
</ins><span class="cx">           if ( 'POST' == $args['method'] ) {
</span><span class="cx">                  if ( in_array( $response['response']['code'], array( 302, 303 ) ) )
</span><span class="cx">                          $args['method'] = 'GET';
</span><span class="cx">          }
</span><span class="cx"> 
</span><del>-               // Include valid cookies in the redirect process
</del><ins>+                // Include valid cookies in the redirect process.
</ins><span class="cx">           if ( ! empty( $response['cookies'] ) ) {
</span><span class="cx">                  foreach ( $response['cookies'] as $cookie ) {
</span><span class="cx">                          if ( $cookie->test( $redirect_location ) )
</span><span class="lines">@@ -805,7 +819,7 @@
</span><span class="cx">                  unset($r['headers']['user-agent']);
</span><span class="cx">          }
</span><span class="cx"> 
</span><del>-               // Construct Cookie: header if any cookies are set
</del><ins>+                // Construct Cookie: header if any cookies are set.
</ins><span class="cx">           WP_Http::buildCookieHeader( $r );
</span><span class="cx"> 
</span><span class="cx">          $arrURL = parse_url($url);
</span><span class="lines">@@ -830,8 +844,11 @@
</span><span class="cx">                  unset( $r['headers']['Host'], $r['headers']['host'] );
</span><span class="cx">          }
</span><span class="cx"> 
</span><del>-               // Certain versions of PHP have issues with 'localhost' and IPv6, It attempts to connect to ::1,
-               // which fails when the server is not set up for it. For compatibility, always connect to the IPv4 address.
</del><ins>+                /*
+                * Certain versions of PHP have issues with 'localhost' and IPv6, It attempts to connect
+                * to ::1, which fails when the server is not set up for it. For compatibility, always
+                * connect to the IPv4 address.
+                */
</ins><span class="cx">           if ( 'localhost' == strtolower( $connect_host ) )
</span><span class="cx">                  $connect_host = '127.0.0.1';
</span><span class="cx"> 
</span><span class="lines">@@ -876,11 +893,14 @@
</span><span class="cx">          $utimeout = $timeout == $r['timeout'] ? 0 : 1000000 * $r['timeout'] % 1000000;
</span><span class="cx">          $connect_timeout = max( $timeout, 1 );
</span><span class="cx"> 
</span><del>-               $connection_error = null; // Store error number
-               $connection_error_str = null; // Store error string
</del><ins>+                // Store error number.
+               $connection_error = null;
</ins><span class="cx"> 
</span><ins>+               // Store error string.
+               $connection_error_str = null;
+
</ins><span class="cx">           if ( !WP_DEBUG ) {
</span><del>-                       // In the event that the SSL connection fails, silence the many PHP Warnings
</del><ins>+                        // In the event that the SSL connection fails, silence the many PHP Warnings.
</ins><span class="cx">                   if ( $secure_transport )
</span><span class="cx">                          $error_reporting = error_reporting(0);
</span><span class="cx"> 
</span><span class="lines">@@ -900,14 +920,14 @@
</span><span class="cx">          }
</span><span class="cx"> 
</span><span class="cx">          if ( false === $handle ) {
</span><del>-                       // SSL connection failed due to expired/invalid cert, or, OpenSSL configuration is broken
</del><ins>+                        // SSL connection failed due to expired/invalid cert, or, OpenSSL configuration is broken.
</ins><span class="cx">                   if ( $secure_transport && 0 === $connection_error && '' === $connection_error_str )
</span><span class="cx">                          return new WP_Error( 'http_request_failed', __( 'The SSL certificate for the host could not be verified.' ) );
</span><span class="cx"> 
</span><span class="cx">                  return new WP_Error('http_request_failed', $connection_error . ': ' . $connection_error_str );
</span><span class="cx">          }
</span><span class="cx"> 
</span><del>-               // Verify that the SSL certificate is valid for this request
</del><ins>+                // Verify that the SSL certificate is valid for this request.
</ins><span class="cx">           if ( $secure_transport && $ssl_verify && ! $proxy->is_enabled() ) {
</span><span class="cx">                  if ( ! self::verify_ssl_certificate( $handle, $arrURL['host'] ) )
</span><span class="cx">                          return new WP_Error( 'http_request_failed', __( 'The SSL certificate for the host could not be verified.' ) );
</span><span class="lines">@@ -963,7 +983,7 @@
</span><span class="cx">          if ( isset( $r['limit_response_size'] ) )
</span><span class="cx">                  $block_size = min( $block_size, $r['limit_response_size'] );
</span><span class="cx"> 
</span><del>-               // If streaming to a file setup the file handle
</del><ins>+                // If streaming to a file setup the file handle.
</ins><span class="cx">           if ( $r['stream'] ) {
</span><span class="cx">                  if ( ! WP_DEBUG )
</span><span class="cx">                          $stream_handle = @fopen( $r['filename'], 'w+' );
</span><span class="lines">@@ -1029,13 +1049,14 @@
</span><span class="cx"> 
</span><span class="cx">          $response = array(
</span><span class="cx">                  'headers' => $arrHeaders['headers'],
</span><del>-                       'body' => null, // Not yet processed
</del><ins>+                        // Not yet processed.
+                       'body' => null,
</ins><span class="cx">                   'response' => $arrHeaders['response'],
</span><span class="cx">                  'cookies' => $arrHeaders['cookies'],
</span><span class="cx">                  'filename' => $r['filename']
</span><span class="cx">          );
</span><span class="cx"> 
</span><del>-               // Handle redirects
</del><ins>+                // Handle redirects.
</ins><span class="cx">           if ( false !== ( $redirect_response = WP_HTTP::handle_redirects( $url, $r, $response ) ) )
</span><span class="cx">                  return $redirect_response;
</span><span class="cx"> 
</span><span class="lines">@@ -1081,7 +1102,10 @@
</span><span class="cx">          if ( ! $cert )
</span><span class="cx">                  return false;
</span><span class="cx"> 
</span><del>-               // If the request is being made to an IP address, we'll validate against IP fields in the cert (if they exist)
</del><ins>+                /*
+                * If the request is being made to an IP address, we'll validate against IP fields
+                * in the cert (if they exist)
+                */
</ins><span class="cx">           $host_type = ( WP_HTTP::is_ip_address( $host ) ? 'ip' : 'dns' );
</span><span class="cx"> 
</span><span class="cx">          $certificate_hostnames = array();
</span><span class="lines">@@ -1093,23 +1117,23 @@
</span><span class="cx">                                  $certificate_hostnames[] = strtolower( trim( $match_host ) );
</span><span class="cx">                  }
</span><span class="cx">          } elseif ( !empty( $cert['subject']['CN'] ) ) {
</span><del>-                       // Only use the CN when the certificate includes no subjectAltName extension
</del><ins>+                        // Only use the CN when the certificate includes no subjectAltName extension.
</ins><span class="cx">                   $certificate_hostnames[] = strtolower( $cert['subject']['CN'] );
</span><span class="cx">          }
</span><span class="cx"> 
</span><del>-               // Exact hostname/IP matches
</del><ins>+                // Exact hostname/IP matches.
</ins><span class="cx">           if ( in_array( strtolower( $host ), $certificate_hostnames ) )
</span><span class="cx">                  return true;
</span><span class="cx"> 
</span><del>-               // IP's can't be wildcards, Stop processing
</del><ins>+                // IP's can't be wildcards, Stop processing.
</ins><span class="cx">           if ( 'ip' == $host_type )
</span><span class="cx">                  return false;
</span><span class="cx"> 
</span><del>-               // Test to see if the domain is at least 2 deep for wildcard support
</del><ins>+                // Test to see if the domain is at least 2 deep for wildcard support.
</ins><span class="cx">           if ( substr_count( $host, '.' ) < 2 )
</span><span class="cx">                  return false;
</span><span class="cx"> 
</span><del>-               // Wildcard subdomains certs (*.example.com) are valid for a.example.com but not a.b.example.com
</del><ins>+                // Wildcard subdomains certs (*.example.com) are valid for a.example.com but not a.b.example.com.
</ins><span class="cx">           $wildcard_host = preg_replace( '/^[^.]+\./', '*.', $host );
</span><span class="cx"> 
</span><span class="cx">          return in_array( strtolower( $wildcard_host ), $certificate_hostnames );
</span><span class="lines">@@ -1162,7 +1186,7 @@
</span><span class="cx">  * @deprecated 3.7.0 Please use WP_HTTP::request() directly
</span><span class="cx">  */
</span><span class="cx"> class WP_HTTP_Fsockopen extends WP_HTTP_Streams {
</span><del>-       // For backwards compatibility for users who are using the class directly
</del><ins>+        // For backwards compatibility for users who are using the class directly.
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><span class="lines">@@ -1270,8 +1294,10 @@
</span><span class="cx">                  $ssl_verify = apply_filters( 'https_ssl_verify', $ssl_verify );
</span><span class="cx">          }
</span><span class="cx"> 
</span><del>-               // CURLOPT_TIMEOUT and CURLOPT_CONNECTTIMEOUT expect integers. Have to use ceil since
-               // a value of 0 will allow an unlimited timeout.
</del><ins>+                /*
+                * CURLOPT_TIMEOUT and CURLOPT_CONNECTTIMEOUT expect integers. Have to use ceil since.
+                * a value of 0 will allow an unlimited timeout.
+                */
</ins><span class="cx">           $timeout = (int) ceil( $r['timeout'] );
</span><span class="cx">          curl_setopt( $handle, CURLOPT_CONNECTTIMEOUT, $timeout );
</span><span class="cx">          curl_setopt( $handle, CURLOPT_TIMEOUT, $timeout );
</span><span class="lines">@@ -1282,8 +1308,11 @@
</span><span class="cx">          curl_setopt( $handle, CURLOPT_SSL_VERIFYPEER, $ssl_verify );
</span><span class="cx">          curl_setopt( $handle, CURLOPT_CAINFO, $r['sslcertificates'] );
</span><span class="cx">          curl_setopt( $handle, CURLOPT_USERAGENT, $r['user-agent'] );
</span><del>-               // The option doesn't work with safe mode or when open_basedir is set, and there's a
-               // bug #17490 with redirected POST requests, so handle redirections outside Curl.
</del><ins>+
+               /*
+                * The option doesn't work with safe mode or when open_basedir is set, and there's
+                * a bug #17490 with redirected POST requests, so handle redirections outside Curl.
+                */
</ins><span class="cx">           curl_setopt( $handle, CURLOPT_FOLLOWLOCATION, false );
</span><span class="cx">          if ( defined( 'CURLOPT_PROTOCOLS' ) ) // PHP 5.2.10 / cURL 7.19.4
</span><span class="cx">                  curl_setopt( $handle, CURLOPT_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS );
</span><span class="lines">@@ -1319,7 +1348,7 @@
</span><span class="cx">          else
</span><span class="cx">                  $this->max_body_length = false;
</span><span class="cx"> 
</span><del>-               // If streaming to a file open a file handle, and setup our curl streaming handler
</del><ins>+                // If streaming to a file open a file handle, and setup our curl streaming handler.
</ins><span class="cx">           if ( $r['stream'] ) {
</span><span class="cx">                  if ( ! WP_DEBUG )
</span><span class="cx">                          $this->stream_handle = @fopen( $r['filename'], 'w+' );
</span><span class="lines">@@ -1332,7 +1361,7 @@
</span><span class="cx">          }
</span><span class="cx"> 
</span><span class="cx">          if ( !empty( $r['headers'] ) ) {
</span><del>-                       // cURL expects full header strings in each element
</del><ins>+                        // cURL expects full header strings in each element.
</ins><span class="cx">                   $headers = array();
</span><span class="cx">                  foreach ( $r['headers'] as $name => $value ) {
</span><span class="cx">                          $headers[] = "{$name}: $value";
</span><span class="lines">@@ -1385,7 +1414,7 @@
</span><span class="cx"> 
</span><span class="cx">          $curl_error = curl_errno( $handle );
</span><span class="cx"> 
</span><del>-               // If an error occured, or, no response
</del><ins>+                // If an error occured, or, no response.
</ins><span class="cx">           if ( $curl_error || ( 0 == strlen( $theBody ) && empty( $theHeaders['headers'] ) ) ) {
</span><span class="cx">                  if ( CURLE_WRITE_ERROR /* 23 */ == $curl_error &&  $r['stream'] ) {
</span><span class="cx">                          fclose( $this->stream_handle );
</span><span class="lines">@@ -1418,7 +1447,7 @@
</span><span class="cx">                  'filename' => $r['filename']
</span><span class="cx">          );
</span><span class="cx"> 
</span><del>-               // Handle redirects
</del><ins>+                // Handle redirects.
</ins><span class="cx">           if ( false !== ( $redirect_response = WP_HTTP::handle_redirects( $url, $r, $response ) ) )
</span><span class="cx">                  return $redirect_response;
</span><span class="cx"> 
</span><span class="lines">@@ -1467,7 +1496,7 @@
</span><span class="cx">                  $bytes_written = $data_length;
</span><span class="cx">          }
</span><span class="cx"> 
</span><del>-               // Upon event of this function returning less than strlen( $data ) curl will error with CURLE_WRITE_ERROR
</del><ins>+                // Upon event of this function returning less than strlen( $data ) curl will error with CURLE_WRITE_ERROR.
</ins><span class="cx">           return $bytes_written;
</span><span class="cx">  }
</span><span class="cx"> 
</span><span class="lines">@@ -1487,7 +1516,8 @@
</span><span class="cx"> 
</span><span class="cx">          if ( $is_ssl ) {
</span><span class="cx">                  $curl_version = curl_version();
</span><del>-                       if ( ! (CURL_VERSION_SSL & $curl_version['features']) ) // Does this cURL version support SSL requests?
</del><ins>+                        // Check whether this cURL version support SSL requests.
+                       if ( ! (CURL_VERSION_SSL & $curl_version['features']) )
</ins><span class="cx">                           return false;
</span><span class="cx">          }
</span><span class="cx"> 
</span><span class="lines">@@ -1657,8 +1687,10 @@
</span><span class="cx">   * @return bool True, to send through the proxy and false if, the proxy should not be used.
</span><span class="cx">   */
</span><span class="cx">  public function send_through_proxy( $uri ) {
</span><del>-               // parse_url() only handles http, https type URLs, and will emit E_WARNING on failure.
-               // This will be displayed on blogs, which is not reasonable.
</del><ins>+                /*
+                * parse_url() only handles http, https type URLs, and will emit E_WARNING on failure.
+                * This will be displayed on blogs, which is not reasonable.
+                */
</ins><span class="cx">           $check = @parse_url($uri);
</span><span class="cx"> 
</span><span class="cx">          // Malformed URL, can not process, but this could mean ssl, so let through anyway.
</span><span class="lines">@@ -1796,20 +1828,24 @@
</span><span class="cx">                  $this->path = dirname( $this->path ) . '/';
</span><span class="cx"> 
</span><span class="cx">          if ( is_string( $data ) ) {
</span><del>-                       // Assume it's a header string direct from a previous request
</del><ins>+                        // Assume it's a header string direct from a previous request.
</ins><span class="cx">                   $pairs = explode( ';', $data );
</span><span class="cx"> 
</span><del>-                       // Special handling for first pair; name=value. Also be careful of "=" in value
</del><ins>+                        // Special handling for first pair; name=value. Also be careful of "=" in value.
</ins><span class="cx">                   $name  = trim( substr( $pairs[0], 0, strpos( $pairs[0], '=' ) ) );
</span><span class="cx">                  $value = substr( $pairs[0], strpos( $pairs[0], '=' ) + 1 );
</span><span class="cx">                  $this->name  = $name;
</span><span class="cx">                  $this->value = urldecode( $value );
</span><del>-                       array_shift( $pairs ); //Removes name=value from items.
</del><span class="cx"> 
</span><del>-                       // Set everything else as a property
</del><ins>+                        // Removes name=value from items.
+                       array_shift( $pairs );
+
+                       // Set everything else as a property.
</ins><span class="cx">                   foreach ( $pairs as $pair ) {
</span><span class="cx">                          $pair = rtrim($pair);
</span><del>-                               if ( empty($pair) ) //Handles the cookie ending in ; which results in a empty final pair
</del><ins>+
+                               // Handle the cookie ending in ; which results in a empty final pair.
+                               if ( empty($pair) )
</ins><span class="cx">                                   continue;
</span><span class="cx"> 
</span><span class="cx">                          list( $key, $val ) = strpos( $pair, '=' ) ? explode( '=', $pair ) : array( $pair, '' );
</span><span class="lines">@@ -1822,7 +1858,7 @@
</span><span class="cx">                  if ( !isset( $data['name'] ) )
</span><span class="cx">                          return false;
</span><span class="cx"> 
</span><del>-                       // Set properties based directly on parameters
</del><ins>+                        // Set properties based directly on parameters.
</ins><span class="cx">                   foreach ( array( 'name', 'value', 'path', 'domain', 'port' ) as $field ) {
</span><span class="cx">                          if ( isset( $data[ $field ] ) )
</span><span class="cx">                                  $this->$field = $data[ $field ];
</span><span class="lines">@@ -1850,32 +1886,32 @@
</span><span class="cx">          if ( is_null( $this->name ) )
</span><span class="cx">                  return false;
</span><span class="cx"> 
</span><del>-               // Expires - if expired then nothing else matters
</del><ins>+                // Expires - if expired then nothing else matters.
</ins><span class="cx">           if ( isset( $this->expires ) && time() > $this->expires )
</span><span class="cx">                  return false;
</span><span class="cx"> 
</span><del>-               // Get details on the URL we're thinking about sending to
</del><ins>+                // Get details on the URL we're thinking about sending to.
</ins><span class="cx">           $url = parse_url( $url );
</span><span class="cx">          $url['port'] = isset( $url['port'] ) ? $url['port'] : ( 'https' == $url['scheme'] ? 443 : 80 );
</span><span class="cx">          $url['path'] = isset( $url['path'] ) ? $url['path'] : '/';
</span><span class="cx"> 
</span><del>-               // Values to use for comparison against the URL
</del><ins>+                // Values to use for comparison against the URL.
</ins><span class="cx">           $path   = isset( $this->path )   ? $this->path   : '/';
</span><span class="cx">          $port   = isset( $this->port )   ? $this->port   : null;
</span><span class="cx">          $domain = isset( $this->domain ) ? strtolower( $this->domain ) : strtolower( $url['host'] );
</span><span class="cx">          if ( false === stripos( $domain, '.' ) )
</span><span class="cx">                  $domain .= '.local';
</span><span class="cx"> 
</span><del>-               // Host - very basic check that the request URL ends with the domain restriction (minus leading dot)
</del><ins>+                // Host - very basic check that the request URL ends with the domain restriction (minus leading dot).
</ins><span class="cx">           $domain = substr( $domain, 0, 1 ) == '.' ? substr( $domain, 1 ) : $domain;
</span><span class="cx">          if ( substr( $url['host'], -strlen( $domain ) ) != $domain )
</span><span class="cx">                  return false;
</span><span class="cx"> 
</span><del>-               // Port - supports "port-lists" in the format: "80,8000,8080"
</del><ins>+                // Port - supports "port-lists" in the format: "80,8000,8080".
</ins><span class="cx">           if ( !empty( $port ) && !in_array( $url['port'], explode( ',', $port) ) )
</span><span class="cx">                  return false;
</span><span class="cx"> 
</span><del>-               // Path - request path must start with path restriction
</del><ins>+                // Path - request path must start with path restriction.
</ins><span class="cx">           if ( substr( $url['path'], 0, strlen( $path ) ) != $path )
</span><span class="cx">                  return false;
</span><span class="cx"> 
</span><span class="lines">@@ -2005,7 +2041,7 @@
</span><span class="cx">   */
</span><span class="cx">  public static function compatible_gzinflate($gzData) {
</span><span class="cx"> 
</span><del>-               // Compressed data might contain a full header, if so strip it for gzinflate()
</del><ins>+                // Compressed data might contain a full header, if so strip it for gzinflate().
</ins><span class="cx">           if ( substr($gzData, 0, 3) == "\x1f\x8b\x08" ) {
</span><span class="cx">                  $i = 10;
</span><span class="cx">                  $flg = ord( substr($gzData, 3, 1) );
</span><span class="lines">@@ -2045,11 +2081,11 @@
</span><span class="cx">          $type = array();
</span><span class="cx">          $compression_enabled = WP_Http_Encoding::is_available();
</span><span class="cx"> 
</span><del>-               if ( ! $args['decompress'] ) // decompression specifically disabled
</del><ins>+                if ( ! $args['decompress'] ) // Decompression specifically disabled.
</ins><span class="cx">                   $compression_enabled = false;
</span><del>-               elseif ( $args['stream'] ) // disable when streaming to file
</del><ins>+                elseif ( $args['stream'] ) // Disable when streaming to file.
</ins><span class="cx">                   $compression_enabled = false;
</span><del>-               elseif ( isset( $args['limit_response_size'] ) ) // If only partial content is being requested, we won't be able to decompress it
</del><ins>+                elseif ( isset( $args['limit_response_size'] ) ) // If only partial content is being requested, we won't be able to decompress it.
</ins><span class="cx">                   $compression_enabled = false;
</span><span class="cx"> 
</span><span class="cx">          if ( $compression_enabled ) {
</span></span></pre>
</div>
</div>

</body>
</html>