diff options
author | David Pursehouse <dpursehouse@collab.net> | 2017-08-30 15:11:10 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2017-08-30 15:11:10 +0000 |
commit | 2c57d619bca9b946eeaa4f5b88397b9e1460cf35 (patch) | |
tree | 40a44a05a9d1a3cd12121f4afe8e8374f9e46da6 /git_config.py | |
parent | d1ebc89a083f2966f8c65246bb63e2deaadfab62 (diff) | |
parent | bed59cec5e5a9a5668cf2c7df3a24545b1e76c09 (diff) | |
download | git-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.py | 9 |
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 | |||
20 | import json | 20 | import json |
21 | import os | 21 | import os |
22 | import re | 22 | import re |
23 | import ssl | ||
23 | import subprocess | 24 | import subprocess |
24 | import sys | 25 | import sys |
25 | try: | 26 | try: |
@@ -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. |