protected static DrupalKernel::validateHostnameLength($host)
Validates a hostname length.
string $host: A hostname.
bool TRUE if the length is appropriate, or FALSE otherwise.
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;
}
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!DrupalKernel.php/function/DrupalKernel::validateHostnameLength/8.1.x