#30217 [Opn->Bgs]: XML RPC 1.1.0 doesn't operate over ssl properly
| From: | iliaa@php.net | Date: | Tue, 28 Sep 2004 14:01:19 +0000 |
| Subject: | #30217 [Opn->Bgs]: XML RPC 1.1.0 doesn't operate over ssl properly | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-66801@lists.php.net to get a copy of this message | ||
ID: 30217
Updated by: iliaa@php.net
Reported By: nkukard at lbsd dot net
-Status: Open
+Status: Bogus
Bug Type: XML related
Operating System: Linux
PHP Version: 5.0.1
New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions.
Thank you for your interest in PHP.
This is a bug in the PEAR class, please re-submit your bug report and
the patch to http://pear.php.net/bugs/.
Thanks.
Previous Comments:
------------------------------------------------------------------------
[2004-09-24 11:30:01] nkukard at lbsd dot net
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 this bug report at http://bugs.php.net/?id=30217&edit=1