Make WordPress Core


Ignore:
Timestamp:
10/27/2013 09:09:49 PM (13 years ago)
Author:
nacin
Message:

When an HTTPS request to api.wordpress.org fails, try an insecure HTTP request and issue a warning.

Certain versions of cURL appear to claim OpenSSL support but fail to work. We need to not trap users on older versions while we work this out, and instead fall back to an insecure request.

Merges [25956] to the 3.7 branch.
fixes #25716 for the 3.7 branch.

Location:
branches/3.7
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/3.7

  • branches/3.7/src

  • branches/3.7/src/wp-admin/includes/theme.php

    r25308 r25957  
    283283
    284284        if ( ! $res ) {
    285                 $url = 'http://api.wordpress.org/themes/info/1.0/';
    286                 if ( wp_http_supports( array( 'ssl' ) ) )
     285                $url = $http_url = 'http://api.wordpress.org/themes/info/1.0/';
     286                if ( $ssl = wp_http_supports( array( 'ssl' ) ) )
    287287                        $url = set_url_scheme( $url, 'https' );
    288288
    289                 $request = wp_remote_post( $url, array(
     289                $args = array(
    290290                        'body' => array(
    291291                                'action' => $action,
    292292                                'request' => serialize( $args )
    293293                        )
    294                 ) );
     294                );
     295                $request = wp_remote_post( $url, $args );
     296
     297                if ( $ssl && is_wp_error( $request ) ) {
     298                        trigger_error( __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="http://wordpress.org/support/">support forums</a>.' ) . ' ' . '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)', headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE );
     299                        $request = wp_remote_post( $http_url, $args );
     300                }
    295301
    296302                if ( is_wp_error($request) ) {
Note: See TracChangeset for help on using the changeset viewer.