]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-11840 - curl was set to use CONNECTs for all http requests. This is disallowed
authorpoltawski <poltawski>
Fri, 19 Oct 2007 14:47:14 +0000 (14:47 +0000)
committerpoltawski <poltawski>
Fri, 19 Oct 2007 14:47:14 +0000 (14:47 +0000)
by most http proxies to prevent tunneling. Added some debugging in case of failure.

Merged from MOODLE_19_STABLE

lib/filelib.php

index 059bab450f8bb17b36358e269c92b91b32edb56f..36145b8ecfed80664fb61745d6b647ed4f5f1cb1 100644 (file)
@@ -16,7 +16,9 @@ function download_file_content($url) {
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($ch, CURLOPT_HEADER, false);
     if (!empty($CFG->proxyhost)) {
-        curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, true);
+        // don't CONNECT for non-https connections
+        curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, false);
+
         if (empty($CFG->proxyport)) {
             curl_setopt($ch, CURLOPT_PROXY, $CFG->proxyhost);
         } else {
@@ -27,6 +29,12 @@ function download_file_content($url) {
         }
     }
     $result = curl_exec($ch);
+
+    if (curl_errno($ch)) {
+        $curlerror = "CURL request for \"$url\" failed with: ". curl_error($ch);
+        debugging($curlerror, DEBUG_DEVELOPER);
+    }
+
     curl_close($ch);
     return $result;
 }