https://www.mediawiki.org/wiki/Special:Code/MediaWiki/112663

Revision: 112663
Author:   aaron
Date:     2012-02-29 00:36:40 +0000 (Wed, 29 Feb 2012)
Log Message:
-----------
r111588: refactored proxy/noProxy code slightly for simplicity

Modified Paths:
--------------
    trunk/phase3/includes/HttpFunctions.php

Modified: trunk/phase3/includes/HttpFunctions.php
===================================================================
--- trunk/phase3/includes/HttpFunctions.php     2012-02-29 00:33:31 UTC (rev 
112662)
+++ trunk/phase3/includes/HttpFunctions.php     2012-02-29 00:36:40 UTC (rev 
112663)
@@ -219,6 +219,10 @@
                                $this->$o = $options[$o];
                        }
                }
+
+               if ( $this->noProxy ) {
+                       $this->proxy = ''; // noProxy takes precedence
+               }
        }
 
        /**
@@ -279,15 +283,14 @@
        }
 
        /**
-        * Take care of setting up the proxy
-        * (override in subclass)
+        * Take care of setting up the proxy (do nothing if "noProxy" is set)
         *
-        * @return String
+        * @return void
         */
        public function proxySetup() {
                global $wgHTTPProxy;
 
-               if ( $this->proxy && !$this->noProxy ) {
+               if ( $this->proxy || !$this->noProxy ) {
                        return;
                }
 
@@ -402,11 +405,7 @@
                        $this->setReferer( wfExpandUrl( $wgTitle->getFullURL(), 
PROTO_CURRENT ) );
                }
 
-               /**
-                * Set up the proxy, but
-                * clear the proxy when $noProxy is set (takes precedence)
-                */
-               $this->proxySetup();
+               $this->proxySetup(); // set up any proxy as needed
 
                if ( !$this->callback ) {
                        $this->setCallback( array( $this, 'read' ) );
@@ -805,7 +804,7 @@
                }
 
                $options = array();
-               if ( $this->proxy && !$this->noProxy ) {
+               if ( $this->proxy ) {
                        $options['proxy'] = $this->urlToTCP( $this->proxy );
                        $options['request_fulluri'] = true;
                }


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to