[tor-commits] [flashproxy/master] Use put_reg_base64() for url registrations.

dcf at torproject.org dcf at torproject.org
Wed Mar 13 09:01:24 UTC 2013


commit d525dc6c9b35da29756de78f98ec49ac3ea24b1e
Author: Alex <alex at alex-macair.(none)>
Date:   Sat Mar 9 14:37:53 2013 -0500

    Use put_reg_base64() for url registrations.
    
    Use the put_reg_base64 function from the fac module to
    register clients, instead connecting to the daemon directly
    using sockets.
---
 facilitator/facilitator.cgi |   15 ++++-----------
 1 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/facilitator/facilitator.cgi b/facilitator/facilitator.cgi
index 0324fe5..1dd125a 100755
--- a/facilitator/facilitator.cgi
+++ b/facilitator/facilitator.cgi
@@ -21,18 +21,11 @@ def exit_error(status):
     output_status(status)
     sys.exit()
 
-# Send a client registration to the helper daemon,
-# which handles decryption and registration.
+# Send a base64-encoded client address to the registration daemon.
 def url_reg(reg):
-    sock = socket.create_connection(FACILITATOR_REG_URL_ADDR)
-    sock.sendall(reg)
-    sock.shutdown(socket.SHUT_WR)
-    response = sock.recv(4096)
-    sock.close()
-    if response == "\x00":
-        return True
-    else:
-        return False
+    # Translate from url-safe base64 alphabet to the standard alphabet.
+    reg = reg.replace('-', '+').replace('_', '/')
+    return fac.put_reg_base64(reg)
 
 method = os.environ.get("REQUEST_METHOD")
 remote_addr = (os.environ.get("REMOTE_ADDR"), None)





More information about the tor-commits mailing list