From cf41cd16a1f156d68f9cb4a84dd77230f29d739f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Thu, 2 Aug 2018 16:54:49 +0200 Subject: Limit Close frame to 125 bytes All control frames should be limited to 125 frames. https://tools.ietf.org/html/rfc6455#section-5.5 Task-number: QTBUG-62949 Change-Id: Id9b5a431faab6ff6edf7dc2e5c3525e999bc04ea Reviewed-by: Timur Pocheptsov Reviewed-by: Jesus Fernandez --- src/websockets/qwebsocket.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/websockets/qwebsocket.cpp') diff --git a/src/websockets/qwebsocket.cpp b/src/websockets/qwebsocket.cpp index 1b0fc35..3472fe4 100644 --- a/src/websockets/qwebsocket.cpp +++ b/src/websockets/qwebsocket.cpp @@ -402,7 +402,10 @@ qint64 QWebSocket::sendBinaryMessage(const QByteArray &data) Any data in the write buffer is flushed before the socket is closed. The \a closeCode is a QWebSocketProtocol::CloseCode indicating the reason to close, and - \a reason describes the reason of the closure more in detail + \a reason describes the reason of the closure more in detail. All control + frames, including the Close frame, are limited to 125 bytes. Since two of + these are used for \a closeCode the maximum length of \a reason is 123! If + \a reason exceeds this limit it will be truncated. */ void QWebSocket::close(QWebSocketProtocol::CloseCode closeCode, const QString &reason) { -- cgit v1.2.1