Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ members = [
[dependencies]
http = "0.2.0"
headers-core = { version = "0.2", path = "./headers-core" }
base64 = "0.13"
base64 = "0.20"
bitflags = "1.0"
bytes = "1"
mime = "0.3.14"
Expand Down
10 changes: 8 additions & 2 deletions src/common/authorization.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
//! Authorization header and types.

use base64;
use base64::{
self,
engine::fast_portable::{FastPortable, FastPortableConfig},
alphabet::STANDARD,
};
use bytes::Bytes;

use util::HeaderValueString;
Expand Down Expand Up @@ -168,8 +172,10 @@ impl Credentials for Basic {
}

fn encode(&self) -> HeaderValue {
const ENGINE: FastPortable = FastPortable::from(&STANDARD, FastPortableConfig::new());

let mut encoded = String::from("Basic ");
base64::encode_config_buf(&self.decoded, base64::STANDARD, &mut encoded);
base64::encode_engine_string(&self.decoded, &mut encoded, &ENGINE);
Comment thread
davidpdrsn marked this conversation as resolved.

let bytes = Bytes::from(encoded);
HeaderValue::from_maybe_shared(bytes)
Expand Down