Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
Mirrored from https://github.com/Slazee/caddy.git
Synced Nov 14, 05:15 UTC
reverse_proxy: Fix invalid argument to Intn in RandomChoice selection
Matthew Holt committed
Nov 18, 2019 at 14:22 UTC
8de1a762273323608d9d9080c42057d1814070b6
1 file changed
+1
-1
modules/caddyhttp/reverseproxy/selectionpolicies.go
+1
-1
@@ -132,7 +132,7 @@ func (r RandomChoiceSelection) Select(pool UpstreamPool, _ *http.Request) *Upstr
132
if !upstream.Available() {
133
continue
134
}
135
- j := weakrand.Intn(i)
135
+ j := weakrand.Intn(i + 1)
136
if j < k {
137
choices[j] = upstream
138
}