Skip to content

Commit

Permalink
add valid
Browse files Browse the repository at this point in the history
add valid
  • Loading branch information
jiuker committed Feb 13, 2025
1 parent 4350d40 commit b86dbf8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cmd/globals.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import (
"github.com/minio/madmin-go/v3"
"github.com/minio/pkg/v3/console"
"github.com/muesli/termenv"
"golang.org/x/net/http/httpguts"
)

const (
Expand Down Expand Up @@ -212,6 +213,9 @@ func setGlobalsFromContext(ctx *cli.Context) error {
if i <= 0 {
return fmt.Errorf("invalid custom header entry %s", header)
}
if !httpguts.ValidHeaderFieldName(header[:i]) || !httpguts.ValidHeaderFieldValue(header[i+1:]) {
return fmt.Errorf("invalid custom header entry %s", header)
}
globalCustomHeader.Add(header[:i], header[i+1:])
}
}
Expand Down

0 comments on commit b86dbf8

Please sign in to comment.