summaryrefslogtreecommitdiffstats
path: root/wp-includes/functions.php
diff options
context:
space:
mode:
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() {