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

Unified Diff: tools/findit/crash_utils.py

Issue 465403004: [Findit] Support sending cookies for http requests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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/findit/https.py » ('j') | tools/findit/https.py » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/findit/crash_utils.py
diff --git a/tools/findit/crash_utils.py b/tools/findit/crash_utils.py
index 7d6ac96eccbf9ddb2d75ffd2901b6305a23f0319..da060b1d51d224450f773f00fd79fd0e1402e603 100644
--- a/tools/findit/crash_utils.py
+++ b/tools/findit/crash_utils.py
@@ -8,6 +8,8 @@ import os
import time
import urllib
+import https
+
INFINITY = float('inf')
@@ -96,20 +98,21 @@ def GetDataFromURL(url, retries=10, sleep_time=0.1):
Returns:
None if the data retrieval fails, or the raw data.
"""
- data = None
- for i in range(retries):
+ count = 0
+ while True:
+ count += 1
# Retrieves data from URL.
try:
- data = urllib.urlopen(url)
-
- # If retrieval is successful, return the data.
- if data:
- return data.read()
-
- # If retrieval fails, try after sleep_time second.
+ if url.startswith('https://'):
+ return https.SendRequest(url)
+ else:
+ return urllib.urlopen(url).read()
except IOError:
- time.sleep(sleep_time)
- continue
+ if count < retries:
+ # If retrieval fails, try after sleep_time second.
+ time.sleep(sleep_time)
+ else:
+ break
# Return None if it fails to read data from URL 'retries' times.
return None
« no previous file with comments | « no previous file | tools/findit/https.py » ('j') | tools/findit/https.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698