You are here

function httprl_basic_auth in HTTP Parallel Request & Threading Library 7

Same name and namespace in other branches
  1. 6 httprl.module \httprl_basic_auth()

Set the Authorization header if a user is set in the URI.

Parameters

array $uri: Array from parse_url().

array &$options: Array containing options.

1 call to httprl_basic_auth()
httprl_request in ./httprl.module
Queue up a HTTP request in httprl_send_request.

File

./httprl.module, line 916
HTTP Parallel Request Library module.

Code

function httprl_basic_auth($uri, &$options) {

  // If the server URL has a user then attempt to use basic authentication.
  if (isset($uri['user'])) {
    $options['headers']['Authorization'] = 'Basic ' . base64_encode($uri['user'] . ':' . (isset($uri['pass']) ? $uri['pass'] : ''));
  }
}