You are here

function _httprl_use_proxy in HTTP Parallel Request & Threading Library 6

Same name and namespace in other branches
  1. 7 httprl.module \_httprl_use_proxy()

Helper function for determining hosts excluded from needing a proxy.

Return value

bool TRUE if a proxy should be used for this host.

1 call to _httprl_use_proxy()
httprl_setup_proxy in ./httprl.module
If server uses a proxy, change the request to utilize said proxy.

File

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

Code

function _httprl_use_proxy($host) {

  // To add a specific domain name in the proxy exception so that all the URL related
  // to this domain can bypass the proxy e.g. we add drupal.org in exception list then
  // it can bypass api.drupal.org, groups.drupal.org so even we can get matching pattern.
  $proxy_exceptions = httprl_variable_get('proxy_exceptions', array(
    'localhost',
    '127\\.0\\.0\\.1',
  ));
  $use_proxy = TRUE;
  if (is_array($proxy_exceptions) && count($proxy_exceptions)) {
    foreach ($proxy_exceptions as $exception) {
      $match = preg_match("/{$exception}/is", $host);
      if ($match) {
        $use_proxy = FALSE;
        break;
      }
    }
  }
  return $use_proxy;
}