Skip to content

Commit

Permalink
HTTP: Improve detection of valid IP addresses.
Browse files Browse the repository at this point in the history
Built from https://develop.svn.wordpress.org/trunk@37115


git-svn-id: http://core.svn.wordpress.org/trunk@37082 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
ocean90 committed Mar 30, 2016
1 parent 9e4415b commit af9f052
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions wp-includes/http.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -523,15 +523,15 @@ function wp_http_validate_url( $url ) {


$parsed_home = @parse_url( get_option( 'home' ) ); $parsed_home = @parse_url( get_option( 'home' ) );


if ( isset( $parsed_home['host'] ) ) { if ( isset( $parsed_home['host'] ) ) {
$same_host = ( strtolower( $parsed_home['host'] ) === strtolower( $parsed_url['host'] ) || 'localhost' === strtolower( $parsed_url['host'] ) ); $same_host = ( strtolower( $parsed_home['host'] ) === strtolower( $parsed_url['host'] ) || 'localhost' === strtolower( $parsed_url['host'] ) );
} else { } else {
$same_host = false; $same_host = false;
} }


if ( ! $same_host ) { if ( ! $same_host ) {
$host = trim( $parsed_url['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; $ip = $host;
} else { } else {
$ip = gethostbyname( $host ); $ip = gethostbyname( $host );
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/version.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.5-RC1-37114'; $wp_version = '4.5-RC1-37115';


/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
Expand Down

0 comments on commit af9f052

Please sign in to comment.