diff options
-rw-r--r-- | system/libraries/Xmlrpc.php | 31 | ||||
-rw-r--r-- | user_guide_src/source/changelog.rst | 8 |
2 files changed, 36 insertions, 3 deletions
diff --git a/system/libraries/Xmlrpc.php b/system/libraries/Xmlrpc.php index fe9781b28..bd59c933d 100644 --- a/system/libraries/Xmlrpc.php +++ b/system/libraries/Xmlrpc.php @@ -348,6 +348,11 @@ class CI_Xmlrpc { $parts = parse_url($url); + if (isset($parts['user'], $parts['pass'])) + { + $parts['host'] = $parts['user'].':'.$parts['pass'].'@'.$parts['host']; + } + $path = isset($parts['path']) ? $parts['path'] : '/'; if ( ! empty($parts['query'])) @@ -569,6 +574,21 @@ class XML_RPC_Client extends CI_Xmlrpc public $port = 80; /** + * + * Server username + * + * @var string + */ + public $username; + + /** + * Server password + * + * @var string + */ + public $password; + + /** * Proxy hostname * * @var string @@ -626,8 +646,16 @@ class XML_RPC_Client extends CI_Xmlrpc { parent::__construct(); + $url = parse_url('http://'.$server); + + if (isset($url['user'], $url['pass'])) + { + $this->username = $url['user']; + $this->password = $url['pass']; + } + $this->port = $port; - $this->server = $server; + $this->server = $url['host']; $this->path = $path; $this->proxy = $proxy; $this->proxy_port = $proxy_port; @@ -691,6 +719,7 @@ class XML_RPC_Client extends CI_Xmlrpc $op = 'POST '.$this->path.' HTTP/1.0'.$r .'Host: '.$this->server.$r .'Content-Type: text/xml'.$r + .(isset($this->username, $this->password) ? 'Authorization: Basic '.base64_encode($this->username.':'.$this->password).$r : '') .'User-Agent: '.$this->xmlrpcName.$r .'Content-Length: '.strlen($msg->payload).$r.$r .$msg->payload; diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 6d0ceb6c3..27031b941 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -342,7 +342,6 @@ Release Date: Not Released - Deprecated usage of the "anchor_class" setting (use the new "attributes" setting instead). - Added $config['reuse_query_string'] to allow automatic repopulation of query string arguments, combined with normal URI segments. - Removed the default `` `` from a number of the configuration variables. - - Added the ability to use a proxy with the :doc:`XML-RPC Library <libraries/xmlrpc>`. - :doc:`Encryption Library <libraries/encryption>` changes include: @@ -354,13 +353,18 @@ Release Date: Not Released - Database object names are now being displayed. - The sum of all queries running times in seconds is now being displayed. - Added support for displaying the HTTP DNT ("Do Not Track") header. - - Added support for displaying $_FILES. + - Added support for displaying ``$_FILES``. - :doc:`Migration Library <libraries/migration>` changes include: - Added support for timestamp-based migrations (enabled by default). - Added ``$config['migration_type']`` to allow switching between *sequential* and *timestamp* migrations. + - :doc:`XML-RPC Library <libraries/xmlrpc>` changes include: + + - Added the ability to use a proxy. + - Added Basic HTTP authentication support. + - :doc:`User Agent Library <libraries/user_agent>` will now check if robots are pretending to be mobile clients (helps with e.g. Google indexing mobile website versions). - Added support for setting :doc:`Table <libraries/table>` class defaults in a config file. |