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/class-wp-community-events.php

    r41316 r41605  
    9393        }
    9494
    95         $api_url        = 'https://api.wordpress.org/events/1.0/';
    96         $request_args   = $this->get_request_args( $location_search, $timezone );
     95        // include an unmodified $wp_version
     96        include( ABSPATH . WPINC . '/version.php' );
     97
     98        $api_url      = 'http://api.wordpress.org/events/1.0/';
     99        $request_args = $this->get_request_args( $location_search, $timezone );
     100        $request_args['user-agent'] = 'WordPress/' . $wp_version . '; ' . home_url( '/' );
     101
     102        if ( wp_http_supports( array( 'ssl' ) ) ) {
     103            $api_url = set_url_scheme( $api_url, 'https' );
     104        }
     105
    97106        $response       = wp_remote_get( $api_url, $request_args );
    98107        $response_code  = wp_remote_retrieve_response_code( $response );
Note: See TracChangeset for help on using the changeset viewer.