From 8bc46488ab216f2217802e8420e622db7615126b Mon Sep 17 00:00:00 2001 From: Optio Agent Date: Sat, 28 Mar 2026 03:10:18 +0000 Subject: [PATCH] chore(test): override curlinfo to unskip test 777 (ssl-sessions) The curl test harness runs `curlinfo` to detect compiled-in features. Since that binary comes from curl's build (not urlx), it reports `ssl-sessions: OFF` even though urlx implements ssl-sessions (#73). This causes test 777 to be skipped unnecessarily. Add a `curlinfo-wrapper` script that intercepts the curlinfo output and overrides `ssl-sessions` to ON to reflect urlx's actual capabilities. The wrapper is installed by `run-curl-tests.sh` using the same pattern as the existing libtests shim. When a real curlinfo binary exists, the wrapper runs it and patches the output. When no binary exists, it outputs a static feature list matching urlx's capabilities. Closes #124 Co-Authored-By: Claude Opus 4.6 (1M context) --- scripts/curlinfo-wrapper | 68 +++++++++++++++++++++++++++++++++++++++ scripts/run-curl-tests.sh | 27 ++++++++++++++++ 2 files changed, 95 insertions(+) create mode 100755 scripts/curlinfo-wrapper diff --git a/scripts/curlinfo-wrapper b/scripts/curlinfo-wrapper new file mode 100755 index 0000000..b662cfa --- /dev/null +++ b/scripts/curlinfo-wrapper @@ -0,0 +1,68 @@ +#!/bin/bash +# Wrapper around curl's curlinfo binary that overrides feature detection +# to reflect urlx's actual capabilities. +# +# The curl test harness runs `curlinfo` to detect which features are compiled +# in. Since curlinfo comes from curl's own build (not urlx), it may report +# features as OFF that urlx actually supports. This wrapper runs the real +# curlinfo and patches the output to match urlx's feature set. + +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +REAL_CURLINFO="${CURLINFO_REAL:-$(dirname "$0")/../vendor/curl-build/src/curlinfo.real}" + +# Features that urlx supports but curl's build may not report +# Add entries here as: "feature-name" +URLX_EXTRA_FEATURES=( + "ssl-sessions" +) + +if [ -x "$REAL_CURLINFO" ]; then + # Run the real curlinfo and override specific features + "$REAL_CURLINFO" "$@" | while IFS= read -r line; do + overridden=false + for feat in "${URLX_EXTRA_FEATURES[@]}"; do + if [[ "$line" == "${feat}: OFF" ]]; then + echo "${feat}: ON" + overridden=true + break + fi + done + if ! $overridden; then + echo "$line" + fi + done +else + # No real curlinfo available — output a static feature list matching + # urlx's capabilities. This list mirrors curlinfo.c from curl's source. + cat <<'FEATURES' +bindlocal: ON +cookies: ON +basic-auth: ON +bearer-auth: ON +digest: ON +negotiate-auth: OFF +aws: ON +DoH: ON +HTTP-auth: ON +Mime: ON +netrc: ON +parsedate: ON +proxy: ON +shuffle-dns: ON +typecheck: ON +verbose-strings: ON +wakeup: ON +headers-api: ON +xattr: OFF +form-api: ON +large-time: ON +large-size: ON +sha512-256: OFF +win32-ca-searchpath: OFF +win32-ca-search-safe: OFF +--libcurl: OFF +override-dns: OFF +ssl-sessions: ON +cert-status: OFF +FEATURES +fi diff --git a/scripts/run-curl-tests.sh b/scripts/run-curl-tests.sh index 89aa9b1..5cd7721 100755 --- a/scripts/run-curl-tests.sh +++ b/scripts/run-curl-tests.sh @@ -70,6 +70,33 @@ elif [ ! -x "$LIBTESTS" ] && [ ! -f "$LIBTESTS_REAL" ]; then echo "Installed libtests-shim for C API tests (e.g., test 678)" fi +# Override curlinfo binary so the test harness detects urlx's features. +# curl's curlinfo reflects curl's own build config; our wrapper reports +# urlx's actual capabilities (e.g., ssl-sessions support). +CURLINFO_BIN="$CURL_BUILD/src/curlinfo" +CURLINFO_REAL="$CURL_BUILD/src/curlinfo.real" +CURLINFO_WRAPPER="$SCRIPT_DIR/curlinfo-wrapper" + +if [ -x "$CURLINFO_BIN" ] && [ ! -f "$CURLINFO_REAL" ]; then + # Save the original and install our wrapper + mv "$CURLINFO_BIN" "$CURLINFO_REAL" + cat > "$CURLINFO_BIN" < "$CURLINFO_BIN" <