You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] curl -L resolves a protocol-relative Location: //host/path as a path on the current host #132
Follow to http://other-host:8080/hello (same scheme as the current URL), as real curl does.
Actual Behavior
The builtin only treats scheme://… as absolute, so //other-host:8080/hello falls into the starts_with('/') branch and is appended to the current origin: http://127.0.0.1:PORT//other-host:8080/hello → 404 (or whatever that path returns).
src/commands/curl.rs (redirect resolution in cmd_curl):
}elseif loc.starts_with('/'){let scheme_end = current_url.find("://").map(|i| i + 3).unwrap_or(0);let host_end = current_url[scheme_end..].find('/').map(|i| i + scheme_end).unwrap_or(current_url.len());format!("{}{loc}",¤t_url[..host_end])
Reproduced with a temporary axum route in tests/curl_integration.rs during review of #131 (pre-existing; identical on main).
Additional Context
Note the kernel's check_url still runs on the resolved URL, so this is a wrong-destination bug, not a sandbox escape.
Possible Solution
Before the starts_with('/') branch: if let Some(rest) = loc.strip_prefix("//") { format!("{scheme}://{rest}") } using the current URL's scheme. Or resolve Location with url::Url::join (the url crate is already a dependency), which handles all RFC 3986 relative forms.
Related Issues
Found while reviewing #131 (not introduced by it).
I would like to take this on with a small fix for protocol-relative redirects, plus regression tests for both the first and later redirect hops. I will keep the existing URL checks and credential handling unchanged.
Activity
ikenyal commentedon Oct 11, 2026
I would like to take this on with a small fix for protocol-relative redirects, plus regression tests for both the first and later redirect hops. I will keep the existing URL checks and credential handling unchanged.