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:
parent
a74e590181
commit
bfbc8ff5ee
2 changed files with 0 additions and 12 deletions
|
@ -57,8 +57,6 @@ func main() {
|
|||
}
|
||||
|
||||
p := imageproxy.NewProxy(nil, c)
|
||||
p.MaxWidth = 2000
|
||||
p.MaxHeight = 2000
|
||||
if *whitelist != "" {
|
||||
p.Whitelist = strings.Split(*whitelist, ",")
|
||||
}
|
||||
|
|
10
proxy.go
10
proxy.go
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue