From 620e30293d7df7a0c76a2a7d44bea955ddcab6be Mon Sep 17 00:00:00 2001 From: Shivaram Lingamneni Date: Tue, 5 May 2020 04:07:19 -0400 Subject: [PATCH] use consistent spelling of WebSocket --- irc/config.go | 6 +++--- irc/listeners.go | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/irc/config.go b/irc/config.go index 7a6468c3..acc6aae0 100644 --- a/irc/config.go +++ b/irc/config.go @@ -478,7 +478,7 @@ type Config struct { Listeners map[string]listenerConfigBlock UnixBindMode os.FileMode `yaml:"unix-bind-mode"` TorListeners TorListenersConfig `yaml:"tor-listeners"` - Websockets struct { + WebSockets struct { AllowedOrigins []string `yaml:"allowed-origins"` allowedOriginRegexps []*regexp.Regexp } @@ -844,12 +844,12 @@ func LoadConfig(filename string) (config *Config, err error) { return nil, fmt.Errorf("failed to prepare listeners: %v", err) } - for _, glob := range config.Server.Websockets.AllowedOrigins { + for _, glob := range config.Server.WebSockets.AllowedOrigins { globre, err := utils.CompileGlob(glob) if err != nil { return nil, fmt.Errorf("invalid websocket allowed-origin expression: %s", glob) } - config.Server.Websockets.allowedOriginRegexps = append(config.Server.Websockets.allowedOriginRegexps, globre) + config.Server.WebSockets.allowedOriginRegexps = append(config.Server.WebSockets.allowedOriginRegexps, globre) } if config.Server.STS.Enabled { diff --git a/irc/listeners.go b/irc/listeners.go index 49f278c3..545f76f2 100644 --- a/irc/listeners.go +++ b/irc/listeners.go @@ -164,14 +164,14 @@ func (wl *WSListener) handle(w http.ResponseWriter, r *http.Request) { wsUpgrader := websocket.Upgrader{ CheckOrigin: func(r *http.Request) bool { - if len(config.Server.Websockets.allowedOriginRegexps) == 0 { + if len(config.Server.WebSockets.allowedOriginRegexps) == 0 { return true } origin := strings.TrimSpace(r.Header.Get("Origin")) if len(origin) == 0 { return false } - for _, re := range config.Server.Websockets.allowedOriginRegexps { + for _, re := range config.Server.WebSockets.allowedOriginRegexps { if re.MatchString(origin) { return true }