Skip to content
Merged
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-urlx
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 flags
# to reflect urlx's actual capabilities.
#
# curl's test harness (runtests.pl) runs curlinfo to detect which features
# are available. Since curlinfo comes from curl's own build, it reflects
# curl's build configuration — not urlx's capabilities. This wrapper runs
# the real curlinfo and patches the output so that features urlx supports
# (but curl wasn't built with) are reported as ON.
#
# Installed by run-curl-tests.sh in place of vendor/curl-build/src/curlinfo.

set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"

# The real curlinfo binary (moved aside by run-curl-tests.sh)
REAL_CURLINFO="${CURLINFO_REAL:-}"

# Features that urlx supports regardless of curl's build configuration.
# Add entries here as urlx gains features that curl may not be built with.
URLX_FEATURES_ON=(
"ssl-sessions"
)

# Run the real curlinfo and patch the output
if [ -n "$REAL_CURLINFO" ] && [ -x "$REAL_CURLINFO" ]; then
# Build a sed expression that overrides each feature to ON
sed_args=()
for feat in "${URLX_FEATURES_ON[@]}"; do
sed_args+=(-e "s/^${feat}: OFF$/${feat}: ON/")
done
"$REAL_CURLINFO" | sed "${sed_args[@]}"
else
# No real curlinfo available — output a complete feature list based on
# urlx's known capabilities. This matches the format of curlinfo.c output.
cat <<'EOF'
bindlocal: ON
cookies: ON
basic-auth: ON
bearer-auth: ON
digest: ON
negotiate-auth: ON
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: ON
win32-ca-searchpath: OFF
win32-ca-search-safe: OFF
--libcurl: ON
override-dns: OFF
ssl-sessions: ON
cert-status: OFF
EOF
fi
29 changes: 29 additions & 0 deletions scripts/run-curl-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,35 @@ elif [ ! -x "$LIBTESTS" ] && [ ! -f "$LIBTESTS_REAL" ]; then
echo "Installed libtests-shim for C API tests (e.g., test 678)"
fi

# Override curlinfo to report urlx's actual capabilities.
#
# curl's curlinfo binary reflects curl's build configuration, not urlx's.
# For example, curl may be built without ssl-sessions support, causing the
# test harness to skip test 777 even though urlx supports ssl-sessions.
# We replace curlinfo with a wrapper that patches the output.
CURLINFO_BIN="$CURL_BUILD/src/curlinfo"
CURLINFO_REAL="$CURL_BUILD/src/curlinfo.real"
CURLINFO_WRAPPER="$SCRIPT_DIR/curlinfo-urlx"

if [ -x "$CURLINFO_BIN" ] && [ ! -f "$CURLINFO_REAL" ]; then
# Move the real binary aside and install our wrapper
mv "$CURLINFO_BIN" "$CURLINFO_REAL"
cat > "$CURLINFO_BIN" <<CURLINFO_SHIM
#!/bin/bash
export CURLINFO_REAL="$CURLINFO_REAL"
exec "$CURLINFO_WRAPPER" "\$@"
CURLINFO_SHIM
chmod +x "$CURLINFO_BIN"
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_SHIM
#!/bin/bash
exec "$CURLINFO_WRAPPER" "\$@"
CURLINFO_SHIM
chmod +x "$CURLINFO_BIN"
fi

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