HTTP: Improve detection of valid IP addresses.

Merge of [37115] to the 3.7 branch.

git-svn-id: https://develop.svn.wordpress.org/branches/3.7@37123 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dominik Schilling (ocean90) 2016-03-30 15:51:01 +00:00
parent ec83dfc341
commit 74fd4adfa6

View File

@ -472,7 +472,7 @@ function wp_http_validate_url( $url ) {
if ( ! $same_host ) {
$host = trim( $parsed_url['host'], '.' );
if ( preg_match( '#^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$#', $host ) ) {
if ( preg_match( '#^(([1-9]?\d|1\d\d|25[0-5]|2[0-4]\d)\.){3}([1-9]?\d|1\d\d|25[0-5]|2[0-4]\d)$#', $host ) ) {
$ip = $host;
} else {
$ip = gethostbyname( $host );