]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-11766 download_file_content is quite broken with proxies - lacking global
authorpoltawski <poltawski>
Fri, 19 Oct 2007 11:45:21 +0000 (11:45 +0000)
committerpoltawski <poltawski>
Fri, 19 Oct 2007 11:45:21 +0000 (11:45 +0000)
CFG definition, so must never have worked, also incorrectly specified proxyhost..

Merged from MOODLE_19_STABLE

lib/filelib.php

index c9a7846745f291444c89730725ffad5574c0324b..059bab450f8bb17b36358e269c92b91b32edb56f 100644 (file)
@@ -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);