I have patched my previous patch, logging now works (at least, works for me)™.
I am building a package with the following fix incorporated and reuploading (NOT going via DELAYED). The logic for this? AFAICT, mailman_url() is only called with a value for $pattern when it has to resolve logging. I am thus only calling resolve_redirects when $pattern is undef or empty.
Description: Make listadmin properly follow redirects to HTTPS-using mailmans Author: Gunnar Wolf <gw...@debian.org> Bug: https://bugs.debian.org/873287 Forwarded: No Last-Update: 2018-09-20 Index: listadmin-2.42/listadmin.pl =================================================================== --- listadmin-2.42.orig/listadmin.pl +++ listadmin-2.42/listadmin.pl @@ -643,6 +643,9 @@ sub uio_adminurl { sub mailman_url { my ($list, $pattern, $params, $action) = @_; + # Calling mailman_url with $pattern often requires the redirects + # _NOT_ to be resolved (i.e. for logging) + my $nopattern = !( defined($pattern) or $pattern ) my ($lp, $domain) = split ('@', $list); $pattern ||= uio_adminurl ($domain); @@ -659,9 +662,30 @@ sub mailman_url { $url .= "/$action"; } $url .= "?$params" if $params; + + $url = resolve_redirects($url) unless $nopattern; return $url; } +sub resolve_redirects { + # Test whether the URL is a redirect and, if so, replace it with + # the destination one. + my ($url, $resp, $req); + $url = shift; + $resp = $ua->get($url); + # If the URL could not get to the requested URL, there's no point + # in trying any further + if (! $resp->is_success) { + print STDERR "Error: Fetching $url\n"; + print STDERR $resp->status_line, "\n"; + return undef; + } + + # $req will have the final URI, even if redirects were followed. + $req = $resp->request->uri; + return $req; +} + # Returns a ref to a hash with all the information about pending messages sub get_list { my ($list, $config, $pw) = @_;
signature.asc
Description: PGP signature