Skip to main content

parse_url

Function parse_url 

Source
pub fn parse_url(url: &str) -> Result<UrlParts, NetError>
Expand description

Parse a scheme://host[:port][/path] URL.

Extracted from sim-lib-agent-runner-http’s parse_url. Differences from that internal helper, which are intentional for a shared primitive:

  • Default ports are resolved here for http (80) and https (443); any other scheme is rejected with NetError::UnsupportedScheme when no explicit port is given. (The client only used http/https.)
  • The path defaults to / instead of the empty string when absent, so the result is a usable request target on its own.