diff --git a/src/app/appconst.ts b/src/app/appconst.ts index 062b36e9..a395519d 100644 --- a/src/app/appconst.ts +++ b/src/app/appconst.ts @@ -47,6 +47,8 @@ export const TabIcons = [ "file", ]; +export const MaxWebSocketSendSize = 64 * 1024 - 100; + // @ts-ignore export const VERSION = __WAVETERM_VERSION__; // @ts-ignore diff --git a/src/app/workspace/cmdinput/textareainput.tsx b/src/app/workspace/cmdinput/textareainput.tsx index 66760d39..60c1f90e 100644 --- a/src/app/workspace/cmdinput/textareainput.tsx +++ b/src/app/workspace/cmdinput/textareainput.tsx @@ -13,6 +13,7 @@ import { getMonoFontSize } from "@/util/textmeasure"; import * as appconst from "@/app/appconst"; type OV = mobx.IObservableValue; +const MaxInputLength = 10 * 1024; function pageSize(div: any): number { if (div == null) { @@ -616,7 +617,7 @@ class TextAreaInput extends React.Component<{ screen: Screen; onHeightChange: () - + @@ -637,6 +638,7 @@ class TextAreaInput extends React.Component<{ screen: Screen; onHeightChange: () onChange={this.onChange} onSelect={this.onSelect} placeholder="Type here..." + maxLength={MaxInputLength} className={cn("textarea", { "display-disabled": auxViewFocused })} > appconst.MaxWebSocketSendSize) { + console.log("ws message too large", byteSize, data.type, msg.substring(0, 100)); + return; + } + this.wsConn.send(msg); } pushMessage(data: any) { diff --git a/wavesrv/cmd/main-server.go b/wavesrv/cmd/main-server.go index aff0d6e8..3709ed46 100644 --- a/wavesrv/cmd/main-server.go +++ b/wavesrv/cmd/main-server.go @@ -990,7 +990,6 @@ func doShutdown(reason string) { } func configDirHandler(w http.ResponseWriter, r *http.Request) { - log.Printf("running?") configPath := r.URL.Path configFullPath := path.Join(scbase.GetWaveHomeDir(), configPath) dirFile, err := os.Open(configFullPath) diff --git a/wavesrv/pkg/wsshell/wsshell.go b/wavesrv/pkg/wsshell/wsshell.go index 48031df5..f9a72b1c 100644 --- a/wavesrv/pkg/wsshell/wsshell.go +++ b/wavesrv/pkg/wsshell/wsshell.go @@ -119,7 +119,7 @@ func (ws *WSShell) ReadPump() { defer func() { ws.Conn.Close() }() - ws.Conn.SetReadLimit(4096) + ws.Conn.SetReadLimit(64 * 1024) ws.Conn.SetReadDeadline(time.Now().Add(readWait)) for { _, message, err := ws.Conn.ReadMessage()