commit 343a47e303bafde772e20a637a8ddefffcf85872 Author: David Fifield david@bamsoftware.com Date: Sat Jul 28 10:15:04 2012 -0700
Uniformity of code between flashproxy-client and flashproxy-reg-http. --- flashproxy-client | 4 ++-- flashproxy-reg-http | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/flashproxy-client b/flashproxy-client index ad60057..0dfe8c7 100755 --- a/flashproxy-client +++ b/flashproxy-client @@ -1,5 +1,6 @@ #!/usr/bin/env python
+import BaseHTTPServer import array import base64 import cStringIO @@ -16,7 +17,6 @@ import time import traceback import urllib import xml.sax.saxutils -import BaseHTTPServer
try: from hashlib import sha1 @@ -123,7 +123,7 @@ def parse_addr_spec(spec, defhost = None, defport = None): af = 0 host = host or defhost port = port or defport - if not (host and port): + if not port: raise ValueError("Bad address specification "%s"" % spec) return host, int(port)
diff --git a/flashproxy-reg-http b/flashproxy-reg-http index 209f77e..ac45a30 100755 --- a/flashproxy-reg-http +++ b/flashproxy-reg-http @@ -2,19 +2,19 @@
import getopt import httplib -import socket import re +import socket import sys import urllib
-DEFAULT_REMOTE_ADDR = "" +DEFAULT_REMOTE_ADDRESS = "" DEFAULT_REMOTE_PORT = 9000 DEFAULT_FACILITATOR_HOST = "tor-facilitator.bamsoftware.com" DEFAULT_FACILITATOR_PORT = 9002
class options(object): - facilitator_addr = None remote_addr = None + facilitator_addr = None
def usage(f = sys.stdout): print >> f, """\ @@ -27,7 +27,7 @@ facilitator address is "%(fac_addr)s". """ % { "progname": sys.argv[0], "fac_addr": format_addr((DEFAULT_FACILITATOR_HOST, DEFAULT_FACILITATOR_PORT)), - "remote_addr": format_addr((DEFAULT_REMOTE_ADDR, DEFAULT_REMOTE_PORT)), + "remote_addr": format_addr((DEFAULT_REMOTE_ADDRESS, DEFAULT_REMOTE_PORT)), }
def parse_addr_spec(spec, defhost = None, defport = None): @@ -81,12 +81,12 @@ def format_addr(addr): return u"%s:%d" % (host, port)
options.facilitator_addr = (DEFAULT_FACILITATOR_HOST, DEFAULT_FACILITATOR_PORT) -options.remote_addr = (DEFAULT_REMOTE_ADDR, DEFAULT_REMOTE_PORT) +options.remote_addr = (DEFAULT_REMOTE_ADDRESS, DEFAULT_REMOTE_PORT)
opts, args = getopt.gnu_getopt(sys.argv[1:], "a:h", ["address=", "help"]) for o, a in opts: if o == "-a" or o == "--address": - options.remote_addr = parse_addr_spec(a, DEFAULT_REMOTE_ADDR, DEFAULT_REMOTE_PORT) + options.remote_addr = parse_addr_spec(a, DEFAULT_REMOTE_ADDRESS, DEFAULT_REMOTE_PORT) elif o == "-h" or o == "--help": usage() sys.exit()
tor-commits@lists.torproject.org