oEmbed: During discovery, only request the first 150kb of linked content to avoid timouts requesting larger documents.
Fixes #35979. Built from https://develop.svn.wordpress.org/trunk@36880 git-svn-id: http://core.svn.wordpress.org/trunk@36847 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
34ab7ae5ac
commit
68eb6c1593
|
@ -309,6 +309,9 @@ class WP_oEmbed {
|
||||||
*/
|
*/
|
||||||
public function discover( $url ) {
|
public function discover( $url ) {
|
||||||
$providers = array();
|
$providers = array();
|
||||||
|
$args = array(
|
||||||
|
'limit_response_size' => 153600, // 150 KB
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filter oEmbed remote get arguments.
|
* Filter oEmbed remote get arguments.
|
||||||
|
@ -320,7 +323,7 @@ class WP_oEmbed {
|
||||||
* @param array $args oEmbed remote get arguments.
|
* @param array $args oEmbed remote get arguments.
|
||||||
* @param string $url URL to be inspected.
|
* @param string $url URL to be inspected.
|
||||||
*/
|
*/
|
||||||
$args = apply_filters( 'oembed_remote_get_args', array(), $url );
|
$args = apply_filters( 'oembed_remote_get_args', $args, $url );
|
||||||
|
|
||||||
// Fetch URL content
|
// Fetch URL content
|
||||||
$request = wp_safe_remote_get( $url, $args );
|
$request = wp_safe_remote_get( $url, $args );
|
||||||
|
@ -342,7 +345,9 @@ class WP_oEmbed {
|
||||||
) );
|
) );
|
||||||
|
|
||||||
// Strip <body>
|
// Strip <body>
|
||||||
$html = substr( $html, 0, stripos( $html, '</head>' ) );
|
if ( $html_head_end = stripos( $html, '</head>' ) ) {
|
||||||
|
$html = substr( $html, 0, $html_head_end );
|
||||||
|
}
|
||||||
|
|
||||||
// Do a quick check
|
// Do a quick check
|
||||||
$tagfound = false;
|
$tagfound = false;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.5-beta2-36879';
|
$wp_version = '4.5-beta2-36880';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
|
|
Loading…
Reference in New Issue