DrupalKernel::validateHostnameLength

protected static DrupalKernel::validateHostnameLength($host)

Validates a hostname length.

Parameters

string $host: A hostname.

Return value

bool TRUE if the length is appropriate, or FALSE otherwise.

File

core/lib/Drupal/Core/DrupalKernel.php, line 1435

Class

DrupalKernel
The DrupalKernel class is the core of Drupal itself.

Namespace

Drupal\Core

Code

protected static function validateHostnameLength($host) {
  // Limit the length of the host name to 1000 bytes to prevent DoS attacks
  // with long host names.
  return strlen($host) <= 1000
    // Limit the number of subdomains and port separators to prevent DoS attacks
    // in findSitePath().
    && substr_count($host, '.') <= 100
    && substr_count($host, ':') <= 100;
}
doc_Drupal
2016-10-29 09:03:05
Comments
Leave a Comment

Please login to continue.