Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch from base64 0.20 to data-encoding 2 #330

Merged
merged 1 commit into from
Jan 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ all-features = true

[features]
default = ["handshake"]
handshake = ["base64", "http", "httparse", "sha1", "url"]
handshake = ["data-encoding", "http", "httparse", "sha1", "url"]
native-tls = ["native-tls-crate"]
native-tls-vendored = ["native-tls", "native-tls-crate/vendored"]
rustls-tls-native-roots = ["__rustls-tls", "rustls-native-certs"]
rustls-tls-webpki-roots = ["__rustls-tls", "webpki-roots"]
__rustls-tls = ["rustls", "webpki"]

[dependencies]
base64 = { version = "0.20.0", optional = true }
data-encoding = { version = "2", optional = true }
byteorder = "1.3.2"
bytes = "1.0"
http = { version = "0.2", optional = true }
Expand Down
2 changes: 1 addition & 1 deletion src/handshake/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ pub fn generate_key() -> String {
// a base64-encoded (see Section 4 of [RFC4648]) value that,
// when decoded, is 16 bytes in length (RFC 6455)
let r: [u8; 16] = rand::random();
base64::encode(&r)
data_encoding::BASE64.encode(&r)
}

#[cfg(test)]
Expand Down
2 changes: 1 addition & 1 deletion src/handshake/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ pub fn derive_accept_key(request_key: &[u8]) -> String {
let mut sha1 = Sha1::default();
sha1.update(request_key);
sha1.update(WS_GUID);
base64::encode(&sha1.finalize())
data_encoding::BASE64.encode(&sha1.finalize())
}

#[cfg(test)]
Expand Down