diff --git a/examples/websocket/Cargo.toml b/examples/websocket/Cargo.toml index 18b417ce..079474ae 100644 --- a/examples/websocket/Cargo.toml +++ b/examples/websocket/Cargo.toml @@ -13,4 +13,4 @@ tokio-tungstenite = "0.18" tokio = "1.11.0" pretty_env_logger = "0.4" sha1 = "0.10" -base64 = "0.13" +base64 = "0.21" diff --git a/examples/websocket/src/ws.rs b/examples/websocket/src/ws.rs index 8ffe7494..a704dfc2 100644 --- a/examples/websocket/src/ws.rs +++ b/examples/websocket/src/ws.rs @@ -1,3 +1,4 @@ +use base64::prelude::*; use gotham::hyper::header::{ HeaderValue, CONNECTION, SEC_WEBSOCKET_ACCEPT, SEC_WEBSOCKET_KEY, UPGRADE, }; @@ -57,7 +58,7 @@ fn accept_key(key: &[u8]) -> String { let mut sha1 = Sha1::default(); sha1.update(key); sha1.update(WS_GUID); - base64::encode(&sha1.finalize()) + BASE64_STANDARD.encode(&sha1.finalize()) } #[cfg(test)] diff --git a/gotham/Cargo.toml b/gotham/Cargo.toml index bd476ed8..e9621f20 100644 --- a/gotham/Cargo.toml +++ b/gotham/Cargo.toml @@ -30,7 +30,7 @@ borrow-bag = { path = "../misc/borrow_bag", version = "1.1" } gotham_derive = { path = "../gotham_derive", version = "0.7", optional = true } anyhow = "1.0" -base64 = "0.13" +base64 = "0.21" bincode = { version = "1.0", optional = true } bytes = "1.0" cookie = "0.15" diff --git a/gotham/src/middleware/session/mod.rs b/gotham/src/middleware/session/mod.rs index d261fa01..ec237e67 100644 --- a/gotham/src/middleware/session/mod.rs +++ b/gotham/src/middleware/session/mod.rs @@ -8,6 +8,7 @@ use std::panic::RefUnwindSafe; use std::pin::Pin; use std::sync::{Arc, Mutex, PoisonError}; +use base64::prelude::*; use cookie::{Cookie, CookieJar}; use futures_util::future::{self, FutureExt, TryFutureExt}; use hyper::header::SET_COOKIE; @@ -847,7 +848,7 @@ where }; SessionIdentifier { - value: base64::encode_config(&bytes[..], base64::URL_SAFE_NO_PAD), + value: BASE64_URL_SAFE_NO_PAD.encode(&bytes[..]), } } }