Skip to content

Commit

Permalink
Upgrade url and percent-encoding deps to 2.1.0 (#1267)
Browse files Browse the repository at this point in the history
* Upgrade percent-encoding dep to 2.1.0

* Upgrade url dep to 2.1.0
  • Loading branch information
wfarner authored and tomaka committed Oct 7, 2019
1 parent 8be73c2 commit 084c7d0
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
4 changes: 2 additions & 2 deletions misc/multiaddr/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ byteorder = "1.3.1"
bytes = "0.4.12"
data-encoding = "2.1"
multihash = { package = "parity-multihash", version = "0.1.0", path = "../multihash" }
percent-encoding = "1.0.1"
percent-encoding = "2.1.0"
serde = "1.0.70"
unsigned-varint = "0.2"
url = { version = "1.7.2", default-features = false }
url = { version = "2.1.0", default-features = false }

[dev-dependencies]
bincode = "1"
Expand Down
17 changes: 15 additions & 2 deletions misc/multiaddr/src/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,19 @@ const WS_WITH_PATH: u32 = 4770; // Note: not standard
const WSS: u32 = 478;
const WSS_WITH_PATH: u32 = 4780; // Note: not standard

const PATH_SEGMENT_ENCODE_SET: &percent_encoding::AsciiSet = &percent_encoding::CONTROLS
.add(b'%')
.add(b'/')
.add(b'`')
.add(b'?')
.add(b'{')
.add(b'}')
.add(b' ')
.add(b'"')
.add(b'#')
.add(b'<')
.add(b'>');

/// `Protocol` describes all possible multiaddress protocols.
///
/// For `Unix`, `Ws` and `Wss` we use `&str` instead of `Path` to allow
Expand Down Expand Up @@ -429,12 +442,12 @@ impl<'a> fmt::Display for Protocol<'a> {
Utp => f.write_str("/utp"),
Ws(ref s) if s == "/" => f.write_str("/ws"),
Ws(s) => {
let encoded = percent_encoding::percent_encode(s.as_bytes(), percent_encoding::PATH_SEGMENT_ENCODE_SET);
let encoded = percent_encoding::percent_encode(s.as_bytes(), PATH_SEGMENT_ENCODE_SET);
write!(f, "/x-parity-ws/{}", encoded)
},
Wss(ref s) if s == "/" => f.write_str("/wss"),
Wss(s) => {
let encoded = percent_encoding::percent_encode(s.as_bytes(), percent_encoding::PATH_SEGMENT_ENCODE_SET);
let encoded = percent_encoding::percent_encode(s.as_bytes(), PATH_SEGMENT_ENCODE_SET);
write!(f, "/x-parity-wss/{}", encoded)
},
}
Expand Down
2 changes: 1 addition & 1 deletion transports/websocket/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ tokio-codec = "0.1.1"
tokio-io = "0.1.12"
tokio-rustls = "0.10.0-alpha.3"
soketto = { version = "0.2.3", features = ["deflate"] }
url = "1.7.2"
url = "2.1.0"
webpki-roots = "0.16.0"

[dev-dependencies]
Expand Down

0 comments on commit 084c7d0

Please sign in to comment.