X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/449d082fcc4873c1f7d363a0d9f7409be7f6e77d..8d3bb1a5dcfdea9857d3c88c3751f09593e34dc8:/wp-includes/class-snoopy.php diff --git a/wp-includes/class-snoopy.php b/wp-includes/class-snoopy.php index b1b32d2f..f26eb0e2 100644 --- a/wp-includes/class-snoopy.php +++ b/wp-includes/class-snoopy.php @@ -1,5 +1,11 @@ ]*?content[\s]*=[\s]*[\"\']?\d+;[\s]*URL[\s]*=[\s]*([^\"\']*?)[\"\']?>'i",$results,$match)) @@ -993,20 +999,23 @@ class Snoopy 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($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) { @@ -1051,7 +1060,7 @@ class Snoopy $this->headers[] = $result_headers[$currentHeader]; } - // check if there is a a redirect meta tag + // check if there is a redirect meta tag if(preg_match("']*?content[\s]*=[\s]*[\"\']?\d+;[\s]*URL[\s]*=[\s]*([^\"\']*?)[\"\']?>'i",$results,$match)) {