wp/wp-includes/class-snoopy.php
changeset 21 48c4eec2b7e6
parent 16 a86126ab1dd4
equal deleted inserted replaced
20:7b1b88e27a20 21:48c4eec2b7e6
    51 	var $agent			=	"Snoopy v1.2.4";	// agent we masquerade as
    51 	var $agent			=	"Snoopy v1.2.4";	// agent we masquerade as
    52 	var	$referer		=	"";					// referer info to pass
    52 	var	$referer		=	"";					// referer info to pass
    53 	var $cookies		=	array();			// array of cookies to pass
    53 	var $cookies		=	array();			// array of cookies to pass
    54 												// $cookies["username"]="joe";
    54 												// $cookies["username"]="joe";
    55 	var	$rawheaders		=	array();			// array of raw headers to send
    55 	var	$rawheaders		=	array();			// array of raw headers to send
    56 												// $rawheaders["Content-type"]="text/html";
    56 												// $rawheaders["Content-Type"]="text/html";
    57 
    57 
    58 	var $maxredirs		=	5;					// http redirection depth maximum. 0 = disallow
    58 	var $maxredirs		=	5;					// http redirection depth maximum. 0 = disallow
    59 	var $lastredirectaddr	=	"";				// contains address of last redirected address
    59 	var $lastredirectaddr	=	"";				// contains address of last redirected address
    60 	var	$offsiteok		=	true;				// allows redirection off-site
    60 	var	$offsiteok		=	true;				// allows redirection off-site
    61 	var $maxframes		=	0;					// frame content depth maximum. 0 = disallow
    61 	var $maxframes		=	0;					// frame content depth maximum. 0 = disallow
   823 				$this->rawheaders = (array)$this->rawheaders;
   823 				$this->rawheaders = (array)$this->rawheaders;
   824 			foreach ( $this->rawheaders as $headerKey => $headerVal )
   824 			foreach ( $this->rawheaders as $headerKey => $headerVal )
   825 				$headers .= $headerKey.": ".$headerVal."\r\n";
   825 				$headers .= $headerKey.": ".$headerVal."\r\n";
   826 		}
   826 		}
   827 		if(!empty($content_type)) {
   827 		if(!empty($content_type)) {
   828 			$headers .= "Content-type: $content_type";
   828 			$headers .= "Content-Type: $content_type";
   829 			if ($content_type == "multipart/form-data")
   829 			if ($content_type == "multipart/form-data")
   830 				$headers .= "; boundary=".$this->_mime_boundary;
   830 				$headers .= "; boundary=".$this->_mime_boundary;
   831 			$headers .= "\r\n";
   831 			$headers .= "\r\n";
   832 		}
   832 		}
   833 		if(!empty($body))
   833 		if(!empty($body))
   834 			$headers .= "Content-length: ".strlen($body)."\r\n";
   834 			$headers .= "Content-Length: ".strlen($body)."\r\n";
   835 		if(!empty($this->user) || !empty($this->pass))
   835 		if(!empty($this->user) || !empty($this->pass))
   836 			$headers .= "Authorization: Basic ".base64_encode($this->user.":".$this->pass)."\r\n";
   836 			$headers .= "Authorization: Basic ".base64_encode($this->user.":".$this->pass)."\r\n";
   837 
   837 
   838 		//add proxy auth headers
   838 		//add proxy auth headers
   839 		if(!empty($this->proxy_user))
   839 		if(!empty($this->proxy_user))
   988 			foreach ( $this->rawheaders as $headerKey => $headerVal )
   988 			foreach ( $this->rawheaders as $headerKey => $headerVal )
   989 				$headers[] = $headerKey.": ".$headerVal;
   989 				$headers[] = $headerKey.": ".$headerVal;
   990 		}
   990 		}
   991 		if(!empty($content_type)) {
   991 		if(!empty($content_type)) {
   992 			if ($content_type == "multipart/form-data")
   992 			if ($content_type == "multipart/form-data")
   993 				$headers[] = "Content-type: $content_type; boundary=".$this->_mime_boundary;
   993 				$headers[] = "Content-Type: $content_type; boundary=".$this->_mime_boundary;
   994 			else
   994 			else
   995 				$headers[] = "Content-type: $content_type";
   995 				$headers[] = "Content-Type: $content_type";
   996 		}
   996 		}
   997 		if(!empty($body))
   997 		if(!empty($body))
   998 			$headers[] = "Content-length: ".strlen($body);
   998 			$headers[] = "Content-Length: ".strlen($body);
   999 		if(!empty($this->user) || !empty($this->pass))
   999 		if(!empty($this->user) || !empty($this->pass))
  1000 			$headers[] = "Authorization: BASIC ".base64_encode($this->user.":".$this->pass);
  1000 			$headers[] = "Authorization: BASIC ".base64_encode($this->user.":".$this->pass);
  1001 
  1001 
  1002 		$headerfile = tempnam( $this->temp_dir, "sno" );
  1002 		$headerfile = tempnam( $this->temp_dir, "sno" );
  1003 		$cmdline_params = '-k -D ' . escapeshellarg( $headerfile );
  1003 		$cmdline_params = '-k -D ' . escapeshellarg( $headerfile );