WordPress.org

Make WordPress Core


Ignore:
Timestamp:
09/27/2017 07:59:14 AM (3 years ago)
Author:
dd32
Message:

Standardise on performing api.WordPress.org requests over SSL when possible, falling back to non-SSL when appropriate.
This also standardises the User-Agent used when communicating with WordPress.org, allowing for more consistent version detection.

Fixes #42004.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/credits.php

    r38705 r41605  
    1616 */
    1717function wp_credits() {
    18     $wp_version = get_bloginfo( 'version' );
     18    // include an unmodified $wp_version
     19    include( ABSPATH . WPINC . '/version.php' );
     20
    1921    $locale = get_user_locale();
    2022
     
    2527        || ( isset( $results['data']['version'] ) && strpos( $wp_version, $results['data']['version'] ) !== 0 )
    2628    ) {
    27         $response = wp_remote_get( "http://api.wordpress.org/core/credits/1.1/?version={$wp_version}&locale={$locale}" );
     29        $url = "http://api.wordpress.org/core/credits/1.1/?version={$wp_version}&locale={$locale}";
     30        $options = array( 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url( '/' ) );
     31
     32        if ( wp_http_supports( array( 'ssl' ) ) ) {
     33            $url = set_url_scheme( $url, 'https' );
     34        }
     35
     36        $response = wp_remote_get( $url, $options );
    2837
    2938        if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) )
Note: See TracChangeset for help on using the changeset viewer.