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