summaryrefslogtreecommitdiffstats
path: root/src/network/socket/qabstractsocket.cpp
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@qt.io>2018-10-29 15:08:30 +0100
committerAndy Shaw <andy.shaw@qt.io>2018-12-10 12:16:48 +0000
commite25d7b14416b2d0ac2598bc03a7c2b8d96e63d42 (patch)
tree73bcf1dd6e5b8cc7807f7eb7b28ec94800a238ce /src/network/socket/qabstractsocket.cpp
parent3464e1e5c7b5b01ae13c99e3529dd02af1d36958 (diff)
Add a means to specify the protocol type, to aid websockets over proxy
When a PAC script is used on macOS, it will only allow connections for http/https, although a proxy can be used for ws/wss. Therefore we need to add a means of setting the protocol type for this sort of connection so that we can pass on the necessary information to the PAC script. Change-Id: I3fa29fa85a529bd88d9565daa58fe9d748b61a92 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'src/network/socket/qabstractsocket.cpp')
-rw-r--r--src/network/socket/qabstractsocket.cpp34
1 files changed, 33 insertions, 1 deletions
diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp
index 2f93c5fa2b..e68c5076b3 100644
--- a/src/network/socket/qabstractsocket.cpp
+++ b/src/network/socket/qabstractsocket.cpp
@@ -914,7 +914,7 @@ void QAbstractSocketPrivate::resolveProxy(const QString &hostname, quint16 port)
proxies << proxy;
} else {
// try the application settings instead
- QNetworkProxyQuery query(hostname, port, QString(),
+ QNetworkProxyQuery query(hostname, port, protocolTag,
socketType == QAbstractSocket::TcpSocket ?
QNetworkProxyQuery::TcpSocket :
socketType == QAbstractSocket::SctpSocket ?
@@ -2959,6 +2959,38 @@ QNetworkProxy QAbstractSocket::proxy() const
Q_D(const QAbstractSocket);
return d->proxy;
}
+
+/*!
+ \since 5.13
+
+ Returns the protocol tag for this socket.
+ If the protocol tag is set then this is passed to QNetworkProxyQuery
+ when this is created internally to indicate the protocol tag to be
+ used.
+
+ \sa setProtocolTag(), QNetworkProxyQuery
+*/
+
+QString QAbstractSocket::protocolTag() const
+{
+ Q_D(const QAbstractSocket);
+ return d->protocolTag;
+}
+
+/*!
+ \since 5.13
+
+ Sets the protocol tag for this socket to \a tag.
+
+ \sa protocolTag()
+*/
+
+void QAbstractSocket::setProtocolTag(const QString &tag)
+{
+ Q_D(QAbstractSocket);
+ d->protocolTag = tag;
+}
+
#endif // QT_NO_NETWORKPROXY
#ifndef QT_NO_DEBUG_STREAM