Skip to content

Commit 7113453

Browse files
committed
Fix lb-method validation
* "least_time" and "last_byte" are no longer valid input * Add the above as invalid input to unit test
1 parent 8acc7ae commit 7113453

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

internal/nginx/extensions.go

+5-7
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,14 @@ func ParseLBMethod(method string) (string, error) {
2525
}
2626

2727
var nginxLBValidInput = map[string]bool{
28-
"least_conn": true,
29-
"ip_hash": true,
30-
"random": true,
31-
"random two": true,
32-
"random two least_conn": true,
28+
"least_conn": true,
29+
"ip_hash": true,
30+
"random": true,
31+
"random two": true,
32+
"random two least_conn": true,
3333
}
3434

3535
var nginxPlusLBValidInput = map[string]bool{
36-
"least_time": true,
37-
"last_byte": true,
3836
"least_conn": true,
3937
"ip_hash": true,
4038
"random": true,

internal/nginx/extensions_test.go

+2
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ func TestParseLBMethodForPlus(t *testing.T) {
7272
"",
7373
"blabla",
7474
"hash123",
75+
"least_time",
76+
"last_byte",
7577
"least_time inflight header",
7678
"random one",
7779
"random two ip_hash",

0 commit comments

Comments
 (0)