@@ -203,6 +203,7 @@ public Dictionary<string, string> Headers {
203
203
public static string FixupURL ( string URL )
204
204
{
205
205
#if UNITY_2018_2_OR_NEWER
206
+ #if NET_4_6
206
207
// Use standard endpoints since 2018.2 supports TLS 1.2
207
208
if ( URL . StartsWith ( "http://stream." ) )
208
209
{
@@ -260,6 +261,26 @@ public static string FixupURL(string URL)
260
261
{
261
262
Log . Warning ( "WSConnector" , "No case for URL for wss://. Leaving URL unchanged." ) ;
262
263
}
264
+ #else
265
+ // Use TLS 1.0 endpoint if user is on .NET 3.5. US South is the
266
+ // only region that supports this endpoint.
267
+ if ( URL . StartsWith ( "http://stream." ) )
268
+ {
269
+ URL = URL . Replace ( "http://stream." , "ws://stream-tls10." ) ;
270
+ }
271
+ else if ( URL . StartsWith ( "https://stream." ) )
272
+ {
273
+ URL = URL . Replace ( "https://stream." , "wss://stream-tls10." ) ;
274
+ }
275
+ else if ( URL . StartsWith ( "http://stream-tls10." ) )
276
+ {
277
+ URL = URL . Replace ( "http://stream-tls10." , "ws://stream-tls10." ) ;
278
+ }
279
+ else if ( URL . StartsWith ( "https://stream-tls10." ) )
280
+ {
281
+ URL = URL . Replace ( "https://stream-tls10." , "wss://stream-tls10." ) ;
282
+ }
283
+ #endif
263
284
#else
264
285
// Redirect to TLS 1.0 endpoints.
265
286
// Note frankfurt endpoint does not support TLS 1.0.
@@ -397,7 +418,7 @@ private IEnumerator ProcessReceiveQueue()
397
418
#endregion
398
419
399
420
#region Threaded Functions
400
- // NOTE: ALl functions in this region are operating in a background thread, do NOT call any Unity functions!
421
+ // NOTE: All functions in this region are operating in a background thread, do NOT call any Unity functions!
401
422
#if ! NETFX_CORE
402
423
private void SendMessages ( )
403
424
{
@@ -415,8 +436,10 @@ private void SendMessages()
415
436
ws . OnError += OnWSError ;
416
437
ws . OnMessage += OnWSMessage ;
417
438
#if NET_4_6
439
+ // Enable TLS 1.1 and TLS 1.2 if we are on .NET 4.x
418
440
ws . SslConfiguration . EnabledSslProtocols = SslProtocols . Tls12 | SslProtocols . Tls11 | SslProtocols . Tls ;
419
441
#else
442
+ // .NET 3.x does not support TLS 1.1 or TLS 1.2
420
443
ws . SslConfiguration . EnabledSslProtocols = SslProtocols . Tls ;
421
444
#endif
422
445
ws . Connect ( ) ;
0 commit comments