diff -r bb196e51827d -r a7a5750aded4 eric6/WebBrowser/Network/NetworkManager.py --- a/eric6/WebBrowser/Network/NetworkManager.py Sun May 03 10:26:40 2020 +0200 +++ b/eric6/WebBrowser/Network/NetworkManager.py Sun May 03 16:18:14 2020 +0200 @@ -64,7 +64,7 @@ if SSL_AVAILABLE: self.__sslErrorHandler = E5SslErrorHandler(self) - self.sslErrors.connect(self.__sslErrorHandler.sslErrorsReplySlot) + self.sslErrors.connect(self.__sslErrorHandlingSlot) self.__temporarilyIgnoredSslErrors = {} self.__permanentlyIgnoredSslErrors = {} @@ -177,6 +177,9 @@ @return flag indicating to ignore this error @rtype bool """ + if Preferences.getWebBrowser("AlwaysRejectFaultyCertificates"): + return False + self.__load() host = error.url().host() @@ -200,11 +203,11 @@ E5MessageBox.Warning, title, self.tr("""<b>{0}</b>""" - """<p>The page you are trying to access has errors""" - """ in the SSL certificate.</p>""" - """<ul><li>{1}</li></ul>""" + """<p>The host <b>{1}</b> you are trying to access has""" + """ errors in the SSL certificate.</p>""" + """<ul><li>{2}</li></ul>""" """<p>Would you like to make an exception?</p>""") - .format(title, error.errorDescription()), + .format(title, host, error.errorDescription()), modal=True, parent=view) permButton = msgBox.addButton(self.tr("&Permanent accept"), E5MessageBox.AcceptRole) @@ -226,10 +229,35 @@ else: return False + def __sslErrorHandlingSlot(self, reply, errors): + """ + Private slot to handle SSL errors for a network reply. + + @param reply reference to the reply object + @type QNetworkReply + @param errors list of SSL errors + @type list of QSslError + """ + if Preferences.getWebBrowser("AlwaysRejectFaultyCertificates"): + return + + self.__load() + + host = reply.url().host() + if ( + host in self.__permanentlyIgnoredSslErrors or + host in self.__temporarilyIgnoredSslErrors + ): + reply.ignoreSslErrors() + else: + self.__sslErrorHandler.sslErrorsReply(reply, errors) + def isInsecureHost(self, host): """ Public method to check a host against the list of insecure hosts. + @param host name of the host to be checked + @type str @return flag indicating an insecure host @rtype bool """