[tor-commits] [bridgedb] 01/03: Shim-token fixes

gitolite role git at cupani.torproject.org
Mon Apr 17 17:52:11 UTC 2023


This is an automated email from the git hooks/post-receive script.

meskio pushed a commit to branch main
in repository bridgedb.

commit 1c5f0a9a82435f8c6ffb70abcb9cebdfc2985ed5
Author: meskio <meskio at torproject.org>
AuthorDate: Wed Aug 24 12:34:56 2022 +0200

    Shim-token fixes
    
    Read all bridges from the dummy file, not only the first one. And use
    dummy bridges only for requests without valid shim-token.
---
 bridgedb/distributors/moat/distributor.py | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/bridgedb/distributors/moat/distributor.py b/bridgedb/distributors/moat/distributor.py
index 82a6d3a..c4aeef4 100644
--- a/bridgedb/distributors/moat/distributor.py
+++ b/bridgedb/distributors/moat/distributor.py
@@ -80,13 +80,17 @@ class MoatDistributor(HTTPSDistributor):
         """Load dummy bridges from a file
         """
         with open(dummyBridgesFile) as f:
-            bridge_line = f.readline()
-            bridge = Bridge()
-            try:
-                bridge.updateFromBridgeLine(bridge_line)
-            except MalformedBridgeInfo as e:
-                logging.warning("Got a malformed dummy bridge: %s" % e)
-            self.dummyHashring.insert(bridge)
+            for bridge_line in f:
+                bridge_line = bridge_line.strip()
+                if not bridge_line:
+                    continue
+
+                bridge = Bridge()
+                try:
+                    bridge.updateFromBridgeLine(bridge_line)
+                except MalformedBridgeInfo as e:
+                    logging.warning("Got a malformed dummy bridge: %s" % e)
+                self.dummyHashring.insert(bridge)
 
     def getBridges(self, bridgeRequest, interval, dummyBridges=False):
         """Return a list of bridges to give to a user.

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the tor-commits mailing list