public static DrupalKernel::validateHostname(Request $request)
Validates the hostname supplied from the HTTP request.
\Symfony\Component\HttpFoundation\Request $request: The request object
bool TRUE if the hostname is valid, or FALSE otherwise.
public static function validateHostname(Request $request) { // $request->getHost() can throw an UnexpectedValueException if it // detects a bad hostname, but it does not validate the length. try { $http_host = $request->getHost(); } catch (\UnexpectedValueException $e) { return FALSE; } if (static::validateHostnameLength($http_host) === FALSE) { return FALSE; } return TRUE; }
© 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::validateHostname/8.1.x