mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
Assume http upload if ssh_info cannot be parsed
When uploading a change for review, we sometimes request /ssh_info to get the correct port number for uploading via ssh (regardless of whether or not we intend to upload over ssh). If we have trouble accessing /ssh_info (for authentication reasons, etc), we now press on under the assumption that we will upload via http instead of aborting. Change-Id: Ica6bbeac1279e89424a903529649b7f4af0b6937
This commit is contained in:
parent
efc986c508
commit
745a39ba3d
@ -596,14 +596,11 @@ class Remote(object):
|
||||
try:
|
||||
info_url = u + 'ssh_info'
|
||||
info = urllib.request.urlopen(info_url).read()
|
||||
if '<' in info:
|
||||
# Assume the server gave us some sort of HTML
|
||||
# response back, like maybe a login page.
|
||||
if info == 'NOT_AVAILABLE' or '<' in info:
|
||||
# If `info` contains '<', we assume the server gave us some sort
|
||||
# of HTML response back, like maybe a login page.
|
||||
#
|
||||
raise UploadError('%s: Cannot parse response' % info_url)
|
||||
|
||||
if info == 'NOT_AVAILABLE':
|
||||
# Assume HTTP if SSH is not enabled.
|
||||
# Assume HTTP if SSH is not enabled or ssh_info doesn't look right.
|
||||
self._review_url = http_url + 'p/'
|
||||
else:
|
||||
host, port = info.split()
|
||||
|
Loading…
Reference in New Issue
Block a user