summaryrefslogtreecommitdiffstats
path: root/git_config.py
diff options
context:
space:
mode:
authorDavid Pursehouse <dpursehouse@collab.net>2017-08-30 15:11:10 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2017-08-30 15:11:10 +0000
commit2c57d619bca9b946eeaa4f5b88397b9e1460cf35 (patch)
tree40a44a05a9d1a3cd12121f4afe8e8374f9e46da6 /git_config.py
parentd1ebc89a083f2966f8c65246bb63e2deaadfab62 (diff)
parentbed59cec5e5a9a5668cf2c7df3a24545b1e76c09 (diff)
downloadgit-repo-2c57d619bca9b946eeaa4f5b88397b9e1460cf35.tar.gz
Merge "Add option '--no-cert-checks' for 'upload' sub command."
Diffstat (limited to 'git_config.py')
-rw-r--r--git_config.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/git_config.py b/git_config.py
index 8c247394..8f666e6d 100644
--- a/git_config.py
+++ b/git_config.py
@@ -20,6 +20,7 @@ import errno
20import json 20import json
21import os 21import os
22import re 22import re
23import ssl
23import subprocess 24import subprocess
24import sys 25import sys
25try: 26try:
@@ -612,7 +613,7 @@ class Remote(object):
612 connectionUrl = self._InsteadOf() 613 connectionUrl = self._InsteadOf()
613 return _preconnect(connectionUrl) 614 return _preconnect(connectionUrl)
614 615
615 def ReviewUrl(self, userEmail): 616 def ReviewUrl(self, userEmail, validate_certs):
616 if self._review_url is None: 617 if self._review_url is None:
617 if self.review is None: 618 if self.review is None:
618 return None 619 return None
@@ -645,7 +646,11 @@ class Remote(object):
645 else: 646 else:
646 try: 647 try:
647 info_url = u + 'ssh_info' 648 info_url = u + 'ssh_info'
648 info = urllib.request.urlopen(info_url).read() 649 if not validate_certs:
650 context = ssl._create_unverified_context()
651 info = urllib.request.urlopen(info_url, context=context).read()
652 else:
653 info = urllib.request.urlopen(info_url).read()
649 if info == 'NOT_AVAILABLE' or '<' in info: 654 if info == 'NOT_AVAILABLE' or '<' in info:
650 # If `info` contains '<', we assume the server gave us some sort 655 # If `info` contains '<', we assume the server gave us some sort
651 # of HTML response back, like maybe a login page. 656 # of HTML response back, like maybe a login page.