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.000000000 -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) = @_;

Attachment: signature.asc
Description: PGP signature

Reply via email to