Update to 2025-08-28 17:00

This commit is contained in:
Daniel Berteaud
2025-08-28 17:00:23 +02:00
parent 053499f33c
commit 0008480f7b
4 changed files with 18 additions and 5 deletions

View File

@@ -22,9 +22,9 @@ sub new {
$args->{server} = DEFAULTWS;
$logger->info("$pr no server given");
}
elsif ( $args->{server} =~ m#^(?:(?:http|ws)(s)?://)?([^/:]+:[^/:]+)/?$# ) {
elsif ( $args->{server} =~ m#^(?:(?:http|ws)(s)?://)?(.+?)/*$# ) {
$args->{server} = $2;
$ssl = 1 if $1;
$ssl = 's' if $1;
}
else {
$logger->error("$pr unparsable server '$args->{server}'");
@@ -108,6 +108,14 @@ sub waitForNextMessage {
sub _connect {
my ($self) = @_;
my ( $host, $port ) = split /:/, $self->{server};
# Remove any path from host or port
$host =~ s|/.*$||;
$port =~ s|/.*$||;
# If port is not defined, use 80 or 443
unless ( $port =~ m/^\d+$/ ){
$port = ( $self->{ssl} eq 's' ) ? 443 : 80;
}
my $sock = IO::Socket::INET->new(
PeerHost => $host,
PeerPort => $port,
@@ -130,7 +138,7 @@ sub _connect {
};
$self->logger->debug("$pr connection upgraded to TLS");
}
my $url = "ws" . ($self->{ssl} ? 's' : '') . "://$self->{server}/subscribe?"
my $url = "ws$self->{ssl}://$self->{server}/subscribe?"
. build_urlencoded( channels => $self->{channels} );
$self->logger->debug("$pr connects to $url");
my $client = Protocol::WebSocket::Client->new( url => $url );
@@ -180,6 +188,10 @@ sub _connect {
$client->connect();
my $buf;
$sock->sysread( $buf, 4096 );
$client->read($buf);
$self->{socket} = $sock;
$self->{selector} = IO::Select->new($sock);
$self->{ws} = $client;

View File

@@ -57,6 +57,7 @@
- name: Install MessageBroker::Web
copy: src=Web.pm dest=/usr/share/perl5/vendor_perl/Lemonldap/NG/Common/MessageBroker/Web.pm owner=root group=root mode=644
notify: "{{ (llng_server == 'nginx' and llng_engine == 'uwsgi') | ternary('reload', 'restart') }} {{ (llng_server == 'nginx') | ternary('llng', 'httpd') }}"
tags: web
- name: Deploy Lemonldap::NG main configuration