aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2023-05-31 20:52:19 +0200
committerFlorian Fischer <florian.fischer@muhq.space>2023-05-31 20:52:19 +0200
commitd8bdce51c336f3693121202402ee38ff3f12c0e2 (patch)
tree1b57fff5b8c6034436cf18b21f28142b3d17762c /main.go
parent8074ecbec4f0036bd887e31c1652961cbf7fc4a2 (diff)
downloadWRMS-d8bdce51c336f3693121202402ee38ff3f12c0e2.tar.gz
WRMS-d8bdce51c336f3693121202402ee38ff3f12c0e2.zip
send bad request status if the websocket connection has a bad UUID cookie
Diffstat (limited to 'main.go')
-rw-r--r--main.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/main.go b/main.go
index f962a76..0539e1a 100644
--- a/main.go
+++ b/main.go
@@ -208,11 +208,15 @@ func wsEndpoint(w http.ResponseWriter, r *http.Request) {
uuidCookie, err := r.Cookie("UUID")
if err != nil {
llog.Error("websocket connection has no set UUID cookie")
+ http.Error(w, "websocket connection has no set UUID cookie", http.StatusBadRequest)
+ return
}
id, err := uuid.Parse(uuidCookie.Value)
if err != nil {
llog.Error("Invalid UUID set in cookie")
+ http.Error(w, "Invalid UUID set in cookie", http.StatusBadRequest)
+ return
}
defer func() {