<?php\r
// by Edd Dumbill (C) 1999-2002\r
// <edd@usefulinc.com>\r
-// $Id: xmlrpc.inc,v 1.174 2009/03/16 19:36:38 ggiunta Exp $\r
\r
// Copyright (c) 1999,2000,2002 Edd Dumbill.\r
// All rights reserved.\r
\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
* http://curl.haxx.se/docs/faq.html#7.3)\r
*/\r
var $xmlrpc_curl_handle = null;\r
- /// Wheter to use persistent connections for http 1.1 and https\r
+ /// Whether to use persistent connections for http 1.1 and https\r
var $keepalive = false;\r
/// Charset encodings that can be decoded without problems by the client\r
var $accepted_charset_encodings = array();\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
$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
curl_close($curl);\r
}\r
$resp =& $msg->parseResponse($result, true, $this->return_type);\r
+ // if we got back a 302, we can not reuse the curl handle for later calls\r
+ if($resp->faultCode() == $GLOBALS['xmlrpcerr']['http_error'] && $keepalive)\r
+ {\r
+ curl_close($curl);\r
+ $this->xmlrpc_curl_handle = null;\r
+ }\r
}\r
return $resp;\r
}\r
$this->content_type = 'text/xml; charset=' . $charset_encoding;\r
else\r
$this->content_type = 'text/xml';\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