function DrupalKernel::validateHostnameLength
Same name in other branches
- 9 core/lib/Drupal/Core/DrupalKernel.php \Drupal\Core\DrupalKernel::validateHostnameLength()
- 8.9.x core/lib/Drupal/Core/DrupalKernel.php \Drupal\Core\DrupalKernel::validateHostnameLength()
- 10 core/lib/Drupal/Core/DrupalKernel.php \Drupal\Core\DrupalKernel::validateHostnameLength()
Validates a hostname length.
Parameters
string $host: A hostname.
Return value
bool TRUE if the length is appropriate, or FALSE otherwise.
1 call to DrupalKernel::validateHostnameLength()
- DrupalKernel::validateHostname in core/
lib/ Drupal/ Core/ DrupalKernel.php - Validates the hostname supplied from the HTTP request.
File
-
core/
lib/ Drupal/ Core/ DrupalKernel.php, line 1560
Class
- DrupalKernel
- The DrupalKernel class is the core of Drupal itself.
Namespace
Drupal\CoreCode
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 && substr_count($host, '.') <= 100 && substr_count($host, ':') <= 100;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.