wp/wp-includes/class-snoopy.php
changeset 7 cf61fcea0001
parent 0 d970ebf37754
child 16 a86126ab1dd4
--- a/wp/wp-includes/class-snoopy.php	Tue Jun 09 11:14:17 2015 +0000
+++ b/wp/wp-includes/class-snoopy.php	Mon Oct 14 17:39:30 2019 +0200
@@ -1,11 +1,11 @@
 <?php
 
 /**
- * Deprecated. Use WP_HTTP (http.php, class-http.php) instead.
+ * Deprecated. Use WP_HTTP (http.php) instead.
  */
-_deprecated_file( basename( __FILE__ ), '3.0', WPINC . '/http.php' );
+_deprecated_file( basename( __FILE__ ), '3.0.0', WPINC . '/http.php' );
 
-if ( !class_exists( 'Snoopy' ) ) :
+if ( ! class_exists( 'Snoopy', false ) ) :
 /*************************************************
 
 Snoopy - the PHP net client
@@ -999,20 +999,23 @@
 		if(!empty($this->user) || !empty($this->pass))
 			$headers[] = "Authorization: BASIC ".base64_encode($this->user.":".$this->pass);
 
-		for($curr_header = 0; $curr_header < count($headers); $curr_header++) {
-			$safer_header = strtr( $headers[$curr_header], "\"", " " );
-			$cmdline_params .= " -H \"".$safer_header."\"";
+		$headerfile = tempnam( $this->temp_dir, "sno" );
+		$cmdline_params = '-k -D ' . escapeshellarg( $headerfile );
+
+		foreach ( $headers as $header ) {
+			$cmdline_params .= ' -H ' . escapeshellarg( $header );
 		}
 
-		if(!empty($body))
-			$cmdline_params .= " -d \"$body\"";
+		if ( ! empty( $body ) ) {
+			$cmdline_params .= ' -d ' . escapeshellarg( $body );
+		}
 
-		if($this->read_timeout > 0)
-			$cmdline_params .= " -m ".$this->read_timeout;
+		if ( $this->read_timeout > 0 ) {
+			$cmdline_params .= ' -m ' . escapeshellarg( $this->read_timeout );
+		}
 
-		$headerfile = tempnam($this->temp_dir, "sno");
 
-		exec($this->curl_path." -k -D \"$headerfile\"".$cmdline_params." \"".escapeshellcmd($URI)."\"",$results,$return);
+		exec( $this->curl_path . ' ' . $cmdline_params . ' ' . escapeshellarg( $URI ), $results, $return );
 
 		if($return)
 		{