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)) {



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to