chiark / gitweb /
git-svn: check HTTPS connection with Python Requests
authorHans-Christoph Steiner <hans@eds.org>
Mon, 5 Feb 2018 13:44:59 +0000 (14:44 +0100)
committerHans-Christoph Steiner <hans@eds.org>
Mon, 12 Feb 2018 11:07:24 +0000 (12:07 +0100)
git-svn will put up the "Reject/Accept" prompt if it encounters a bad HTTPS
certificate.  I could find no way to stop it from doing that.  So instead,
this checks the HTTPS connection with an HTTP HEAD request first.

fdroidserver/common.py

index 938b1c158b8dbc1b6ebefc076f682e9fb283f267..87a9d27904023724f4dca37137b3799d4cf61dd7 100644 (file)
@@ -1007,6 +1007,11 @@ class vcs_gitsvn(vcs):
             if not remote.startswith('https://'):
                 raise VCSException(_('HTTPS must be used with Subversion URLs!'))
 
+            # git-svn sucks at certificate validation, this throws useful errors:
+            import requests
+            r = requests.head(remote)
+            r.raise_for_status()
+
             gitsvn_args.extend(['--', remote, self.local])
             p = self.git(gitsvn_args)
             if p.returncode != 0: