servo / rust-url

URL parser for Rust
https://docs.rs/url/
Apache License 2.0
1.27k stars 318 forks source link

Wrongly resolves ip to domain. #828

Closed mokeyish closed 1 year ago

mokeyish commented 1 year ago

Describe the bug A clear and concise description of what the bug is. Include code snippets if possible.

Input: udp://8.8.8.8:53

Output: Host::Domain("8.8.8.8")

Expect: Host:Ipv4(8.8.8.8)

valenting commented 1 year ago

This behaviour is caused by the fact that udp is a non-special scheme. So it could have basically anything in the hostname. For example udp://555.555.555.555:53/ is a valid URL, but you wouldn't expect it's hostname to be an IP, right? It's an opaque domain.

mokeyish commented 1 year ago

Can we have an option to configure udp to a special schema?