aboutsummaryrefslogtreecommitdiffstats
path: root/libmproxy/flow.py
diff options
context:
space:
mode:
authorTerry Long <macmantrl@me.com>2015-03-28 00:10:24 -0700
committerTerry Long <macmantrl@me.com>2015-07-03 07:55:37 -0700
commit4c50c36345761f2b012c52bff230bdc5347f3d66 (patch)
treec1473e84a57adadb7d2322e65cc75eb848eff2c6 /libmproxy/flow.py
parent4c831992aabae6bb99109d4a7abc1d7a2fb1d611 (diff)
downloadmitmproxy-4c50c36345761f2b012c52bff230bdc5347f3d66.tar.gz
mitmproxy-4c50c36345761f2b012c52bff230bdc5347f3d66.tar.bz2
mitmproxy-4c50c36345761f2b012c52bff230bdc5347f3d66.zip
Prevent unecessary upstream server connects
Selectively connect to upstream server based on no_upstream_cert option. When no_upstream_cert is used during server replay, prevent connecting to the upstream server unless absolutely necessary.
Diffstat (limited to 'libmproxy/flow.py')
-rw-r--r--libmproxy/flow.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/libmproxy/flow.py b/libmproxy/flow.py
index 1a052f51..59312ceb 100644
--- a/libmproxy/flow.py
+++ b/libmproxy/flow.py
@@ -240,9 +240,13 @@ class ServerPlaybackState:
_, _, path, _, query, _ = urlparse.urlparse(r.url)
queriesArray = urlparse.parse_qsl(query, keep_blank_values=True)
+ # scheme should match the client connection to be able to replay
+ # although r.scheme may have been changed to http to connect to upstream server
+ scheme = "https" if flow.client_conn and flow.client_conn.ssl_established else "http"
+
key = [
str(r.port),
- str(r.scheme),
+ str(scheme),
str(r.method),
str(path),
]