summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKurt Pattyn <pattyn.kurt@gmail.com>2013-08-25 15:20:05 +0200
committerKurt Pattyn <pattyn.kurt@gmail.com>2013-08-25 15:20:05 +0200
commit768d6dc9644837cf04dcef9b3856dc27501f5057 (patch)
treea2b146e36296b2ecb4f0a9ce4be39c0da91ee3c7 /src
parent3a24ef03a45f4b8e81129cbe5a531e5581030228 (diff)
downloadqtwebsockets-768d6dc9644837cf04dcef9b3856dc27501f5057.tar.gz
Added check on QT_NO_NETWORKPROXY to include proxy functionality only when required
Diffstat (limited to 'src')
-rw-r--r--src/qwebsocket.cpp10
-rw-r--r--src/qwebsocket.h8
-rw-r--r--src/qwebsocket_p.cpp2
-rw-r--r--src/qwebsocket_p.h6
-rw-r--r--src/qwebsocketserver.cpp33
-rw-r--r--src/qwebsocketserver.h4
-rw-r--r--src/qwebsocketserver_p.cpp14
-rw-r--r--src/qwebsocketserver_p.h4
8 files changed, 57 insertions, 24 deletions
diff --git a/src/qwebsocket.cpp b/src/qwebsocket.cpp
index 7fab343..7360105 100644
--- a/src/qwebsocket.cpp
+++ b/src/qwebsocket.cpp
@@ -439,6 +439,7 @@ quint16 QWebSocket::peerPort() const
return d_ptr->peerPort();
}
+#ifndef QT_NO_NETWORKPROXY
/*!
* Returns the currently configured proxy
*/
@@ -448,6 +449,15 @@ QNetworkProxy QWebSocket::proxy() const
}
/*!
+ Sets the proxy to \a networkProxy
+ */
+void QWebSocket::setProxy(const QNetworkProxy &networkProxy)
+{
+ d_ptr->setProxy(networkProxy);
+}
+#endif
+
+/*!
* Returns the size in bytes of the readbuffer that is used by the socket.
*/
qint64 QWebSocket::readBufferSize() const
diff --git a/src/qwebsocket.h b/src/qwebsocket.h
index 8556185..7248b7e 100644
--- a/src/qwebsocket.h
+++ b/src/qwebsocket.h
@@ -14,7 +14,9 @@
#include <QUrl>
#include <QAbstractSocket>
#include <QHostAddress>
+#ifndef QT_NO_NETWORKPROXY
#include <QNetworkProxy>
+#endif
#include <QTime>
#include "qwebsocketsglobal.h"
#include "qwebsocketprotocol.h"
@@ -42,9 +44,11 @@ public:
QHostAddress peerAddress() const;
QString peerName() const;
quint16 peerPort() const;
+#ifndef QT_NO_NETWORKPROXY
QNetworkProxy proxy() const;
- qint64 readBufferSize() const;
void setProxy(const QNetworkProxy &networkProxy);
+#endif
+ qint64 readBufferSize() const;
void setReadBufferSize(qint64 size);
void setSocketOption(QAbstractSocket::SocketOption option, const QVariant &value);
QVariant socketOption(QAbstractSocket::SocketOption option);
@@ -75,7 +79,9 @@ Q_SIGNALS:
void connected();
void disconnected();
void stateChanged(QAbstractSocket::SocketState state);
+#ifndef QT_NO_NETWORKPROXY
void proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *pAuthenticator);
+#endif
void readChannelFinished();
void textFrameReceived(QString frame, bool isLastFrame);
void binaryFrameReceived(QByteArray frame, bool isLastFrame);
diff --git a/src/qwebsocket_p.cpp b/src/qwebsocket_p.cpp
index dd1af0d..6dd4528 100644
--- a/src/qwebsocket_p.cpp
+++ b/src/qwebsocket_p.cpp
@@ -10,7 +10,9 @@
#include <QRegularExpression>
#include <QStringList>
#include <QHostAddress>
+#ifndef QT_NONETWORKPROXY
#include <QNetworkProxy>
+#endif
#include <QDebug>
diff --git a/src/qwebsocket_p.h b/src/qwebsocket_p.h
index d0feeba..9625e82 100644
--- a/src/qwebsocket_p.h
+++ b/src/qwebsocket_p.h
@@ -24,7 +24,9 @@
#include <QUrl>
#include <QAbstractSocket>
#include <QHostAddress>
+#ifndef QT_NO_NETWORKPROXY
#include <QNetworkProxy>
+#endif
#include <QTime>
#include "qwebsocketsglobal.h"
#include "qwebsocketprotocol.h"
@@ -58,9 +60,11 @@ public:
QHostAddress peerAddress() const;
QString peerName() const;
quint16 peerPort() const;
+#ifndef QT_NO_NETWORKPROXY
QNetworkProxy proxy() const;
- qint64 readBufferSize() const;
void setProxy(const QNetworkProxy &networkProxy);
+#endif
+ qint64 readBufferSize() const;
void setReadBufferSize(qint64 size);
void setSocketOption(QAbstractSocket::SocketOption option, const QVariant &value);
QVariant socketOption(QAbstractSocket::SocketOption option);
diff --git a/src/qwebsocketserver.cpp b/src/qwebsocketserver.cpp
index cc7322c..13c2f98 100644
--- a/src/qwebsocketserver.cpp
+++ b/src/qwebsocketserver.cpp
@@ -167,6 +167,8 @@ QWebSocket *QWebSocketServer::nextPendingConnection()
}
/*!
+#ifndef QT_NO_NETWORKPROXY
+/*!
Returns the network proxy for this socket. By default QNetworkProxy::DefaultProxy is used.
\sa setProxy().
@@ -177,6 +179,21 @@ QNetworkProxy QWebSocketServer::proxy() const
}
/*!
+ \brief Sets the explicit network proxy for this socket to \a networkProxy.
+
+ To disable the use of a proxy for this socket, use the QNetworkProxy::NoProxy proxy type:
+
+ \code
+ server->setProxy(QNetworkProxy::NoProxy);
+ \endcode
+
+ \sa proxy().
+*/
+void QWebSocketServer::setProxy(const QNetworkProxy &networkProxy)
+{
+ d_ptr->setProxy(networkProxy);
+}
+#endif
Returns the server's address if the server is listening for connections; otherwise returns QHostAddress::Null.
\sa serverPort() and listen().
@@ -218,22 +235,6 @@ void QWebSocketServer::setMaxPendingConnections(int numConnections)
}
/*!
- \brief Sets the explicit network proxy for this socket to \a networkProxy.
-
- To disable the use of a proxy for this socket, use the QNetworkProxy::NoProxy proxy type:
-
- \code
- server->setProxy(QNetworkProxy::NoProxy);
- \endcode
-
- \sa proxy().
-*/
-void QWebSocketServer::setProxy(const QNetworkProxy &networkProxy)
-{
- d_ptr->setProxy(networkProxy);
-}
-
-/*!
Sets the socket descriptor this server should use when listening for incoming connections to \a socketDescriptor.
Returns true if the socket is set successfully; otherwise returns false.\n
diff --git a/src/qwebsocketserver.h b/src/qwebsocketserver.h
index 21efe54..95adb41 100644
--- a/src/qwebsocketserver.h
+++ b/src/qwebsocketserver.h
@@ -42,6 +42,10 @@ public:
bool setSocketDescriptor(int socketDescriptor);
int socketDescriptor() const;
bool waitForNewConnection(int msec = 0, bool *timedOut = 0);
+#ifndef QT_NO_NETWORKPROXY
+ void setProxy(const QNetworkProxy &networkProxy);
+ QNetworkProxy proxy() const;
+#endif
QList<QWebSocketProtocol::Version> supportedVersions() const;
QList<QString> supportedProtocols() const;
diff --git a/src/qwebsocketserver_p.cpp b/src/qwebsocketserver_p.cpp
index 79e4ef1..b5381b4 100644
--- a/src/qwebsocketserver_p.cpp
+++ b/src/qwebsocketserver_p.cpp
@@ -112,6 +112,10 @@ QWebSocket *QWebSocketServerPrivate::nextPendingConnection()
return pWebSocket;
}
+#ifndef QT_NO_NETWORKPROXY
+/*!
+ \internal
+ */
QNetworkProxy QWebSocketServerPrivate::proxy() const
{
return m_pTcpServer->proxy();
@@ -120,6 +124,11 @@ QNetworkProxy QWebSocketServerPrivate::proxy() const
/*!
\internal
*/
+void QWebSocketServerPrivate::setProxy(const QNetworkProxy &networkProxy)
+{
+ m_pTcpServer->setProxy(networkProxy);
+}
+#endif
/*!
\internal
*/
@@ -152,11 +161,6 @@ void QWebSocketServerPrivate::setMaxPendingConnections(int numConnections)
m_pTcpServer->setMaxPendingConnections(numConnections);
}
-void QWebSocketServerPrivate::setProxy(const QNetworkProxy &networkProxy)
-{
- m_pTcpServer->setProxy(networkProxy);
-}
-
/*!
\internal
*/
diff --git a/src/qwebsocketserver_p.h b/src/qwebsocketserver_p.h
index 00a6c4e..a853fb4 100644
--- a/src/qwebsocketserver_p.h
+++ b/src/qwebsocketserver_p.h
@@ -43,12 +43,14 @@ public:
bool listen(const QHostAddress &address = QHostAddress::Any, quint16 port = 0);
int maxPendingConnections() const;
virtual QWebSocket *nextPendingConnection();
+#ifndef QT_NO_NETWORKPROXY
QNetworkProxy proxy() const;
+ void setProxy(const QNetworkProxy &networkProxy);
+#endif
QHostAddress serverAddress() const;
QAbstractSocket::SocketError serverError() const;
quint16 serverPort() const;
void setMaxPendingConnections(int numConnections);
- void setProxy(const QNetworkProxy &networkProxy);
bool setSocketDescriptor(int socketDescriptor);
int socketDescriptor() const;
bool waitForNewConnection(int msec = 0, bool *timedOut = 0);