Skip to content

Commit

Permalink
Change Default SSL Configuration
Browse files Browse the repository at this point in the history
The default SSL configuration has problems negotiating the TLS bits on some sites. Setting TLSv1 as the only protocol choice, got alot more (at least the set I cared about) to work.
  • Loading branch information
mattwoodyard committed Nov 3, 2013
1 parent 14e5068 commit 5812463
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions ghost/ghost.py
Expand Up @@ -13,7 +13,7 @@
from PySide import QtWebKit
from PySide.QtNetwork import QNetworkRequest, QNetworkAccessManager, \
QNetworkCookieJar, QNetworkDiskCache, \
QNetworkProxy, QNetworkCookie
QNetworkProxy, QNetworkCookie, QSslConfiguration, QSsl
from PySide import QtCore
from PySide.QtCore import QSize, QByteArray, QUrl, QDateTime, \
QtCriticalMsg, QtDebugMsg, QtFatalMsg, \
Expand All @@ -27,7 +27,7 @@
from PyQt4 import QtWebKit
from PyQt4.QtNetwork import QNetworkRequest, QNetworkAccessManager, \
QNetworkCookieJar, QNetworkDiskCache, \
QNetworkProxy, QNetworkCookie
QNetworkProxy, QNetworkCookie, QSslConfiguration, QSsl
from PyQt4 import QtCore
from PyQt4.QtCore import QSize, QByteArray, QUrl, QDateTime, \
QtCriticalMsg, QtDebugMsg, QtFatalMsg, \
Expand Down Expand Up @@ -224,7 +224,7 @@ def __init__(self, user_agent=default_user_agent, wait_timeout=8,
cache_dir=os.path.join(tempfile.gettempdir(), "ghost.py"),
plugins_enabled=False, java_enabled=False,
plugin_path=['/usr/lib/mozilla/plugins', ],
download_images=True, qt_debug=False,
download_images=True, qt_debug=False, no_sslv3 = True,
show_scroolbars=True):
self.http_resources = []

Expand Down Expand Up @@ -252,6 +252,15 @@ def __init__(self, user_agent=default_user_agent, wait_timeout=8,
for p in plugin_path:
Ghost._app.addLibraryPath(p)



if no_sslv3:
# enable tls1 only
old = QSslConfiguration.defaultConfiguration()
old.setProtocol(QSsl.TlsV1)
QSslConfiguration.setDefaultConfiguration(old)


self.popup_messages = []
self.page = GhostWebPage(Ghost._app, self)
QtWebKit.QWebSettings.setMaximumPagesInCache(0)
Expand Down

0 comments on commit 5812463

Please sign in to comment.