initial work on #1483

Add the new utf8-only cap, disallow non-utf8 when websockets are enabled
This commit is contained in:
Shivaram Lingamneni 2021-01-15 06:19:13 -05:00
parent 5095a4d814
commit db81b15acb
4 changed files with 18 additions and 12 deletions

View file

@ -686,9 +686,12 @@ func (client *Client) run(session *Session) {
if err == errInvalidUtf8 {
invalidUtf8 = true // handle as normal, including labeling
} else if err != nil {
quitMessage := "connection closed"
if err == errReadQ {
quitMessage = "readQ exceeded"
var quitMessage string
switch err {
case errReadQ, errWSBinaryMessage:
quitMessage = err.Error()
default:
quitMessage = "connection closed"
}
client.Quit(quitMessage, session)
// since the client did not actually send us a QUIT,