Skip to content

Commit

Permalink
Merge pull request #57 from fornax-a/master
Browse files Browse the repository at this point in the history
Better handle missing system proxy/credentials
  • Loading branch information
Ylianst authored Oct 7, 2023
2 parents fde77c0 + d6a63fc commit a245e1f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/WebSocketClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -289,12 +289,11 @@ private void OnConnectSink(IAsyncResult ar)
// 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;
}

Expand Down

0 comments on commit a245e1f

Please sign in to comment.