From 44c53c4be74cf700d340e2f7edfae2e9ae623259 Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Fri, 4 Dec 2020 12:18:45 +0100 Subject: [PATCH] improve protocol selection heuristic Signed-off-by: Thomas Lamprecht --- PVE/APIClient/LWP.pm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/PVE/APIClient/LWP.pm b/PVE/APIClient/LWP.pm index bc158e9..63f2177 100755 --- a/PVE/APIClient/LWP.pm +++ b/PVE/APIClient/LWP.pm @@ -353,7 +353,13 @@ sub new { $self->{port} = $self->{host} eq 'localhost' ? 85 : 8006; } if (!$self->{protocol}) { - $self->{protocol} = $self->{host} eq 'localhost' ? 'http' : 'https'; + # cope that PBS and PVE can be installed on the same host, and one may thus use + # 'localhost' then - so only default to http for privileged ports, in that case, + # as the HTTP daemons normally run with those (e.g., 85 or 87) + $self->{protocol} = $self->{host} eq 'localhost' && $self->{port} < 1024 + ? 'http' + : 'https' + ; } $self->{useragent} = LWP::UserAgent->new( -- 2.39.2