Uses
Uses | Description |
---|---|
wp-includes/Requests/SSL.php: Requests_SSL::verify_reference_name() | Verify that a reference name is valid |
Match a hostname against a dNSName reference
(string) (Required) Requested host
(string) (Required) dNSName to match against
(boolean) Does the domain match?
File: wp-includes/Requests/SSL.php
public static function match_domain($host, $reference) { // Check if the reference is blocklisted first if (self::verify_reference_name($reference) !== true) { return false; } // Check for a direct match if ($host === $reference) { return true; } // Calculate the valid wildcard match if the host is not an IP address // Also validates that the host has 3 parts or more, as per Firefox's // ruleset. if (ip2long($host) === false) { $parts = explode('.', $host); $parts[0] = '*'; $wildcard = implode('.', $parts); if ($wildcard === $reference) { return true; } } return false; }
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/requests_ssl/match_domain