Longer default timeouts, more filters and other HTTP changes.

git-svn-id: https://develop.svn.wordpress.org/trunk@9188 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Peter Westwood 2008-10-15 20:36:23 +00:00
parent 6385463926
commit 6bbd750157
1 changed files with 13 additions and 12 deletions

View File

@ -183,14 +183,17 @@ class WP_Http {
global $wp_version; global $wp_version;
$defaults = array( $defaults = array(
'method' => 'GET', 'timeout' => apply_filters('http_request_timeout', 3), 'method' => 'GET',
'redirection' => 5, 'httpversion' => '1.0', 'timeout' => apply_filters( 'http_request_timeout', 5),
'redirection' => apply_filters( 'http_request_redirection_count', 5),
'httpversion' => apply_filters( 'http_request_version', '1.0'),
'user-agent' => apply_filters( 'http_headers_useragent', 'WordPress/' . $wp_version ), 'user-agent' => apply_filters( 'http_headers_useragent', 'WordPress/' . $wp_version ),
'blocking' => true, 'blocking' => true,
'headers' => array(), 'body' => null 'headers' => array(), 'body' => null
); );
$r = wp_parse_args( $args, $defaults ); $r = wp_parse_args( $args, $defaults );
$r = apply_filters( 'http_request_args', $r );
if ( is_null( $r['headers'] ) ) if ( is_null( $r['headers'] ) )
$r['headers'] = array(); $r['headers'] = array();
@ -423,7 +426,7 @@ class WP_Http_Fsockopen {
*/ */
function request($url, $args = array()) { function request($url, $args = array()) {
$defaults = array( $defaults = array(
'method' => 'GET', 'timeout' => 3, 'method' => 'GET', 'timeout' => 5,
'redirection' => 5, 'httpversion' => '1.0', 'redirection' => 5, 'httpversion' => '1.0',
'blocking' => true, 'blocking' => true,
'headers' => array(), 'body' => null 'headers' => array(), 'body' => null
@ -597,7 +600,7 @@ class WP_Http_Fopen {
global $http_response_header; global $http_response_header;
$defaults = array( $defaults = array(
'method' => 'GET', 'timeout' => 3, 'method' => 'GET', 'timeout' => 5,
'redirection' => 5, 'httpversion' => '1.0', 'redirection' => 5, 'httpversion' => '1.0',
'blocking' => true, 'blocking' => true,
'headers' => array(), 'body' => null 'headers' => array(), 'body' => null
@ -691,7 +694,7 @@ class WP_Http_Streams {
*/ */
function request($url, $args = array()) { function request($url, $args = array()) {
$defaults = array( $defaults = array(
'method' => 'GET', 'timeout' => 3, 'method' => 'GET', 'timeout' => 5,
'redirection' => 5, 'httpversion' => '1.0', 'redirection' => 5, 'httpversion' => '1.0',
'blocking' => true, 'blocking' => true,
'headers' => array(), 'body' => null 'headers' => array(), 'body' => null
@ -815,7 +818,7 @@ class WP_Http_ExtHTTP {
*/ */
function request($url, $args = array()) { function request($url, $args = array()) {
$defaults = array( $defaults = array(
'method' => 'GET', 'timeout' => 3, 'method' => 'GET', 'timeout' => 5,
'redirection' => 5, 'httpversion' => '1.0', 'redirection' => 5, 'httpversion' => '1.0',
'blocking' => true, 'blocking' => true,
'headers' => array(), 'body' => null 'headers' => array(), 'body' => null
@ -832,15 +835,13 @@ class WP_Http_ExtHTTP {
} }
switch ( $r['method'] ) { switch ( $r['method'] ) {
case 'GET':
$r['method'] = HTTP_METH_GET;
break;
case 'POST': case 'POST':
$r['method'] = HTTP_METH_POST; $r['method'] = HTTP_METH_POST;
break; break;
case 'HEAD': case 'HEAD':
$r['method'] = HTTP_METH_HEAD; $r['method'] = HTTP_METH_HEAD;
break; break;
case 'GET':
default: default:
$r['method'] = HTTP_METH_GET; $r['method'] = HTTP_METH_GET;
} }
@ -924,7 +925,7 @@ class WP_Http_Curl {
*/ */
function request($url, $args = array()) { function request($url, $args = array()) {
$defaults = array( $defaults = array(
'method' => 'GET', 'timeout' => 3, 'method' => 'GET', 'timeout' => 5,
'redirection' => 5, 'httpversion' => '1.0', 'redirection' => 5, 'httpversion' => '1.0',
'blocking' => true, 'blocking' => true,
'headers' => array(), 'body' => null 'headers' => array(), 'body' => null