Make WordPress Core

Changeset 42682


Ignore:
Timestamp:
02/09/2018 06:10:15 PM (7 years ago)
Author:
johnbillion
Message:

HTTP API: Add the URL as a paramter to various HTTP related filters.

Props paulschreiber, purnendu

Fixes #42186

Location:
trunk/src/wp-includes
Files:
4 edited

Legend:

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

    r42343 r42682  
    153153             *
    154154             * @since 2.7.0
    155              *
    156              * @param int $timeout_value Time in seconds until a request times out.
    157              *                           Default 5.
     155             * @since 5.0.0 The `$url` parameter was added.
     156             *
     157             * @param int    $timeout_value Time in seconds until a request times out. Default 5.
     158             * @param string $url           The request URL.
    158159             */
    159             'timeout'             => apply_filters( 'http_request_timeout', 5 ),
     160            'timeout'             => apply_filters( 'http_request_timeout', 5, $url ),
    160161            /**
    161162             * Filters the number of redirects allowed during an HTTP request.
    162163             *
    163164             * @since 2.7.0
    164              *
    165              * @param int $redirect_count Number of redirects allowed. Default 5.
     165             * @since 5.0.0 The `$url` parameter was added.
     166             *
     167             * @param int    $redirect_count Number of redirects allowed. Default 5.
     168             * @param string $url            The request URL.
    166169             */
    167             'redirection'         => apply_filters( 'http_request_redirection_count', 5 ),
     170            'redirection'         => apply_filters( 'http_request_redirection_count', 5, $url ),
    168171            /**
    169172             * Filters the version of the HTTP protocol used in a request.
    170173             *
    171174             * @since 2.7.0
    172              *
    173              * @param string $version Version of HTTP used. Accepts '1.0' and '1.1'.
    174              *                        Default '1.0'.
     175             * @since 5.0.0 The `$url` parameter was added.
     176             *
     177             * @param string $version Version of HTTP used. Accepts '1.0' and '1.1'. Default '1.0'.
     178             * @param string $url     The request URL.
    175179             */
    176             'httpversion'         => apply_filters( 'http_request_version', '1.0' ),
     180            'httpversion'         => apply_filters( 'http_request_version', '1.0', $url ),
    177181            /**
    178182             * Filters the user agent value sent with an HTTP request.
    179183             *
    180184             * @since 2.7.0
     185             * @since 5.0.0 The `$url` parameter was added.
    181186             *
    182187             * @param string $user_agent WordPress user agent string.
     188             * @param string $url        The request URL.
    183189             */
    184             'user-agent'          => apply_filters( 'http_headers_useragent', 'WordPress/' . get_bloginfo( 'version' ) . '; ' . get_bloginfo( 'url' ) ),
     190            'user-agent'          => apply_filters( 'http_headers_useragent', 'WordPress/' . get_bloginfo( 'version' ) . '; ' . get_bloginfo( 'url' ), $url ),
    185191            /**
    186192             * Filters whether to pass URLs through wp_http_validate_url() in an HTTP request.
    187193             *
    188194             * @since 3.6.0
    189              *
    190              * @param bool $pass_url Whether to pass URLs through wp_http_validate_url().
    191              *                       Default false.
     195             * @since 5.0.0 The `$url` parameter was added.
     196             *
     197             * @param bool   $pass_url Whether to pass URLs through wp_http_validate_url(). Default false.
     198             * @param string $url      The request URL.
    192199             */
    193             'reject_unsafe_urls'  => apply_filters( 'http_request_reject_unsafe_urls', false ),
     200            'reject_unsafe_urls'  => apply_filters( 'http_request_reject_unsafe_urls', false, $url ),
    194201            'blocking'            => true,
    195202            'headers'             => array(),
     
    351358         *
    352359         * @since 2.8.0
    353          *
    354          * @param bool $ssl_verify Whether to verify the SSL connection. Default true.
     360         * @since 5.0.0 The `$url` parameter was added.
     361         *
     362         * @param bool   $ssl_verify Whether to verify the SSL connection. Default true.
     363         * @param string $url        The request URL.
    355364         */
    356         $options['verify'] = apply_filters( 'https_ssl_verify', $options['verify'] );
     365        $options['verify'] = apply_filters( 'https_ssl_verify', $options['verify'], $url );
    357366
    358367        // Check for proxies.
  • trunk/src/wp-includes/class-wp-http-curl.php

    r42681 r42682  
    114114        if ( $is_local ) {
    115115            /** This filter is documented in wp-includes/class-wp-http-streams.php */
    116             $ssl_verify = apply_filters( 'https_local_ssl_verify', $ssl_verify );
     116            $ssl_verify = apply_filters( 'https_local_ssl_verify', $ssl_verify, $url );
    117117        } elseif ( ! $is_local ) {
    118118            /** This filter is documented in wp-includes/class-http.php */
    119             $ssl_verify = apply_filters( 'https_ssl_verify', $ssl_verify );
     119            $ssl_verify = apply_filters( 'https_ssl_verify', $ssl_verify, $url );
    120120        }
    121121
  • trunk/src/wp-includes/class-wp-http-streams.php

    r42681 r42682  
    9898             *
    9999             * @since 2.8.0
     100             * @since 5.0.0 The `$url` parameter was added.
    100101             *
    101              * @param bool $ssl_verify Whether to verify the SSL connection. Default true.
     102             * @param bool   $ssl_verify Whether to verify the SSL connection. Default true.
     103             * @param string $url        The request URL.
    102104             */
    103             $ssl_verify = apply_filters( 'https_local_ssl_verify', $ssl_verify );
     105            $ssl_verify = apply_filters( 'https_local_ssl_verify', $ssl_verify, $url );
    104106        } elseif ( ! $is_local ) {
    105107            /** This filter is documented in wp-includes/class-http.php */
    106             $ssl_verify = apply_filters( 'https_ssl_verify', $ssl_verify );
     108            $ssl_verify = apply_filters( 'https_ssl_verify', $ssl_verify, $url );
    107109        }
    108110
  • trunk/src/wp-includes/class-wp-xmlrpc-server.php

    r42648 r42682  
    67456745
    67466746        /** This filter is documented in wp-includes/class-http.php */
    6747         $user_agent = apply_filters( 'http_headers_useragent', 'WordPress/' . get_bloginfo( 'version' ) . '; ' . get_bloginfo( 'url' ) );
     6747        $user_agent = apply_filters( 'http_headers_useragent', 'WordPress/' . get_bloginfo( 'version' ) . '; ' . get_bloginfo( 'url' ), $url );
    67486748
    67496749        // Let's check the remote site
Note: See TracChangeset for help on using the changeset viewer.