- changelog update
[plcapi.git] / lib / xmlrpc.inc
index 52424b0..79dbafb 100644 (file)
 \r
        // set to TRUE to enable encoding of php NULL values to <EX:NIL/> instead of <NIL/>\r
        $GLOBALS['xmlrpc_null_apache_encoding']=false;\r
+    $GLOBALS['xmlrpc_null_apache_encoding_ns']='http://ws.apache.org/xmlrpc/namespaces/extensions';\r
 \r
        // used to store state during parsing\r
        // quick explanation of components:\r
                                        $GLOBALS['_xh']['value'] = $curr_val['values'];\r
                                        $GLOBALS['_xh']['vt']=strtolower($name);\r
                                        if (isset($curr_val['php_class']))\r
+\r
                                        {\r
                                                $GLOBALS['_xh']['php_class'] = $curr_val['php_class'];\r
                                        }\r
                function setCaCertificate($cacert, $is_dir=false)\r
                {\r
                        if ($is_dir)\r
+\r
                        {\r
                                $this->cacertdir = $cacert;\r
                        }\r
                        if ($compmethod == 'any')\r
                                $this->accepted_compression = array('gzip', 'deflate');\r
                        else\r
-                               $this->accepted_compression = array($compmethod);\r
+                           if ($compmethod == false )\r
+                               $this->accepted_compression = array();\r
+                   else\r
+                               $this->accepted_compression = array($compmethod);\r
                }\r
 \r
                /**\r
                        $msg->debug=$this->debug;\r
 \r
                        if($method == 'https')\r
+\r
                        {\r
                                $r =& $this->sendPayloadHTTPS(\r
                                        $msg,\r
                                $cookieheader = 'Cookie:' . $version . substr($cookieheader, 0, -1) . "\r\n";\r
                        }\r
 \r
+                   // omit port if 80\r
+                   $port = ($port == 80) ? '' : (':' . $port);\r
+\r
                        $op= 'POST ' . $uri. " HTTP/1.0\r\n" .\r
                                'User-Agent: ' . $this->user_agent . "\r\n" .\r
-                               'Host: '. $server . ':' . $port . "\r\n" .\r
+                               'Host: '. $server . $port . "\r\n" .\r
                                $credentials .\r
                                $proxy_credentials .\r
                                $accepted_encoding .\r
                        {\r
                                print "<PRE>\n---CURL INFO---\n";\r
                                foreach(curl_getinfo($curl) as $name => $val)\r
-                                        print $name . ': ' . htmlentities($val). "\n";\r
+                               {\r
+                                       if (is_array($val))\r
+                                       {\r
+                                               $val = implode("\n", $val);\r
+                                       }\r
+                                       print $name . ': ' . htmlentities($val) . "\n";\r
+                               }\r
+\r
                                print "---END---\n</PRE>";\r
                        }\r
 \r
                                                case 1:\r
                                                        if(!isset($val[0]))\r
                                                        {\r
+\r
                                                                return false;           // Bad value\r
                                                        }\r
                                                        // Normal return value\r
                                $this->content_type = 'text/xml; charset=' . $charset_encoding;\r
                        else\r
                                $this->content_type = 'text/xml';\r
-                       $result = "<methodResponse>\n";\r
+                   if ($GLOBALS['xmlrpc_null_apache_encoding'])\r
+                   {\r
+                       $result = "<methodResponse xmlns:ex=\"".$GLOBALS['xmlrpc_null_apache_encoding_ns']."\">\n";\r
+                   }\r
+                   else\r
+                   {\r
+                       $result = "<methodResponse>\n";\r
+                   }\r
                        if($this->errno)\r
                        {\r
                                // G. Giunta 2005/2/13: let non-ASCII response messages be tolerated by clients\r
@@ -3316,7 +3341,7 @@ xmlrpc_encode_entitites($this->errstr, $GLOBALS['xmlrpc_internalencoding'], $cha
                                        $out = $xmlrpc_val->scalarval();\r
                                        if (is_string($out))\r
                                        {\r
-                                               $out= strtotime($out);\r
+                                               $out = strtotime($out);\r
                                        }\r
                                        if (is_int($out))\r
                                        {\r
@@ -3499,6 +3524,7 @@ xmlrpc_encode_entitites($this->errstr, $GLOBALS['xmlrpc_internalencoding'], $cha
                                        $xmlrpc_val = new xmlrpcval((int)$php_val, $GLOBALS['xmlrpcInt']);\r
                                }\r
                                else\r
+\r
                                {\r
                                        $xmlrpc_val = new xmlrpcval();\r
                                }\r
@@ -3700,6 +3726,7 @@ xmlrpc_encode_entitites($this->errstr, $GLOBALS['xmlrpc_internalencoding'], $cha
                }\r
                elseif(preg_match('/^(\xEF\xBB\xBF)/', $xmlchunk))\r
                {\r
+\r
                        return 'UTF-8';\r
                }\r
 \r