summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2013-05-29 12:02:54 -0700
committerAndrew Dolgov <[email protected]>2013-05-29 12:02:54 -0700
commit102a36c233a8897d38110bad3ece6fc07dfdcd03 (patch)
treeeb4d3ed7d73a842d6c940ed7aead144575652666 /include
parent2505aea5f3b8eb0e79f10566c21857d4237384d2 (diff)
parent40a35a628dffe559df0da8abae2ae09808011d53 (diff)
Merge pull request #212 from hoelzro/master
Fix self-signed certificate issue (issue 698)
Diffstat (limited to 'include')
-rw-r--r--include/functions.php17
1 files changed, 15 insertions, 2 deletions
diff --git a/include/functions.php b/include/functions.php
index bad01eb96..8dc109f99 100644
--- a/include/functions.php
+++ b/include/functions.php
@@ -317,7 +317,12 @@
$fetch_curl_used = true;
if (ini_get("safe_mode") || ini_get("open_basedir")) {
- $ch = curl_init(geturl($url));
+ $new_url = geturl($url);
+ if (!$new_url) {
+ // geturl has already populated $fetch_last_error
+ return false;
+ }
+ $ch = curl_init($new_url);
} else {
$ch = curl_init($url);
}
@@ -4096,14 +4101,15 @@
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
//curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); //CURLOPT_FOLLOWLOCATION Disabled...
curl_setopt($curl, CURLOPT_TIMEOUT, 60);
+ curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
$html = curl_exec($curl);
$status = curl_getinfo($curl);
- curl_close($curl);
if($status['http_code']!=200){
if($status['http_code'] == 301 || $status['http_code'] == 302) {
+ curl_close($curl);
list($header) = explode("\r\n\r\n", $html, 2);
$matches = array();
preg_match("/(Location:|URI:)[^(\n)]*/", $header, $matches);
@@ -4111,6 +4117,12 @@
$url_parsed = parse_url($url);
return (isset($url_parsed))? geturl($url):'';
}
+
+ global $fetch_last_error;
+
+ $fetch_last_error = curl_errno($curl) . " " . curl_error($curl);
+ curl_close($curl);
+
$oline='';
foreach($status as $key=>$eline){$oline.='['.$key.']'.$eline.' ';}
$line =$oline." \r\n ".$url."\r\n-----------------\r\n";
@@ -4118,6 +4130,7 @@
# fwrite($handle, $line);
return FALSE;
}
+ curl_close($curl);
return $url;
}