content-type checking

This commit is contained in:
Christopher Brown 2018-02-09 15:50:57 -06:00 committed by Will Norris
parent 74c16f575e
commit 39a4e1813d
3 changed files with 82 additions and 6 deletions

View file

@ -51,6 +51,7 @@ var scaleUp = flag.Bool("scaleUp", false, "allow images to scale beyond their or
var timeout = flag.Duration("timeout", 0, "time limit for requests served by this proxy")
var verbose = flag.Bool("verbose", false, "print verbose logging messages")
var version = flag.Bool("version", false, "Deprecated: this flag does nothing")
var contentTypes = flag.String("contentTypes", "", "comma separated list of allowed content types")
func init() {
flag.Var(&cache, "cache", "location to cache images (see https://github.com/willnorris/imageproxy#cache)")
@ -66,6 +67,9 @@ func main() {
if *referrers != "" {
p.Referrers = strings.Split(*referrers, ",")
}
if *contentTypes != "" {
p.ContentTypes = strings.Split(*contentTypes, ",")
}
if *signatureKey != "" {
key := []byte(*signatureKey)
if strings.HasPrefix(*signatureKey, "@") {