From 5224736c9954853af344b7c7da5060bb00280cf8 Mon Sep 17 00:00:00 2001 From: westi Date: Wed, 15 Oct 2008 20:36:23 +0000 Subject: [PATCH] Longer default timeouts, more filters and other HTTP changes. git-svn-id: http://svn.automattic.com/wordpress/trunk@9188 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/http.php | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/wp-includes/http.php b/wp-includes/http.php index 911ba50b0..17e6667ce 100644 --- a/wp-includes/http.php +++ b/wp-includes/http.php @@ -183,15 +183,18 @@ class WP_Http { global $wp_version; $defaults = array( - 'method' => 'GET', 'timeout' => apply_filters('http_request_timeout', 3), - 'redirection' => 5, 'httpversion' => '1.0', - 'user-agent' => apply_filters('http_headers_useragent', 'WordPress/' . $wp_version ), + 'method' => 'GET', + '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 ), 'blocking' => true, 'headers' => array(), 'body' => null ); $r = wp_parse_args( $args, $defaults ); - + $r = apply_filters( 'http_request_args', $r ); + if ( is_null( $r['headers'] ) ) $r['headers'] = array(); @@ -423,7 +426,7 @@ class WP_Http_Fsockopen { */ function request($url, $args = array()) { $defaults = array( - 'method' => 'GET', 'timeout' => 3, + 'method' => 'GET', 'timeout' => 5, 'redirection' => 5, 'httpversion' => '1.0', 'blocking' => true, 'headers' => array(), 'body' => null @@ -597,7 +600,7 @@ class WP_Http_Fopen { global $http_response_header; $defaults = array( - 'method' => 'GET', 'timeout' => 3, + 'method' => 'GET', 'timeout' => 5, 'redirection' => 5, 'httpversion' => '1.0', 'blocking' => true, 'headers' => array(), 'body' => null @@ -691,7 +694,7 @@ class WP_Http_Streams { */ function request($url, $args = array()) { $defaults = array( - 'method' => 'GET', 'timeout' => 3, + 'method' => 'GET', 'timeout' => 5, 'redirection' => 5, 'httpversion' => '1.0', 'blocking' => true, 'headers' => array(), 'body' => null @@ -815,7 +818,7 @@ class WP_Http_ExtHTTP { */ function request($url, $args = array()) { $defaults = array( - 'method' => 'GET', 'timeout' => 3, + 'method' => 'GET', 'timeout' => 5, 'redirection' => 5, 'httpversion' => '1.0', 'blocking' => true, 'headers' => array(), 'body' => null @@ -832,15 +835,13 @@ class WP_Http_ExtHTTP { } switch ( $r['method'] ) { - case 'GET': - $r['method'] = HTTP_METH_GET; - break; case 'POST': $r['method'] = HTTP_METH_POST; break; case 'HEAD': $r['method'] = HTTP_METH_HEAD; break; + case 'GET': default: $r['method'] = HTTP_METH_GET; } @@ -924,7 +925,7 @@ class WP_Http_Curl { */ function request($url, $args = array()) { $defaults = array( - 'method' => 'GET', 'timeout' => 3, + 'method' => 'GET', 'timeout' => 5, 'redirection' => 5, 'httpversion' => '1.0', 'blocking' => true, 'headers' => array(), 'body' => null