Fix percent-encoded usernames and passwords

Closes #113
This commit is contained in:
Steven Fackler
2015-04-15 20:31:15 -07:00
parent 2eea62fed2
commit 411a8c495c
2 changed files with 11 additions and 3 deletions

View File

@@ -17,6 +17,7 @@ use postgres::{HandleNotice,
Error,
ConnectError,
DbError,
IntoConnectParams,
VecStreamIterator};
use postgres::SqlState::{SyntaxError,
QueryCanceled,
@@ -936,3 +937,10 @@ fn test_get_opt_wrong_type() {
Err(e) => panic!("unexpected error {}", e),
}
}
#[test]
fn url_encoded_password() {
let params = "postgresql://username%7b%7c:password%7b%7c@localhost".into_connect_params().unwrap();
assert_eq!("username{|", &params.user.as_ref().unwrap().user[..]);
assert_eq!("password{|", &params.user.as_ref().unwrap().password.as_ref().unwrap()[..]);
}