fix: test_nginx_proxy_temp 改用 remote() 执行
This commit is contained in:
12
lib/test.sh
12
lib/test.sh
@@ -456,15 +456,13 @@ test_payment_verify_detection() {
|
|||||||
|
|
||||||
test_nginx_proxy_temp() {
|
test_nginx_proxy_temp() {
|
||||||
log_info "测试 nginx proxy temp(POST body 权限)..."
|
log_info "测试 nginx proxy temp(POST body 权限)..."
|
||||||
# 发送 POST 请求验证 nginx 能正确代理带 body 的请求(AppArmor proxy temp 权限检查)
|
# 发送带 POST body 的请求到公开 POST 端点,验证 nginx 能正常代理
|
||||||
local body; body=$(python3 -c "print('x'*50000)" 2>/dev/null || printf 'x%.0s' {1..50000})
|
# 如果 proxy temp 无权限,nginx 返回 502/403 或超时
|
||||||
local resp
|
local resp
|
||||||
resp=$(curl -sk --max-time 10 -X POST "${BASE_URL}" \
|
resp=$(remote "curl -sk --max-time 10 -X POST '${BASE_URL}/api/login' \
|
||||||
-H "Content-Type: application/json" \
|
-H 'Content-Type: application/json' \
|
||||||
-d "{\"test_body_size\":${#body}}" 2>&1) || true
|
-d '{\"test\":\"x\"}'" 2>/dev/null || true)
|
||||||
|
|
||||||
# 只要能返回响应(包括错误),就说明 nginx 能正常处理 POST body
|
|
||||||
# 如果 proxy temp 无权限,nginx 会返回 502/403 或超时
|
|
||||||
if [ -n "$resp" ]; then
|
if [ -n "$resp" ]; then
|
||||||
log_info " nginx POST body 代理正常 ✅"
|
log_info " nginx POST body 代理正常 ✅"
|
||||||
return 0
|
return 0
|
||||||
|
|||||||
Reference in New Issue
Block a user