mirror of
https://github.com/pgsty/minio.git
synced 2026-08-10 16:23:28 +03:00
Create Cors handler with permissive configuration (#7186)
Create new Cors handler allowing all origins with all standard methods with any header and credentials. Fixes #7181
This commit is contained in:
+5
-4
@@ -12,7 +12,7 @@ type wildcard struct {
|
||||
}
|
||||
|
||||
func (w wildcard) match(s string) bool {
|
||||
return len(s) >= len(w.prefix+w.suffix) && strings.HasPrefix(s, w.prefix) && strings.HasSuffix(s, w.suffix)
|
||||
return len(s) >= len(w.prefix)+len(w.suffix) && strings.HasPrefix(s, w.prefix) && strings.HasSuffix(s, w.suffix)
|
||||
}
|
||||
|
||||
// convert converts a list of string using the passed converter function
|
||||
@@ -39,19 +39,20 @@ func parseHeaderList(headerList string) []string {
|
||||
headers := make([]string, 0, t)
|
||||
for i := 0; i < l; i++ {
|
||||
b := headerList[i]
|
||||
if b >= 'a' && b <= 'z' {
|
||||
switch {
|
||||
case b >= 'a' && b <= 'z':
|
||||
if upper {
|
||||
h = append(h, b-toLower)
|
||||
} else {
|
||||
h = append(h, b)
|
||||
}
|
||||
} else if b >= 'A' && b <= 'Z' {
|
||||
case b >= 'A' && b <= 'Z':
|
||||
if !upper {
|
||||
h = append(h, b+toLower)
|
||||
} else {
|
||||
h = append(h, b)
|
||||
}
|
||||
} else if b == '-' || b == '_' || (b >= '0' && b <= '9') {
|
||||
case b == '-' || b == '_' || (b >= '0' && b <= '9'):
|
||||
h = append(h, b)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user