mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-21 10:27:46 +08:00
http/client: log errors when stream copy fails
License: MIT Signed-off-by: Juan Batiz-Benet <juan@benet.ai>
This commit is contained in:
parent
8c0ca5e376
commit
886d47561a
@ -166,19 +166,14 @@ func (i internalHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
streamChans, _, _ := req.Option("stream-channels").Bool()
|
||||
if isChan && streamChans {
|
||||
// w.WriteString(transferEncodingHeader + ": chunked\r\n")
|
||||
// w.Header().Set(channelHeader, "1")
|
||||
// w.WriteHeader(200)
|
||||
err = copyChunks(applicationJson, w, out)
|
||||
if err != nil {
|
||||
log.Debug("copy chunks error: ", err)
|
||||
if err := copyChunks(applicationJson, w, out); err != nil {
|
||||
log.Error("error while writing stream", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
err = flushCopy(w, out)
|
||||
if err != nil {
|
||||
log.Debug("Flush copy returned an error: ", err)
|
||||
if err := flushCopy(w, out); err != nil {
|
||||
log.Error("error while writing stream", err)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user