Browse Source

[volume] requests that were canceled by the client are not an internal server problem(500 => 499) (#5304)

pull/5308/head
Konstantin Lebedev 11 months ago
committed by GitHub
parent
commit
8fb978d6f6
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 2
      weed/server/filer_server_handlers_write_autochunk.go
  2. 2
      weed/server/volume_server_handlers.go
  3. 2
      weed/util/constants.go

2
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 {

2
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:

2
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

Loading…
Cancel
Save