[tor-commits] [bridgedb/master] Send correct X-Forwarded-For headers in test-moat script.

isis at torproject.org isis at torproject.org
Wed Dec 20 23:10:05 UTC 2017


commit a1597da01eb30e7222dc153a81cd7575a889f8ff
Author: Isis Lovecruft <isis at torproject.org>
Date:   Mon Nov 27 19:30:03 2017 +0000

    Send correct X-Forwarded-For headers in test-moat script.
---
 bridgedb/bridgerequest.py | 2 +-
 scripts/test-moat         | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/bridgedb/bridgerequest.py b/bridgedb/bridgerequest.py
index 560b704..e555e0a 100644
--- a/bridgedb/bridgerequest.py
+++ b/bridgedb/bridgerequest.py
@@ -149,7 +149,7 @@ class BridgeRequestBase(object):
             mod the number of nodes in the hashring.
         """
         if not client:
-            client = self.client
+            client = type('')(self.client)
 
         # Get an HMAC with the key of the client identifier:
         digest = getHMACFunc(key)(client)
diff --git a/scripts/test-moat b/scripts/test-moat
index 490edc6..13b835e 100755
--- a/scripts/test-moat
+++ b/scripts/test-moat
@@ -15,6 +15,7 @@ fi
 function do_fetch() {
     curl -H 'Content-Type: application/vnd.api+json' \
          -H 'Accept: application/vnd.api+json' \
+         -H 'X-Forwarded-For: 1.2.3.4' \
          --data '{"data": [{"supported": ["obfs4"], "version": "0.1.0", "type": "client-transports"}]}' \
          http://127.0.0.1:6790/meek/moat/fetch
     echo
@@ -23,6 +24,7 @@ function do_fetch() {
 function do_check() {
     curl -H 'Content-Type: application/vnd.api+json' \
          -H 'Accept: application/vnd.api+json' \
+         -H 'X-Forwarded-For: 1.2.3.4' \
          --data '{"data": [{"challenge": "'$CHALLENGE'", "solution": "'$SOLUTION'", "version": "0.1.0", "qrcode": "false", "type": "moat-solution", "id": 2, "transport": "obfs4"}]}' \
          http://127.0.0.1:6790/meek/moat/check
     echo





More information about the tor-commits mailing list