From: poltawski Date: Fri, 19 Oct 2007 11:45:21 +0000 (+0000) Subject: MDL-11766 download_file_content is quite broken with proxies - lacking global X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=e27f076535c2d5aa47bf616201c4b5881347232f;p=moodle.git MDL-11766 download_file_content is quite broken with proxies - lacking global CFG definition, so must never have worked, also incorrectly specified proxyhost.. Merged from MOODLE_19_STABLE --- diff --git a/lib/filelib.php b/lib/filelib.php index c9a7846745..059bab450f 100644 --- a/lib/filelib.php +++ b/lib/filelib.php @@ -10,15 +10,17 @@ define('BYTESERVING_BOUNDARY', 's1k2o3d4a5k6s7'); //unique string constant * @return mixed false if request failed or content of the file as string if ok. */ function download_file_content($url) { + global $CFG; + $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HEADER, false); if (!empty($CFG->proxyhost)) { curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, true); if (empty($CFG->proxyport)) { - curl_setopt($ch, CURLOPT_PROXY, $CFG->proxy); + curl_setopt($ch, CURLOPT_PROXY, $CFG->proxyhost); } else { - curl_setopt($ch, CURLOPT_PROXY, $CFG->proxy.':'.$CFG->proxyport); + curl_setopt($ch, CURLOPT_PROXY, $CFG->proxyhost.':'.$CFG->proxyport); } if(!empty($CFG->proxyuser) and !empty($CFG->proxypassword)) { curl_setopt($ch, CURLOPT_PROXYUSERPWD, $CFG->proxyuser.':'.$CFG->proxypassword);