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 HANDSHAKERESPONSE_P_H
21 #define HANDSHAKERESPONSE_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 HandshakeRequest;
42 class HandshakeResponse:public QObject
46 HandshakeResponse(const HandshakeRequest &request,
47 const QString &serverName,
49 const QList<QWebSocketProtocol::Version> &supportedVersions,
50 const QList<QString> &supportedProtocols,
51 const QList<QString> &supportedExtensions);
53 virtual ~HandshakeResponse();
56 bool canUpgrade() const;
57 QString getAcceptedProtocol() const;
58 QString getAcceptedExtension() const;
59 QWebSocketProtocol::Version getAcceptedVersion() const;
66 Q_DISABLE_COPY(HandshakeResponse)
70 QString m_acceptedProtocol;
71 QString m_acceptedExtension;
72 QWebSocketProtocol::Version m_acceptedVersion;
74 QString calculateAcceptKey(const QString &key) const;
75 QString getHandshakeResponse(const HandshakeRequest &request,
76 const QString &serverName,
78 const QList<QWebSocketProtocol::Version> &supportedVersions,
79 const QList<QString> &supportedProtocols,
80 const QList<QString> &supportedExtensions);
82 QTextStream &writeToStream(QTextStream &textStream) const;
83 friend QTextStream &operator <<(QTextStream &stream, const HandshakeResponse &response);
88 #endif // HANDSHAKERESPONSE_P_H