Skip to content

Commit 72b3187

Browse files
committed
Add support for proxies (patch by Christopher Jones)
1 parent aa4e898 commit 72b3187

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

pear/fetch.php

+12-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,18 @@ function stream_notification_callback($notification_code, $severity, $message, $
5050

5151
isset($argv[1], $argv[2]) or usage($argv);
5252

53-
$ctx = stream_context_create(null, array("notification" => "stream_notification_callback"));
53+
if (!isset($_ENV['http_proxy'])) {
54+
$copt = null;
55+
} else {
56+
$copt = array(
57+
'http' => array(
58+
'proxy' => preg_replace('/^http/i', 'tcp', $_ENV['http_proxy']),
59+
'request_fulluri' => true,
60+
),
61+
);
62+
}
63+
64+
$ctx = stream_context_create($copt, array("notification" => "stream_notification_callback"));
5465

5566
$fp = fopen($argv[1], "r", false, $ctx);
5667
if (is_resource($fp) && file_put_contents($argv[2], $fp)) {

0 commit comments

Comments
 (0)