Index: tools/findit/https.py |
diff --git a/tools/findit/https.py b/tools/findit/https.py |
index c382f0cf7f1cbf65250135164e189af1aa2e33cd..3f44d738f359b9185add916c2686591127dd1d7c 100644 |
--- a/tools/findit/https.py |
+++ b/tools/findit/https.py |
@@ -14,6 +14,7 @@ One use case is to download Chromium DEPS file in a secure way: |
Notice: python 2.7 or newer is required. |
""" |
+import cookielib |
import httplib |
import os |
import re |
@@ -187,7 +188,13 @@ def SendRequest(https_url): |
if not https_url or not https_url.startswith('https://'): |
raise ValueError('Not a https request for url %s.' % str(https_url)) |
- url_opener = urllib2.build_opener(HTTPSHandler) |
+ handlers = [HTTPSHandler()] |
+ cookie_file = os.environ.get('COOKIE_FILE') |
+ if cookie_file and os.path.exists(cookie_file): |
+ handlers.append( |
+ urllib2.HTTPCookieProcessor(cookielib.MozillaCookieJar(cookie_file))) |
+ |
+ url_opener = urllib2.build_opener(*handlers) |
return url_opener.open(https_url).read() |