filer: return http status 499 for client closed connection

fix https://github.com/chrislusf/seaweedfs/issues/1684
This commit is contained in:
Chris Lu 2020-12-16 08:17:57 -08:00
parent 8cb67952db
commit b789767cd1

View file

@ -57,7 +57,11 @@ func (fs *FilerServer) autoChunk(ctx context.Context, w http.ResponseWriter, r *
reply, md5bytes, err = fs.doPutAutoChunk(ctx, w, r, chunkSize, so)
}
if err != nil {
writeJsonError(w, r, http.StatusInternalServerError, err)
if strings.HasPrefix(err.Error(), "read input:") {
writeJsonError(w, r, 499, err)
} else {
writeJsonError(w, r, http.StatusInternalServerError, err)
}
} else if reply != nil {
if len(md5bytes) > 0 {
w.Header().Set("Content-MD5", util.Base64Encode(md5bytes))