summaryrefslogtreecommitdiff
path: root/modules/caddyhttp/reverseproxy/selectionpolicies.go
diff options
context:
space:
mode:
authorMatthew Holt <mholt@users.noreply.github.com>2019-11-18 14:22:55 -0700
committerMatthew Holt <mholt@users.noreply.github.com>2019-11-18 14:22:55 -0700
commit8de1a762273323608d9d9080c42057d1814070b6 (patch)
tree88dcf3b9169f053217d799b7a49ec6587d49202a /modules/caddyhttp/reverseproxy/selectionpolicies.go
parent9fe54e1c6025a45cdd531c093bb94d193a8b91a0 (diff)
reverse_proxy: Fix invalid argument to Intn in RandomChoice selection
Diffstat (limited to 'modules/caddyhttp/reverseproxy/selectionpolicies.go')
-rw-r--r--modules/caddyhttp/reverseproxy/selectionpolicies.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/modules/caddyhttp/reverseproxy/selectionpolicies.go b/modules/caddyhttp/reverseproxy/selectionpolicies.go
index e34dd9b..a21e44c 100644
--- a/modules/caddyhttp/reverseproxy/selectionpolicies.go
+++ b/modules/caddyhttp/reverseproxy/selectionpolicies.go
@@ -132,7 +132,7 @@ func (r RandomChoiceSelection) Select(pool UpstreamPool, _ *http.Request) *Upstr
if !upstream.Available() {
continue
}
- j := weakrand.Intn(i)
+ j := weakrand.Intn(i + 1)
if j < k {
choices[j] = upstream
}