aboutsummaryrefslogtreecommitdiffstats
path: root/pathoc
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2013-01-05 20:29:46 +1300
committerAldo Cortesi <aldo@nullcube.com>2013-01-05 20:29:46 +1300
commit5493925ea07aabc569d0f6cddffff49fda59383c (patch)
tree1d62dbecab9c97ad1de1349157c1e2dc83fb8121 /pathoc
parentc744ef2dcbb95182668ed8897542029c6c6734b9 (diff)
downloadmitmproxy-5493925ea07aabc569d0f6cddffff49fda59383c.tar.gz
mitmproxy-5493925ea07aabc569d0f6cddffff49fda59383c.tar.bz2
mitmproxy-5493925ea07aabc569d0f6cddffff49fda59383c.zip
CONNECT through proxy mode for pathoc
Also, use this to unit test the pathod CONNECT implementation.
Diffstat (limited to 'pathoc')
-rwxr-xr-xpathoc19
1 files changed, 18 insertions, 1 deletions
diff --git a/pathoc b/pathoc
index 42369b37..527b9a22 100755
--- a/pathoc
+++ b/pathoc
@@ -18,6 +18,11 @@ if __name__ == "__main__":
parser = argparse.ArgumentParser(description='A perverse HTTP client.', parents=[preparser])
parser.add_argument(
+ "-c", dest="connect_to", type=str, default=False,
+ metavar = "HOST:PORT",
+ help="Issue an HTTP CONNECT to connect to the specified host."
+ )
+ parser.add_argument(
"-i", dest="sni", type=str, default=False,
help="SSL Server Name Indication"
)
@@ -94,11 +99,23 @@ if __name__ == "__main__":
except ValueError:
parser.error("Invalid return code specification: %s"%args.ignorecodes)
+ if args.connect_to:
+ parts = args.connect_to.split(":")
+ if len(parts) != 2:
+ parser.error("Invalid CONNECT specification: %s"%args.connect_to)
+ try:
+ parts[1] = int(parts[1])
+ except ValueError:
+ parser.error("Invalid CONNECT specification: %s"%args.connect_to)
+ connect_to = parts
+ else:
+ connect_to = None
+
try:
for i in range(args.repeat):
p = pathoc.Pathoc(args.host, port, args.ssl, args.sni)
try:
- p.connect()
+ p.connect(connect_to)
except tcp.NetLibError, v:
print >> sys.stderr, str(v)
sys.exit(1)