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

Unified Diff: tools/android/loading/request_track.py

Issue 2138713002: sandwich: Fix some trivial failures on SWR benchmark runs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 | « no previous file | tools/android/loading/sandwich_swr.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/android/loading/request_track.py
diff --git a/tools/android/loading/request_track.py b/tools/android/loading/request_track.py
index 454cbe0718a54aaede442e21ffe629f18116e3be..01371b855f2ae66f0b9a566f878b32c02371cfc6 100644
--- a/tools/android/loading/request_track.py
+++ b/tools/android/loading/request_track.py
@@ -341,7 +341,7 @@ class Request(object):
directives = [s.strip() for s in cache_control_str.split(',')]
for directive in directives:
parts = directive.split('=')
- if len(parts) == 1:
+ if len(parts) != 2:
pasko 2016/07/11 11:26:50 was it an empty directive or more than one '='? Is
gabadie 2016/07/11 12:14:35 I had a Cache-Control: max-age=stuff1 max-age=stuf
continue
(name, value) = parts
if name == directive_name:
@@ -385,10 +385,16 @@ class Request(object):
net::HttpResponseHeaders's constructor.
"""
assert not self.IsDataRequest()
+ assert self.HasReceivedResponse()
headers = '{} {} {}\x00'.format(
self.protocol.upper(), self.status, self.status_text)
for key in sorted(self.response_headers.keys()):
- headers += '{}: {}\x00'.format(key, self.response_headers[key])
+ try:
+ headers += '{}: {}\x00'.format(
pasko 2016/07/11 11:26:50 response headers do not have to be valid unicode,
gabadie 2016/07/11 12:14:35 Good point. Done.
+ str(key), str(self.response_headers[key]))
+ except UnicodeEncodeError:
+ logging.exception('failure when encoding one of the following: %s, %s',
+ repr(key), repr(self.response_headers[key]))
return headers
def __eq__(self, o):
« no previous file with comments | « no previous file | tools/android/loading/sandwich_swr.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698