Permalink
Browse files

Fix OS X keychain bug in Qt 5

* Performing basic auth would pop up a keychain dialog
* Pressing "Accept" resulted in an infinite loop
  • Loading branch information...
1 parent 87418b8 commit b5ca7e6057bcad7334c5d99664cace77dd893fa0 @jferris jferris committed Nov 10, 2013
Showing with 12 additions and 0 deletions.
  1. +10 −0 src/NetworkAccessManager.cpp
  2. +2 −0 src/NetworkAccessManager.h
View
10 src/NetworkAccessManager.cpp
@@ -8,6 +8,7 @@
NetworkAccessManager::NetworkAccessManager(QObject *parent):QNetworkAccessManager(parent) {
connect(this, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)), SLOT(provideAuthentication(QNetworkReply*,QAuthenticator*)));
connect(this, SIGNAL(finished(QNetworkReply *)), this, SLOT(finished(QNetworkReply *)));
+ disableKeyChainLookup();
}
QNetworkReply* NetworkAccessManager::createRequest(QNetworkAccessManager::Operation operation, const QNetworkRequest &request, QIODevice * outgoingData = 0) {
@@ -93,3 +94,12 @@ bool NetworkAccessManager::isBlacklisted(QUrl url) {
return false;
};
+/*
+ * This is a workaround for a Qt 5/OS X bug:
+ * https://bugreports.qt-project.org/browse/QTBUG-30434
+ */
+void NetworkAccessManager::disableKeyChainLookup() {
+ QNetworkProxy fixedProxy = proxy();
+ fixedProxy.setHostName(" ");
+ setProxy(fixedProxy);
+}
View
2 src/NetworkAccessManager.h
@@ -24,6 +24,8 @@ class NetworkAccessManager : public QNetworkAccessManager {
QList<QUrl> m_urlBlacklist;
private:
+ void disableKeyChainLookup();
+
QHash<QString, QString> m_headers;
bool isBlacklisted(QUrl url);
QHash<QUrl, QUrl> m_redirectMappings;

0 comments on commit b5ca7e6

Please sign in to comment.