summaryrefslogtreecommitdiff
path: root/pear/fetch.php
diff options
context:
space:
mode:
authorHannes Magnusson <bjori@php.net>2008-05-31 19:05:19 +0000
committerHannes Magnusson <bjori@php.net>2008-05-31 19:05:19 +0000
commit72b3187d43723fd1d4367987d0d6308a268d211e (patch)
tree2f7b2cdf4d3ee6920dddf57d46a2e0d7acaba32e /pear/fetch.php
parentaa4e898fe53f78316bd56b23f936a8189a992836 (diff)
downloadphp-git-72b3187d43723fd1d4367987d0d6308a268d211e.tar.gz
Add support for proxies (patch by Christopher Jones)
Diffstat (limited to 'pear/fetch.php')
-rw-r--r--pear/fetch.php13
1 files changed, 12 insertions, 1 deletions
diff --git a/pear/fetch.php b/pear/fetch.php
index c3fd44df40..01d223392e 100644
--- a/pear/fetch.php
+++ b/pear/fetch.php
@@ -50,7 +50,18 @@ function stream_notification_callback($notification_code, $severity, $message, $
isset($argv[1], $argv[2]) or usage($argv);
-$ctx = stream_context_create(null, array("notification" => "stream_notification_callback"));
+if (!isset($_ENV['http_proxy'])) {
+ $copt = null;
+} else {
+ $copt = array(
+ 'http' => array(
+ 'proxy' => preg_replace('/^http/i', 'tcp', $_ENV['http_proxy']),
+ 'request_fulluri' => true,
+ ),
+ );
+}
+
+$ctx = stream_context_create($copt, array("notification" => "stream_notification_callback"));
$fp = fopen($argv[1], "r", false, $ctx);
if (is_resource($fp) && file_put_contents($argv[2], $fp)) {