Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions rpcserver/jsonrpc_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"io"
"log/slog"
"net/http"
"net/url"
"strconv"
"strings"
"time"
Expand Down Expand Up @@ -52,6 +53,7 @@ type (
highPriorityKey struct{}
builderNetSentAtKey struct{}
signerKey struct{}
urlKey struct{}
originKey struct{}
sizeKey struct{}
)
Expand Down Expand Up @@ -267,6 +269,8 @@ func (h *JSONRPCHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
}
ctx = context.WithValue(ctx, signerKey{}, signer)
}
// r.URL
ctx = context.WithValue(ctx, urlKey{}, r.URL)

// read request
var req jsonRPCRequest
Expand Down Expand Up @@ -417,3 +421,7 @@ func GetOrigin(ctx context.Context) string {
func GetRequestSize(ctx context.Context) int {
return ctx.Value(sizeKey{}).(int)
}

func GetURL(ctx context.Context) *url.URL {
return ctx.Value(urlKey{}).(*url.URL)
}