Added check on QT_NO_NETWORKPROXY to include proxy functionality only when required
authorKurt Pattyn <pattyn.kurt@gmail.com>
Sun, 25 Aug 2013 13:20:05 +0000 (15:20 +0200)
committerKurt Pattyn <pattyn.kurt@gmail.com>
Sun, 25 Aug 2013 13:20:05 +0000 (15:20 +0200)
src/qwebsocket.cpp
src/qwebsocket.h
src/qwebsocket_p.cpp
src/qwebsocket_p.h
src/qwebsocketserver.cpp
src/qwebsocketserver.h
src/qwebsocketserver_p.cpp
src/qwebsocketserver_p.h

index 7fab343..7360105 100644 (file)
@@ -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
index 8556185..7248b7e 100644 (file)
@@ -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);
index dd1af0d..6dd4528 100644 (file)
@@ -10,7 +10,9 @@
 #include <QRegularExpression>
 #include <QStringList>
 #include <QHostAddress>
+#ifndef QT_NONETWORKPROXY
 #include <QNetworkProxy>
+#endif
 
 #include <QDebug>
 
index d0feeba..9625e82 100644 (file)
@@ -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);
index cc7322c..13c2f98 100644 (file)
@@ -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
index 21efe54..95adb41 100644 (file)
@@ -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;
index 79e4ef1..b5381b4 100644 (file)
@@ -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
  */
index 00a6c4e..a853fb4 100644 (file)
@@ -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);