Bug#873287: Fails to administer lists whose web interfaces have redirected
I am attaching a second patch. Both of the suggestions mentioned here work for me™. This one generates a bit more requests early on, but the POSTs go to the right place from the beginning. My only quip here is that, if the URL built in the mailman_url function (line 643--665) does not exist, the function will now return undef instead of an invalid URL. It will be caught in line 694 as a servererror and dealt with accordingly, although a more descriptive message would surely be welcome. --- /usr/bin/listadmin 2017-01-17 13:37:20.0 -0600 +++ /tmp/listadmin 2018-09-04 10:50:43.852787648 -0500 @@ -659,9 +659,30 @@ $url .= "/$action"; } $url .= "?$params" if $params; + +$url = resolve_redirects($url); 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
Bug#873287: Fails to administer lists whose web interfaces have redirected
tags 873287 + patch thanks Hi, The simple patch below fixes the issue. Now, I am not too fond of this patch because it could introduce some strange behavior - POST has reasons _not_ to be redirected. I would not like actions happening at a 301 redirect! Of course, the very existence of a 301 redirect _should_ mean the server is not acting on it (and is informing us where to do it)... Anyway, I'm preparing an IMO better patch; up to our dear package maintainer to choose the route! --- /usr/bin/listadmin 2017-01-17 13:37:20.0 -0600 +++ /tmp/listadmin 2018-09-04 10:04:29.662029226 -0500 @@ -92,7 +92,7 @@ usage() if $will_modify_membership > 1; usage() if defined $opt_l && $will_modify_membership; -my $ua = new LWP::UserAgent("timeout" => 900, "env_proxy" => 1); +my $ua = new LWP::UserAgent("timeout" => 900, "env_proxy" => 1, "requests_redirectable" => ['GET', 'HEAD', 'POST']); my $time_limit = time + 60 * ($opt_t || 24*60); my $term; my $term_encoding = langinfo(CODESET()); signature.asc Description: PGP signature
Bug#873287: Fails to administer lists whose web interfaces have redirected
On Tuesday 10. April 2018 12.47, Johnny A. Solbu wrote: > What happens if you add the following new line below that (and install the > WWW::Mechanize perl module)? > == > use WWW::Mechanize > == It occured to me that one of the lists I administer also have this redirection. So I tested it, and apparently adding that require did nothing. Oh well. -- Johnny A. Solbu web site, http://www.solbu.net PGP key ID: 0x4F5AD64DFA687324 signature.asc Description: This is a digitally signed message part.
Bug#873287: Fails to administer lists whose web interfaces have redirected
> Due to HTTPS hosting requirements, lists.pantsfullofunix.net redirects to > https://pantsfullofunix-net.lists.madduck.net/. Unfortunately, listadmin is > unable to follow the redirection: > > fetching data for recl...@lists.pantsfullofunix.net ... > ERROR: fetching http://lists.pantsfullofunix.net/mailman/admindb/reclass > ERROR: 301 Moved Permanently -- skipping list > > Could this easily be fixed? On line 31 of listadmin.pl (or /usr/bin/listadmin in the debian package) you find == use Net::INET6Glue::INET_is_INET6; == What happens if you add the following new line below that (and install the WWW::Mechanize perl module)? == use WWW::Mechanize == -- Johnny A. Solbu web site, http://www.solbu.net PGP key ID: 0x4F5AD64DFA687324 signature.asc Description: This is a digitally signed message part.
Bug#873287: Fails to administer lists whose web interfaces have redirected
Package: listadmin Version: 2.42-1 Severity: normal Due to HTTPS hosting requirements, lists.pantsfullofunix.net redirects to https://pantsfullofunix-net.lists.madduck.net/. Unfortunately, listadmin is unable to follow the redirection: fetching data for recl...@lists.pantsfullofunix.net ... ERROR: fetching http://lists.pantsfullofunix.net/mailman/admindb/reclass ERROR: 301 Moved Permanently -- skipping list Could this easily be fixed? -- System Information: Debian Release: buster/sid APT prefers unstable APT policy: (500, 'unstable'), (1, 'experimental') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 4.12.0-1-amd64 (SMP w/4 CPU cores) Locale: LANG=en_NZ, LC_CTYPE=en_NZ.UTF-8 (charmap=UTF-8), LANGUAGE=en_NZ:en (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) Versions of packages listadmin depends on: ii libcrypt-ssleay-perl 0.73.04-2+b2 ii libnet-inet6glue-perl 0.603-2 ii libtext-reform-perl1.20-3 ii libwww-perl6.15-2 listadmin recommends no packages. listadmin suggests no packages. -- no debconf information -- .''`. martin f. krafft@martinkrafft : :' : proud Debian developer `. `'` http://people.debian.org/~madduck `- Debian - when you have better things to do than fixing systems digital_signature_gpg.asc Description: Digital GPG signature (see http://martin-krafft.net/gpg/sig-policy/999bbcc4/current)