mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-29 01:12:24 +08:00
Fix SetAllowedOrigins
License: MIT Signed-off-by: rht <rhtbot@gmail.com>
This commit is contained in:
@ -332,7 +332,9 @@ func (cfg ServerConfig) AllowedOrigins() []string {
|
|||||||
func (cfg *ServerConfig) SetAllowedOrigins(origins ...string) {
|
func (cfg *ServerConfig) SetAllowedOrigins(origins ...string) {
|
||||||
cfg.cORSOptsRWMutex.Lock()
|
cfg.cORSOptsRWMutex.Lock()
|
||||||
defer cfg.cORSOptsRWMutex.Unlock()
|
defer cfg.cORSOptsRWMutex.Unlock()
|
||||||
cfg.cORSOpts.AllowedOrigins = origins
|
o := make([]string, len(origins))
|
||||||
|
copy(o, origins)
|
||||||
|
cfg.cORSOpts.AllowedOrigins = o
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cfg *ServerConfig) AppendAllowedOrigins(origins ...string) {
|
func (cfg *ServerConfig) AppendAllowedOrigins(origins ...string) {
|
||||||
|
Reference in New Issue
Block a user