Discussion:
[rust-dev] [ANN] rust-url
Simon Sapin
2014-07-31 15:09:00 UTC
Permalink
Hi Rustaceans,

rustc comes with an `url` crate (previously a `extra::url` module) for
parsing an serializing URLs. This crate is now deprecated:

https://github.com/rust-lang/rust/commit/491bd299

The replacement is rust-url, which solves a number of issues that the
old url crate had and adds some features that were missing:

http://servo.github.io/rust-url/

rust-url is not distributed with rustc, but builds easily with Cargo.

Please use the GitHub issue tracker for any feedback on the
documentation, bugs, feature requests, etc.

Cheers,
--
Simon Sapin
Brian Anderson
2014-07-31 22:38:47 UTC
Permalink
Thanks, Simon!

This is huge. Simon knows everything about web standards, and this is
Servo's URL type, so it's going to be maintained and correct.

The old url crate was originally written by me, without looking at any
specs, in order to teach Servo able to open `http://www.google.com`. It
wasn't the best (though other people improved it).

Regards,
Brian
Post by Simon Sapin
Hi Rustaceans,
rustc comes with an `url` crate (previously a `extra::url` module) for
https://github.com/rust-lang/rust/commit/491bd299
The replacement is rust-url, which solves a number of issues that the
http://servo.github.io/rust-url/
rust-url is not distributed with rustc, but builds easily with Cargo.
Please use the GitHub issue tracker for any feedback on the
documentation, bugs, feature requests, etc.
Cheers,
Daniel Fath
2014-07-31 23:08:50 UTC
Permalink
Is rust-url compatible with rust-uri? And if not are there any plans to
support URI specification with it?


On Fri, Aug 1, 2014 at 12:38 AM, Brian Anderson <banderson at mozilla.com>
Post by Brian Anderson
Thanks, Simon!
This is huge. Simon knows everything about web standards, and this is
Servo's URL type, so it's going to be maintained and correct.
The old url crate was originally written by me, without looking at any
specs, in order to teach Servo able to open `http://www.google.com`. It
wasn't the best (though other people improved it).
Regards,
Brian
Post by Simon Sapin
Hi Rustaceans,
rustc comes with an `url` crate (previously a `extra::url` module) for
https://github.com/rust-lang/rust/commit/491bd299
The replacement is rust-url, which solves a number of issues that the old
http://servo.github.io/rust-url/
rust-url is not distributed with rustc, but builds easily with Cargo.
Please use the GitHub issue tracker for any feedback on the
documentation, bugs, feature requests, etc.
Cheers,
_______________________________________________
Rust-dev mailing list
Rust-dev at mozilla.org
https://mail.mozilla.org/listinfo/rust-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/rust-dev/attachments/20140801/8f841c38/attachment.html>
Simon Sapin
2014-08-01 09:04:30 UTC
Permalink
Post by Daniel Fath
Is rust-url compatible with rust-uri? And if not are there any plans to
support URI specification with it?
Is there a project called rust-uri? I can?t find it.

rust-url supports URIs because they?re really the same thing as URLs. It
Post by Daniel Fath
* Standardize on the term URL. URI and IRI are just confusing. In
practice a single algorithm is used for both so keeping them distinct
is not helping anyone.
For example:

```
extern crate url;
use url::Url;

let isbn_url = Url::parse("urn:isbn:0-486-27557-4#chapter6").unwrap();
assert(isbn_url.scheme == "urn".to_sting());
assert(isbn_url.non_relative_scheme_data()
== Some("isbn:0-486-27557-4"));
assert(isbn_url.query == None);
assert(isbn_url.fragment == Some("chapter6".to_sting()));
```

The only interesting thing here is that "urn" is a "non-relative"
scheme: Other than the scheme, query string, and fragment identifier,
URLs in that scheme (as in data, mailto, and others) only have a "scheme
data" string.

For URLs in a "relative" scheme like http, instead of a single string
the scheme data is a username, password, host, port number, and path.
(Some of which are optional or can be empty.)
--
Simon Sapin
Loading...