mirror of
https://github.com/house-of-vanity/v2-uri-parser.git
synced 2025-12-15 14:47:51 +00:00
Improve names for uri prefix
This commit is contained in:
@@ -56,11 +56,11 @@ fn parse_ss_address(raw_data: &str) -> models::ShadowSocksAddress {
|
||||
|
||||
let parsed = address_wo_slash.parse::<Uri>().unwrap();
|
||||
|
||||
let a = general_purpose::STANDARD
|
||||
let method_and_password = general_purpose::STANDARD
|
||||
.decode(url_decode_str(&userinfo).unwrap_or(userinfo))
|
||||
.expect("User info is not base64");
|
||||
|
||||
let (method, password) = std::str::from_utf8(&a)
|
||||
let (method, password) = std::str::from_utf8(&method_and_password)
|
||||
.expect("Base64 did not yield a valid utf-8 string")
|
||||
.split_once(":")
|
||||
.expect("No `:` found in the decoded base64");
|
||||
|
||||
@@ -57,7 +57,7 @@ fn parse_socks_address(raw_data: &str) -> models::SocksAddress {
|
||||
return match maybe_userinfo {
|
||||
Some(userinfo) => {
|
||||
let url_decoded = url_decode_str(&userinfo).unwrap_or(userinfo);
|
||||
let a = general_purpose::STANDARD
|
||||
let username_and_password = general_purpose::STANDARD
|
||||
.decode(url_decoded.clone())
|
||||
.map(|a| {
|
||||
String::from(
|
||||
@@ -66,7 +66,7 @@ fn parse_socks_address(raw_data: &str) -> models::SocksAddress {
|
||||
})
|
||||
.unwrap_or(String::from(url_decoded.clone()));
|
||||
|
||||
let (username, password) = a
|
||||
let (username, password) = username_and_password
|
||||
.split_once(":")
|
||||
.expect("No `:` found in the decoded base64");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user