From 4c50c36345761f2b012c52bff230bdc5347f3d66 Mon Sep 17 00:00:00 2001 From: Terry Long Date: Sat, 28 Mar 2015 00:10:24 -0700 Subject: 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. --- libmproxy/flow.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'libmproxy/flow.py') 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), ] -- cgit v1.2.3