Reedy has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/60422


Change subject: Add $wgTorBlockProxy. Used for loading Tor exit node list
......................................................................

Add $wgTorBlockProxy. Used for loading Tor exit node list

Needed for WMF migration from hume to terbium

Change-Id: I0ca6f67bf827550209c6089126031fabae94fd55
---
M TorBlock.php
M TorExitNodes.php
2 files changed, 21 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TorBlock 
refs/changes/22/60422/1

diff --git a/TorBlock.php b/TorBlock.php
index fd59f76..70c19a6 100644
--- a/TorBlock.php
+++ b/TorBlock.php
@@ -117,3 +117,8 @@
 
 /** Mark tor edits as such */
 $wgTorTagChanges = true;
+
+/**
+ * Proxy to use, if not the default proxy
+ */
+$wgTorBlockProxy = false;
\ No newline at end of file
diff --git a/TorExitNodes.php b/TorExitNodes.php
index 2e18d3e..4cf1e88 100644
--- a/TorExitNodes.php
+++ b/TorExitNodes.php
@@ -133,14 +133,19 @@
        protected static function loadExitNodes_BulkList() {
                wfProfileIn( __METHOD__ );
 
-               global $wgTorIPs, $wgTorProjectCA;
+               global $wgTorIPs, $wgTorProjectCA, $wgTorBlockProxy;
+
+               $options = array(
+                       'caInfo' => is_readable( $wgTorProjectCA ) ? 
$wgTorProjectCA : null
+               );
+               if ( $wgTorBlockProxy ) {
+                       $options['proxy'] = $wgTorBlockProxy;
+               }
 
                $nodes = array();
                foreach ( $wgTorIPs as $ip ) {
                        $url = 
'https://check.torproject.org/cgi-bin/TorBulkExitList.py?ip=' . $ip;
-                       $data = Http::get( $url, 'default', array(
-                               'caInfo' => is_readable( $wgTorProjectCA ) ? 
$wgTorProjectCA : null
-                       ) );
+                       $data = Http::get( $url, 'default', $options );
                        $lines = explode("\n", $data);
 
                        foreach ( $lines as $line ) {
@@ -164,12 +169,15 @@
        protected static function loadExitNodes_Onionoo() {
                wfProfileIn( __METHOD__ );
 
-               global $wgTorOnionooServer, $wgTorOnionooCA;
-               $nodes = array();
+               global $wgTorOnionooServer, $wgTorOnionooCA, $wgTorBlockProxy;
                $url = wfExpandUrl( "$wgTorOnionooServer/summary", PROTO_HTTPS 
);
-               $raw = Http::get( $url, 'default', array(
+               $options = array(
                        'caInfo' => is_readable( $wgTorOnionooCA ) ? 
$wgTorOnionooCA : null
-               ) );
+               );
+               if ( $wgTorBlockProxy ) {
+                       $options['proxy'] = $wgTorBlockProxy;
+               }
+               $raw = Http::get( $url, 'default', $options );
                $data = FormatJson::decode( $raw, true );
 
                $nodes = array();

-- 
To view, visit https://gerrit.wikimedia.org/r/60422
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0ca6f67bf827550209c6089126031fabae94fd55
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TorBlock
Gerrit-Branch: master
Gerrit-Owner: Reedy <[email protected]>

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

Reply via email to