mirror of
https://github.com/willnorris/imageproxy.git
synced 2026-06-08 19:05:15 +02:00
Delegate Content-Type verification solely to contentTypeMatches()
Some customer-proxied files have been hosted on servers that will kick back errors if we a) provide a list of Accept'ed Content-Types, or b) provide a Content-Type in the Accept list that the server does not know about.
This commit is contained in:
parent
c08b3c505a
commit
65d30640c6
1 changed files with 1 additions and 3 deletions
|
|
@ -180,12 +180,10 @@ func (p *Proxy) serveImage(w http.ResponseWriter, r *http.Request) {
|
|||
req.Options.ScaleUp = p.ScaleUp
|
||||
|
||||
actualReq, _ := http.NewRequest("GET", req.String(), nil)
|
||||
actualReq.Header.Set("Accept", "*/*")
|
||||
if p.UserAgent != "" {
|
||||
actualReq.Header.Set("User-Agent", p.UserAgent)
|
||||
}
|
||||
if len(p.ContentTypes) != 0 {
|
||||
actualReq.Header.Set("Accept", strings.Join(p.ContentTypes, ", "))
|
||||
}
|
||||
if p.IncludeReferer {
|
||||
// pass along the referer header from the original request
|
||||
copyHeader(actualReq.Header, r.Header, "referer")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue