Skip to content
This repository has been archived by the owner on Aug 3, 2022. It is now read-only.

Bug fix in should_generate_certs option #50

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions httpproxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,9 +365,10 @@ def close_request(self, request):
class HttpsProxyServer(HttpProxyServer):
"""SSL server that generates certs for each host."""

def __init__(self, http_archive_fetch, custom_handlers,
def __init__(self, real_dns_lookup, http_archive_fetch, custom_handlers,
https_root_ca_cert_path, **kwargs):
self.ca_cert_path = https_root_ca_cert_path
self._real_dns_lookup = real_dns_lookup
self.HANDLER = sslproxy.wrap_handler(HttpArchiveHandler)
HttpProxyServer.__init__(self, http_archive_fetch, custom_handlers,
is_ssl=True, protocol='HTTPS', **kwargs)
Expand All @@ -387,7 +388,8 @@ def get_certificate(self, host):
if host in self._host_to_cert_map:
return self._host_to_cert_map[host]

server_cert = self.http_archive_fetch.http_archive.get_server_cert(host)
host_ip = self._real_dns_lookup(host)
server_cert = self.http_archive_fetch.http_archive.get_server_cert(host_ip)
if server_cert in self._server_cert_to_cert_map:
cert = self._server_cert_to_cert_map[server_cert]
self._host_to_cert_map[host] = cert
Expand Down
2 changes: 1 addition & 1 deletion replay.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def AddWebProxy(server_manager, options, host, real_dns_lookup, http_archive):
if options.ssl:
if options.should_generate_certs:
server_manager.Append(
httpproxy.HttpsProxyServer, archive_fetch, custom_handlers,
httpproxy.HttpsProxyServer, real_dns_lookup, archive_fetch, custom_handlers,
options.https_root_ca_cert_path, host=host, port=options.ssl_port,
use_delays=options.use_server_delay, **options.shaping_http)
else:
Expand Down