WP_HTTP: More relaxed host matching for WP_PROXY_BYPASS_HOSTS and WP_ACCESSIBLE_HOSTS, allowing for subdomains in wildcards to include dashes (and anything else which [\w.] didn't catch). Fixes #24201

Built from https://develop.svn.wordpress.org/trunk@25149


git-svn-id: http://core.svn.wordpress.org/trunk@25128 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Dion Hulse 2013-08-28 04:54:09 +00:00
parent 1fbc03a388
commit f8e3be14fe

View File

@ -555,7 +555,7 @@ class WP_Http {
if ( false !== strpos(WP_ACCESSIBLE_HOSTS, '*') ) {
$wildcard_regex = array();
foreach ( $accessible_hosts as $host )
$wildcard_regex[] = str_replace('\*', '[\w.]+?', preg_quote($host, '/'));
$wildcard_regex[] = str_replace( '\*', '.+', preg_quote( $host, '/' ) );
$wildcard_regex = '/^(' . implode('|', $wildcard_regex) . ')$/i';
}
}
@ -1621,7 +1621,7 @@ class WP_HTTP_Proxy {
if ( false !== strpos(WP_PROXY_BYPASS_HOSTS, '*') ) {
$wildcard_regex = array();
foreach ( $bypass_hosts as $host )
$wildcard_regex[] = str_replace('\*', '[\w.]+?', preg_quote($host, '/'));
$wildcard_regex[] = str_replace( '\*', '.+', preg_quote( $host, '/' ) );
$wildcard_regex = '/^(' . implode('|', $wildcard_regex) . ')$/i';
}
}