WordPress.org

Make WordPress Core

Ticket #9998: 9998.diff

File 9998.diff, 3.6 KB (added by dd32, 9 years ago)
  • wp-includes/http.php

     
    7373         * Tests all of the objects and returns the object that passes. Also caches
    7474         * that object to be used later.
    7575         *
    76          * The order for the GET/HEAD requests are Streams, HTTP Extension, Fopen,
    77          * and finally Fsockopen. fsockopen() is used last, because it has the most
    78          * overhead in its implementation. There isn't any real way around it, since
    79          * redirects have to be supported, much the same way the other transports
    80          * also handle redirects.
     76         * The order for the GET/HEAD requests are HTTP Extension, FSockopen Streams,
     77         * Fopen, and finally cURL. Whilst Fsockopen has the highest overhead, Its
     78         * used 2nd due to high compatibility with most hosts, The HTTP Extension is
     79         * tested first due to hosts which have it enabled, are likely to work
     80         * correctly with it.
    8181         *
    8282         * There are currently issues with "localhost" not resolving correctly with
    8383         * DNS. This may cause an error "failed to open stream: A connection attempt
     
    9898                        if ( true === WP_Http_ExtHttp::test($args) ) {
    9999                                $working_transport['exthttp'] = new WP_Http_ExtHttp();
    100100                                $blocking_transport[] = &$working_transport['exthttp'];
    101                         } else if ( true === WP_Http_Curl::test($args) ) {
    102                                 $working_transport['curl'] = new WP_Http_Curl();
    103                                 $blocking_transport[] = &$working_transport['curl'];
     101                        } else if ( true === WP_Http_Fsockopen::test($args) ) {
     102                                $working_transport['fsockopen'] = new WP_Http_Fsockopen();
     103                                $blocking_transport[] = &$working_transport['fsockopen'];
    104104                        } else if ( true === WP_Http_Streams::test($args) ) {
    105105                                $working_transport['streams'] = new WP_Http_Streams();
    106106                                $blocking_transport[] = &$working_transport['streams'];
    107107                        } else if ( true === WP_Http_Fopen::test($args) ) {
    108108                                $working_transport['fopen'] = new WP_Http_Fopen();
    109109                                $blocking_transport[] = &$working_transport['fopen'];
    110                         } else if ( true === WP_Http_Fsockopen::test($args) ) {
    111                                 $working_transport['fsockopen'] = new WP_Http_Fsockopen();
    112                                 $blocking_transport[] = &$working_transport['fsockopen'];
     110                        } else if ( true === WP_Http_Curl::test($args) ) {
     111                                $working_transport['curl'] = new WP_Http_Curl();
     112                                $blocking_transport[] = &$working_transport['curl'];
    113113                        }
    114114
    115115                        foreach ( array('curl', 'streams', 'fopen', 'fsockopen', 'exthttp') as $transport ) {
     
    149149                        if ( true === WP_Http_ExtHttp::test($args) ) {
    150150                                $working_transport['exthttp'] = new WP_Http_ExtHttp();
    151151                                $blocking_transport[] = &$working_transport['exthttp'];
     152                        } else if ( true === WP_Http_Fsockopen::test($args) ) {
     153                                $working_transport['fsockopen'] = new WP_Http_Fsockopen();
     154                                $blocking_transport[] = &$working_transport['fsockopen'];
     155                        } else if ( true === WP_Http_Streams::test($args) ) {
     156                                $working_transport['streams'] = new WP_Http_Streams();
     157                                $blocking_transport[] = &$working_transport['streams'];
    152158                        } else if ( true === WP_Http_Curl::test($args) ) {
    153159                                $working_transport['curl'] = new WP_Http_Curl();
    154160                                $blocking_transport[] = &$working_transport['curl'];
    155                         } else if ( true === WP_Http_Streams::test($args) ) {
    156                                 $working_transport['streams'] = new WP_Http_Streams();
    157                                 $blocking_transport[] = &$working_transport['streams'];
    158                         } else if ( true === WP_Http_Fsockopen::test($args) ) {
    159                                 $working_transport['fsockopen'] = new WP_Http_Fsockopen();
    160                                 $blocking_transport[] = &$working_transport['fsockopen'];
    161161                        }
    162162
    163163                        foreach ( array('curl', 'streams', 'fsockopen', 'exthttp') as $transport ) {