From 0cba5fa731802a3662120c0b4ce61f9713b30a0f Mon Sep 17 00:00:00 2001 From: mateusvicente100 Date: Wed, 10 Jun 2020 17:05:39 -0300 Subject: [PATCH] Update Bird.Socket.Client.pas --- src/Bird.Socket.Client.pas | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Bird.Socket.Client.pas b/src/Bird.Socket.Client.pas index 493a8a1..26c5969 100644 --- a/src/Bird.Socket.Client.pas +++ b/src/Bird.Socket.Client.pas @@ -146,7 +146,10 @@ procedure TBirdSocketClient.Connect; try FClosingEventLocalHandshake := False; FHost := LURI.Host; - LURI.Protocol := ReplaceOnlyFirst(LURI.Protocol.ToLower, 'ws', 'http'); + if LURI.Protocol.Contains('wss') then + LURI.Protocol := ReplaceOnlyFirst(LURI.Protocol.ToLower, 'wss', 'https') + else + LURI.Protocol := ReplaceOnlyFirst(LURI.Protocol.ToLower, 'ws', 'http'); if LURI.Path.Trim.IsEmpty then LURI.Path := '/'; LSecure := LURI.Protocol.ToLower.Equals('https'); @@ -157,7 +160,7 @@ procedure TBirdSocketClient.Connect; begin if FAutoCreateHandler then begin - FIOHandler := TIdSSLIOHandlerSocketOpenSSL.Create(Self); + SetIOHandler(TIdSSLIOHandlerSocketOpenSSL.Create(Self)); TIdSSLIOHandlerSocketOpenSSL(FIOHandler).SSLOptions.Mode := TIdSSLMode.sslmClient; TIdSSLIOHandlerSocketOpenSSL(FIOHandler).SSLOptions.SSLVersions := [TIdSSLVersion.sslvTLSv1, TIdSSLVersion.sslvTLSv1_1, TIdSSLVersion.sslvTLSv1_2]; end