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

Side by Side Diff: telemetry/third_party/webpagereplay/httpclient.py

Issue 1821953002: Roll web-page-replay to b03f84da6e90951d4275b5675533d4512a178398 (Closed) Base URL: https://github.com/catapult-project/catapult.git@master
Patch Set: Created 4 years, 9 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 unified diff | Download patch
« no previous file with comments | « telemetry/third_party/webpagereplay/README.chromium ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2012 Google Inc. All Rights Reserved. 2 # Copyright 2012 Google Inc. All Rights Reserved.
3 # 3 #
4 # Licensed under the Apache License, Version 2.0 (the "License"); 4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License. 5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at 6 # You may obtain a copy of the License at
7 # 7 #
8 # http://www.apache.org/licenses/LICENSE-2.0 8 # http://www.apache.org/licenses/LICENSE-2.0
9 # 9 #
10 # Unless required by applicable law or agreed to in writing, software 10 # Unless required by applicable law or agreed to in writing, software
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 class DetailedHTTPSResponse(DetailedHTTPResponse): 179 class DetailedHTTPSResponse(DetailedHTTPResponse):
180 """Preserve details relevant to replaying SSL responses.""" 180 """Preserve details relevant to replaying SSL responses."""
181 pass 181 pass
182 182
183 183
184 class DetailedHTTPSConnection(httplib.HTTPSConnection): 184 class DetailedHTTPSConnection(httplib.HTTPSConnection):
185 """Preserve details relevant to replaying SSL connections.""" 185 """Preserve details relevant to replaying SSL connections."""
186 response_class = DetailedHTTPSResponse 186 response_class = DetailedHTTPSResponse
187 187
188 def __init__(self, host, port): 188 def __init__(self, host, port):
189 httplib.HTTPSConnection.__init__( 189 # https://www.python.org/dev/peps/pep-0476/#opting-out
190 self, host=host, port=port, context=ssl._create_unverified_context()) 190 if hasattr(ssl, '_create_unverified_context'):
191 httplib.HTTPSConnection.__init__(
192 self, host=host, port=port, context=ssl._create_unverified_context())
193 else:
194 httplib.HTTPSConnection.__init__(self, host=host, port=port)
191 195
192 196
193 class RealHttpFetch(object): 197 class RealHttpFetch(object):
194 198
195 def __init__(self, real_dns_lookup): 199 def __init__(self, real_dns_lookup):
196 """Initialize RealHttpFetch. 200 """Initialize RealHttpFetch.
197 201
198 Args: 202 Args:
199 real_dns_lookup: a function that resolves a host to an IP. 203 real_dns_lookup: a function that resolves a host to an IP.
200 """ 204 """
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 self.fetch = self.record_fetch 492 self.fetch = self.record_fetch
489 self.is_record_mode = True 493 self.is_record_mode = True
490 494
491 def SetReplayMode(self): 495 def SetReplayMode(self):
492 self.fetch = self.replay_fetch 496 self.fetch = self.replay_fetch
493 self.is_record_mode = False 497 self.is_record_mode = False
494 498
495 def __call__(self, *args, **kwargs): 499 def __call__(self, *args, **kwargs):
496 """Forward calls to Replay/Record fetch functions depending on mode.""" 500 """Forward calls to Replay/Record fetch functions depending on mode."""
497 return self.fetch(*args, **kwargs) 501 return self.fetch(*args, **kwargs)
OLDNEW
« no previous file with comments | « telemetry/third_party/webpagereplay/README.chromium ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698