From f716fedec5450c800f06291a5feb6254413f97e0 Mon Sep 17 00:00:00 2001
From: Li
Date: Sun, 20 Nov 2022 12:47:18 +1300
Subject: [PATCH] Fix connecting on XMLSocket-
---
HorseIsleServer/HISPd/Properties/AssemblyInfo.cs | 4 ++--
HorseIsleServer/HISPd/Resources/DEBIAN/control | 2 +-
HorseIsleServer/LibHISP/Properties/AssemblyInfo.cs | 4 ++--
.../LibHISP/Security/CrossDomainPolicy.cs | 14 ++------------
HorseIsleServer/LibHISP/Server/Network/Hybrid.cs | 6 +++---
.../LibHISP/Server/Network/XmlSocket.cs | 13 +++++++------
HorseIsleServer/MPN00BS/Properties/AssemblyInfo.cs | 4 ++--
7 files changed, 19 insertions(+), 28 deletions(-)
diff --git a/HorseIsleServer/HISPd/Properties/AssemblyInfo.cs b/HorseIsleServer/HISPd/Properties/AssemblyInfo.cs
index 478956e..e880002 100755
--- a/HorseIsleServer/HISPd/Properties/AssemblyInfo.cs
+++ b/HorseIsleServer/HISPd/Properties/AssemblyInfo.cs
@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.8.48.0")]
-[assembly: AssemblyFileVersion("1.8.48.0")]
+[assembly: AssemblyVersion("1.8.51.0")]
+[assembly: AssemblyFileVersion("1.8.51.0")]
diff --git a/HorseIsleServer/HISPd/Resources/DEBIAN/control b/HorseIsleServer/HISPd/Resources/DEBIAN/control
index 380251a..8b6b9d4 100755
--- a/HorseIsleServer/HISPd/Resources/DEBIAN/control
+++ b/HorseIsleServer/HISPd/Resources/DEBIAN/control
@@ -1,5 +1,5 @@
Package: hisp
-Version: 1.8.48
+Version: 1.8.51
Depends: coreutils,systemd,mariadb-server,libsqlite3-dev,zlib1g-dev,libicu-dev,libkrb5-dev
Maintainer: Li
Homepage: https://islehorse.com
diff --git a/HorseIsleServer/LibHISP/Properties/AssemblyInfo.cs b/HorseIsleServer/LibHISP/Properties/AssemblyInfo.cs
index ef0c975..b0e3397 100755
--- a/HorseIsleServer/LibHISP/Properties/AssemblyInfo.cs
+++ b/HorseIsleServer/LibHISP/Properties/AssemblyInfo.cs
@@ -30,8 +30,8 @@ using System.Runtime.InteropServices;
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
-[assembly: AssemblyVersion("1.8.48.0")]
-[assembly: AssemblyFileVersion("1.8.48.0")]
+[assembly: AssemblyVersion("1.8.51.0")]
+[assembly: AssemblyFileVersion("1.8.51.0")]
diff --git a/HorseIsleServer/LibHISP/Security/CrossDomainPolicy.cs b/HorseIsleServer/LibHISP/Security/CrossDomainPolicy.cs
index bc6d5f2..75ab62a 100755
--- a/HorseIsleServer/LibHISP/Security/CrossDomainPolicy.cs
+++ b/HorseIsleServer/LibHISP/Security/CrossDomainPolicy.cs
@@ -10,19 +10,9 @@ namespace HISP.Security
if (!File.Exists(ConfigReader.CrossDomainPolicyFile)) {
Logger.InfoPrint("Cross-Domain-Policy file not found, using default");
File.WriteAllText(ConfigReader.CrossDomainPolicyFile, Resources.DefaultCrossDomain);
- }
-
-
- MemoryStream ms = new MemoryStream();
+ }
byte[] policyFileBytes = File.ReadAllBytes(ConfigReader.CrossDomainPolicyFile);
- ms.Write(policyFileBytes, 0x00, policyFileBytes.Length);
- ms.WriteByte(0x00);
-
- ms.Seek(0x00, SeekOrigin.Begin);
- byte[] policyFileData = ms.ToArray();
- ms.Close();
-
- return policyFileData;
+ return policyFileBytes;
}
}
}
diff --git a/HorseIsleServer/LibHISP/Server/Network/Hybrid.cs b/HorseIsleServer/LibHISP/Server/Network/Hybrid.cs
index 6ce3e1b..f700be2 100644
--- a/HorseIsleServer/LibHISP/Server/Network/Hybrid.cs
+++ b/HorseIsleServer/LibHISP/Server/Network/Hybrid.cs
@@ -13,7 +13,7 @@ namespace HISP.Server.Network
get
{
if(actualTransport == null)
- return "TransportDeterminer";
+ return "Hybrid";
else
return actualTransport.Name;
}
@@ -60,7 +60,7 @@ namespace HISP.Server.Network
if (ConfigReader.EnableWebSocket && WebSocket.IsStartOfHandshake(buffer))
{
- Logger.InfoPrint(this.Ip + " Switching to WebSocket");
+ Logger.DebugPrint(this.Ip + " Switching to WebSocket");
actualTransport = new WebSocket();
actualTransport.passObjects(this.socket, this.onReceiveCallback, this.onDisconnectCallback);
@@ -69,7 +69,7 @@ namespace HISP.Server.Network
}
else
{
- Logger.InfoPrint(this.Ip + " Switching to XmlSocket");
+ Logger.DebugPrint(this.Ip + " Switching to XmlSocket");
actualTransport = new XmlSocket();
actualTransport.passObjects(this.socket, this.onReceiveCallback, this.onDisconnectCallback);
diff --git a/HorseIsleServer/LibHISP/Server/Network/XmlSocket.cs b/HorseIsleServer/LibHISP/Server/Network/XmlSocket.cs
index 8d5f152..fa02903 100644
--- a/HorseIsleServer/LibHISP/Server/Network/XmlSocket.cs
+++ b/HorseIsleServer/LibHISP/Server/Network/XmlSocket.cs
@@ -10,6 +10,7 @@ namespace HISP.Server.Network
{
private List currentPacket = new List();
private const byte XMLSOCKET_PACKET_TERMINATOR = 0x00;
+ private static byte[] XMLSOCKET_POLICY_FILE = Encoding.UTF8.GetBytes("");
public override void ProcessReceivedPackets(int available, byte[] buffer)
{
// In XmlSocket Packets are terminates by 0x00 so we have to read until we receive that terminator
@@ -18,17 +19,17 @@ namespace HISP.Server.Network
{
if (buffer[i] == XMLSOCKET_PACKET_TERMINATOR) // Read until \0...
{
- onReceiveCallback(currentPacket.ToArray());
+ byte[] packet = currentPacket.ToArray();
+ if (Helper.ByteArrayStartsWith(packet, XMLSOCKET_POLICY_FILE))
+ this.Send(CrossDomainPolicy.GetPolicyFile());
+
+ onReceiveCallback(packet);
currentPacket.Clear();
+ continue;
}
currentPacket.Add(buffer[i]);
}
- // Handle XMLSocket Policy File
- if (Helper.ByteArrayStartsWith(buffer, Encoding.UTF8.GetBytes("")))
- {
- this.Send(CrossDomainPolicy.GetPolicyFile());
- }
}
public override string Name
diff --git a/HorseIsleServer/MPN00BS/Properties/AssemblyInfo.cs b/HorseIsleServer/MPN00BS/Properties/AssemblyInfo.cs
index f470e08..4590298 100755
--- a/HorseIsleServer/MPN00BS/Properties/AssemblyInfo.cs
+++ b/HorseIsleServer/MPN00BS/Properties/AssemblyInfo.cs
@@ -30,8 +30,8 @@ using System.Runtime.InteropServices;
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
-[assembly: AssemblyVersion("1.8.48.0")]
-[assembly: AssemblyFileVersion("1.8.48.0")]
+[assembly: AssemblyVersion("1.8.51.0")]
+[assembly: AssemblyFileVersion("1.8.51.0")]