summaryrefslogtreecommitdiffstats
path: root/wp-includes/functions.php
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2007-01-16 21:27:04 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2007-01-16 21:27:04 +0000
commit72e9496bfc2f7a962cf4f428ccab25c7a0175aaa (patch)
treeaf3e2ca7136c77140d9e9201e3f495a4b8e7a6da /wp-includes/functions.php
parent04b67169db33e30f5ca63dbbafe551fdc6fb2164 (diff)
downloadwordpress-mu-72e9496bfc2f7a962cf4f428ccab25c7a0175aaa.tar.gz
wordpress-mu-72e9496bfc2f7a962cf4f428ccab25c7a0175aaa.tar.xz
wordpress-mu-72e9496bfc2f7a962cf4f428ccab25c7a0175aaa.zip
WP Merge to rev 4753
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@849 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-includes/functions.php')
-rw-r--r--wp-includes/functions.php18
1 files changed, 15 insertions, 3 deletions
diff --git a/wp-includes/functions.php b/wp-includes/functions.php
index 4f103e9..bb7965e 100644
--- a/wp-includes/functions.php
+++ b/wp-includes/functions.php
@@ -791,10 +791,21 @@ function add_magic_quotes($array) {
}
function wp_remote_fopen( $uri ) {
+ $timeout = 10;
+ $parsed_url = @parse_url($uri);
+
+ if ( !$parsed_url || !is_array($parsed_url) )
+ return false;
+
+ if ( !isset($parsed_url['scheme']) || !in_array($parsed_url['scheme'], array('http','https')) )
+ $uri = 'http://' . $uri;
+
if ( ini_get('allow_url_fopen') ) {
$fp = @fopen( $uri, 'r' );
if ( !$fp )
return false;
+
+ //stream_set_timeout($fp, $timeout); // Requires php 4.3
$linea = '';
while( $remote_read = fread($fp, 4096) )
$linea .= $remote_read;
@@ -805,6 +816,7 @@ function wp_remote_fopen( $uri ) {
curl_setopt ($handle, CURLOPT_URL, $uri);
curl_setopt ($handle, CURLOPT_CONNECTTIMEOUT, 1);
curl_setopt ($handle, CURLOPT_RETURNTRANSFER, 1);
+ curl_setopt ($handle, CURLOPT_TIMEOUT, $timeout);
$buffer = curl_exec($handle);
curl_close($handle);
return $buffer;
@@ -833,10 +845,10 @@ function status_header( $header ) {
elseif ( 410 == $header )
$text = 'Gone';
-// if ( substr(php_sapi_name(), 0, 3) == 'cgi' )
+ if ( version_compare(phpversion(), '4.3.0', '>=') )
+ @header("HTTP/1.1 $header $text", true, $header);
+ else
@header("HTTP/1.1 $header $text");
-// else
-// @header("Status: $header $text");
}
function nocache_headers() {