[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

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



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@xxxxxxxxxxxxxx>
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.
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits