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

Unified Diff: tools/findit/https.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 | « tools/findit/crash_utils.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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()
« no previous file with comments | « tools/findit/crash_utils.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698