From 84535aff0e5bca575202df45833197958b93fe40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BD=97=E6=B3=BD=E8=BD=A9?= Date: Mon, 23 May 2022 22:14:50 +0800 Subject: [PATCH] fix(batch-requests): ignore "unix:" in the configuration (#7109) Signed-off-by: spacewander --- apisix/cli/ops.lua | 6 ++++-- t/cli/test_validate_config.sh | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/apisix/cli/ops.lua b/apisix/cli/ops.lua index 85d0d452176d..098f91ff16d3 100644 --- a/apisix/cli/ops.lua +++ b/apisix/cli/ops.lua @@ -279,8 +279,10 @@ Please modify "admin_key" in conf/config.yaml . if real_ip_from then for _, ip in ipairs(real_ip_from) do local _ip = cli_ip:new(ip) - if _ip and _ip:is_loopback() or _ip:is_unspecified() then - pass_real_client_ip = true + if _ip then + if _ip:is_loopback() or _ip:is_unspecified() then + pass_real_client_ip = true + end end end end diff --git a/t/cli/test_validate_config.sh b/t/cli/test_validate_config.sh index 2d7ba15552c4..164d530fe0a4 100755 --- a/t/cli/test_validate_config.sh +++ b/t/cli/test_validate_config.sh @@ -195,7 +195,7 @@ nginx_config: - "unix:" ' > conf/config.yaml -out=$(make init 2>&1 || true) +out=$(make init 2>&1) if echo "$out" | grep "missing loopback or unspecified in the nginx_config.http.real_ip_from for plugin batch-requests"; then echo "failed: should check the realip configuration for batch-requests" exit 1