From: nkukard at lbsd dot net Operating system: Linux PHP version: 5.0.1 PHP Bug Type: XML related Bug description: XML RPC 1.1.0 doesn't operate over ssl properly
Description: ------------ XML RPC doesn't allow for communication over ssl and uses the incorrect information in the http headers. 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); -- Edit bug report at http://bugs.php.net/?id=30217&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30217&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30217&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30217&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=30217&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=30217&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=30217&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=30217&r=needscript Try newer version: http://bugs.php.net/fix.php?id=30217&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=30217&r=support Expected behavior: http://bugs.php.net/fix.php?id=30217&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=30217&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=30217&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=30217&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30217&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=30217&r=dst IIS Stability: http://bugs.php.net/fix.php?id=30217&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=30217&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=30217&r=float MySQL Configuration Error: http://bugs.php.net/fix.php?id=30217&r=mysqlcfg