1
0
mirror of https://github.com/fafhrd91/actix-web synced 2024-11-30 18:44:35 +01:00

Actix-web client: Always append a colon after username in basic auth (#949)

* Always append a colon after username in basic auth

* Update CHANGES.md
This commit is contained in:
Alec Moskvin 2019-06-30 23:34:42 -04:00 committed by Nikolay Kim
parent 5901dfee1a
commit d2eb1edac3
4 changed files with 13 additions and 6 deletions

View File

@ -1,5 +1,12 @@
# Changes # Changes
## [0.2.2] - TBD
### Changed
* Always append a colon after username in basic auth
## [0.2.1] - 2019-06-05 ## [0.2.1] - 2019-06-05
### Added ### Added

View File

@ -115,7 +115,7 @@ impl ClientBuilder {
{ {
let auth = match password { let auth = match password {
Some(password) => format!("{}:{}", username, password), Some(password) => format!("{}:{}", username, password),
None => format!("{}", username), None => format!("{}:", username),
}; };
self.header( self.header(
header::AUTHORIZATION, header::AUTHORIZATION,
@ -164,7 +164,7 @@ mod tests {
.unwrap() .unwrap()
.to_str() .to_str()
.unwrap(), .unwrap(),
"Basic dXNlcm5hbWU=" "Basic dXNlcm5hbWU6"
); );
} }

View File

@ -280,7 +280,7 @@ impl ClientRequest {
{ {
let auth = match password { let auth = match password {
Some(password) => format!("{}:{}", username, password), Some(password) => format!("{}:{}", username, password),
None => format!("{}", username), None => format!("{}:", username),
}; };
self.header( self.header(
header::AUTHORIZATION, header::AUTHORIZATION,
@ -664,7 +664,7 @@ mod tests {
.unwrap() .unwrap()
.to_str() .to_str()
.unwrap(), .unwrap(),
"Basic dXNlcm5hbWU=" "Basic dXNlcm5hbWU6"
); );
} }

View File

@ -195,7 +195,7 @@ impl WebsocketsRequest {
{ {
let auth = match password { let auth = match password {
Some(password) => format!("{}:{}", username, password), Some(password) => format!("{}:{}", username, password),
None => format!("{}", username), None => format!("{}:", username),
}; };
self.header(AUTHORIZATION, format!("Basic {}", base64::encode(&auth))) self.header(AUTHORIZATION, format!("Basic {}", base64::encode(&auth)))
} }
@ -443,7 +443,7 @@ mod tests {
.unwrap() .unwrap()
.to_str() .to_str()
.unwrap(), .unwrap(),
"Basic dXNlcm5hbWU=" "Basic dXNlcm5hbWU6"
); );
} }