From 06b0ebd66fb1a7c536c96572ad8a3b55b713b177 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 4 Nov 2015 21:35:31 +0100 Subject: [PATCH] Check QT_NO_SSL in SocketStreamHandleQt. Since Qt 5.5, Secure Transport is used instead of OpenSSL on OS X. This means secure websockets (wss://) were disabled on OS X despite QSslSocket being available. Change-Id: Ic584a6ed81b625c84a85e54dba84c8fc920b861a Task-number: QTBUG-49027 Reviewed-by: Richard J. Moore Reviewed-by: Timur Pocheptsov --- Source/WebCore/platform/network/qt/SocketStreamHandlePrivate.h | 2 +- Source/WebCore/platform/network/qt/SocketStreamHandleQt.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Source/WebCore/platform/network/qt/SocketStreamHandlePrivate.h b/Source/WebCore/platform/network/qt/SocketStreamHandlePrivate.h index f447cc2..647c4ef 100644 --- Source/WebCore/platform/network/qt/SocketStreamHandlePrivate.h +++ Source/WebCore/platform/network/qt/SocketStreamHandlePrivate.h @@ -60,7 +60,7 @@ public Q_SLOTS: void socketError(QAbstractSocket::SocketError); void socketClosedCallback(); void socketErrorCallback(int); -#ifndef QT_NO_OPENSSL +#ifndef QT_NO_SSL void socketSslErrors(const QList&); #endif public: diff --git a/Source/WebCore/platform/network/qt/SocketStreamHandleQt.cpp b/Source/WebCore/platform/network/qt/SocketStreamHandleQt.cpp index d4cbdc7..cd71190 100644 --- Source/WebCore/platform/network/qt/SocketStreamHandleQt.cpp +++ Source/WebCore/platform/network/qt/SocketStreamHandleQt.cpp @@ -48,7 +48,7 @@ SocketStreamHandlePrivate::SocketStreamHandlePrivate(SocketStreamHandle* streamH bool isSecure = url.protocolIs("wss"); if (isSecure) { -#ifndef QT_NO_OPENSSL +#ifndef QT_NO_SSL m_socket = new QSslSocket(this); #endif } else @@ -63,7 +63,7 @@ SocketStreamHandlePrivate::SocketStreamHandlePrivate(SocketStreamHandle* streamH QString host = url.host(); if (isSecure) { -#ifndef QT_NO_OPENSSL +#ifndef QT_NO_SSL static_cast(m_socket)->connectToHostEncrypted(host, port); #endif } else @@ -88,7 +88,7 @@ void SocketStreamHandlePrivate::initConnections() connect(m_socket, SIGNAL(readyRead()), this, SLOT(socketReadyRead())); connect(m_socket, SIGNAL(disconnected()), this, SLOT(socketClosed())); connect(m_socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(socketError(QAbstractSocket::SocketError))); -#ifndef QT_NO_OPENSSL +#ifndef QT_NO_SSL if (qobject_cast(m_socket)) connect(m_socket, SIGNAL(sslErrors(const QList&)), this, SLOT(socketSslErrors(const QList&))); #endif @@ -176,7 +176,7 @@ void SocketStreamHandlePrivate::socketErrorCallback(int error) } } -#ifndef QT_NO_OPENSSL +#ifndef QT_NO_SSL void SocketStreamHandlePrivate::socketSslErrors(const QList& error) { QMetaObject::invokeMethod(this, "socketErrorCallback", Qt::QueuedConnection, Q_ARG(int, error[0].error())); -- 2.6.2.2.g1b5ffa3 From 11ce03bd807504559961dc69bdf6ccc382b61812 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 4 Nov 2015 21:49:48 +0100 Subject: [PATCH] Check QT_NO_SSL for QtWebKit user agent. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit When QT_NO_OPENSSL is checked, the user agent says "no SSL support" even when there *is* SSL support via Secure Transport on OS X. Change-Id: Idb8bf3ee95689f60adab332b3cbac7b6bdf6a738 Reviewed-by: Timur Pocheptsov Reviewed-by: Michael Brüning --- Source/WebCore/platform/qt/UserAgentQt.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/WebCore/platform/qt/UserAgentQt.cpp b/Source/WebCore/platform/qt/UserAgentQt.cpp index 6f1da23..80996a2 100644 --- Source/WebCore/platform/qt/UserAgentQt.cpp +++ Source/WebCore/platform/qt/UserAgentQt.cpp @@ -74,7 +74,7 @@ String UserAgentQt::standardUserAgent(const String &applicationNameForUserAgent, // Security strength. QString securityStrength; -#if defined(QT_NO_OPENSSL) +#if defined(QT_NO_SSL) securityStrength = QLatin1String("N; "); #endif ua = ua.arg(securityStrength); -- 2.6.2.2.g1b5ffa3 From 2caa61dc485dc7d38c847ed6c6cff774fcf80061 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 4 Nov 2015 21:32:42 +0100 Subject: [PATCH 1/1] Check m_socket in SocketStreamHandlePrivate::close. m_socket can be set to 0 in the constructor, e.g. when Qt is compiled without SSL support. Change-Id: Ic3bb18f6c801d463e2277b4c19ef2c790216bf69 Task-number: QTBUG-49027 Reviewed-by: Richard J. Moore --- Source/WebCore/platform/network/qt/SocketStreamHandleQt.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/WebCore/platform/network/qt/SocketStreamHandleQt.cpp b/Source/WebCore/platform/network/qt/SocketStreamHandleQt.cpp index ca7b60c..d4cbdc7 100644 --- Source/WebCore/platform/network/qt/SocketStreamHandleQt.cpp +++ Source/WebCore/platform/network/qt/SocketStreamHandleQt.cpp @@ -127,7 +127,7 @@ int SocketStreamHandlePrivate::send(const char* data, int len) void SocketStreamHandlePrivate::close() { - if (m_streamHandle && m_streamHandle->m_state == SocketStreamHandleBase::Connecting) { + if (m_socket && m_streamHandle && m_streamHandle->m_state == SocketStreamHandleBase::Connecting) { m_socket->abort(); m_streamHandle->client()->didCloseSocketStream(m_streamHandle); return; -- 2.6.2.2.g1b5ffa3