Validate that the close reason is proper utf-8. Autobahn 7.5.1

This commit is contained in:
Benjamin Sergeant 2019-09-03 14:35:40 -07:00
parent 7c7c877621
commit deaa753657
2 changed files with 11 additions and 2 deletions

View File

@ -3,8 +3,9 @@ All notable changes to this project will be documented in this file.
## [5.1.6] - 2019-09-03
Sending invalid UTF-8 TEXT message should fail and close the connection (fix remaining autobahn test: 6.X UTF-8 Handling)
Fix failing unittest which was sending binary data in text mode with WebSocket::send to call properly call WebSocket::sendBinary instead.
- Sending invalid UTF-8 TEXT message should fail and close the connection (fix remaining autobahn test: 6.X UTF-8 Handling)
- Fix failing unittest which was sending binary data in text mode with WebSocket::send to call properly call WebSocket::sendBinary instead.
- Validate that the reason is proper utf-8. (fix autobahn test 7.5.1)
## [5.1.5] - 2019-09-03

View File

@ -37,6 +37,7 @@
#include "IXWebSocketHttpHeaders.h"
#include "IXUrlParser.h"
#include "IXSocketFactory.h"
#include "IXUtf8Validator.h"
#include <string.h>
#include <stdlib.h>
@ -676,6 +677,13 @@ namespace ix
reason.assign(_rxbuf.begin()+ws.header_size + 2,
_rxbuf.begin()+ws.header_size + (size_t) ws.N);
}
// Validate that the reason is proper utf-8. Autobahn 7.5.1
if (!validateUtf8(reason))
{
code = WebSocketCloseConstants::kInvalidFramePayloadData;
reason = WebSocketCloseConstants::kInvalidFramePayloadDataMessage;
}
}
else
{