sapling/lib/url-ext
Arun Kulshreshtha 5ae0d91378 url-ext: add url-ext crate
Summary:
Crate adding easy conversions between `http::Uri` and `url::Url`.

Rust has two main types for working with URLs: `http::Uri` and `url::Url`.  `http::Uri` comes from the `http` crate, which is supposed to be a set of common types to be used throughout the Rust HTTP ecosystem, to ensure mutual compatibility between different HTTP crates and web frameworks. This is the type that HTTP clients like Hyper expect when specifying URLs.

Unfortunately, `http::Uri` is a very simple type that does not expose any means of mutating or otherwise manipulating the URL. It can only parse URLs from strings, forcing the users to construct URLs via error-prone string concatenation.

In contrast, the `url::Url` comes from the `rust-url` crate from the Servo project. This type does support easily constructing and manipulating URLs, making it very useful for assembling a URL from components.

The only way to convert between the two types is to first convert back to a string, and then re-parse as the desired type. Several issues [have](https://github.com/hyperium/hyper/issues/1219) [been](https://github.com/hyperium/hyper/issues/1102) [raised](https://github.com/hyperium/hyper/issues/1219) about this upstream, but there has been no consensus or action as of yet. To get around the problem for now, this crate adds convenience methods to perform the conversions.

Reviewed By: DurhamG

Differential Revision: D13887403

fbshipit-source-id: ecfaf3ea9d884621493b0fe44a6b5658d10108b4
2019-01-30 18:30:49 -08:00
..
src url-ext: add url-ext crate 2019-01-30 18:30:49 -08:00
Cargo.toml url-ext: add url-ext crate 2019-01-30 18:30:49 -08:00