Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.5.5

Bug #2489 XML RPC doesn't allow for proper communication over ssl
Submitted: 2004-10-10 14:08 UTC
From: nkukard at lbsd dot net Assigned: danielc
Status: Closed Package: XML_RPC
PHP Version: Irrelevant OS: Linux
Roadmaps: (Not assigned)    
Subscription  


 [2004-10-10 14:08 UTC] nkukard at lbsd dot net
Description: ------------ XML RPC doesn't allow for communication over ssl and uses the incorrect information in the http headers. Reproduce code: --------------- Here is a patch to fix the problem... diff -u --recursive XML_RPC-1.1.0_vanilla/RPC.php XML_RPC-1.1.0_xmlrpcssl/RPC.php --- XML_RPC-1.1.0_vanilla/RPC.php 2004-03-15 15:51:44.000000000 +0200 +++ XML_RPC-1.1.0_xmlrpcssl/RPC.php 2004-05-01 18:54:11.991190696 +0200 @@ -452,16 +452,37 @@ { // If we're using a proxy open a socket to the proxy server instead to the xml-rpc server if ($this->proxy){ + $proxy_server = $this->proxy; + $proxy_proto = ""; + if (strstr($proxy_server,"https://")) + { + $proxy_server = substr($proxy_server,8); + $proxy_proto = "ssl://"; + } + // Backward compatibility + if (!strstr($proxy_server,"http://")) + { + $server = "http://" . $server; + } if ($timeout > 0) { - $fp = fsockopen($this->proxy, $this->proxy_port, $this->errno, $this->errstr, $timeout); + $fp = fsockopen($proxy_proto . $this->proxy, $this->proxy_port, $this->errno, $this->errstr, $timeout); } else { - $fp = fsockopen($this->proxy, $this->proxy_port, $this->errno, $this->errstr); + $fp = fsockopen($proxy_proto . $this->proxy, $this->proxy_port, $this->errno, $this->errstr); } } else { + $server_proto = ""; + if (strstr($server,"https://")) + { + $server = substr($server,8); + $server_proto = "ssl://"; + } elseif (strstr($server,"http://")) + { + $server = substr($server,7); + } if ($timeout > 0) { - $fp = fsockopen($server, $port, $this->errno, $this->errstr, $timeout); + $fp = fsockopen($server_proto . $server, $port, $this->errno, $this->errstr, $timeout); } else { - $fp = fsockopen($server, $port, $this->errno, $this->errstr); + $fp = fsockopen($server_proto . $server, $port, $this->errno, $this->errstr); } } @@ -489,7 +510,7 @@ if ($this->proxy) { - $op = "POST http://" . $this->server; + $op = "POST ". $server; if ($this->proxy_port) { $op .= ":" . $this->port; @@ -500,7 +521,7 @@ $op .= $this->path. " HTTP/1.0\r\n" . "User-Agent: PEAR XML_RPC\r\n" . - "Host: " . $this->server . "\r\n"; + "Host: " . $server . "\r\n"; if ($this->proxy && $this->proxy_user != '') { $op .= 'Proxy-Authorization: Basic ' . base64_encode($this->proxy_user . ':' . $this->proxy_pass) . @@ -660,7 +681,7 @@ { $ipd = ""; - while($data = fread($fp, 32768)) { + while($data = @fread($fp, 32768)) { $ipd .= $data; } return $this->parseResponse($ipd);

Comments

 [2004-12-08 22:33 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2005-01-15 03:32 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!