We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents b4e4f4f + 454aee8 commit e2016acCopy full SHA for e2016ac
ws_js.go
@@ -42,7 +42,7 @@ const (
42
// Conn provides a wrapper around the browser WebSocket API.
43
type Conn struct {
44
noCopy noCopy
45
- ws wsjs.WebSocket
+ ws wsjs.WebSocket
46
47
// read limit for a message in bytes.
48
msgReadLimit xsync.Int64
@@ -138,7 +138,8 @@ func (c *Conn) Read(ctx context.Context) (MessageType, []byte, error) {
138
if err != nil {
139
return 0, nil, fmt.Errorf("failed to read: %w", err)
140
}
141
- if int64(len(p)) > c.msgReadLimit.Load() {
+ readLimit := c.msgReadLimit.Load()
142
+ if readLimit >= 0 && int64(len(p)) > readLimit {
143
err := fmt.Errorf("read limited at %v bytes", c.msgReadLimit.Load())
144
c.Close(StatusMessageTooBig, err.Error())
145
return 0, nil, err
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
0 commit comments