Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions scripts/curlinfo-wrapper
Original file line number Diff line number Diff line change
@@ -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
27 changes: 27 additions & 0 deletions scripts/run-curl-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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_WRAP
#!/bin/bash
CURLINFO_REAL="$CURLINFO_REAL" exec "$CURLINFO_WRAPPER" "\$@"
CURLINFO_WRAP
chmod +x "$CURLINFO_BIN"
echo "Installed curlinfo wrapper (overrides feature detection for urlx)"
elif [ ! -x "$CURLINFO_BIN" ] && [ ! -f "$CURLINFO_REAL" ]; then
# No curlinfo binary at all — install our wrapper directly
mkdir -p "$CURL_BUILD/src"
cat > "$CURLINFO_BIN" <<CURLINFO_WRAP
#!/bin/bash
exec "$CURLINFO_WRAPPER" "\$@"
CURLINFO_WRAP
chmod +x "$CURLINFO_BIN"
echo "Installed curlinfo wrapper (no real curlinfo found)"
fi

# Ensure symlinks are in place
cd "$TESTS_DIR"
[ ! -e data ] && ln -sf "$CURL_SRC/tests/data" data
Expand Down
Loading