include original http.Request in WebSocket struct.

This commit is contained in:
fiatjaf
2023-11-29 12:26:04 -03:00
parent 84d01dc1d3
commit 3c1b062eb8
2 changed files with 5 additions and 0 deletions

View File

@@ -45,6 +45,7 @@ func (rl *Relay) HandleWebsocket(w http.ResponseWriter, r *http.Request) {
ws := &WebSocket{ ws := &WebSocket{
conn: conn, conn: conn,
Request: r,
Challenge: hex.EncodeToString(challenge), Challenge: hex.EncodeToString(challenge),
Authed: make(chan struct{}), Authed: make(chan struct{}),
} }

View File

@@ -1,6 +1,7 @@
package khatru package khatru
import ( import (
"net/http"
"sync" "sync"
"github.com/fasthttp/websocket" "github.com/fasthttp/websocket"
@@ -10,6 +11,9 @@ type WebSocket struct {
conn *websocket.Conn conn *websocket.Conn
mutex sync.Mutex mutex sync.Mutex
// original request
Request *http.Request
// nip42 // nip42
Challenge string Challenge string
AuthedPublicKey string AuthedPublicKey string