File tree 3 files changed +10
-7
lines changed
3 files changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -19,8 +19,8 @@ members = [
19
19
20
20
[dependencies ]
21
21
http = " 0.2.0"
22
- headers-core = " 0.2"
23
- base64 = " 0.13 "
22
+ headers-core = { version = " 0.2" }
23
+ base64 = " 0.21.3 "
24
24
bytes = " 1"
25
25
mime = " 0.3.14"
26
26
sha1 = " 0.10"
Original file line number Diff line number Diff line change 1
1
//! Authorization header and types.
2
2
3
- use base64;
3
+ use base64:: engine:: general_purpose:: STANDARD as ENGINE ;
4
+ use base64:: Engine ;
4
5
use bytes:: Bytes ;
5
6
6
7
use util:: HeaderValueString ;
@@ -158,7 +159,8 @@ impl Credentials for Basic {
158
159
let bytes = & value. as_bytes ( ) [ "Basic " . len ( ) ..] ;
159
160
let non_space_pos = bytes. iter ( ) . position ( |b| * b != b' ' ) ?;
160
161
let bytes = & bytes[ non_space_pos..] ;
161
- let bytes = base64:: decode ( bytes) . ok ( ) ?;
162
+
163
+ let bytes = ENGINE . decode ( bytes) . ok ( ) ?;
162
164
163
165
let decoded = String :: from_utf8 ( bytes) . ok ( ) ?;
164
166
@@ -169,7 +171,7 @@ impl Credentials for Basic {
169
171
170
172
fn encode ( & self ) -> HeaderValue {
171
173
let mut encoded = String :: from ( "Basic " ) ;
172
- base64 :: encode_config_buf ( & self . decoded , base64 :: STANDARD , & mut encoded) ;
174
+ ENGINE . encode_string ( & self . decoded , & mut encoded) ;
173
175
174
176
let bytes = Bytes :: from ( encoded) ;
175
177
HeaderValue :: from_maybe_shared ( bytes)
Original file line number Diff line number Diff line change 1
- use base64;
1
+ use base64:: engine:: general_purpose:: STANDARD as ENGINE ;
2
+ use base64:: Engine ;
2
3
use bytes:: Bytes ;
3
4
use sha1:: { Digest , Sha1 } ;
4
5
@@ -39,7 +40,7 @@ fn sign(key: &[u8]) -> SecWebsocketAccept {
39
40
let mut sha1 = Sha1 :: default ( ) ;
40
41
sha1. update ( key) ;
41
42
sha1. update ( & b"258EAFA5-E914-47DA-95CA-C5AB0DC85B11" [ ..] ) ;
42
- let b64 = Bytes :: from ( base64 :: encode ( & sha1. finalize ( ) ) ) ;
43
+ let b64 = Bytes :: from ( ENGINE . encode ( & sha1. finalize ( ) ) ) ;
43
44
44
45
let val = :: HeaderValue :: from_maybe_shared ( b64) . expect ( "base64 is a valid value" ) ;
45
46
You can’t perform that action at this time.
0 commit comments