diff options
author | Maximilian Hils <git@maximilianhils.com> | 2016-05-21 15:25:57 -0700 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2016-05-21 15:25:57 -0700 |
commit | c160a47e51aa86283c6be9315c35bf3a9f6b68e4 (patch) | |
tree | fc7e1be089532e869a8794c26f5ee775a0e91b27 | |
parent | e6c2e012a5df3bbc4fc13e3fe1048976bda48ed8 (diff) | |
download | mitmproxy-c160a47e51aa86283c6be9315c35bf3a9f6b68e4.tar.gz mitmproxy-c160a47e51aa86283c6be9315c35bf3a9f6b68e4.tar.bz2 mitmproxy-c160a47e51aa86283c6be9315c35bf3a9f6b68e4.zip |
warn users if rfile == outfile, refs #1117
-rw-r--r-- | mitmproxy/cmdline.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/mitmproxy/cmdline.py b/mitmproxy/cmdline.py index da91e952..8476f6f3 100644 --- a/mitmproxy/cmdline.py +++ b/mitmproxy/cmdline.py @@ -165,6 +165,18 @@ def get_common_options(options): raise configargparse.ArgumentTypeError(e.message) setheaders.append(p) + if options.outfile and options.outfile[0] == options.rfile: + if options.outfile[1] == "wb": + raise configargparse.ArgumentTypeError( + "Cannot use '{}' for both reading and writing flows. " + "Are you looking for --afile?".format(options.rfile) + ) + else: + raise configargparse.ArgumentTypeError( + "Cannot use '{}' for both reading and appending flows. " + "That would trigger an infinite loop." + ) + return dict( app=options.app, app_host=options.app_host, |