Changeset 24481 for branches/3.5/wp-includes/comment.php
- Timestamp:
- 06/21/2013 06:12:17 AM (12 years ago)
- Location:
- branches/3.5
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.5
-
branches/3.5/wp-includes/comment.php
r23332 r24481 1662 1662 return false; 1663 1663 1664 $response = wp_remote_head( $url, array( 'timeout' => 2, 'httpversion' => '1.0' ) );1664 $response = wp_remote_head( $url, array( 'timeout' => 2, 'httpversion' => '1.0', 'reject_unsafe_urls' => true ) ); 1665 1665 1666 1666 if ( is_wp_error( $response ) ) … … 1675 1675 1676 1676 // Now do a GET since we're going to look in the html headers (and we're sure its not a binary file) 1677 $response = wp_remote_get( $url, array( 'timeout' => 2, 'httpversion' => '1.0' ) );1677 $response = wp_remote_get( $url, array( 'timeout' => 2, 'httpversion' => '1.0', 'reject_unsafe_urls' => true ) ); 1678 1678 1679 1679 if ( is_wp_error( $response ) ) … … 1909 1909 $options = array(); 1910 1910 $options['timeout'] = 4; 1911 $options['reject_unsafe_urls'] = true; 1911 1912 $options['body'] = array( 1912 1913 'title' => $title, … … 1956 1957 * 1957 1958 * @since 3.5.1 1959 * @see wp_http_validate_url() 1958 1960 * 1959 1961 * @param string $source_uri … … 1961 1963 */ 1962 1964 function pingback_ping_source_uri( $source_uri ) { 1963 $uri = esc_url_raw( $source_uri, array( 'http', 'https' ) ); 1964 if ( ! $uri ) 1965 return ''; 1966 1967 $parsed_url = @parse_url( $uri ); 1968 if ( ! $parsed_url ) 1969 return ''; 1970 1971 if ( isset( $parsed_url['user'] ) || isset( $parsed_url['pass'] ) ) 1972 return ''; 1973 1974 if ( false !== strpos( $parsed_url['host'], ':' ) ) 1975 return ''; 1976 1977 $parsed_home = @parse_url( get_option( 'home' ) ); 1978 1979 $same_host = strtolower( $parsed_home['host'] ) === strtolower( $parsed_url['host'] ); 1980 1981 if ( ! $same_host ) { 1982 $host = trim( $parsed_url['host'], '.' ); 1983 if ( preg_match( '#^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$#', $host ) ) { 1984 $ip = $host; 1985 } else { 1986 $ip = gethostbyname( $host ); 1987 if ( $ip === $host ) // Error condition for gethostbyname() 1988 $ip = false; 1989 } 1990 if ( $ip ) { 1991 if ( '127.0.0.1' === $ip ) 1992 return ''; 1993 $parts = array_map( 'intval', explode( '.', $ip ) ); 1994 if ( 10 === $parts[0] ) 1995 return ''; 1996 if ( 172 === $parts[0] && 16 <= $parts[1] && 31 >= $parts[1] ) 1997 return ''; 1998 if ( 192 === $parts[0] && 168 === $parts[1] ) 1999 return ''; 2000 } 2001 } 2002 2003 if ( empty( $parsed_url['port'] ) ) 2004 return $uri; 2005 2006 $port = $parsed_url['port']; 2007 if ( 80 === $port || 443 === $port || 8080 === $port ) 2008 return $uri; 2009 2010 if ( $parsed_home && $same_host && $parsed_home['port'] === $port ) 2011 return $uri; 2012 2013 return ''; 1965 return (string) wp_http_validate_url( $source_uri ); 2014 1966 } 2015 1967
Note: See TracChangeset
for help on using the changeset viewer.