aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2016-05-11 16:10:04 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2016-05-11 16:10:04 +0800
commit34c56766b7bae7e31c9e7c628fe5a01e6dcc76f9 (patch)
treec7321b31132290cc610b7f5b7b81f1b20c692c79
parent20d4e527bd85f4bc20cd6a26daf7cd04e90fce07 (diff)
parent54790977904cd51671ab57d926d83175dbc2ca55 (diff)
downloaddexon-34c56766b7bae7e31c9e7c628fe5a01e6dcc76f9.tar
dexon-34c56766b7bae7e31c9e7c628fe5a01e6dcc76f9.tar.gz
dexon-34c56766b7bae7e31c9e7c628fe5a01e6dcc76f9.tar.bz2
dexon-34c56766b7bae7e31c9e7c628fe5a01e6dcc76f9.tar.lz
dexon-34c56766b7bae7e31c9e7c628fe5a01e6dcc76f9.tar.xz
dexon-34c56766b7bae7e31c9e7c628fe5a01e6dcc76f9.tar.zst
dexon-34c56766b7bae7e31c9e7c628fe5a01e6dcc76f9.zip
Merge pull request #2539 from bas-vk/origin-case
rpc: HTTP origin case insensitive
-rw-r--r--rpc/websocket.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/rpc/websocket.go b/rpc/websocket.go
index 1303f98db..fe9354d94 100644
--- a/rpc/websocket.go
+++ b/rpc/websocket.go
@@ -61,22 +61,22 @@ func wsHandshakeValidator(allowedOrigins []string) func(*websocket.Config, *http
allowAllOrigins = true
}
if origin != "" {
- origins.Add(origin)
+ origins.Add(strings.ToLower(origin))
}
}
- // allow localhost if no allowedOrigins are specified
+ // allow localhost if no allowedOrigins are specified.
if len(origins.List()) == 0 {
origins.Add("http://localhost")
if hostname, err := os.Hostname(); err == nil {
- origins.Add("http://" + hostname)
+ origins.Add("http://" + strings.ToLower(hostname))
}
}
glog.V(logger.Debug).Infof("Allowed origin(s) for WS RPC interface %v\n", origins.List())
f := func(cfg *websocket.Config, req *http.Request) error {
- origin := req.Header.Get("Origin")
+ origin := strings.ToLower(req.Header.Get("Origin"))
if allowAllOrigins || origins.Has(origin) {
return nil
}