From e27f076535c2d5aa47bf616201c4b5881347232f Mon Sep 17 00:00:00 2001 From: poltawski Date: Fri, 19 Oct 2007 11:45:21 +0000 Subject: [PATCH] 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 --- lib/filelib.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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); -- 2.39.5