1
0
mirror of https://github.com/Ylianst/MeshCentralRouter synced 2025-12-06 00:13:33 +00:00

Merge pull request #57 from fornax-a/master

Better handle missing system proxy/credentials
This commit is contained in:
Ylian Saint-Hilaire
2023-10-07 12:02:05 -07:00
committed by GitHub

View File

@@ -289,12 +289,11 @@ namespace MeshCentralRouter
// Send proxy connection request
wsrawstream = wsclient.GetStream();
string userCreds = proxyUri.UserInfo;
string basicAuth = "";
if (userCreds.Length > 0)
if (proxyUri?.UserInfo != null)
{
// Base64 encode for basic authentication
userCreds = System.Convert.ToBase64String(Encoding.GetEncoding("ISO-8859-1").GetBytes(userCreds));
string userCreds = System.Convert.ToBase64String(Encoding.GetEncoding("ISO-8859-1").GetBytes(proxyUri.UserInfo));
basicAuth = "\r\nProxy-Authorization: Basic " + userCreds;
}