aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2014-03-18 17:19:57 +0100
committerMaximilian Hils <git@maximilianhils.com>2014-03-18 17:19:57 +0100
commitd5cfc1c080e2736afb478a310afe525ab493a72f (patch)
tree6157b0d0324698436aff8419522557ed4b3e628d
parentce38a17893791944fb8b4f589e7ce00d79b8ced0 (diff)
parenta66913d4a30b2ce2dedc58afcf79ad77faead278 (diff)
downloadmitmproxy-d5cfc1c080e2736afb478a310afe525ab493a72f.tar.gz
mitmproxy-d5cfc1c080e2736afb478a310afe525ab493a72f.tar.bz2
mitmproxy-d5cfc1c080e2736afb478a310afe525ab493a72f.zip
Merge pull request #239 from mitmproxy/options_cleanup
Options cleanup
-rw-r--r--doc-src/_nav.html2
-rw-r--r--doc-src/features/index.py2
-rw-r--r--doc-src/features/reverseproxy.html6
-rw-r--r--doc-src/features/upstreamproxy.html (renamed from doc-src/features/forwardproxy.html)6
-rw-r--r--libmproxy/cmdline.py129
-rw-r--r--libmproxy/console/__init__.py6
-rw-r--r--libmproxy/proxy/config.py15
-rw-r--r--libmproxy/proxy/primitives.py2
-rwxr-xr-xmitmproxy2
9 files changed, 85 insertions, 85 deletions
diff --git a/doc-src/_nav.html b/doc-src/_nav.html
index 5460601f..ddc27dca 100644
--- a/doc-src/_nav.html
+++ b/doc-src/_nav.html
@@ -11,7 +11,7 @@
$!nav("anticache.html", this, state)!$
$!nav("clientreplay.html", this, state)!$
$!nav("filters.html", this, state)!$
- $!nav("forwardproxy.html", this, state)!$
+ $!nav("upstreamproxy.html", this, state)!$
$!nav("proxyauth.html", this, state)!$
$!nav("replacements.html", this, state)!$
$!nav("serverreplay.html", this, state)!$
diff --git a/doc-src/features/index.py b/doc-src/features/index.py
index e15f3311..0618681f 100644
--- a/doc-src/features/index.py
+++ b/doc-src/features/index.py
@@ -4,7 +4,7 @@ pages = [
Page("anticache.html", "Anticache"),
Page("clientreplay.html", "Client-side replay"),
Page("filters.html", "Filter expressions"),
- Page("forwardproxy.html", "Forward proxy mode"),
+ Page("upstreamproxy.html", "Upstream proxy mode"),
Page("setheaders.html", "Set Headers"),
Page("serverreplay.html", "Server-side replay"),
Page("sticky.html", "Sticky cookies and auth"),
diff --git a/doc-src/features/reverseproxy.html b/doc-src/features/reverseproxy.html
index 7be02b87..7ad1c26c 100644
--- a/doc-src/features/reverseproxy.html
+++ b/doc-src/features/reverseproxy.html
@@ -1,8 +1,8 @@
In reverse proxy mode, mitmproxy accepts standard HTTP requests and forwards
-them to the specified upstream server. This is in contrast to <a
-href="@!urlTo("forwardproxy.html")!@">forward proxy mode</a>, in which
-mitmproxy forwards HTTP proxy requests to an upstream server.
+them to the specified upstream server. This is in contrast to
+<a href="@!urlTo("upstreamproxy.html")!@">upstream proxy mode</a>, in which
+mitmproxy forwards HTTP proxy requests to an upstream proxy server.
Note that the displayed URL for flows in this mode will use the value of the
__Host__ header field from the request, not the reverse proxy server.
diff --git a/doc-src/features/forwardproxy.html b/doc-src/features/upstreamproxy.html
index 203520d5..5b9c2289 100644
--- a/doc-src/features/forwardproxy.html
+++ b/doc-src/features/upstreamproxy.html
@@ -1,16 +1,16 @@
In this mode, mitmproxy accepts proxy requests and unconditionally forwards all
-requests to a specified upstream server. This is in contrast to <a
+requests to a specified upstream proxy server. This is in contrast to <a
href="@!urlTo("reverseproxy.html")!@">reverse proxy mode</a>, in which
mitmproxy forwards ordinary HTTP requests to an upstream server.
<table class="table">
<tbody>
<tr>
- <th width="20%">command-line</th> <td>-F http[s]://hostname[:port]</td>
+ <th width="20%">command-line</th> <td>-U http[s]://hostname[:port]</td>
</tr>
<tr>
- <th>mitmproxy shortcut</th> <td><b>F</b></td>
+ <th>mitmproxy shortcut</th> <td><b>U</b></td>
</tr>
</tbody>
</table>
diff --git a/libmproxy/cmdline.py b/libmproxy/cmdline.py
index d933ba4b..22db25fb 100644
--- a/libmproxy/cmdline.py
+++ b/libmproxy/cmdline.py
@@ -181,11 +181,6 @@ def get_common_options(options):
def common_options(parser):
parser.add_argument(
- "-b",
- action="store", type = str, dest="addr", default='',
- help = "Address to bind proxy to (defaults to all interfaces)"
- )
- parser.add_argument(
"--anticache",
action="store_true", dest="anticache", default=False,
help="Strip out request headers that might cause the server to return 304-not-modified."
@@ -196,57 +191,10 @@ def common_options(parser):
help = "Configuration directory. (~/.mitmproxy)"
)
parser.add_argument(
- "-n",
- action="store_true", dest="no_server",
- help="Don't start a proxy server."
- )
- parser.add_argument(
- "-p",
- action="store", type = int, dest="port", default=8080,
- help = "Proxy service port."
- )
- # We could make a mutually exclusive group out of -R, -F, -T, but we don't do that because
- # - --upstream-server should be in that group as well, but it's already in a different group.
- # - our own error messages are more helpful
- parser.add_argument(
- "-R",
- action="store", type=parse_server_spec, dest="reverse_proxy", default=None,
- help="Reverse proxy to upstream server: http[s]://host[:port]"
- )
- parser.add_argument(
- "-F",
- action="store", type=parse_server_spec, dest="forward_proxy", default=None,
- help="Proxy to unconditionally forward to: http[s]://host[:port]"
- )
- parser.add_argument(
- "-T",
- action="store_true", dest="transparent_proxy", default=False,
- help="Set transparent proxy mode."
- )
-
- group = parser.add_argument_group(
- "Advanced Proxy Options",
- """
- The following options allow a custom adjustment of the proxy behavior.
- Normally, you don't want to use these options directly and use the provided wrappers instead (-R, -F, -T).
- """.strip()
- )
- group.add_argument(
- "--http-form-in", dest="http_form_in", default=None,
- action="store", choices=("relative", "absolute"),
- help="Override the HTTP request form accepted by the proxy"
- )
- group.add_argument(
- "--http-form-out", dest="http_form_out", default=None,
- action="store", choices=("relative", "absolute"),
- help="Override the HTTP request form sent upstream by the proxy"
- )
- group.add_argument(
- "--upstream-server", dest="manual_upstream_server", default=None,
- action="store", type=parse_server_spec,
- help="Override the destination server all requests are sent to."
+ "--host",
+ action="store_true", dest="showhost", default=False,
+ help="Use the Host header to construct URLs for display."
)
-
parser.add_argument(
"-q",
action="store_true", dest="quiet",
@@ -295,17 +243,67 @@ def common_options(parser):
help="Byte size limit of HTTP request and response bodies."\
" Understands k/m/g suffixes, i.e. 3m for 3 megabytes."
)
- parser.add_argument(
- "--host",
- action="store_true", dest="showhost", default=False,
- help="Use the Host header to construct URLs for display."
+
+
+ group = parser.add_argument_group("Proxy Options")
+ # We could make a mutually exclusive group out of -R, -F, -T, but we don't do that because
+ # - --upstream-server should be in that group as well, but it's already in a different group.
+ # - our own error messages are more helpful
+ group.add_argument(
+ "-b",
+ action="store", type = str, dest="addr", default='',
+ help = "Address to bind proxy to (defaults to all interfaces)"
+ )
+ group.add_argument(
+ "-U",
+ action="store", type=parse_server_spec, dest="upstream_proxy", default=None,
+ help="Forward all requests to upstream proxy server: http[s]://host[:port]"
+ )
+ group.add_argument(
+ "-n",
+ action="store_true", dest="no_server",
+ help="Don't start a proxy server."
+ )
+ group.add_argument(
+ "-p",
+ action="store", type = int, dest="port", default=8080,
+ help = "Proxy service port."
+ )
+ group.add_argument(
+ "-R",
+ action="store", type=parse_server_spec, dest="reverse_proxy", default=None,
+ help="Forward all requests to upstream HTTP server: http[s][2http[s]]://host[:port]"
+ )
+ group.add_argument(
+ "-T",
+ action="store_true", dest="transparent_proxy", default=False,
+ help="Set transparent proxy mode."
)
- parser.add_argument(
- "--no-upstream-cert", default=False,
- action="store_true", dest="no_upstream_cert",
- help="Don't connect to upstream server to look up certificate details."
+
+ group = parser.add_argument_group(
+ "Advanced Proxy Options",
+ """
+ The following options allow a custom adjustment of the proxy behavior.
+ Normally, you don't want to use these options directly and use the provided wrappers instead (-R, -F, -T).
+ """.strip()
)
+ group.add_argument(
+ "--http-form-in", dest="http_form_in", default=None,
+ action="store", choices=("relative", "absolute"),
+ help="Override the HTTP request form accepted by the proxy"
+ )
+ group.add_argument(
+ "--http-form-out", dest="http_form_out", default=None,
+ action="store", choices=("relative", "absolute"),
+ help="Override the HTTP request form sent upstream by the proxy"
+ )
+ group.add_argument(
+ "--destination-server", dest="manual_destination_server", default=None,
+ action="store", type=parse_server_spec,
+ help="Override the destination server all requests are sent to: http[s][2http[s]]://host[:port]"
+ )
+
group = parser.add_argument_group("Web App")
group.add_argument(
@@ -331,6 +329,7 @@ def common_options(parser):
help="Serve the app outside of the proxy."
)
+
group = parser.add_argument_group("Client Replay")
group.add_argument(
"-c",
@@ -368,6 +367,7 @@ def common_options(parser):
"This makes it possible to replay same response multiple times."
)
+
group = parser.add_argument_group(
"Replacements",
"""
@@ -434,4 +434,5 @@ def common_options(parser):
help="Allow access to users specified in an Apache htpasswd file."
)
- proxy.config.ssl_option_group(parser)
+
+ proxy.config.ssl_option_group(parser) \ No newline at end of file
diff --git a/libmproxy/console/__init__.py b/libmproxy/console/__init__.py
index 72263c0e..83145f66 100644
--- a/libmproxy/console/__init__.py
+++ b/libmproxy/console/__init__.py
@@ -174,8 +174,7 @@ class StatusBar(common.WWrap):
r.append("[dest:%s]"%utils.unparse_url(*self.master.server.config.get_upstream_server.dst))
if self.master.scripts:
r.append("[scripts:%s]"%len(self.master.scripts))
- if self.master.debug:
- r.append("[lt:%0.3f]"%self.master.looptime)
+ # r.append("[lt:%0.3f]"%self.master.looptime)
if self.master.stream:
r.append("[W:%s]"%self.master.stream_path)
@@ -325,7 +324,6 @@ class Options(object):
"anticache",
"anticomp",
"client_replay",
- "debug",
"eventlog",
"keepserving",
"kill",
@@ -406,8 +404,6 @@ class ConsoleMaster(flow.FlowMaster):
if options.server_replay:
self.server_playback_path(options.server_replay)
- self.debug = options.debug
-
if options.scripts:
for i in options.scripts:
err = self.load_script(i)
diff --git a/libmproxy/proxy/config.py b/libmproxy/proxy/config.py
index ed0787da..067c361d 100644
--- a/libmproxy/proxy/config.py
+++ b/libmproxy/proxy/config.py
@@ -44,15 +44,15 @@ def process_proxy_options(parser, options):
c += 1
get_upstream_server = ConstUpstreamServerResolver(options.reverse_proxy)
http_form_in, http_form_out = "relative", "relative"
- if options.forward_proxy:
+ if options.upstream_proxy:
c += 1
- get_upstream_server = ConstUpstreamServerResolver(options.forward_proxy)
+ get_upstream_server = ConstUpstreamServerResolver(options.upstream_proxy)
http_form_in, http_form_out = "absolute", "absolute"
- if options.manual_upstream_server:
+ if options.manual_destination_server:
c += 1
- get_upstream_server = ConstUpstreamServerResolver(options.manual_upstream_server)
+ get_upstream_server = ConstUpstreamServerResolver(options.manual_destination_server)
if c > 1:
- return parser.error("Transparent mode, reverse mode, forward mode and "
+ return parser.error("Transparent mode, reverse mode, upstream proxy mode and "
"specification of an upstream server are mutually exclusive.")
if options.http_form_in:
http_form_in = options.http_form_in
@@ -133,3 +133,8 @@ def ssl_option_group(parser):
dest="certforward", default=False,
help="Simply forward SSL certificates from upstream."
)
+ group.add_argument(
+ "--no-upstream-cert", default=False,
+ action="store_true", dest="no_upstream_cert",
+ help="Don't connect to upstream server to look up certificate details."
+ ) \ No newline at end of file
diff --git a/libmproxy/proxy/primitives.py b/libmproxy/proxy/primitives.py
index 0fa5273b..691db922 100644
--- a/libmproxy/proxy/primitives.py
+++ b/libmproxy/proxy/primitives.py
@@ -61,7 +61,7 @@ class AddressPriority(object):
MANUALLY_CHANGED = 3
"""user changed the target address in the ui"""
FROM_SETTINGS = 2
- """upstream server from arguments (reverse proxy, forward proxy or from transparent resolver)"""
+ """upstream server from arguments (reverse proxy, upstream proxy or from transparent resolver)"""
FROM_PROTOCOL = 1
"""derived from protocol (e.g. absolute-form http requests)"""
diff --git a/mitmproxy b/mitmproxy
index f227f201..90f9ce1f 100755
--- a/mitmproxy
+++ b/mitmproxy
@@ -17,7 +17,6 @@ if __name__ == '__main__':
parser = argparse.ArgumentParser(usage = "%(prog)s [options]")
parser.add_argument('--version', action='version', version=libmproxy.version.NAMEVERSION)
cmdline.common_options(parser)
- parser.add_argument("--debug", dest="debug", default=False, action="store_true")
parser.add_argument(
"--palette", type=str, default="dark",
action="store", dest="palette",
@@ -55,7 +54,6 @@ if __name__ == '__main__':
opts = console.Options(**cmdline.get_common_options(options))
opts.eventlog = options.eventlog
opts.intercept = options.intercept
- opts.debug = options.debug
opts.palette = options.palette
spec = ""