Index: common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.359 diff -u -B -u -r1.359 common.inc --- common.inc 21 Jun 2004 20:14:41 -0000 1.359 +++ common.inc 3 Aug 2004 03:25:06 -0000 @@ -305,11 +307,24 @@ * headers, data, and redirect status. */ function drupal_http_request($url, $headers = array(), $method = 'GET', $data = NULL, $retry = 3) { + global $http_proxy; + // Parse the URL, and make sure we can handle the schema $uri = parse_url($url); + + // temporary patch for proxy connections + if (isset($http_proxy) && ($uri['scheme'] == "http")) { + $host = $http_proxy['host'] ? $http_proxy['host'] : $uri['host']; + $port = $http_proxy['port'] ? $http_proxy['port'] : 8080; + } + else { + $host = $uri['host']; + $port = $uri['port'] ? $uri['port'] : 80; + } + switch ($uri['scheme']) { case 'http': - $fp = @fsockopen($uri['host'], ($uri['port'] ? $uri['port'] : 80), $errno, $errstr, 15); + $fp = @fsockopen($host, $port, $errno, $errstr, 15); break; case 'https': // Note: only works for PHP 4.3 compiled with openssl @@ -331,6 +346,9 @@ if ($uri['query']) { $path .= "?$uri[query]"; } + if (isset($http_proxy) && ($uri['scheme'] == "http")) { + $path = $uri['scheme'] . "://" . $uri['host'] . $uri['path']; + } // Create http request $defaults = array( Index: conf.php =================================================================== RCS file: /cvs/drupal/drupal/includes/conf.php,v retrieving revision 1.29 diff -u -B -u -r1.29 conf.php --- conf.php 30 Apr 2004 05:12:36 -0000 1.29 +++ conf.php 3 Aug 2004 03:25:06 -0000 @@ -66,4 +67,10 @@ // "journal", // "articles"); +# HTTP Proxy: +# +# This allows you to override normal HTTP connections to go over +# your preferred HTTP proxy. +//$http_proxy = array("host" => "wwwcache.cam.ac.uk", "port" => 8080); + ?>