mirror of
https://github.com/jeremyd/ergo.git
synced 2026-04-27 08:00:00 -07:00
simplify utf8 validation of incoming WS lines
As of #1483, websockets entail enforce-utf8, so there's no need to check globalUTF8EnforcementSetting when handling websockets.
This commit is contained in:
@@ -126,10 +126,8 @@ func (wc IRCWSConn) WriteLines(buffers [][]byte) (err error) {
|
||||
func (wc IRCWSConn) ReadLine() (line []byte, err error) {
|
||||
messageType, line, err := wc.conn.ReadMessage()
|
||||
if err == nil {
|
||||
if messageType == websocket.BinaryMessage && globalUtf8EnforcementSetting {
|
||||
if !utf8.Valid(line) {
|
||||
return line, errInvalidUtf8
|
||||
}
|
||||
if messageType == websocket.BinaryMessage && !utf8.Valid(line) {
|
||||
return line, errInvalidUtf8
|
||||
}
|
||||
return line, nil
|
||||
} else if err == websocket.ErrReadLimit {
|
||||
|
||||
Reference in New Issue
Block a user