Skip to content
This repository has been archived by the owner on Sep 6, 2022. It is now read-only.

Commit

Permalink
applying 0045
Browse files Browse the repository at this point in the history
  • Loading branch information
till committed Jun 15, 2009
1 parent 3eccb5e commit fe8f840
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions integration_api_lib.php
Expand Up @@ -89,10 +89,28 @@ protected function api_request($query) {
if (empty($this->server_path)) {
return;
}

try {
if (!($this->request instanceof HTTP_Request2)) {

/**
* Parse server_path to extract an optional username and
* password for basic auth.
*/
$_url = new Net_Url2($this->server_path);

$basic_auth_user = $_url->getUser();
$basic_auth_pass = $_url->getPassword();

$request = new HTTP_Request2($this->server_path . $query);
if ($basic_auth_user !== false) {
if ($basic_auth_pass !== false) {
$request->setAuth($basic_auth_user, $basic_auth_pass);
} else {
$request->setAuth($basic_auth_user);
}
}

} else {
$request = $this->request;
}
Expand All @@ -102,7 +120,7 @@ protected function api_request($query) {
return $body;

} catch (HTTP_Request2_Exception $e) {
trigger_error($e->getMessage(), E_USER_WARNING);
trigger_error($e->getMessage(), E_USER_WARNING);
}
}
}

0 comments on commit fe8f840

Please sign in to comment.