aboutsummaryrefslogtreecommitdiffstats
path: root/test/tserv
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2010-02-16 17:09:07 +1300
committerAldo Cortesi <aldo@nullcube.com>2010-02-16 17:09:07 +1300
commitcb0e3287090786fad566feb67ac07b8ef361b2c3 (patch)
tree0cce85760f1811bc3bbd00245764142621fa9d16 /test/tserv
downloadmitmproxy-cb0e3287090786fad566feb67ac07b8ef361b2c3.tar.gz
mitmproxy-cb0e3287090786fad566feb67ac07b8ef361b2c3.tar.bz2
mitmproxy-cb0e3287090786fad566feb67ac07b8ef361b2c3.zip
Initial checkin.
Diffstat (limited to 'test/tserv')
-rwxr-xr-xtest/tserv30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/tserv b/test/tserv
new file mode 100755
index 00000000..5b35b72a
--- /dev/null
+++ b/test/tserv
@@ -0,0 +1,30 @@
+#!/usr/bin/env python
+"""
+ A simple program for testing the test HTTP/S servers.
+"""
+from optparse import OptionParser, OptionGroup
+import sslserv, serv
+
+if __name__ == "__main__":
+ parser = OptionParser(
+ usage = "%prog [options] output",
+ version="%prog 0.1",
+ )
+ parser.add_option(
+ "-s", "--ssl", action="store_true",
+ dest="ssl", default=False
+ )
+ options, args = parser.parse_args()
+
+ if options.ssl:
+ port = 8443
+ print "Running on port %s"%port
+ s = sslserv.make(port)
+ else:
+ port = 8080
+ print "Running on port %s"%port
+ s = serv.make(port)
+ try:
+ s.serve_forever()
+ except KeyboardInterrupt:
+ pass