Open Redfire75369 opened 1 year ago
I'm not totally convinced this is something that belongs in the url crate. I'd rather keep dependencies to a minimal, and even if this is behind a feature gate, it still needs CI testing. I would suggest a crate that depends on both rust-url and http that uses Builder to create a new http uri from parts.
I understand your concerns, perhaps a Builder
API for this crate may be more helpful then, so that the conversion could be done both ways relatively efficiently.
Are URIs truly deprecated in some sense? The URL standard by WHATWG claims that a single algorithm is used for both and that they aim to deprecate URIs as a term in favor of URL, but I don't quite get how that could be possible when URIs are a superset of URLs.
Rationale
The simplest way to convert from a
url::Url
to ahttp::Uri
currently is to turn it into a string and then parse it again. It would be helpful if there was an API to do this conversion directly, instead of necessitating another round of parsingProposal
With a feature flag called
http
, the dependencyhttp
can be added. When thehttp
feature is active, a function can be exposed which does the conversion fromurl
's internal structure to that ofhttp::Uri
's.