parent
2eea62fed2
commit
411a8c495c
@ -309,13 +309,13 @@ fn get_authority(rawurl: &str) ->
|
||||
colon_count = 0; // reset count
|
||||
match st {
|
||||
State::Start => {
|
||||
let user = rawurl[begin..i].to_string();
|
||||
let user = try!(decode_component(&rawurl[begin..i]));
|
||||
userinfo = Some(UserInfo::new(user, None));
|
||||
st = State::InHost;
|
||||
}
|
||||
State::PassHostPort => {
|
||||
let user = rawurl[begin..pos].to_string();
|
||||
let pass = rawurl[pos+1..i].to_string();
|
||||
let user = try!(decode_component(&rawurl[begin..pos]));
|
||||
let pass = try!(decode_component(&rawurl[pos+1..i]));
|
||||
userinfo = Some(UserInfo::new(user, Some(pass)));
|
||||
st = State::InHost;
|
||||
}
|
||||
|
@ -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{|", ¶ms.user.as_ref().unwrap().user[..]);
|
||||
assert_eq!("password{|", ¶ms.user.as_ref().unwrap().password.as_ref().unwrap()[..]);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user