bugfix: add SSL Handshake

create a connecting socket SSL_startHandshake is dependent on the
protocol: this lets us use one socket to work with either SSL or non-SSL sockets.
This commit is contained in:
Marko Oldenburg 2023-11-15 19:23:19 +01:00
parent 38c47bd0ef
commit 813dd5ee34
3 changed files with 17 additions and 5 deletions

View File

@ -7,6 +7,7 @@
#
# Special thanks goes to comitters:
# - Vitolinker / Commandref
# - ska- / SSL_startHandshake - SSL Port 3001 Support
#
#
# This script is free software; you can redistribute it and/or modify

View File

@ -1,2 +1,2 @@
UPD 2023-05-16_04:16:05 18968 FHEM/82_LGTV_WebOS.pm
UPD 2023-05-16_04:14:37 55512 lib/FHEM/Devices/LGTV/LGTVWebOS.pm
UPD 2023-11-15_19:19:41 19028 FHEM/82_LGTV_WebOS.pm
UPD 2023-11-15_19:19:45 55994 lib/FHEM/Devices/LGTV/LGTVWebOS.pm

View File

@ -643,14 +643,25 @@ sub Open {
my $hash = shift;
my $name = $hash->{NAME};
my $host = $hash->{HOST};
my $port = 3000;
my $timeout = 0.1;
::Log3( $name, 4, "LGTV_WebOS ($name) - Baue Socket Verbindung auf" );
my $socket = IO::Socket::INET->new(
# create a connecting socket
# SSL_startHandshake is dependent on the protocol: this lets us use one socket
# to work with either SSL or non-SSL sockets.
my $socket = IO::Socket::SSL->new(
PeerHost => $host,
PeerPort => 3001,
Proto => 'tcp',
SSL_startHandshake => 1, #( $proto eq 'wss' ? 1 : 0 ),
SSL_verify_mode => SSL_VERIFY_NONE,
KeepAlive => 1,
Timeout => $timeout
)
|| IO::Socket::INET->new(
PeerHost => $host,
PeerPort => $port,
PeerPort => 3000,
Proto => 'tcp',
KeepAlive => 1,
Timeout => $timeout