mirror of
https://github.com/minio/minio.git
synced 2025-01-28 15:06:00 -05:00
Merge pull request #541 from fkautz/pr_out_adding_error_message_on_connection_limit_met
This commit is contained in:
commit
8be3b92ab7
@ -61,6 +61,8 @@ func (c *connLimit) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
|||||||
if c.TestAndAdd(longIP) {
|
if c.TestAndAdd(longIP) {
|
||||||
defer c.Remove(longIP)
|
defer c.Remove(longIP)
|
||||||
c.handler.ServeHTTP(w, req)
|
c.handler.ServeHTTP(w, req)
|
||||||
|
} else {
|
||||||
|
writeErrorResponse(w, req, ConnectionLimitExceeded, req.RequestURI)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,6 +47,7 @@ const (
|
|||||||
BandWidthQuotaExceeded
|
BandWidthQuotaExceeded
|
||||||
BandWidthInsufficientToProceed
|
BandWidthInsufficientToProceed
|
||||||
SlowDown
|
SlowDown
|
||||||
|
ConnectionLimitExceeded
|
||||||
)
|
)
|
||||||
|
|
||||||
// Golang http doesn't implement these
|
// Golang http doesn't implement these
|
||||||
@ -89,6 +90,11 @@ var errorCodeResponse = map[int]Error{
|
|||||||
Description: "Reduce your request rate.",
|
Description: "Reduce your request rate.",
|
||||||
HTTPStatusCode: StatusTooManyRequests,
|
HTTPStatusCode: StatusTooManyRequests,
|
||||||
},
|
},
|
||||||
|
ConnectionLimitExceeded: {
|
||||||
|
Code: "ConnectionLimit",
|
||||||
|
Description: "Connection Limit Met",
|
||||||
|
HTTPStatusCode: StatusTooManyRequests,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write error response headers
|
// Write error response headers
|
||||||
|
Loading…
x
Reference in New Issue
Block a user