mirror of
https://github.com/minio/minio.git
synced 2025-11-26 04:26:12 -05:00
Enhance error responses for request limit and bring some code from api errors
~~~ mc: <ERROR> Failed to create bucket for URL [http://localhost:9000/newbucket-101]. Reason: [Reduce your request rate.]. ~~~ Client sees proper errors now.
This commit is contained in:
@@ -33,7 +33,7 @@ func (h *requestLimitHandler) ServeHTTP(w http.ResponseWriter, req *http.Request
|
||||
host, _, _ := net.SplitHostPort(req.RemoteAddr)
|
||||
longIP := longIP{net.ParseIP(host)}.IptoUint32()
|
||||
if h.quotas.IsQuotaMet(longIP) {
|
||||
return
|
||||
writeErrorResponse(w, req, SlowDown, req.URL.Path)
|
||||
}
|
||||
h.quotas.Add(longIP, 1)
|
||||
h.handler.ServeHTTP(w, req)
|
||||
|
||||
Reference in New Issue
Block a user