mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-07 23:00:55 +03:00
make sure that Retry-After header has a value greater than zero
This commit is contained in:
@@ -160,6 +160,7 @@ func (s *webDavServer) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
delay, err := common.LimitRate(common.ProtocolWebDAV, ipAddr)
|
||||
if err != nil {
|
||||
delay += 499999999 * time.Nanosecond
|
||||
w.Header().Set("Retry-After", fmt.Sprintf("%.0f", delay.Seconds()))
|
||||
w.Header().Set("X-Retry-In", delay.String())
|
||||
http.Error(w, err.Error(), http.StatusTooManyRequests)
|
||||
|
||||
Reference in New Issue
Block a user