diff --git a/websocket-sharp.userprefs b/websocket-sharp.userprefs index c1a56c579..2268092de 100644 --- a/websocket-sharp.userprefs +++ b/websocket-sharp.userprefs @@ -1,8 +1,8 @@  - + - + diff --git a/websocket-sharp/AssemblyInfo.cs b/websocket-sharp/AssemblyInfo.cs index 89a8f31aa..1dc4f2319 100644 --- a/websocket-sharp/AssemblyInfo.cs +++ b/websocket-sharp/AssemblyInfo.cs @@ -17,7 +17,7 @@ // The form "{Major}.{Minor}.*" will automatically update the build and revision, // and "{Major}.{Minor}.{Build}.*" will update just the revision. -[assembly: AssemblyVersion("1.0.0.*")] +[assembly: AssemblyVersion("0.9.9.*")] // The following attributes are used to specify the signing key for the assembly, // if desired. See the Mono documentation for more information about signing. diff --git a/websocket-sharp/Ext.cs b/websocket-sharp/Ext.cs index 54934a29d..12fc5ee16 100644 --- a/websocket-sharp/Ext.cs +++ b/websocket-sharp/Ext.cs @@ -28,7 +28,6 @@ using System; using System.Collections.Generic; -using System.Linq; namespace WebSocketSharp { @@ -41,58 +40,6 @@ public static bool EqualsWithSaveTo(this int asByte, char c, List dist) return b == Convert.ToByte(c); } - public static uint GenerateKey(this Random rand, int space) - { - uint max = (uint)(0xffffffff / space); - - int upper16 = (int)((max & 0xffff0000) >> 16); - int lower16 = (int)(max & 0x0000ffff); - - return ((uint)rand.Next(upper16 + 1) << 16) + (uint)rand.Next(lower16 + 1); - } - - public static char GeneratePrintableASCIIwithoutSPandNum(this Random rand) - { - int ascii = rand.Next(2) == 0 ? rand.Next(33, 48) : rand.Next(58, 127); - return Convert.ToChar(ascii); - } - - public static string GenerateSecKey(this Random rand, out uint key) - { - int space = rand.Next(1, 13); - int ascii = rand.Next(1, 13); - - key = rand.GenerateKey(space); - - long mKey = key * space; - List secKey = new List(mKey.ToString().ToCharArray()); - - int i; - ascii.Times( () => - { - i = rand.Next(secKey.Count + 1); - secKey.Insert(i, rand.GeneratePrintableASCIIwithoutSPandNum()); - } ); - - space.Times( () => - { - i = rand.Next(1, secKey.Count); - secKey.Insert(i, ' '); - } ); - - return new String(secKey.ToArray()); - } - - public static Byte[] InitializeWithPrintableASCII(this Byte[] bytes, Random rand) - { - for (int i = 0; i < bytes.Length; i++) - { - bytes[i] = (byte)rand.Next(32, 127); - } - - return bytes; - } - public static void NotEqualsDo(this string expected, string actual, Action act) { if (expected != actual) @@ -100,13 +47,5 @@ public static void NotEqualsDo(this string expected, string actual, Action - { - #if DEBUG - Console.WriteLine("WS: Error @doHandshake: Invalid challenge response."); - Console.WriteLine("\texpected: {0}", e); - Console.WriteLine("\tactual : {0}", a); - #endif - throw new IOException("Invalid challenge response: " + a); - }); #endif ReadyState = WsState.OPEN; } -#if !CHALLENGE private string createOpeningHandshake() -#else - private string createOpeningHandshake(out byte[] expectedRes) -#endif { string path = uri.PathAndQuery; string host = uri.DnsSafeHost; @@ -350,55 +314,16 @@ private string createOpeningHandshake(out byte[] expectedRes) } string subProtocol = protocol != String.Empty -#if !CHALLENGE ? String.Format("WebSocket-Protocol: {0}\r\n", protocol) -#else - ? String.Format("Sec-WebSocket-Protocol: {0}\r\n", protocol) -#endif : protocol; -#if !CHALLENGE - string secKeys = String.Empty; - string key3ToAscii = String.Empty; -#else - Random rand = new Random(); - - uint key1, key2; - string secKey1 = rand.GenerateSecKey(out key1); - string secKey2 = rand.GenerateSecKey(out key2); - byte[] key3 = new byte[8].InitializeWithPrintableASCII(rand); - - string secKeys = "Sec-WebSocket-Key1: {0}\r\n" + - "Sec-WebSocket-Key2: {1}\r\n"; - secKeys = String.Format(secKeys, secKey1, secKey2); - - string key3ToAscii = Encoding.ASCII.GetString(key3); - - expectedRes = createExpectedRes(key1, key2, key3); -#endif return "GET " + path + " HTTP/1.1\r\n" + "Upgrade: WebSocket\r\n" + "Connection: Upgrade\r\n" + subProtocol + "Host: " + host + "\r\n" + "Origin: " + origin + "\r\n" + - secKeys + - "\r\n" + - key3ToAscii; - } - - private byte[] createExpectedRes(uint key1, uint key2, byte[] key3) - { - byte[] key1Bytes = BitConverter.GetBytes(key1); - byte[] key2Bytes = BitConverter.GetBytes(key2); - - Array.Reverse(key1Bytes); - Array.Reverse(key2Bytes); - - byte[] concatKeys = key1Bytes.Concat(key2Bytes).Concat(key3).ToArray(); - - MD5 md5 = MD5.Create(); - return md5.ComputeHash(concatKeys); + "\r\n"; } private void message() diff --git a/websocket-sharp/bin/Debug/websocket-sharp.dll b/websocket-sharp/bin/Debug/websocket-sharp.dll index b33f3d669..03e626ccc 100755 Binary files a/websocket-sharp/bin/Debug/websocket-sharp.dll and b/websocket-sharp/bin/Debug/websocket-sharp.dll differ diff --git a/websocket-sharp/bin/Debug/websocket-sharp.dll.mdb b/websocket-sharp/bin/Debug/websocket-sharp.dll.mdb index 84b9cea6b..e2e33d9d7 100644 Binary files a/websocket-sharp/bin/Debug/websocket-sharp.dll.mdb and b/websocket-sharp/bin/Debug/websocket-sharp.dll.mdb differ diff --git a/websocket-sharp/bin/Debug_Ubuntu/websocket-sharp.dll b/websocket-sharp/bin/Debug_Ubuntu/websocket-sharp.dll index 80b261860..bc1e76e86 100755 Binary files a/websocket-sharp/bin/Debug_Ubuntu/websocket-sharp.dll and b/websocket-sharp/bin/Debug_Ubuntu/websocket-sharp.dll differ diff --git a/websocket-sharp/bin/Debug_Ubuntu/websocket-sharp.dll.mdb b/websocket-sharp/bin/Debug_Ubuntu/websocket-sharp.dll.mdb index 03f71e023..00df25d51 100644 Binary files a/websocket-sharp/bin/Debug_Ubuntu/websocket-sharp.dll.mdb and b/websocket-sharp/bin/Debug_Ubuntu/websocket-sharp.dll.mdb differ diff --git a/websocket-sharp/bin/Release/websocket-sharp.dll b/websocket-sharp/bin/Release/websocket-sharp.dll index 82caef18a..14a15a073 100755 Binary files a/websocket-sharp/bin/Release/websocket-sharp.dll and b/websocket-sharp/bin/Release/websocket-sharp.dll differ diff --git a/websocket-sharp/bin/Release_Ubuntu/websocket-sharp.dll b/websocket-sharp/bin/Release_Ubuntu/websocket-sharp.dll index 2a3946e01..48eac99d8 100755 Binary files a/websocket-sharp/bin/Release_Ubuntu/websocket-sharp.dll and b/websocket-sharp/bin/Release_Ubuntu/websocket-sharp.dll differ diff --git a/websocket-sharp/websocket-sharp.csproj b/websocket-sharp/websocket-sharp.csproj index 4f902fb89..8d32d7f1c 100644 --- a/websocket-sharp/websocket-sharp.csproj +++ b/websocket-sharp/websocket-sharp.csproj @@ -18,7 +18,7 @@ full false bin\Debug - DEBUG,CHALLENGE + DEBUG prompt 4 false @@ -36,7 +36,7 @@ full false bin\Debug_Ubuntu - DEBUG,CHALLENGE + DEBUG prompt 4 false diff --git a/websocket-sharp/websocket-sharp.pidb b/websocket-sharp/websocket-sharp.pidb index f91107613..dfb942f00 100644 Binary files a/websocket-sharp/websocket-sharp.pidb and b/websocket-sharp/websocket-sharp.pidb differ diff --git a/wsclient/bin/Debug/websocket-sharp.dll b/wsclient/bin/Debug/websocket-sharp.dll index b33f3d669..03e626ccc 100755 Binary files a/wsclient/bin/Debug/websocket-sharp.dll and b/wsclient/bin/Debug/websocket-sharp.dll differ diff --git a/wsclient/bin/Debug/websocket-sharp.dll.mdb b/wsclient/bin/Debug/websocket-sharp.dll.mdb index 84b9cea6b..e2e33d9d7 100644 Binary files a/wsclient/bin/Debug/websocket-sharp.dll.mdb and b/wsclient/bin/Debug/websocket-sharp.dll.mdb differ diff --git a/wsclient/bin/Debug/wsclient.exe b/wsclient/bin/Debug/wsclient.exe index 8f3d39f1b..3d06a0708 100755 Binary files a/wsclient/bin/Debug/wsclient.exe and b/wsclient/bin/Debug/wsclient.exe differ diff --git a/wsclient/bin/Debug/wsclient.exe.mdb b/wsclient/bin/Debug/wsclient.exe.mdb index b7038045a..8a9f82380 100644 Binary files a/wsclient/bin/Debug/wsclient.exe.mdb and b/wsclient/bin/Debug/wsclient.exe.mdb differ diff --git a/wsclient/bin/Debug_Ubuntu/websocket-sharp.dll b/wsclient/bin/Debug_Ubuntu/websocket-sharp.dll index 80b261860..bc1e76e86 100755 Binary files a/wsclient/bin/Debug_Ubuntu/websocket-sharp.dll and b/wsclient/bin/Debug_Ubuntu/websocket-sharp.dll differ diff --git a/wsclient/bin/Debug_Ubuntu/websocket-sharp.dll.mdb b/wsclient/bin/Debug_Ubuntu/websocket-sharp.dll.mdb index 03f71e023..00df25d51 100644 Binary files a/wsclient/bin/Debug_Ubuntu/websocket-sharp.dll.mdb and b/wsclient/bin/Debug_Ubuntu/websocket-sharp.dll.mdb differ diff --git a/wsclient/bin/Debug_Ubuntu/wsclient.exe b/wsclient/bin/Debug_Ubuntu/wsclient.exe index 246a33c44..02f1c2396 100755 Binary files a/wsclient/bin/Debug_Ubuntu/wsclient.exe and b/wsclient/bin/Debug_Ubuntu/wsclient.exe differ diff --git a/wsclient/bin/Debug_Ubuntu/wsclient.exe.mdb b/wsclient/bin/Debug_Ubuntu/wsclient.exe.mdb index d3cb2c6ae..2b75a9c4d 100644 Binary files a/wsclient/bin/Debug_Ubuntu/wsclient.exe.mdb and b/wsclient/bin/Debug_Ubuntu/wsclient.exe.mdb differ diff --git a/wsclient/bin/Release/websocket-sharp.dll b/wsclient/bin/Release/websocket-sharp.dll index 82caef18a..14a15a073 100755 Binary files a/wsclient/bin/Release/websocket-sharp.dll and b/wsclient/bin/Release/websocket-sharp.dll differ diff --git a/wsclient/bin/Release/wsclient.exe b/wsclient/bin/Release/wsclient.exe index 432e7468f..68ddcb051 100755 Binary files a/wsclient/bin/Release/wsclient.exe and b/wsclient/bin/Release/wsclient.exe differ diff --git a/wsclient/bin/Release_Ubuntu/websocket-sharp.dll b/wsclient/bin/Release_Ubuntu/websocket-sharp.dll index 2a3946e01..48eac99d8 100755 Binary files a/wsclient/bin/Release_Ubuntu/websocket-sharp.dll and b/wsclient/bin/Release_Ubuntu/websocket-sharp.dll differ diff --git a/wsclient/bin/Release_Ubuntu/wsclient.exe b/wsclient/bin/Release_Ubuntu/wsclient.exe index 92ea1e263..5954d73a7 100755 Binary files a/wsclient/bin/Release_Ubuntu/wsclient.exe and b/wsclient/bin/Release_Ubuntu/wsclient.exe differ diff --git a/wsclient/wsclient.pidb b/wsclient/wsclient.pidb index 214097e10..00f775c51 100644 Binary files a/wsclient/wsclient.pidb and b/wsclient/wsclient.pidb differ