aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Lebedev <9497591+kmlebedev@users.noreply.github.com>2024-02-15 03:18:56 +0500
committerGitHub <noreply@github.com>2024-02-14 14:18:56 -0800
commit8fb978d6f69d411b2502f02b3c50b19332746a19 (patch)
tree4c25f36aeb1a5303a21498036868dfac1b4e3836
parent3d463ef471f4d7b0412c34b18caa658221ffd35c (diff)
downloadseaweedfs-8fb978d6f69d411b2502f02b3c50b19332746a19.tar.xz
seaweedfs-8fb978d6f69d411b2502f02b3c50b19332746a19.zip
[volume] requests that were canceled by the client are not an internal server problem(500 => 499) (#5304)
-rw-r--r--weed/server/filer_server_handlers_write_autochunk.go2
-rw-r--r--weed/server/volume_server_handlers.go2
-rw-r--r--weed/util/constants.go2
3 files changed, 4 insertions, 2 deletions
diff --git a/weed/server/filer_server_handlers_write_autochunk.go b/weed/server/filer_server_handlers_write_autochunk.go
index f1834c893..f4428be61 100644
--- a/weed/server/filer_server_handlers_write_autochunk.go
+++ b/weed/server/filer_server_handlers_write_autochunk.go
@@ -50,7 +50,7 @@ func (fs *FilerServer) autoChunk(ctx context.Context, w http.ResponseWriter, r *
}
if err != nil {
if strings.HasPrefix(err.Error(), "read input:") || err.Error() == io.ErrUnexpectedEOF.Error() {
- writeJsonError(w, r, 499, err)
+ writeJsonError(w, r, util.HttpStatusCancelled, err)
} else if strings.HasSuffix(err.Error(), "is a file") || strings.HasSuffix(err.Error(), "already exists") {
writeJsonError(w, r, http.StatusConflict, err)
} else {
diff --git a/weed/server/volume_server_handlers.go b/weed/server/volume_server_handlers.go
index 06134e648..4325b0074 100644
--- a/weed/server/volume_server_handlers.go
+++ b/weed/server/volume_server_handlers.go
@@ -53,7 +53,7 @@ func (vs *VolumeServer) privateStoreHandler(w http.ResponseWriter, r *http.Reque
select {
case <-r.Context().Done():
glog.V(4).Infof("request cancelled from %s: %v", r.RemoteAddr, r.Context().Err())
- w.WriteHeader(http.StatusInternalServerError)
+ w.WriteHeader(util.HttpStatusCancelled)
vs.inFlightDownloadDataLimitCond.L.Unlock()
return
default:
diff --git a/weed/util/constants.go b/weed/util/constants.go
index ea80337cd..8037f60c9 100644
--- a/weed/util/constants.go
+++ b/weed/util/constants.go
@@ -4,6 +4,8 @@ import (
"fmt"
)
+const HttpStatusCancelled = 499
+
var (
VERSION_NUMBER = fmt.Sprintf("%.02f", 3.62)
VERSION = sizeLimit + " " + VERSION_NUMBER