Skip to content

Commit

Permalink
forward proxy -> upstream proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
mhils committed Mar 13, 2014
1 parent f14eeef commit a66913d
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion doc-src/_nav.html
Expand Up @@ -11,7 +11,7 @@
$!nav("anticache.html", this, state)!$ $!nav("anticache.html", this, state)!$
$!nav("clientreplay.html", this, state)!$ $!nav("clientreplay.html", this, state)!$
$!nav("filters.html", this, state)!$ $!nav("filters.html", this, state)!$
$!nav("forwardproxy.html", this, state)!$ $!nav("upstreamproxy.html", this, state)!$
$!nav("proxyauth.html", this, state)!$ $!nav("proxyauth.html", this, state)!$
$!nav("replacements.html", this, state)!$ $!nav("replacements.html", this, state)!$
$!nav("serverreplay.html", this, state)!$ $!nav("serverreplay.html", this, state)!$
Expand Down
2 changes: 1 addition & 1 deletion doc-src/features/index.py
Expand Up @@ -4,7 +4,7 @@
Page("anticache.html", "Anticache"), Page("anticache.html", "Anticache"),
Page("clientreplay.html", "Client-side replay"), Page("clientreplay.html", "Client-side replay"),
Page("filters.html", "Filter expressions"), Page("filters.html", "Filter expressions"),
Page("forwardproxy.html", "Forward proxy mode"), Page("upstreamproxy.html", "Upstream proxy mode"),
Page("setheaders.html", "Set Headers"), Page("setheaders.html", "Set Headers"),
Page("serverreplay.html", "Server-side replay"), Page("serverreplay.html", "Server-side replay"),
Page("sticky.html", "Sticky cookies and auth"), Page("sticky.html", "Sticky cookies and auth"),
Expand Down
6 changes: 3 additions & 3 deletions doc-src/features/reverseproxy.html
@@ -1,8 +1,8 @@


In reverse proxy mode, mitmproxy accepts standard HTTP requests and forwards In reverse proxy mode, mitmproxy accepts standard HTTP requests and forwards
them to the specified upstream server. This is in contrast to <a them to the specified upstream server. This is in contrast to
href="@!urlTo("forwardproxy.html")!@">forward proxy mode</a>, in which <a href="@!urlTo("upstreamproxy.html")!@">upstream proxy mode</a>, in which
mitmproxy forwards HTTP proxy requests to an upstream server. 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 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. __Host__ header field from the request, not the reverse proxy server.
Expand Down
@@ -1,16 +1,16 @@


In this mode, mitmproxy accepts proxy requests and unconditionally forwards all 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 href="@!urlTo("reverseproxy.html")!@">reverse proxy mode</a>, in which
mitmproxy forwards ordinary HTTP requests to an upstream server. mitmproxy forwards ordinary HTTP requests to an upstream server.


<table class="table"> <table class="table">
<tbody> <tbody>
<tr> <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>
<tr> <tr>
<th>mitmproxy shortcut</th> <td><b>F</b></td> <th>mitmproxy shortcut</th> <td><b>U</b></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
12 changes: 6 additions & 6 deletions libmproxy/cmdline.py
Expand Up @@ -255,9 +255,9 @@ def common_options(parser):
help = "Address to bind proxy to (defaults to all interfaces)" help = "Address to bind proxy to (defaults to all interfaces)"
) )
group.add_argument( group.add_argument(
"-F", "-U",
action="store", type=parse_server_spec, dest="forward_proxy", default=None, action="store", type=parse_server_spec, dest="upstream_proxy", default=None,
help="Proxy to unconditionally forward to: http[s]://host[:port]" help="Forward all requests to upstream proxy server: http[s]://host[:port]"
) )
group.add_argument( group.add_argument(
"-n", "-n",
Expand All @@ -272,7 +272,7 @@ def common_options(parser):
group.add_argument( group.add_argument(
"-R", "-R",
action="store", type=parse_server_spec, dest="reverse_proxy", default=None, action="store", type=parse_server_spec, dest="reverse_proxy", default=None,
help="Reverse proxy to upstream server: http[s]://host[:port]" help="Forward all requests to upstream HTTP server: http[s][2http[s]]://host[:port]"
) )
group.add_argument( group.add_argument(
"-T", "-T",
Expand All @@ -299,9 +299,9 @@ def common_options(parser):
help="Override the HTTP request form sent upstream by the proxy" help="Override the HTTP request form sent upstream by the proxy"
) )
group.add_argument( group.add_argument(
"--upstream-server", dest="manual_upstream_server", default=None, "--destination-server", dest="manual_destination_server", default=None,
action="store", type=parse_server_spec, action="store", type=parse_server_spec,
help="Override the destination server all requests are sent to." help="Override the destination server all requests are sent to: http[s][2http[s]]://host[:port]"
) )




Expand Down
10 changes: 5 additions & 5 deletions libmproxy/proxy/config.py
Expand Up @@ -44,15 +44,15 @@ def process_proxy_options(parser, options):
c += 1 c += 1
get_upstream_server = ConstUpstreamServerResolver(options.reverse_proxy) get_upstream_server = ConstUpstreamServerResolver(options.reverse_proxy)
http_form_in, http_form_out = "relative", "relative" http_form_in, http_form_out = "relative", "relative"
if options.forward_proxy: if options.upstream_proxy:
c += 1 c += 1
get_upstream_server = ConstUpstreamServerResolver(options.forward_proxy) get_upstream_server = ConstUpstreamServerResolver(options.upstream_proxy)
http_form_in, http_form_out = "absolute", "absolute" http_form_in, http_form_out = "absolute", "absolute"
if options.manual_upstream_server: if options.manual_destination_server:
c += 1 c += 1
get_upstream_server = ConstUpstreamServerResolver(options.manual_upstream_server) get_upstream_server = ConstUpstreamServerResolver(options.manual_destination_server)
if c > 1: 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.") "specification of an upstream server are mutually exclusive.")
if options.http_form_in: if options.http_form_in:
http_form_in = options.http_form_in http_form_in = options.http_form_in
Expand Down
2 changes: 1 addition & 1 deletion libmproxy/proxy/primitives.py
Expand Up @@ -61,7 +61,7 @@ class AddressPriority(object):
MANUALLY_CHANGED = 3 MANUALLY_CHANGED = 3
"""user changed the target address in the ui""" """user changed the target address in the ui"""
FROM_SETTINGS = 2 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 FROM_PROTOCOL = 1
"""derived from protocol (e.g. absolute-form http requests)""" """derived from protocol (e.g. absolute-form http requests)"""


Expand Down

0 comments on commit a66913d

Please sign in to comment.