#182410 by greggles: HTTP Basic authentication username and password was parsed in drupal_http_request() but then not used in the request

6.x
Gábor Hojtsy 2007-10-11 09:47:23 +00:00
parent 3fb218cb7e
commit ba3c558f0d
1 changed files with 5 additions and 0 deletions

View File

@ -458,6 +458,11 @@ function drupal_http_request($url, $headers = array(), $method = 'GET', $data =
'Content-Length' => 'Content-Length: '. strlen($data)
);
// If the server url has a user then attempt to use basic authentication
if (isset($uri['user'])) {
$defaults['Authorization'] = 'Authorization: Basic '. base64_encode($uri['user'] . (!empty($uri['pass']) ? ":". $uri['pass'] : ''));
}
foreach ($headers as $header => $value) {
$defaults[$header] = $header .': '. $value;
}