From 1d065d50f63676e081b0101f849aaa0249b950c7 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Wed, 29 Feb 2012 00:36:40 +0000 Subject: [PATCH] r111588: refactored proxy/noProxy code slightly for simplicity --- includes/HttpFunctions.php | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/includes/HttpFunctions.php b/includes/HttpFunctions.php index 23ea8df2cf..8dd652581f 100644 --- a/includes/HttpFunctions.php +++ b/includes/HttpFunctions.php @@ -219,6 +219,10 @@ class MWHttpRequest { $this->$o = $options[$o]; } } + + if ( $this->noProxy ) { + $this->proxy = ''; // noProxy takes precedence + } } /** @@ -279,15 +283,14 @@ class MWHttpRequest { } /** - * 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 @@ class MWHttpRequest { $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 @@ class PhpHttpRequest extends MWHttpRequest { } $options = array(); - if ( $this->proxy && !$this->noProxy ) { + if ( $this->proxy ) { $options['proxy'] = $this->urlToTCP( $this->proxy ); $options['request_fulluri'] = true; } -- 2.20.1