aboutsummaryrefslogtreecommitdiffstats
path: root/ethstats
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2017-03-30 17:52:34 +0800
committerPéter Szilágyi <peterke@gmail.com>2017-03-30 17:53:50 +0800
commitdb93641941ec995190921f477d834a1b80c5752c (patch)
tree8f8bd23f0ea212746fec0f233c6bb7984fead641 /ethstats
parent1cf2ee4597e3e1902088fd84663d4ce4eff8946a (diff)
downloaddexon-db93641941ec995190921f477d834a1b80c5752c.tar
dexon-db93641941ec995190921f477d834a1b80c5752c.tar.gz
dexon-db93641941ec995190921f477d834a1b80c5752c.tar.bz2
dexon-db93641941ec995190921f477d834a1b80c5752c.tar.lz
dexon-db93641941ec995190921f477d834a1b80c5752c.tar.xz
dexon-db93641941ec995190921f477d834a1b80c5752c.tar.zst
dexon-db93641941ec995190921f477d834a1b80c5752c.zip
ethstats: work around weird URL scheme parsing issues
Diffstat (limited to 'ethstats')
-rw-r--r--ethstats/ethstats.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/ethstats/ethstats.go b/ethstats/ethstats.go
index 9d494b615..10f611c79 100644
--- a/ethstats/ethstats.go
+++ b/ethstats/ethstats.go
@@ -23,10 +23,10 @@ import (
"fmt"
"math/big"
"net"
- "net/url"
"regexp"
"runtime"
"strconv"
+ "strings"
"time"
"github.com/ethereum/go-ethereum/common"
@@ -128,7 +128,7 @@ func (s *Service) loop() {
path := fmt.Sprintf("%s/api", s.host)
urls := []string{path}
- if parsed, err := url.Parse(path); err == nil && !parsed.IsAbs() {
+ if !strings.Contains(path, "://") { // url.Parse and url.IsAbs is unsuitable (https://github.com/golang/go/issues/19779)
urls = []string{"wss://" + path, "ws://" + path}
}
// Establish a websocket connection to the server on any supported URL