From 3c1b062eb81765d64dd16e693c4aa7cfdfd1c28a Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Wed, 29 Nov 2023 12:26:04 -0300 Subject: [PATCH] include original http.Request in WebSocket struct. --- handlers.go | 1 + websocket.go | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/handlers.go b/handlers.go index ca57854..891225c 100644 --- a/handlers.go +++ b/handlers.go @@ -45,6 +45,7 @@ func (rl *Relay) HandleWebsocket(w http.ResponseWriter, r *http.Request) { ws := &WebSocket{ conn: conn, + Request: r, Challenge: hex.EncodeToString(challenge), Authed: make(chan struct{}), } diff --git a/websocket.go b/websocket.go index 171d029..9f75d69 100644 --- a/websocket.go +++ b/websocket.go @@ -1,6 +1,7 @@ package khatru import ( + "net/http" "sync" "github.com/fasthttp/websocket" @@ -10,6 +11,9 @@ type WebSocket struct { conn *websocket.Conn mutex sync.Mutex + // original request + Request *http.Request + // nip42 Challenge string AuthedPublicKey string