Skip to content

Commit df8358c

Browse files
committed
Add a changelog and an upgrade guide for v2.0.
Fix #532.
1 parent f491cb4 commit df8358c

File tree

5 files changed

+276
-1
lines changed

5 files changed

+276
-1
lines changed

CHANGELOG.md

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# Changelog
2+
3+
All notable changes to the url package will be documented in this file.
4+
5+
Changes to the other packages in this project can be found in their respective
6+
directories:
7+
8+
* [data-url](data-url/CHANGELOG.md)
9+
* [idna](idna/CHANGELOG.md)
10+
* [percent-encoding](percent_encoding/CHANGELOG.md)
11+
12+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
13+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
14+
15+
## [Unreleased]
16+
17+
## [2.0.0] - 2019-07-23
18+
19+
### Changed
20+
21+
* The minimum supported Rust version is now v1.33.0 ([#510], [9ab946f34],
22+
and [#517]).
23+
24+
* Serde has been bumped to v1.x ([#512]).
25+
26+
* Exhaustive matching of `url::ParseError` and `url::SyntaxError` is now
27+
discouraged via a hidden enum variant ([#525]), so that adding additional
28+
variants in the future will not be considered a breaking change.
29+
30+
### Removed
31+
32+
* `url::Url` no longer implements `std::net::ToSocketAddrs` ([[6e0820148]]), and
33+
the related method `with_default_port` and type `HostAndPort` have been
34+
removed as well. The implementation of these features introduced a large
35+
amount of API surface area and was not considered to be a core competency of
36+
the project.
37+
38+
* The `idna` and `percent_export` crates are no longer exported by the `url`
39+
crate, so that breaking changes to those crates do not constitute a breaking
40+
change to the `url` crate ([fe74a60bd]).
41+
42+
* `_charset_` support ([47e2286ff]). TODO: say more.
43+
44+
* `rust-encoding` support ([b567a51e7]). TODO: say more.
45+
46+
* rustc-serialize is no longer supported. Specifically, the `rustc-serialize`
47+
feature has been removed, and so it is no longer possible to configure
48+
`url::Url` to implement the `rustc_serialize::Encodable` and
49+
`rustc_serialize::Decodable` traits ([#507]). rustc-serialize is deprecated,
50+
and Serde has been stable for over two years.
51+
52+
* The `heapsize` feature has been removed, as the [heapsize] project is no
53+
longer maintained ([394e63a75]).
54+
55+
* The `url_serde` crate is no longer maintained, as the `url` crate now ships
56+
support for Serde 1.x (when the `serde` feature is enabled) ([51d6b33f7]).
57+
58+
### Fixed
59+
60+
* Domains that have trailing hyphens are no longer incorrectly rejected
61+
([#484]).
62+
63+
## 1.7.2 - 2018-07-06
64+
65+
The changelog was not maintained for v1.7.2 and earlier.
66+
67+
[Unreleased]: https://github.com/servo/rust-url/compare/v2.0.0...HEAD
68+
[2.0.0]: https://github.com/servo/rust-url/compare/v1.7.2...v2.0.0
69+
70+
[#484]: https://github.com/servo/rust-url/pull/484
71+
[#507]: https://github.com/servo/rust-url/pull/507
72+
[#510]: https://github.com/servo/rust-url/pull/510
73+
[#512]: https://github.com/servo/rust-url/pull/512
74+
[#517]: https://github.com/servo/rust-url/pull/517
75+
[#525]: https://github.com/servo/rust-url/pull/525
76+
77+
[394e63a75]: https://github.com/servo/rust-url/commit/394e63a7518e1bfe8e106ebc7938706b10cfa1aa
78+
[47e2286ff]: https://github.com/servo/rust-url/commit/47e2286ff32359879e69651409ed08385949eb8c
79+
[51d6b33f7]: https://github.com/servo/rust-url/commit/51d6b33f717d29880cb53a1f5bf0d061d846ad35
80+
[6e0820148]: https://github.com/servo/rust-url/commit/6e082014827061a79a27be1d7712e53a84c28280
81+
[9ab946f34]: https://github.com/servo/rust-url/commit/9ab946f3419ed14142227e9e1dfea9bbb6ac5c17
82+
[b567a51e7]: https://github.com/servo/rust-url/commit/b567a51e784bae1fdad1d1e5d7e4dcb00b406080
83+
[fe74a60bd]: https://github.com/servo/rust-url/commit/fe74a60bd0636c5e5da920674b9bbffc22f3c384
84+
85+
[heapsize]: https://github.com/servo/heapsize

UPGRADING.md

+110-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,113 @@
1-
# Guide to upgrading from url 0.x to 1.x
1+
# Upgrade guide
2+
3+
This guide contains steps for upgrading crates in this project between major
4+
versions. Only the most common issues are covered here. For full details of
5+
changes, see the [changelog](CHANGELOG.md).
6+
7+
## Upgrading from url 1.x to 2.x
8+
9+
* The minimum supported Rust version is now v1.33.0. Verify that you can bump
10+
your library or application to the same MSRV.
11+
12+
* `Url` no longer implements `std::net::ToSocketAddrs`. You will instead need to
13+
explicitly convert your `Url` to a type that implements `ToSocketAddrs`.
14+
15+
Before upgrading:
16+
17+
```rust
18+
let url = Url::parse("http://github.com:80").unwrap();
19+
let stream = TcpStream::connect(url).unwrap();
20+
```
21+
22+
After upgrading:
23+
24+
```rust
25+
let url = Url::parse("http://github.com:80").unwrap();
26+
let port = url.port_or_known_default().unwrap();
27+
let addrs;
28+
let addr;
29+
let addrs = match url.host().unwrap() {
30+
url::Host::Domain(domain) => {
31+
addrs = (domain, port).to_socket_addrs().unwrap();
32+
addrs.as_slice()
33+
}
34+
url::Host::Ipv4(ip) => {
35+
addr = (ip, port).into();
36+
std::slice::from_ref(&addr)
37+
}
38+
url::Host::Ipv6(ip) => {
39+
addr = (ip, port).into();
40+
std::slice::from_ref(&addr)
41+
}
42+
};
43+
let stream = TcpStream::connect(addrs).unwrap();
44+
```
45+
46+
* `url_serde` is no longer required to use `Url` with Serde 1.x. Remove
47+
references to `url_serde` and enable the `serde` feature instead.
48+
49+
```toml
50+
# Cargo.toml
51+
[dependencies]
52+
url = { version = "2.0", features = ["serde"] }
53+
```
54+
55+
* The `idna` and `percent_export` crates are no longer exported by the `url`
56+
crate. Depend on those crates directly instead. See below for additional
57+
breaking changes in the percent-export package.
58+
59+
Before upgrading:
60+
61+
```rust
62+
use url::percent_encoding::percent_decode;
63+
```
64+
65+
After upgrading:
66+
67+
```rust
68+
use percent_encoding::percent_decode;
69+
```
70+
71+
## Upgrading from percent-encoding 1.x to 2.x
72+
73+
* Prepackaged encoding sets, like `QUERY_ENCODE_SET` and
74+
`PATH_SEGMENT_ENCODE_SET`, are no longer provided. You will need to read You
75+
will need to read the specifications relevant to your domain and construct
76+
your own encoding sets by using the `percent_encoding::AsciiSet` builder
77+
methods on either of the base encoding sets, `percent_encoding::CONTROLS` or
78+
`percent_encoding::NON_ALPHANUMERIC`.
79+
80+
Before upgrading:
81+
82+
```rust
83+
use percent_encoding::PATH_SEGMENT_ENCODE_SET;
84+
85+
percent_encoding::utf8_percent_encode(value, PATH_SEGMENT_ENCODE_SET);
86+
```
87+
88+
After upgrading:
89+
90+
```rust
91+
/// https://url.spec.whatwg.org/#fragment-percent-encode-set
92+
const FRAGMENT_ENCODE_SET: &AsciiSet = &percent_encoding::CONTROLS
93+
.add(b' ').add(b'"').add(b'<').add(b'>').add(b'`');
94+
95+
/// https://url.spec.whatwg.org/#path-percent-encode-set
96+
const PATH_ENCODE_SET: &AsciiSet = &FRAGMENT_ENCODE_SET
97+
.add(b'#').add(b'?').add(b'{').add(b'}');
98+
99+
const PATH_SEGMENT_ENCODE_SET: &AsciiSet = &PATH_ENCODE_SET.add(b'/').add(b'%');
100+
101+
percent_encoding::utf8_percent_encode(value, PATH_SEGMENT_ENCODE_SET);
102+
```
103+
104+
You can use the [private encoding sets in the URL parser][encoding-sets] as
105+
a basis.
106+
107+
[encoding-sets]: https://github.com/servo/rust-url/blob/f491cb442edab75be54ff5961af6458a474f1f9a/src/parser.rs#L18-L45
108+
109+
110+
## Upgrading from url 0.x to 1.x
2111

3112
* The fields of `Url` are now private because the `Url` constructor, parser,
4113
and setters maintain invariants that could be violated if you were to set the fields directly.

data-url/CHANGELOG.md

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Changelog
2+
3+
All notable changes to the data-url package will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## Unreleased
9+
10+
## 0.1.0 - 2018-02-02
11+
12+
The changelog was not maintained for v0.1.0 and earlier.

idna/CHANGELOG.md

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Changelog
2+
3+
All notable changes to the idna package will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## Unreleased
9+
10+
## 0.2.0 - 2019-07-23
11+
12+
### Added
13+
14+
* Support for the `CheckHyphens` flag in the domain to ASCII algorithm ([#484]).
15+
16+
* A `domain_to_ascii_strict` function, which runs the domain to ASCII algorithm
17+
with the `beStrict` flag set ([737128608]).
18+
19+
### Changed
20+
21+
* The algorithms are now configured through a `Config` struct, which
22+
can be modified via the builder pattern, rather than by directly passing
23+
a flags struct to the implicated functions ([#484]).
24+
25+
### Removed
26+
27+
* The `uts46` module is private. The relevant structs within are re-exported at
28+
the top level ([5aeaf89af]).
29+
30+
## 0.1.5 - 2018-07-06
31+
32+
The changelog was not maintained for v0.1.5 and earlier.
33+
34+
[#484]: https://github.com/servo/rust-url/pull/484
35+
36+
[5aeaf89af]: https://github.com/servo/rust-url/commit/5aeaf89afe43c78eef7c958b1089bd586f68c271
37+
[737128608]: https://github.com/servo/rust-url/commit/7371286087b32d358610df1ad3a3b1f55f6836df

percent_encoding/CHANGELOG.md

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Changelog
2+
3+
All notable changes to the percent-encoding package will be documented in this
4+
file.
5+
6+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
7+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
8+
9+
## Unreleased
10+
11+
## 2.0.0 - 2019-07-23
12+
13+
### Changed
14+
15+
* Encoding sets are now values of a new `percent_encoding::AsciiSet` type,
16+
rather than any type that implements `percent_encoding::EncodeSet` ([#519]).
17+
This fixes a longstanding bug where `EncodeSet`s could not be boxed ([#388]).
18+
The `EncodeSet` trait has accordingly been removed.
19+
20+
* The prepackaged encoding sets, like `percent_encoding::QUERY_ENCODE_SET` and
21+
`percent_encoding::PATH_SEGMENT_ENCODE_SET`, have been removed ([#519]).
22+
Instead, read the specifications relevant to your domain and construct your
23+
own encoding sets by using the `percent_encoding::AsciiSet` builder methods
24+
on either of the base encoding sets, `percent_encoding::CONTROLS` or
25+
`percent_encoding::NON_ALPHANUMERIC`.
26+
27+
## 1.0.1 - 2017-11-11
28+
29+
The changelog was not maintained for v1.0.1 and earlier.
30+
31+
[#388]: https://github.com/servo/rust-url/issues/388
32+
[#519]: https://github.com/servo/rust-url/pull/619

0 commit comments

Comments
 (0)