2 QWebSockets implements the WebSocket protocol as defined in RFC 6455.
3 Copyright (C) 2013 Kurt Pattyn (pattyn.kurt@gmail.com)
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 #ifndef QWEBSOCKETHANDSHAKERESPONSE_P_H
21 #define QWEBSOCKETHANDSHAKERESPONSE_P_H
26 // This file is not part of the Qt API. It exists purely as an
27 // implementation detail. This header file may change from version to
28 // version without notice, or even be removed.
34 #include "qwebsocketprotocol.h"
38 class QWebSocketHandshakeRequest;
42 class QWebSocketHandshakeResponse : public QObject
45 Q_DISABLE_COPY(QWebSocketHandshakeResponse)
48 QWebSocketHandshakeResponse(const QWebSocketHandshakeRequest &request,
49 const QString &serverName,
51 const QList<QWebSocketProtocol::Version> &supportedVersions,
52 const QList<QString> &supportedProtocols,
53 const QList<QString> &supportedExtensions);
55 virtual ~QWebSocketHandshakeResponse();
58 bool canUpgrade() const;
59 QString getAcceptedProtocol() const;
60 QString getAcceptedExtension() const;
61 QWebSocketProtocol::Version getAcceptedVersion() const;
71 QString m_acceptedProtocol;
72 QString m_acceptedExtension;
73 QWebSocketProtocol::Version m_acceptedVersion;
75 QString calculateAcceptKey(const QString &key) const;
76 QString getHandshakeResponse(const QWebSocketHandshakeRequest &request,
77 const QString &serverName,
79 const QList<QWebSocketProtocol::Version> &supportedVersions,
80 const QList<QString> &supportedProtocols,
81 const QList<QString> &supportedExtensions);
83 QTextStream &writeToStream(QTextStream &textStream) const;
84 friend QTextStream &operator <<(QTextStream &stream, const QWebSocketHandshakeResponse &response);
89 #endif // QWEBSOCKETHANDSHAKERESPONSE_P_H