WordPress.org

Make WordPress Core

Ticket #29079: http-args-separated.patch

File http-args-separated.patch, 2.6 KB (added by Corphi, 7 years ago)

Separate query args, use as additional filter parameter.

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

     
    337337                if ( $ssl = wp_http_supports( array( 'ssl' ) ) )
    338338                        $url = set_url_scheme( $url, 'https' );
    339339
    340                 $args = array(
     340                $http_args = array(
    341341                        'body' => array(
    342342                                'action' => $action,
    343343                                'request' => serialize( $args )
    344344                        )
    345345                );
    346                 $request = wp_remote_post( $url, $args );
     346                $request = wp_remote_post( $url, $http_args );
    347347
    348348                if ( $ssl && is_wp_error( $request ) ) {
    349349                        if ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) {
    350350                                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="https://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 );
    351351                        }
    352                         $request = wp_remote_post( $http_url, $args );
     352                        $request = wp_remote_post( $http_url, $http_args );
    353353                }
    354354
    355355                if ( is_wp_error($request) ) {
     
    359359                        if ( ! is_object( $res ) && ! is_array( $res ) )
    360360                                $res = new WP_Error('themes_api_failed', __( '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="https://wordpress.org/support/">support forums</a>.' ), wp_remote_retrieve_body( $request ) );
    361361                }
     362        } else {
     363                $http_args = array();
    362364        }
    363365
    364366        /**
     
    366368         *
    367369         * @since 2.8.0
    368370         *
    369          * @param array|object $res    WordPress.org Themes API response.
    370          * @param string       $action Requested action. Likely values are 'theme_information',
    371          *                             'feature_list', or 'query_themes'.
    372          * @param object       $args   Arguments used to query for installer pages from the WordPress.org Themes API.
     371         * @param array|object $res       WordPress.org Themes API response.
     372         * @param string       $action    Requested action. Likely values are 'theme_information',
     373         *                                'feature_list', or 'query_themes'.
     374         * @param object       $args      Arguments used to query for installer pages from the WordPress.org Themes API.
     375         * @param array        $http_args HTTP request arguments used for native query, if any.
    373376         */
    374         return apply_filters( 'themes_api_result', $res, $action, $args );
     377        return apply_filters( 'themes_api_result', $res, $action, $args, $http_args );
    375378}
    376379
    377380/**