Skip navigation
Help

drupal_valid_http_host

6 bootstrap.inc drupal_valid_http_host($host)
7 bootstrap.inc drupal_valid_http_host($host)

Validate that a hostname (for example $_SERVER['HTTP_HOST']) is safe.

Return value

TRUE if only containing valid characters, or FALSE otherwise.

2 calls to drupal_valid_http_host()

File

drupal/includes/bootstrap.inc, line 516
Functions that need to be loaded on every Drupal request.

Code

function drupal_valid_http_host($host) {
  return preg_match('/^\[?(?:[a-zA-Z0-9-:\]_]+\.?)+$/', $host);
}