Merge branch 'master' of ssh://tonks/qutebrowser

This commit is contained in:
Florian Bruhin 2015-01-28 08:43:48 +01:00
commit 1526cf1532
2 changed files with 35 additions and 27 deletions

View File

@ -152,33 +152,34 @@ class NetworkManager(QNetworkAccessManager):
request.deleteLater() request.deleteLater()
self.shutting_down.emit() self.shutting_down.emit()
@pyqtSlot('QNetworkReply*', 'QList<QSslError>') if SSL_AVAILABLE:
def on_ssl_errors(self, reply, errors): @pyqtSlot('QNetworkReply*', 'QList<QSslError>')
"""Decide if SSL errors should be ignored or not. def on_ssl_errors(self, reply, errors):
"""Decide if SSL errors should be ignored or not.
This slot is called on SSL/TLS errors by the self.sslErrors signal. This slot is called on SSL/TLS errors by the self.sslErrors signal.
Args: Args:
reply: The QNetworkReply that is encountering the errors. reply: The QNetworkReply that is encountering the errors.
errors: A list of errors. errors: A list of errors.
""" """
ssl_strict = config.get('network', 'ssl-strict') ssl_strict = config.get('network', 'ssl-strict')
if ssl_strict == 'ask': if ssl_strict == 'ask':
err_string = '\n'.join('- ' + err.errorString() for err in errors) err_string = '\n'.join('- ' + err.errorString() for err in
answer = self._ask('SSL errors - continue?\n{}'.format(err_string), errors)
mode=usertypes.PromptMode.yesno, answer = self._ask('SSL errors - continue?\n{}'.format(
owner=reply) err_string), mode=usertypes.PromptMode.yesno, owner=reply)
if answer: if answer:
reply.ignoreSslErrors()
elif ssl_strict:
pass
else:
for err in errors:
# FIXME we might want to use warn here (non-fatal error)
# https://github.com/The-Compiler/qutebrowser/issues/114
message.error(self._win_id,
'SSL error: {}'.format(err.errorString()))
reply.ignoreSslErrors() reply.ignoreSslErrors()
elif ssl_strict:
pass
else:
for err in errors:
# FIXME we might want to use warn here (non-fatal error)
# https://github.com/The-Compiler/qutebrowser/issues/114
message.error(self._win_id,
'SSL error: {}'.format(err.errorString()))
reply.ignoreSslErrors()
@pyqtSlot('QNetworkReply', 'QAuthenticator') @pyqtSlot('QNetworkReply', 'QAuthenticator')
def on_authentication_required(self, reply, authenticator): def on_authentication_required(self, reply, authenticator):

View File

@ -29,7 +29,10 @@ import collections
from PyQt5.QtCore import QT_VERSION_STR, PYQT_VERSION_STR, qVersion from PyQt5.QtCore import QT_VERSION_STR, PYQT_VERSION_STR, qVersion
from PyQt5.QtWebKit import qWebKitVersion from PyQt5.QtWebKit import qWebKitVersion
from PyQt5.QtNetwork import QSslSocket try:
from PyQt5.QtNetwork import QSslSocket
except ImportError:
QSslSocket = None
import qutebrowser import qutebrowser
from qutebrowser.utils import log, utils from qutebrowser.utils import log, utils
@ -206,11 +209,15 @@ def version():
'PyQt: {}'.format(PYQT_VERSION_STR), 'PyQt: {}'.format(PYQT_VERSION_STR),
] ]
lines += _module_versions() lines += _module_versions()
if QSslSocket is not None and QSslSocket.supportsSsl():
ssl_version = QSslSocket.sslLibraryVersionString()
else:
ssl_version = 'unavailable'
lines += [ lines += [
'Webkit: {}'.format(qWebKitVersion()), 'Webkit: {}'.format(qWebKitVersion()),
'Harfbuzz: {}'.format(os.environ.get('QT_HARFBUZZ', 'system')), 'Harfbuzz: {}'.format(os.environ.get('QT_HARFBUZZ', 'system')),
'SSL: {}'.format(QSslSocket.sslLibraryVersionString() if 'SSL: {}'.format(ssl_version),
QSslSocket.supportsSsl() else 'unavailable'),
'', '',
'Frozen: {}'.format(hasattr(sys, 'frozen')), 'Frozen: {}'.format(hasattr(sys, 'frozen')),
'Platform: {}, {}'.format(platform.platform(), 'Platform: {}, {}'.format(platform.platform(),