Skip to content

Commit

Permalink
Update Bird.Socket.Client.pas
Browse files Browse the repository at this point in the history
  • Loading branch information
mateusvicente100 committed Jun 10, 2020
1 parent 60a259e commit 0cba5fa
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Bird.Socket.Client.pas
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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
Expand Down

0 comments on commit 0cba5fa

Please sign in to comment.