From 1c3590078d1827037eb0388545a42e9ed7bc2f17 Mon Sep 17 00:00:00 2001 From: Klaus Post Date: Wed, 11 Nov 2020 18:07:40 -0800 Subject: [PATCH] Skip 0 byte stream writes (#10875) Don't send a packet when receiving 0 bytes or there is an error recorded --- cmd/storage-rest-server.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmd/storage-rest-server.go b/cmd/storage-rest-server.go index 6b57c6052..d99ae555e 100644 --- a/cmd/storage-rest-server.go +++ b/cmd/storage-rest-server.go @@ -781,6 +781,10 @@ type httpStreamResponse struct { // Write part of the the streaming response. // Note that upstream errors are currently not forwarded, but may be in the future. func (h *httpStreamResponse) Write(b []byte) (int, error) { + if len(b) == 0 || h.err != nil { + // Ignore 0 length blocks + return 0, h.err + } tmp := make([]byte, len(b)) copy(tmp, b) h.block <- tmp