Make WordPress Core


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

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

Props paulschreiber, purnendu

Fixes #42186

File:
1 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.
Note: See TracChangeset for help on using the changeset viewer.