Preferred transport: move curl to last position and fockopen to 2nd position due to higher compatibility, props DD32, fixes #9998

git-svn-id: http://svn.automattic.com/wordpress/trunk@11524 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
azaozz 2009-06-06 06:51:35 +00:00
parent 75eb453e8c
commit 782b2624e3
1 changed files with 17 additions and 17 deletions

View File

@ -73,11 +73,11 @@ class WP_Http {
* Tests all of the objects and returns the object that passes. Also caches * Tests all of the objects and returns the object that passes. Also caches
* that object to be used later. * that object to be used later.
* *
* The order for the GET/HEAD requests are Streams, HTTP Extension, Fopen, * The order for the GET/HEAD requests are HTTP Extension, FSockopen Streams,
* and finally Fsockopen. fsockopen() is used last, because it has the most * Fopen, and finally cURL. Whilst Fsockopen has the highest overhead, Its
* overhead in its implementation. There isn't any real way around it, since * used 2nd due to high compatibility with most hosts, The HTTP Extension is
* redirects have to be supported, much the same way the other transports * tested first due to hosts which have it enabled, are likely to work
* also handle redirects. * correctly with it.
* *
* There are currently issues with "localhost" not resolving correctly with * There are currently issues with "localhost" not resolving correctly with
* DNS. This may cause an error "failed to open stream: A connection attempt * DNS. This may cause an error "failed to open stream: A connection attempt
@ -98,18 +98,18 @@ class WP_Http {
if ( true === WP_Http_ExtHttp::test($args) ) { if ( true === WP_Http_ExtHttp::test($args) ) {
$working_transport['exthttp'] = new WP_Http_ExtHttp(); $working_transport['exthttp'] = new WP_Http_ExtHttp();
$blocking_transport[] = &$working_transport['exthttp']; $blocking_transport[] = &$working_transport['exthttp'];
} else if ( true === WP_Http_Curl::test($args) ) { } else if ( true === WP_Http_Fsockopen::test($args) ) {
$working_transport['curl'] = new WP_Http_Curl(); $working_transport['fsockopen'] = new WP_Http_Fsockopen();
$blocking_transport[] = &$working_transport['curl']; $blocking_transport[] = &$working_transport['fsockopen'];
} else if ( true === WP_Http_Streams::test($args) ) { } else if ( true === WP_Http_Streams::test($args) ) {
$working_transport['streams'] = new WP_Http_Streams(); $working_transport['streams'] = new WP_Http_Streams();
$blocking_transport[] = &$working_transport['streams']; $blocking_transport[] = &$working_transport['streams'];
} else if ( true === WP_Http_Fopen::test($args) ) { } else if ( true === WP_Http_Fopen::test($args) ) {
$working_transport['fopen'] = new WP_Http_Fopen(); $working_transport['fopen'] = new WP_Http_Fopen();
$blocking_transport[] = &$working_transport['fopen']; $blocking_transport[] = &$working_transport['fopen'];
} else if ( true === WP_Http_Fsockopen::test($args) ) { } else if ( true === WP_Http_Curl::test($args) ) {
$working_transport['fsockopen'] = new WP_Http_Fsockopen(); $working_transport['curl'] = new WP_Http_Curl();
$blocking_transport[] = &$working_transport['fsockopen']; $blocking_transport[] = &$working_transport['curl'];
} }
foreach ( array('curl', 'streams', 'fopen', 'fsockopen', 'exthttp') as $transport ) { foreach ( array('curl', 'streams', 'fopen', 'fsockopen', 'exthttp') as $transport ) {
@ -149,15 +149,15 @@ class WP_Http {
if ( true === WP_Http_ExtHttp::test($args) ) { if ( true === WP_Http_ExtHttp::test($args) ) {
$working_transport['exthttp'] = new WP_Http_ExtHttp(); $working_transport['exthttp'] = new WP_Http_ExtHttp();
$blocking_transport[] = &$working_transport['exthttp']; $blocking_transport[] = &$working_transport['exthttp'];
} else if ( true === WP_Http_Curl::test($args) ) {
$working_transport['curl'] = new WP_Http_Curl();
$blocking_transport[] = &$working_transport['curl'];
} else if ( true === WP_Http_Streams::test($args) ) {
$working_transport['streams'] = new WP_Http_Streams();
$blocking_transport[] = &$working_transport['streams'];
} else if ( true === WP_Http_Fsockopen::test($args) ) { } else if ( true === WP_Http_Fsockopen::test($args) ) {
$working_transport['fsockopen'] = new WP_Http_Fsockopen(); $working_transport['fsockopen'] = new WP_Http_Fsockopen();
$blocking_transport[] = &$working_transport['fsockopen']; $blocking_transport[] = &$working_transport['fsockopen'];
} else if ( true === WP_Http_Streams::test($args) ) {
$working_transport['streams'] = new WP_Http_Streams();
$blocking_transport[] = &$working_transport['streams'];
} else if ( true === WP_Http_Curl::test($args) ) {
$working_transport['curl'] = new WP_Http_Curl();
$blocking_transport[] = &$working_transport['curl'];
} }
foreach ( array('curl', 'streams', 'fsockopen', 'exthttp') as $transport ) { foreach ( array('curl', 'streams', 'fsockopen', 'exthttp') as $transport ) {