Make WordPress Core

Changeset 36880


Ignore:
Timestamp:
03/08/2016 05:57:13 AM (11 years ago)
Author:
dd32
Message:

oEmbed: During discovery, only request the first 150kb of linked content to avoid timouts requesting larger documents.

Fixes #35979.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-oembed.php

    r36007 r36880  
    310310        public function discover( $url ) {
    311311                $providers = array();
     312                $args = array(
     313                        'limit_response_size' => 153600, // 150 KB
     314                );
    312315
    313316                /**
     
    321324                 * @param string $url  URL to be inspected.
    322325                 */
    323                 $args = apply_filters( 'oembed_remote_get_args', array(), $url );
     326                $args = apply_filters( 'oembed_remote_get_args', $args, $url );
    324327
    325328                // Fetch URL content
     
    343346
    344347                        // Strip <body>
    345                         $html = substr( $html, 0, stripos( $html, '</head>' ) );
     348                        if ( $html_head_end = stripos( $html, '</head>' ) ) {
     349                                $html = substr( $html, 0, $html_head_end );
     350                        }
    346351
    347352                        // Do a quick check
Note: See TracChangeset for help on using the changeset viewer.