Skip to content

Commit 666d991

Browse files
committed
Replace indexing in auth::Basic with &[u8]::trim_ascii_start
1 parent de0b1a1 commit 666d991

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

src/common/authorization.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,8 @@ impl Credentials for Basic {
155155
"HeaderValue to decode should start with \"Basic ..\", received = {:?}",
156156
value,
157157
);
158-
159158
let bytes = value.as_bytes().get("Basic ".len()..)?;
160-
let non_space_pos = bytes.iter().position(|b| *b != b' ')?;
161-
let bytes = &bytes[non_space_pos..];
159+
let bytes = bytes.trim_ascii_start();
162160

163161
let bytes = ENGINE.decode(bytes).ok()?;
164162

0 commit comments

Comments
 (0)