aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordivinerapier <poriter.coco@gmail.com>2019-10-24 16:51:26 +0800
committerdivinerapier <poriter.coco@gmail.com>2019-10-24 16:51:26 +0800
commitf1ee6b7a5470024a92226667ed610346abd40e49 (patch)
tree838163ed8358064e9107e59ba435e96aab6c389e
parent253dd20bc6d5ae81c70d8953cdb76da4e2c2d1b2 (diff)
downloadseaweedfs-f1ee6b7a5470024a92226667ed610346abd40e49.tar.xz
seaweedfs-f1ee6b7a5470024a92226667ed610346abd40e49.zip
fix abused 404 status code
Signed-off-by: divinerapier <poriter.coco@gmail.com>
-rw-r--r--weed/server/filer_server_handlers_read.go13
1 files changed, 9 insertions, 4 deletions
diff --git a/weed/server/filer_server_handlers_read.go b/weed/server/filer_server_handlers_read.go
index 0edf501a8..ba21298ba 100644
--- a/weed/server/filer_server_handlers_read.go
+++ b/weed/server/filer_server_handlers_read.go
@@ -32,10 +32,15 @@ func (fs *FilerServer) GetOrHeadHandler(w http.ResponseWriter, r *http.Request,
fs.listDirectoryHandler(w, r)
return
}
- glog.V(1).Infof("Not found %s: %v", path, err)
-
- stats.FilerRequestCounter.WithLabelValues("read.notfound").Inc()
- w.WriteHeader(http.StatusNotFound)
+ if err == filer2.ErrNotFound {
+ glog.V(1).Infof("Not found %s: %v", path, err)
+ stats.FilerRequestCounter.WithLabelValues("read.notfound").Inc()
+ w.WriteHeader(http.StatusNotFound)
+ } else {
+ glog.V(0).Infof("Internal %s: %v", path, err)
+ stats.FilerRequestCounter.WithLabelValues("read.internalerror").Inc()
+ w.WriteHeader(http.StatusInternalServerError)
+ }
return
}