mirror of
https://github.com/2dust/v2rayN.git
synced 2026-04-16 12:35:46 +00:00
Update HttpFmt.cs
This commit is contained in:
parent
6e2cd1c23e
commit
b4a5d7ee29
1 changed files with 9 additions and 2 deletions
|
|
@ -7,6 +7,11 @@ public class HttpFmt : BaseFmt
|
||||||
return value.Replace(':', ':');
|
return value.Replace(':', ':');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static string EncodeUserInfoPart(string value)
|
||||||
|
{
|
||||||
|
return Uri.EscapeDataString(value);
|
||||||
|
}
|
||||||
|
|
||||||
public static ProfileItem? Resolve(string str, out string msg)
|
public static ProfileItem? Resolve(string str, out string msg)
|
||||||
{
|
{
|
||||||
msg = ResUI.ConfigurationFormatIncorrect;
|
msg = ResUI.ConfigurationFormatIncorrect;
|
||||||
|
|
@ -41,13 +46,15 @@ public class HttpFmt : BaseFmt
|
||||||
var userInfo = string.Empty;
|
var userInfo = string.Empty;
|
||||||
if (item.Security.IsNotEmpty() && item.Id.IsNotEmpty())
|
if (item.Security.IsNotEmpty() && item.Id.IsNotEmpty())
|
||||||
{
|
{
|
||||||
userInfo = $"{NormalizeColon(item.Security)}:{NormalizeColon(item.Id)}";
|
var security = EncodeUserInfoPart(NormalizeColon(item.Security));
|
||||||
|
var id = EncodeUserInfoPart(NormalizeColon(item.Id));
|
||||||
|
userInfo = $"{security}:{id}";
|
||||||
}
|
}
|
||||||
|
|
||||||
var protocol = item.StreamSecurity == "tls" ? "https://" : "http://";
|
var protocol = item.StreamSecurity == "tls" ? "https://" : "http://";
|
||||||
if (userInfo.IsNotEmpty())
|
if (userInfo.IsNotEmpty())
|
||||||
{
|
{
|
||||||
return $"{protocol}{Utils.UrlEncode(userInfo)}@{GetIpv6(NormalizeColon(item.Address))}:{item.Port}{remark}";
|
return $"{protocol}{userInfo}@{GetIpv6(NormalizeColon(item.Address))}:{item.Port}{remark}";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue