mirror of
https://git.phreedom.club/localhost_frssoft/compy.git
synced 2024-11-27 02:21:34 +00:00
fix: allow ResponseReader.Reader to be wrapped by transcoders
fixes -minify errors
This commit is contained in:
parent
1d5b6eff72
commit
480053a71a
|
@ -69,7 +69,7 @@ func (p *Proxy) handle(w http.ResponseWriter, r *http.Request) error {
|
|||
rw := newResponseWriter(w)
|
||||
rr := newResponseReader(resp)
|
||||
err = p.proxyResponse(rw, rr)
|
||||
read := rr.Count()
|
||||
read := rr.counter.Count()
|
||||
written := rw.rw.Count()
|
||||
log.Printf("transcoded: %d -> %d (%3.1f%%)", read, written, float64(written)/float64(read)*100)
|
||||
atomic.AddUint64(&p.ReadCount, read)
|
||||
|
|
|
@ -9,14 +9,17 @@ import (
|
|||
)
|
||||
|
||||
type ResponseReader struct {
|
||||
datacounter.ReaderCounter
|
||||
r *http.Response
|
||||
io.Reader
|
||||
counter *datacounter.ReaderCounter
|
||||
r *http.Response
|
||||
}
|
||||
|
||||
func newResponseReader(r *http.Response) *ResponseReader {
|
||||
counter := datacounter.NewReaderCounter(r.Body)
|
||||
return &ResponseReader{
|
||||
ReaderCounter: *datacounter.NewReaderCounter(r.Body),
|
||||
r: r,
|
||||
Reader: counter,
|
||||
counter: counter,
|
||||
r: r,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue