cvs: php-src(PHP_5_3) /pear fetch.php
| From: | Hannes Magnusson | Date: | Sat, 31 May 2008 19:05:19 +0000 |
| Subject: | cvs: php-src(PHP_5_3) /pear fetch.php | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-50214@lists.php.net to get a copy of this message | ||
bjori Sat May 31 19:05:19 2008 UTC
Modified files: (Branch: PHP_5_3)
/php-src/pear fetch.php
Log:
Add support for proxies (patch by Christopher Jones)
http://cvs.php.net/viewvc.cgi/php-src/pear/fetch.php?r1=1.1.2.2&r2=1.1.2.3&diff_format=u
Index: php-src/pear/fetch.php
diff -u php-src/pear/fetch.php:1.1.2.2 php-src/pear/fetch.php:1.1.2.3
--- php-src/pear/fetch.php:1.1.2.2 Fri May 30 23:42:50 2008
+++ php-src/pear/fetch.php Sat May 31 19:05:19 2008
@@ -50,7 +50,18 @@
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)) {