public static DrupalKernel::validateHostname(Request $request)
Validates the hostname supplied from the HTTP request.
Parameters
\Symfony\Component\HttpFoundation\Request $request: The request object
Return value
bool TRUE if the hostname is valid, or FALSE otherwise.
File
- core/lib/Drupal/Core/DrupalKernel.php, line 1454
Class
- DrupalKernel
- The DrupalKernel class is the core of Drupal itself.
Namespace
Drupal\Core
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | 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; } |
Please login to continue.