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

Reverted bad change to web socket client.

This commit is contained in:
Ylian Saint-Hilaire
2023-10-07 12:22:45 -07:00
parent c9d8f59b06
commit ebaa8c5b0c
3 changed files with 206 additions and 391 deletions

View File

@@ -679,8 +679,7 @@
this.rdpToolStripMenuItem,
this.sshToolStripMenuItem,
this.scpToolStripMenuItem,
this.wolToolStripMenuItem,
});
this.wolToolStripMenuItem});
this.devicesContextMenuStrip.Name = "devicesContextMenuStrip";
resources.ApplyResources(this.devicesContextMenuStrip, "devicesContextMenuStrip");
this.devicesContextMenuStrip.Opening += new System.ComponentModel.CancelEventHandler(this.devicesContextMenuStrip_Opening);

File diff suppressed because it is too large Load Diff

View File

@@ -209,9 +209,30 @@ namespace MeshCentralRouter
else
{
// Use C# coded websockets
Uri proxyUri = Win32Api.GetProxy(url);
Uri proxyUri = null;
Log("Websocket Start, URL=" + ((url == null) ? "(NULL)" : url.ToString()));
// Check if we need to use a HTTP proxy (Auto-proxy way)
try
{
RegistryKey registryKey = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings", true);
Object x = registryKey.GetValue("AutoConfigURL", null);
if ((x != null) && (x.GetType() == typeof(string)))
{
string proxyStr = GetProxyForUrlUsingPac("http" + ((url.Port == 80) ? "" : "s") + "://" + url.Host + ":" + url.Port, x.ToString());
if (proxyStr != null) { proxyUri = new Uri("http://" + proxyStr); }
}
}
catch (Exception) { proxyUri = null; }
// Check if we need to use a HTTP proxy (Normal way)
if (proxyUri == null)
{
var proxy = System.Net.HttpWebRequest.GetSystemWebProxy();
proxyUri = proxy.GetProxy(url);
if ((url.Host.ToLower() == proxyUri.Host.ToLower()) && (url.Port == proxyUri.Port)) { proxyUri = null; }
}
if (proxyUri != null)
{
// Proxy in use
@@ -267,8 +288,7 @@ namespace MeshCentralRouter
{
// Send proxy connection request
wsrawstream = wsclient.GetStream();
Uri proxyUri = Win32Api.GetProxy(url);
string userCreds = proxyUri.UserInfo;
string basicAuth = "";
if (proxyUri?.UserInfo != null)
{