mirror of
https://github.com/fafhrd91/actix-web
synced 2024-11-27 09:42:57 +01:00
Update base64 to 0.21 (#2966)
Co-authored-by: Rob Ede <robjtede@icloud.com>
This commit is contained in:
parent
2f0b8a264a
commit
b00fe72cf6
@ -37,7 +37,6 @@ actix-rt = "2.2"
|
||||
actix-server = "2"
|
||||
awc = { version = "3", default-features = false }
|
||||
|
||||
base64 = "0.13"
|
||||
bytes = "1"
|
||||
futures-core = { version = "0.3.17", default-features = false }
|
||||
http = "0.2.5"
|
||||
|
@ -86,7 +86,7 @@ h2 = { version = "0.3.9", optional = true }
|
||||
|
||||
# websockets
|
||||
local-channel = { version = "0.1", optional = true }
|
||||
base64 = { version = "0.13", optional = true }
|
||||
base64 = { version = "0.21", optional = true }
|
||||
rand = { version = "0.8", optional = true }
|
||||
sha1 = { version = "0.10", optional = true }
|
||||
|
||||
|
@ -3,6 +3,7 @@ use std::{
|
||||
fmt,
|
||||
};
|
||||
|
||||
use base64::prelude::*;
|
||||
use tracing::error;
|
||||
|
||||
/// Operation codes defined in [RFC 6455 §11.8].
|
||||
@ -244,7 +245,7 @@ pub fn hash_key(key: &[u8]) -> [u8; 28] {
|
||||
};
|
||||
|
||||
let mut hash_b64 = [0; 28];
|
||||
let n = base64::encode_config_slice(hash, base64::STANDARD, &mut hash_b64);
|
||||
let n = BASE64_STANDARD.encode_slice(hash, &mut hash_b64).unwrap();
|
||||
assert_eq!(n, 28);
|
||||
|
||||
hash_b64
|
||||
|
@ -63,7 +63,7 @@ actix-tls = { version = "3", features = ["connect", "uri"] }
|
||||
actix-utils = "3"
|
||||
|
||||
ahash = "0.7"
|
||||
base64 = "0.13"
|
||||
base64 = "0.21"
|
||||
bytes = "1"
|
||||
cfg-if = "1"
|
||||
derive_more = "0.99.5"
|
||||
|
@ -1,5 +1,7 @@
|
||||
use std::{convert::TryFrom, fmt, net::IpAddr, rc::Rc, time::Duration};
|
||||
|
||||
use base64::prelude::*;
|
||||
|
||||
use actix_http::{
|
||||
error::HttpError,
|
||||
header::{self, HeaderMap, HeaderName, TryIntoHeaderPair},
|
||||
@ -210,7 +212,7 @@ where
|
||||
};
|
||||
self.add_default_header((
|
||||
header::AUTHORIZATION,
|
||||
format!("Basic {}", base64::encode(auth)),
|
||||
format!("Basic {}", BASE64_STANDARD.encode(auth)),
|
||||
))
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
use std::{convert::TryFrom, fmt, net, rc::Rc, time::Duration};
|
||||
|
||||
use base64::prelude::*;
|
||||
use bytes::Bytes;
|
||||
use futures_core::Stream;
|
||||
use serde::Serialize;
|
||||
@ -238,7 +239,7 @@ impl ClientRequest {
|
||||
|
||||
self.insert_header((
|
||||
header::AUTHORIZATION,
|
||||
format!("Basic {}", base64::encode(auth)),
|
||||
format!("Basic {}", BASE64_STANDARD.encode(auth)),
|
||||
))
|
||||
}
|
||||
|
||||
|
@ -28,6 +28,8 @@
|
||||
|
||||
use std::{convert::TryFrom, fmt, net::SocketAddr, str};
|
||||
|
||||
use base64::prelude::*;
|
||||
|
||||
use actix_codec::Framed;
|
||||
use actix_http::{ws, Payload, RequestHead};
|
||||
use actix_rt::time::timeout;
|
||||
@ -236,7 +238,10 @@ impl WebsocketsRequest {
|
||||
Some(password) => format!("{}:{}", username, password),
|
||||
None => format!("{}:", username),
|
||||
};
|
||||
self.header(AUTHORIZATION, format!("Basic {}", base64::encode(auth)))
|
||||
self.header(
|
||||
AUTHORIZATION,
|
||||
format!("Basic {}", BASE64_STANDARD.encode(auth)),
|
||||
)
|
||||
}
|
||||
|
||||
/// Set HTTP bearer authentication header
|
||||
@ -321,7 +326,7 @@ impl WebsocketsRequest {
|
||||
// Generate a random key for the `Sec-WebSocket-Key` header which is a base64-encoded
|
||||
// (see RFC 4648 §4) value that, when decoded, is 16 bytes in length (RFC 6455 §1.3).
|
||||
let sec_key: [u8; 16] = rand::random();
|
||||
let key = base64::encode(sec_key);
|
||||
let key = BASE64_STANDARD.encode(sec_key);
|
||||
|
||||
self.head.headers.insert(
|
||||
header::SEC_WEBSOCKET_KEY,
|
||||
|
@ -13,6 +13,7 @@ use std::{
|
||||
};
|
||||
|
||||
use actix_utils::future::ok;
|
||||
use base64::prelude::*;
|
||||
use bytes::Bytes;
|
||||
use cookie::Cookie;
|
||||
use futures_util::stream;
|
||||
@ -783,7 +784,7 @@ async fn client_basic_auth() {
|
||||
.unwrap()
|
||||
.to_str()
|
||||
.unwrap()
|
||||
== format!("Basic {}", base64::encode("username:password"))
|
||||
== format!("Basic {}", BASE64_STANDARD.encode("username:password"))
|
||||
{
|
||||
HttpResponse::Ok()
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user