1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-09-15 18:57:04 +00:00

Do not buffer responses in the image proxy

The image proxy buffered the whole image before sending it to the
browser. If the image is large and/or hosted on a slow server, this
caused a long delay before the user's browser could display anything.
This commit is contained in:
Peter De Wachter 2019-08-14 17:54:02 +02:00 committed by Frédéric Guillot
parent b94160df72
commit 937492f6f5
2 changed files with 25 additions and 9 deletions

View file

@ -8,6 +8,7 @@ import (
"compress/flate"
"compress/gzip"
"fmt"
"io"
"net/http"
"strings"
"time"
@ -84,6 +85,10 @@ func (b *Builder) Write() {
b.compress([]byte(v))
case error:
b.compress([]byte(v.Error()))
case io.Reader:
// Compression not implemented in this case
b.writeHeaders()
io.Copy(b.w, v)
}
}