From b789767cd1059eeba393e3bdcf98b136e64db6eb Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Wed, 16 Dec 2020 08:17:57 -0800 Subject: [PATCH] filer: return http status 499 for client closed connection fix https://github.com/chrislusf/seaweedfs/issues/1684 --- weed/server/filer_server_handlers_write_autochunk.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/weed/server/filer_server_handlers_write_autochunk.go b/weed/server/filer_server_handlers_write_autochunk.go index 0f6d0dc47..82c6c11b4 100644 --- a/weed/server/filer_server_handlers_write_autochunk.go +++ b/weed/server/filer_server_handlers_write_autochunk.go @@ -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))