From 9440ee8df0cbf374a3cf54ff72543ebfa1ab7898 Mon Sep 17 00:00:00 2001
From: Andy Shaw <andy.shaw@qt.io>
Date: Mon, 29 Oct 2018 15:18:41 +0100
Subject: [PATCH] Set the protocol type so that PAC scripts handle ws/wss
 correctly

On macOS it will only allow proxies in a PAC script to use http/https
protocols, so this enables them to work by automatically setting these
as the type instead.

Change-Id: I66589057d40d135229cbae4986ef0819287ea69a
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
---
 src/websockets/qwebsocket_p.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/websockets/qwebsocket_p.cpp b/src/websockets/qwebsocket_p.cpp
index a4601090..c8bee536 100644
--- a/src/websockets/qwebsocket_p.cpp
+++ b/src/websockets/qwebsocket_p.cpp
@@ -436,6 +436,7 @@ void QWebSocketPrivate::open(const QNetworkRequest &request, bool mask)
                         sslSocket->ignoreSslErrors(m_configuration.m_ignoredSslErrors);
     #ifndef QT_NO_NETWORKPROXY
                     sslSocket->setProxy(m_configuration.m_proxy);
+                    m_pSocket->setProtocolTag(QStringLiteral("https"));
     #endif
                     sslSocket->connectToHostEncrypted(url.host(), quint16(url.port(443)));
                 } else {
@@ -458,6 +459,7 @@ void QWebSocketPrivate::open(const QNetworkRequest &request, bool mask)
                 setSocketState(QAbstractSocket::ConnectingState);
     #ifndef QT_NO_NETWORKPROXY
                 m_pSocket->setProxy(m_configuration.m_proxy);
+                m_pSocket->setProtocolTag(QStringLiteral("http"));
     #endif
                 m_pSocket->connectToHost(url.host(), quint16(url.port(80)));
             } else {
-- 
GitLab