Changeset 52084 for trunk/src/wp-includes/http.php
- Timestamp:
- 11/09/2021 10:37:19 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/http.php
r49108 r52084 515 515 */ 516 516 function wp_http_validate_url( $url ) { 517 if ( ! is_string( $url ) || '' === $url || is_numeric( $url ) ) { 518 return false; 519 } 520 517 521 $original_url = $url; 518 522 $url = wp_kses_bad_protocol( $url, array( 'http', 'https' ) ); … … 535 539 536 540 $parsed_home = parse_url( get_option( 'home' ) ); 537 538 if ( isset( $parsed_home['host'] ) ) { 539 $same_host = strtolower( $parsed_home['host'] ) === strtolower( $parsed_url['host'] ); 540 } else { 541 $same_host = false; 542 } 541 $same_host = isset( $parsed_home['host'] ) && strtolower( $parsed_home['host'] ) === strtolower( $parsed_url['host'] ); 542 $host = trim( $parsed_url['host'], '.' ); 543 543 544 544 if ( ! $same_host ) { 545 $host = trim( $parsed_url['host'], '.' );546 545 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 ) ) { 547 546 $ip = $host; … … 582 581 583 582 $port = $parsed_url['port']; 584 if ( 80 === $port || 443 === $port || 8080 === $port ) { 583 584 /** 585 * Controls the list of ports considered safe in HTTP API. 586 * 587 * Allows to change and allow external requests for the HTTP request. 588 * 589 * @since 5.9.0 590 * 591 * @param array $allowed_ports Array of integers for valid ports. 592 * @param string $host Host name of the requested URL. 593 * @param string $url Requested URL. 594 */ 595 $allowed_ports = apply_filters( 'http_allowed_safe_ports', array( 80, 443, 8080 ), $host, $url ); 596 if ( in_array( $port, $allowed_ports, true ) ) { 585 597 return $url; 586 598 }
Note: See TracChangeset
for help on using the changeset viewer.