From b5426191a1d931087bdf5d26310efd755d1f47f7 Mon Sep 17 00:00:00 2001 From: Jan Winkelmann Date: Mon, 7 Nov 2016 20:30:14 +0100 Subject: [PATCH] Revert "http api: makes sure header is sent even when r is not ready yet. fixes #3304 (#3305)" This reverts commit 68d8a298c58ed950bd44118cc5e6d1ffc2def395. --- commands/http/handler.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/commands/http/handler.go b/commands/http/handler.go index 270ad4ac0609..44646d31f774 100644 --- a/commands/http/handler.go +++ b/commands/http/handler.go @@ -288,7 +288,6 @@ func sendResponse(w http.ResponseWriter, r *http.Request, res cmds.Response, req log.Error("err: ", err) w.Header().Set(StreamErrHeader, sanitizedErrStr(err)) } - } func flushCopy(w io.Writer, r io.Reader) error { @@ -299,9 +298,6 @@ func flushCopy(w io.Writer, r io.Reader) error { return err } for { - // flush to send header when r is not ready yet - f.Flush() - n, err := r.Read(buf) switch err { case io.EOF: @@ -324,6 +320,8 @@ func flushCopy(w io.Writer, r io.Reader) error { if nw != n { return fmt.Errorf("http write failed to write full amount: %d != %d", nw, n) } + + f.Flush() } return nil }