mirror of
https://github.com/minio/minio.git
synced 2024-12-25 22:55:54 -05:00
Avoid sending errors in gob in storage requests (#10977)
This commit is contained in:
parent
2ff655a745
commit
91130e884b
@ -18,7 +18,6 @@ package cmd
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"bytes"
|
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"encoding/gob"
|
"encoding/gob"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
@ -828,15 +827,8 @@ func streamHTTPResponse(w http.ResponseWriter) *httpStreamResponse {
|
|||||||
ticker.Stop()
|
ticker.Stop()
|
||||||
defer close(doneCh)
|
defer close(doneCh)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
var buf bytes.Buffer
|
|
||||||
enc := gob.NewEncoder(&buf)
|
|
||||||
if ee := enc.Encode(err); ee == nil {
|
|
||||||
w.Write([]byte{3})
|
|
||||||
w.Write(buf.Bytes())
|
|
||||||
} else {
|
|
||||||
w.Write([]byte{1})
|
w.Write([]byte{1})
|
||||||
w.Write([]byte(err.Error()))
|
w.Write([]byte(err.Error()))
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
w.Write([]byte{0})
|
w.Write([]byte{0})
|
||||||
}
|
}
|
||||||
@ -882,7 +874,8 @@ func waitForHTTPStream(respBody io.ReadCloser, w io.Writer) error {
|
|||||||
respBody.Close()
|
respBody.Close()
|
||||||
return errors.New(string(errorText))
|
return errors.New(string(errorText))
|
||||||
case 3:
|
case 3:
|
||||||
// Typed error
|
// gob style is already deprecated, we can remove this when
|
||||||
|
// storage API version will be greater or equal to 23.
|
||||||
defer respBody.Close()
|
defer respBody.Close()
|
||||||
dec := gob.NewDecoder(respBody)
|
dec := gob.NewDecoder(respBody)
|
||||||
var err error
|
var err error
|
||||||
|
Loading…
Reference in New Issue
Block a user