Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(400)

Unified Diff: telemetry/third_party/webpagereplay/httpclient.py

Issue 2162963002: [polymer] Merge of master into polymer10-migration (Closed) Base URL: git@github.com:catapult-project/catapult.git@polymer10-migration
Patch Set: Merge polymer10-migration int polymer10-merge Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « telemetry/third_party/webpagereplay/README.chromium ('k') | telemetry/third_party/webpagereplay/replay.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: telemetry/third_party/webpagereplay/httpclient.py
diff --git a/telemetry/third_party/webpagereplay/httpclient.py b/telemetry/third_party/webpagereplay/httpclient.py
index d85054a2c3adf74afba6022edba88f4eab43c8a1..73335fad1965a8e55b56fb456887051917e9811f 100644
--- a/telemetry/third_party/webpagereplay/httpclient.py
+++ b/telemetry/third_party/webpagereplay/httpclient.py
@@ -200,7 +200,9 @@ class RealHttpFetch(object):
"""Initialize RealHttpFetch.
Args:
- real_dns_lookup: a function that resolves a host to an IP.
+ real_dns_lookup: a function that resolves a host to an IP. RealHttpFetch
+ will resolve host name to the IP before making fetching request if this
+ is not None.
"""
self._real_dns_lookup = real_dns_lookup
@@ -295,17 +297,20 @@ class RealHttpFetch(object):
connection_port = system_proxy.port
# Use an IP address because WPR may override DNS settings.
- connection_ip = self._real_dns_lookup(connection_host)
- if not connection_ip:
- logging.critical('Unable to find host ip for name: %s', connection_host)
- return None
+ if self._real_dns_lookup:
+ connection_ip = self._real_dns_lookup(connection_host)
+ if not connection_ip:
+ logging.critical(
+ 'Unable to find IP for host name: %s', connection_host)
+ return None
+ connection_host = connection_ip
if is_ssl:
- connection = DetailedHTTPSConnection(connection_ip, connection_port)
+ connection = DetailedHTTPSConnection(connection_host, connection_port)
if system_proxy:
connection.set_tunnel(request_host, request_port)
else:
- connection = DetailedHTTPConnection(connection_ip, connection_port)
+ connection = DetailedHTTPConnection(connection_host, connection_port)
return connection
def __call__(self, request):
@@ -361,16 +366,18 @@ class RealHttpFetch(object):
class RecordHttpArchiveFetch(object):
"""Make real HTTP fetches and save responses in the given HttpArchive."""
- def __init__(self, http_archive, real_dns_lookup, inject_script):
+ def __init__(self, http_archive, inject_script):
"""Initialize RecordHttpArchiveFetch.
Args:
http_archive: an instance of a HttpArchive
- real_dns_lookup: a function that resolves a host to an IP.
inject_script: script string to inject in all pages
"""
self.http_archive = http_archive
- self.real_http_fetch = RealHttpFetch(real_dns_lookup)
+ # Do not resolve host name to IP when recording to avoid SSL3 handshake
+ # failure.
+ # See https://github.com/chromium/web-page-replay/issues/73 for details.
+ self.real_http_fetch = RealHttpFetch(real_dns_lookup=None)
self.inject_script = inject_script
def __call__(self, request):
@@ -478,8 +485,7 @@ class ControllableHttpArchiveFetch(object):
in the archive instead of giving a 404.
"""
self.http_archive = http_archive
- self.record_fetch = RecordHttpArchiveFetch(
- http_archive, real_dns_lookup, inject_script)
+ self.record_fetch = RecordHttpArchiveFetch(http_archive, inject_script)
self.replay_fetch = ReplayHttpArchiveFetch(
http_archive, real_dns_lookup, inject_script,
use_diff_on_unknown_requests, use_closest_match, scramble_images)
« no previous file with comments | « telemetry/third_party/webpagereplay/README.chromium ('k') | telemetry/third_party/webpagereplay/replay.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698