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/import.php

    r38705 r41605  
    132132    if ( ! $popular_importers ) {
    133133        $url = add_query_arg( array(
    134             'locale'  => get_user_locale(),
     134            'locale'  => $locale,
    135135            'version' => $wp_version,
    136136        ), 'http://api.wordpress.org/core/importers/1.1/' );
    137         $options = array( 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url() );
     137        $options = array( 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url( '/' ) );
     138
     139        if ( wp_http_supports( array( 'ssl' ) ) ) {
     140            $url = set_url_scheme( $url, 'https' );
     141        }
     142
    138143        $response = wp_remote_get( $url, $options );
    139144        $popular_importers = json_decode( wp_remote_retrieve_body( $response ), true );
Note: See TracChangeset for help on using the changeset viewer.