Make WordPress Core


Ignore:
Timestamp:
09/27/2017 07:59:14 AM (9 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/dashboard.php

    r41200 r41605  
    15101510
    15111511        if ( false === ($response = get_site_transient('browser_' . $key) ) ) {
     1512                // include an unmodified $wp_version
     1513                include( ABSPATH . WPINC . '/version.php' );
     1514
     1515                $url = 'http://api.wordpress.org/core/browse-happy/1.1/';
    15121516                $options = array(
    1513                         'body'                  => array( 'useragent' => $_SERVER['HTTP_USER_AGENT'] ),
    1514                         'user-agent'    => 'WordPress/' . get_bloginfo( 'version' ) . '; ' . home_url()
     1517                        'body'       => array( 'useragent' => $_SERVER['HTTP_USER_AGENT'] ),
     1518                        'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url( '/' )
    15151519                );
    15161520
    1517                 $response = wp_remote_post( 'http://api.wordpress.org/core/browse-happy/1.1/', $options );
     1521                if ( wp_http_supports( array( 'ssl' ) ) ) {
     1522                        $url = set_url_scheme( $url, 'https' );
     1523                }
     1524
     1525                $response = wp_remote_post( $url, $options );
    15181526
    15191527                if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) )
Note: See TracChangeset for help on using the changeset viewer.