diff --git a/websocket-sharp.userprefs b/websocket-sharp.userprefs index c1a56c57..5833fa07 100644 --- a/websocket-sharp.userprefs +++ b/websocket-sharp.userprefs @@ -1,8 +1,8 @@  - + - + diff --git a/websocket-sharp/WebSocket.cs b/websocket-sharp/WebSocket.cs index 865fd211..f3fcf81d 100644 --- a/websocket-sharp/WebSocket.cs +++ b/websocket-sharp/WebSocket.cs @@ -248,12 +248,8 @@ namespace WebSocketSharp private void doHandshake() { -#if !CHALLENGE - string request = createOpeningHandshake(); -#else byte[] expectedRes, actualRes = new byte[16]; string request = createOpeningHandshake(out expectedRes); -#endif #if DEBUG Console.WriteLine("WS: Info @doHandshake: Handshake from client: \n{0}", request); #endif @@ -270,10 +266,8 @@ namespace WebSocketSharp wsStream.ReadByte().EqualsWithSaveTo('\r', rawdata) && wsStream.ReadByte().EqualsWithSaveTo('\n', rawdata)) { -#if CHALLENGE wsStream.Read(actualRes, 0, actualRes.Length); rawdata.AddRange(actualRes); -#endif break; } } @@ -292,21 +286,13 @@ namespace WebSocketSharp { throw new IOException("Invalid handshake response: " + a); }; -#if !CHALLENGE - "HTTP/1.1 101 Web Socket Protocol Handshake".NotEqualsDo(response[0], act); -#else "HTTP/1.1 101 WebSocket Protocol Handshake".NotEqualsDo(response[0], act); -#endif "Upgrade: WebSocket".NotEqualsDo(response[1], act); "Connection: Upgrade".NotEqualsDo(response[2], act); for (int i = 3; i < response.Length; i++) { -#if !CHALLENGE - if (response[i].Contains("WebSocket-Protocol:")) -#else if (response[i].Contains("Sec-WebSocket-Protocol:")) -#endif { int j = response[i].IndexOf(":"); protocol = response[i].Substring(j + 1).Trim(); @@ -316,7 +302,6 @@ namespace WebSocketSharp #if DEBUG Console.WriteLine("WS: Info @doHandshake: Sub protocol: {0}", protocol); #endif -#if CHALLENGE string expectedResToHexStr = BitConverter.ToString(expectedRes); string actualResToHexStr = BitConverter.ToString(actualRes); @@ -329,15 +314,11 @@ namespace WebSocketSharp #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,16 +331,9 @@ namespace WebSocketSharp } 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; @@ -375,7 +349,7 @@ namespace WebSocketSharp 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" + diff --git a/websocket-sharp/bin/Debug/websocket-sharp.dll b/websocket-sharp/bin/Debug/websocket-sharp.dll index b33f3d66..05920489 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 84b9cea6..48d46df4 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 80b26186..3f102feb 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 03f71e02..d5b7c2db 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 82caef18..c8c97066 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 2a3946e0..549a498b 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 4f902fb8..8d32d7f1 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 f9110761..17ce51c8 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 b33f3d66..05920489 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 84b9cea6..48d46df4 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 8f3d39f1..8417f482 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 b7038045..2e18ba06 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 80b26186..3f102feb 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 03f71e02..d5b7c2db 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 246a33c4..da625a5e 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 d3cb2c6a..d51fa738 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 82caef18..c8c97066 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 432e7468..a115807a 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 2a3946e0..549a498b 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 92ea1e26..f51cdac0 100755 Binary files a/wsclient/bin/Release_Ubuntu/wsclient.exe and b/wsclient/bin/Release_Ubuntu/wsclient.exe differ