Fix NIP-11 fetch URL scheme conversion for non-proxied relays
- Convert wss:// to https:// and ws:// to http:// before fetching NIP-11 documents, fixing failures for users not using HTTPS upgrade proxies - The fetchNIP11 function was using WebSocket URLs directly for HTTP requests, causing scheme mismatch errors 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -69,8 +69,11 @@ func (c *NIP11Cache) Get(ctx context.Context, relayURL string) (*relayinfo.T, er
|
|||||||
|
|
||||||
// fetchNIP11 fetches relay information document from a given URL
|
// fetchNIP11 fetches relay information document from a given URL
|
||||||
func (c *NIP11Cache) fetchNIP11(ctx context.Context, relayURL string) (*relayinfo.T, error) {
|
func (c *NIP11Cache) fetchNIP11(ctx context.Context, relayURL string) (*relayinfo.T, error) {
|
||||||
// Construct NIP-11 URL
|
// Convert WebSocket URL to HTTP URL for NIP-11 fetch
|
||||||
|
// wss:// -> https://, ws:// -> http://
|
||||||
nip11URL := relayURL
|
nip11URL := relayURL
|
||||||
|
nip11URL = strings.Replace(nip11URL, "wss://", "https://", 1)
|
||||||
|
nip11URL = strings.Replace(nip11URL, "ws://", "http://", 1)
|
||||||
if !strings.HasSuffix(nip11URL, "/") {
|
if !strings.HasSuffix(nip11URL, "/") {
|
||||||
nip11URL += "/"
|
nip11URL += "/"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user