Enhanced error message for broken SSL keyfiles

This commit is contained in:
Sebastian Lohff 2012-06-25 20:33:21 +02:00
parent 2ce2a9c228
commit 8a040fbb75
1 changed files with 4 additions and 1 deletions

View File

@ -782,7 +782,10 @@ class ServeFile():
if self.useSSL: if self.useSSL:
if not self._getKey(): if not self._getKey():
self.genKeyPair() self.genKeyPair()
try:
server = SecureThreadedHTTPServer(self._getCert(), self._getKey(), (listenIp, self.port), handler, False) server = SecureThreadedHTTPServer(self._getCert(), self._getKey(), (listenIp, self.port), handler, False)
except SSL.Error as e:
raise ServeFileException("SSL Error: Could not read SSL public/private key from file(s) (error was: \"%s\")" % (e[0][0][2],))
else: else:
server = ThreadedHTTPServer((listenIp, self.port), handler, False) server = ThreadedHTTPServer((listenIp, self.port), handler, False)