@cryptotaxi247 / kubo / commits / b9706815b

Fix SetAllowedOrigins

License: MIT Signed-off-by: rht <rhtbot@gmail.com>

rht committed Dec 1, 2015 at 18:44 UTC b9706815b3bd9ef70a13a7d92a12cbd0461b8a02
1 file changed +3 -1
commands/http/handler.go
+3 -1
@@ -332,7 +332,9 @@ func (cfg ServerConfig) AllowedOrigins() []string {
332 func (cfg *ServerConfig) SetAllowedOrigins(origins ...string) {
333 cfg.cORSOptsRWMutex.Lock()
334 defer cfg.cORSOptsRWMutex.Unlock()
335 - cfg.cORSOpts.AllowedOrigins = origins
335 + o := make([]string, len(origins))
336 + copy(o, origins)
337 + cfg.cORSOpts.AllowedOrigins = o
338 }
339
340 func (cfg *ServerConfig) AppendAllowedOrigins(origins ...string) {