Skip to content
This repository was archived by the owner on Jul 19, 2022. It is now read-only.

Commit

Permalink
Fixed an issue with proxy loading...
Browse files Browse the repository at this point in the history
...causing all proxies to be marked as invalid
  • Loading branch information
Laiteux committed May 31, 2020
1 parent f247adb commit c7acae6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
4 changes: 3 additions & 1 deletion src/Milky/Models/Combo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ public class Combo

public Combo(string combo, string separator = ":")
{
Separator = separator;

string[] split = combo.Split(separator, _splitCount, StringSplitOptions.RemoveEmptyEntries);

if (split.Length != _splitCount)
Expand All @@ -17,7 +19,7 @@ public Combo(string combo, string separator = ":")

Username = split[0];
Password = split[1];
Separator = separator;

IsValid = true;
}

Expand Down
15 changes: 6 additions & 9 deletions src/Milky/Models/Proxy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ public class Proxy
{
public Proxy(string proxy, ProxySettings settings)
{
Settings = settings;

string[] split = proxy.Split(':');

if (split.Length >= 2)
if (split.Length == 2 || split.Length == 4)
{
Host = split[0];

if (!int.TryParse(split[1], out int port))
if (!int.TryParse(split[1], out int port) || port > 65535)
{
return;
}
Expand All @@ -27,14 +29,9 @@ public Proxy(string proxy, ProxySettings settings)
{
Credentials = new NetworkCredential(split[2], split[3]);
}
else
{
return;
}
}

Settings = settings;
IsValid = true;
IsValid = true;
}
}

internal bool IsValid { get; }
Expand Down

0 comments on commit c7acae6

Please sign in to comment.