From 67f0aceea6f08c98a7aed321d92bb176aee57f93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Till=20H=C3=B6ppner?= Date: Sun, 1 Jul 2018 15:25:00 +0200 Subject: [PATCH] Account for joining ':' in basic auth (#2) --- src/headers/authorization/scheme/basic.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/headers/authorization/scheme/basic.rs b/src/headers/authorization/scheme/basic.rs index 449ea2ad6..1af2868cf 100644 --- a/src/headers/authorization/scheme/basic.rs +++ b/src/headers/authorization/scheme/basic.rs @@ -70,7 +70,7 @@ impl IntoHeaderValue for Basic { fn try_into(self) -> Result::Error> { let mut credentials = BytesMut::with_capacity( - self.username.len() + self.password.as_ref().map_or(0, |pwd| pwd.len()) + self.username.len() + 1 + self.password.as_ref().map_or(0, |pwd| pwd.len()) ); credentials.put(&self.username); credentials.put_u8(b':');