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:
parent
b94160df72
commit
937492f6f5
2 changed files with 25 additions and 9 deletions
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue