NobuNobu
nobun****@users*****
2006年 5月 30日 (火) 12:34:54 JST
Index: xoops2jp/html/class/snoopy.php diff -u xoops2jp/html/class/snoopy.php:1.2 xoops2jp/html/class/snoopy.php:1.2.2.1 --- xoops2jp/html/class/snoopy.php:1.2 Mon May 1 11:37:24 2006 +++ xoops2jp/html/class/snoopy.php Tue May 30 12:34:54 2006 @@ -43,6 +43,7 @@ var $host = "www.php.net"; // host name we are connecting to var $port = 80; // port we are connecting to + var $host_port = ""; // port for Host Header var $proxy_host = ""; // proxy host to use var $proxy_port = ""; // proxy port to use var $proxy_user = ""; // proxy user to use @@ -144,8 +145,10 @@ { case "http": $this->host = $URI_PARTS["host"]; - if(!empty($URI_PARTS["port"])) + if(!empty($URI_PARTS["port"])) { $this->port = $URI_PARTS["port"]; + $this->host_port = $URI_PARTS["port"]; + } if($this->_connect($fp)) { if($this->_isproxy) @@ -208,8 +211,10 @@ if (!is_executable($this->curl_path)) return false; $this->host = $URI_PARTS["host"]; - if(!empty($URI_PARTS["port"])) + if(!empty($URI_PARTS["port"])) { $this->port = $URI_PARTS["port"]; + $this->host_port = $URI_PARTS["port"]; + } if($this->_isproxy) { // using proxy, send entire URI @@ -296,8 +301,10 @@ { case "http": $this->host = $URI_PARTS["host"]; - if(!empty($URI_PARTS["port"])) + if(!empty($URI_PARTS["port"])) { $this->port = $URI_PARTS["port"]; + $this->host_port = $URI_PARTS["port"]; + } if($this->_connect($fp)) { if($this->_isproxy) @@ -367,8 +374,10 @@ if (!is_executable($this->curl_path)) return false; $this->host = $URI_PARTS["host"]; - if(!empty($URI_PARTS["port"])) + if(!empty($URI_PARTS["port"])) { $this->port = $URI_PARTS["port"]; + $this->host_port = $URI_PARTS["port"]; + } if($this->_isproxy) { // using proxy, send entire URI @@ -807,8 +816,8 @@ $headers .= "User-Agent: ".$this->agent."\r\n"; if(!empty($this->host) && !isset($this->rawheaders['Host'])) { $headers .= "Host: ".$this->host; - if(!empty($this->port)) - $headers .= ":".$this->port; + if(!empty($this->host_port)) + $headers .= ":".$this->host_port; $headers .= "\r\n"; } if(!empty($this->accept)) @@ -884,7 +893,9 @@ if(!preg_match("|\:\/\/|",$matches[2])) { // no host in the path, so prepend - $this->_redirectaddr = $URI_PARTS["scheme"]."://".$this->host.":".$this->port; + $this->_redirectaddr = $URI_PARTS["scheme"]."://".$this->host; + if(!empty($this->host_port)) + $this->_redirectaddr .= ":".$this->host_port; // eliminate double slash if(!preg_match("|^/|",$matches[2])) $this->_redirectaddr .= "/".$matches[2]; @@ -971,8 +982,8 @@ if(!empty($this->agent)) $headers[] = "User-Agent: ".$this->agent; if(!empty($this->host)) - if(!empty($this->port)) - $headers[] = "Host: ".$this->host.":".$this->port; + if(!empty($this->host_port)) + $headers[] = "Host: ".$this->host.":".$this->host_port; else $headers[] = "Host: ".$this->host; if(!empty($this->accept)) @@ -1053,7 +1064,9 @@ if(!preg_match("|\:\/\/|",$matches[2])) { // no host in the path, so prepend - $this->_redirectaddr = $URI_PARTS["scheme"]."://".$this->host.":".$this->port; + $this->_redirectaddr = $URI_PARTS["scheme"]."://".$this->host; + if(!empty($this->host_port)) + $this->_redirectaddr .= ":".$this->host_port; // eliminate double slash if(!preg_match("|^/|",$matches[2])) $this->_redirectaddr .= "/".$matches[2];