X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/a6f44f0edcda2471c5a33e4156c1c9488c7f3210..refs/tags/wordpress-3.7:/wp-includes/http.php diff --git a/wp-includes/http.php b/wp-includes/http.php index 59dfa55c..e30fa41a 100644 --- a/wp-includes/http.php +++ b/wp-includes/http.php @@ -338,11 +338,18 @@ function get_http_origin() { if ( ! empty ( $_SERVER[ 'HTTP_ORIGIN' ] ) ) $origin = $_SERVER[ 'HTTP_ORIGIN' ]; + /** + * Change the origin of an HTTP request. + * + * @since 3.4.0 + * + * @param string $origin The original origin for the request. + */ return apply_filters( 'http_origin', $origin ); } /** - * Retrieve list of allowed http origins. + * Retrieve list of allowed HTTP origins. * * @since 3.4.0 * @@ -360,11 +367,24 @@ function get_allowed_http_origins() { 'https://' . $home_origin[ 'host' ], ) ); + /** + * Change the origin types allowed for HTTP requests. + * + * @since 3.4.0 + * + * @param array $allowed_origins { + * Default allowed HTTP origins. + * @type string Non-secure URL for admin origin. + * @type string Secure URL for admin origin. + * @type string Non-secure URL for home origin. + * @type string Secure URL for home origin. + * } + */ return apply_filters( 'allowed_http_origins' , $allowed_origins ); } /** - * Determines if the http origin is an authorized one. + * Determines if the HTTP origin is an authorized one. * * @since 3.4.0 * @@ -380,6 +400,14 @@ function is_allowed_http_origin( $origin = null ) { if ( $origin && ! in_array( $origin, get_allowed_http_origins() ) ) $origin = ''; + /** + * Change the allowed HTTP origin result. + * + * @since 3.4.0 + * + * @param string $origin Result of check for allowed origin. + * @param string $origin_arg original origin string passed into is_allowed_http_origin function. + */ return apply_filters( 'allowed_http_origin', $origin, $origin_arg ); } @@ -458,6 +486,17 @@ function wp_http_validate_url( $url ) { || ( 192 === $parts[0] && 168 === $parts[1] ) ) { // If host appears local, reject unless specifically allowed. + /** + * Check if HTTP request is external or not. + * + * Allows to change and allow external requests for the HTTP request. + * + * @since 3.6.0 + * + * @param bool false Whether HTTP request is external or not. + * @param string $host IP of the requested host. + * @param string $url URL of the requested host. + */ if ( ! apply_filters( 'http_request_host_is_external', false, $host, $url ) ) return false; }