mirror of
https://github.com/minio/minio.git
synced 2025-02-13 06:38:09 -05:00
Skip 0 byte stream writes (#10875)
Don't send a packet when receiving 0 bytes or there is an error recorded
This commit is contained in:
parent
aa158228f9
commit
1c3590078d
@ -781,6 +781,10 @@ type httpStreamResponse struct {
|
|||||||
// Write part of the the streaming response.
|
// Write part of the the streaming response.
|
||||||
// Note that upstream errors are currently not forwarded, but may be in the future.
|
// Note that upstream errors are currently not forwarded, but may be in the future.
|
||||||
func (h *httpStreamResponse) Write(b []byte) (int, error) {
|
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))
|
tmp := make([]byte, len(b))
|
||||||
copy(tmp, b)
|
copy(tmp, b)
|
||||||
h.block <- tmp
|
h.block <- tmp
|
||||||
|
Loading…
x
Reference in New Issue
Block a user