Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
tino committed Mar 18, 2018
1 parent e329e31 commit 59453bc
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions proxy/http_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,17 +172,20 @@ func (p *HTTPProxy) ServeHTTP(w http.ResponseWriter, r *http.Request) {
h = newHTTPProxy(targetURL, tr, time.Duration(0))
}

if p.Config.GZIPContentTypes != nil {
h = gzip.NewGzipHandler(h, p.Config.GZIPContentTypes)
}

timeNow := p.Time
if timeNow == nil {
timeNow = time.Now
}

start := timeNow()
h.ServeHTTP(w, r)
// we can't transparently wrap the proxy, as we need the raw proxy object
// below for the metrics and logger
if p.Config.GZIPContentTypes != nil {
gzipHandler := gzip.NewGzipHandler(h, p.Config.GZIPContentTypes)
gzipHandler.ServeHTTP(w, r)
} else {
h.ServeHTTP(w, r)
}
end := timeNow()
dur := end.Sub(start)

Expand Down

0 comments on commit 59453bc

Please sign in to comment.