0
Fork 0
mirror of https://github.com/willnorris/imageproxy.git synced 2024-12-30 22:34:18 -05:00

remove MaxWidth and MaxHeight options

These were originally added to prevent a denial of service caused by
requesting very large images,  but are no longer needed since we no
longer resize images larger than their original size.
This commit is contained in:
Will Norris 2014-08-06 08:47:41 -07:00
parent a74e590181
commit bfbc8ff5ee
2 changed files with 0 additions and 12 deletions

View file

@ -57,8 +57,6 @@ func main() {
}
p := imageproxy.NewProxy(nil, c)
p.MaxWidth = 2000
p.MaxHeight = 2000
if *whitelist != "" {
p.Whitelist = strings.Split(*whitelist, ",")
}

View file

@ -38,9 +38,6 @@ type Proxy struct {
// Whitelist specifies a list of remote hosts that images can be proxied from. An empty list means all hosts are allowed.
Whitelist []string
MaxWidth int
MaxHeight int
}
// NewProxy constructs a new proxy. The provided http Client will be used to
@ -75,13 +72,6 @@ func (p *Proxy) ServeHTTP(w http.ResponseWriter, r *http.Request) {
return
}
if p.MaxWidth > 0 && int(req.Options.Width) > p.MaxWidth {
req.Options.Width = float64(p.MaxWidth)
}
if p.MaxHeight > 0 && int(req.Options.Height) > p.MaxHeight {
req.Options.Height = float64(p.MaxHeight)
}
if !p.allowed(req.URL) {
glog.Errorf("remote URL is not for an allowed host: %v", req.URL)
http.Error(w, fmt.Sprintf("remote URL is not for an allowed host: %v", req.URL), http.StatusBadRequest)