summaryrefslogtreecommitdiff
path: root/src/rhimportd/ctrlWebSocket.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/rhimportd/ctrlWebSocket.go')
-rw-r--r--src/rhimportd/ctrlWebSocket.go13
1 files changed, 2 insertions, 11 deletions
diff --git a/src/rhimportd/ctrlWebSocket.go b/src/rhimportd/ctrlWebSocket.go
index 1f04b84..e764085 100644
--- a/src/rhimportd/ctrlWebSocket.go
+++ b/src/rhimportd/ctrlWebSocket.go
@@ -415,17 +415,8 @@ func webSocketHandler(conf *rhimport.Config, db *rddb.DBChan, sessions *rhimport
// rhdl.Printf("Websocket Client %s got: %+v", ws.RemoteAddr(), reqdata)
reqchan <- *reqdata
case websocket.BinaryMessage:
- data, err := ioutil.ReadAll(r)
- if err != nil {
- if err == io.EOF {
- err = io.ErrUnexpectedEOF
- }
- rhdl.Println("WebSocket Client", ws.RemoteAddr(), "disconnected:", err)
- sendWebSocketErrorResponse(ws, http.StatusInternalServerError, err.Error())
- return
- }
- // rhdl.Printf("WebSocket Client %s: got binary message (%d bytes)", ws.RemoteAddr(), len(data))
- binchan <- data
+ sendWebSocketErrorResponse(ws, http.StatusBadRequest, "binary messages are not allowed")
+ io.Copy(ioutil.Discard, r) // consume all the data
}
}
}