Skip to content

Commit

Permalink
revert commit breaking ipfs add for js-ipfs-api
Browse files Browse the repository at this point in the history
Revert "http api: makes sure header is sent even when r is not ready yet. fixes #3304 (#3305)"
This reverts commit 68d8a29.

License: MIT
Signed-off-by: Jan Winkelmann <j-winkelmann@tuhh.de>
  • Loading branch information
keks committed Nov 7, 2016
1 parent 6779ff1 commit c618698
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions commands/http/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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:
Expand All @@ -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
}
Expand Down

0 comments on commit c618698

Please sign in to comment.