Permalink
Browse files

Adjust for new get_remote_cert API.

  • Loading branch information...
cortesi committed Jun 27, 2012
1 parent 35ee0c0 commit 243e0efefc2ae6842a2d03c7d0a0e648802515b1
Showing with 6 additions and 5 deletions.
  1. +1 −1 .coveragerc
  2. +1 −0 libmproxy/flow.py
  3. +4 −4 libmproxy/proxy.py
View
@@ -1,3 +1,3 @@
[report]
-omit = *contrib*, *tnetstring*
+omit = *contrib*, *tnetstring*, *platform*
include = *libmproxy*
View
@@ -198,6 +198,7 @@ class Request(HTTPMsg):
path: Path portion of the URL
timestamp: Seconds since the epoch
+
method: HTTP method
"""
def __init__(self, client_conn, httpversion, host, port, scheme, method, path, headers, content, timestamp=None):
View
@@ -193,13 +193,13 @@ def handle_request(self, cc):
else:
return True
- def find_cert(self, host, port):
+ def find_cert(self, host, port, sni):
if self.config.certfile:
return self.config.certfile
else:
sans = []
if self.config.upstream_cert:
- cert = certutils.get_remote_cert(host, port)
+ cert = certutils.get_remote_cert(host, port, sni)
sans = cert.altnames
host = cert.cn
ret = certutils.dummy_cert(self.config.certdir, self.config.cacert, host, sans)
@@ -225,7 +225,7 @@ def read_request(self, client_conn):
host, port = self.config.transparent_proxy["resolver"].original_addr(self.connection)
if not self.ssl_established and (port in self.config.transparent_proxy["sslports"]):
scheme = "https"
- certfile = self.find_cert(host, port)
+ certfile = self.find_cert(host, port, None)
self.convert_to_ssl(certfile, self.config.certfile or self.config.cacert)
else:
scheme = "http"
@@ -274,7 +274,7 @@ def read_request(self, client_conn):
'\r\n'
)
self.wfile.flush()
- certfile = self.find_cert(host, port)
+ certfile = self.find_cert(host, port, None)
self.convert_to_ssl(certfile, self.config.certfile or self.config.cacert)
self.proxy_connect_state = (host, port, httpversion)
line = self.rfile.readline(line)

0 comments on commit 243e0ef

Please sign in to comment.