WordPress.org

Make WordPress Core

Ticket #25747: 25747.diff

File 25747.diff, 1.1 KB (added by johnbillion, 6 years ago)
  • wp-includes/class-http.php

    diff --git wp-includes/class-http.php wp-includes/class-http.php
    index c75b47e..fbf0e80 100644
    class WP_Http { 
    256256                static $transports = array();
    257257
    258258                $class = $this->_get_first_available_transport( $args, $url );
    259                 if ( !$class )
    260                         return new WP_Error( 'http_failure', __( 'There are no HTTP transports available which can complete the requested request.' ) );
     259                if ( !$class ) {
     260                        $response = new WP_Error( 'http_failure', __( 'There are no HTTP transports available which can complete the requested request.' ) );
     261                } else {
     262
     263                        // Transport claims to support request, instantiate it and give it a whirl.
     264                        if ( empty( $transports[$class] ) )
     265                                $transports[$class] = new $class;
    261266
    262                 // Transport claims to support request, instantiate it and give it a whirl.
    263                 if ( empty( $transports[$class] ) )
    264                         $transports[$class] = new $class;
     267                        $response = $transports[$class]->request( $url, $args );
    265268
    266                 $response = $transports[$class]->request( $url, $args );
     269                }
    267270
    268271                do_action( 'http_api_debug', $response, 'response', $class, $args, $url );
    269272