Allow '-' (dash) in the retrieved project directory.
[www.jankratochvil.net.git] / Mailman.pm
index 3b5f39d..cf5979c 100644 (file)
@@ -25,12 +25,12 @@ use strict;
 use warnings;
 
 use My::Web;
-require CGI;
 use URI::Escape;
 require LWP::Simple;
 
 
-our $HTML_TEST=0;
+our $HTML_TEST=0;      # TODO: Provide some real URLs for download/translation.
+our $HTML_TEST_QUERY_STRING="list=html_test";
 
 sub handler
 {
@@ -44,6 +44,9 @@ my $W=My::Web->init(
                                "list"=>['^[-\w]+$'],
                                "back"=>'',
                                },
+               "http_safe"=>0, # LWP downloads.
+               # Mailman does not produce valid XHTML.
+               "content_type"=>"text/html",
                );
 My::Web->heading();
 
@@ -51,10 +54,12 @@ My::Web->heading();
 for my $list (@{$W->{"args"}{"list"}}) {
        print "<h1>List <i>$list</i></h1><blockquote>\n";
                my $url_base=$W->{"mailman_url"}."/subscribe/$list";
-               my $t=LWP::Simple::get("$url_base?"
-                               .join('&',
-                                               "list=$list",
-                                               map({ $_."=".uri_escape($W->{"args"}{$_}); } qw(email pw pw-conf))));
+               my $url=URI->new($url_base);
+               $url->query_form(
+                               "list"=>$list,
+                               map(($_=>$W->{"args"}{$_}),qw(email pw pw-conf)),
+                               );
+               my $t=LWP::Simple::get($url);
                $t=($t=~m#^.*<body\b[^>]*>(.*?)</body>#is)[0];
                $t=~s#(href=")(../[^"]*)(")#$1$url_base/$2$3#gi;
                print $t;
@@ -66,6 +71,6 @@ if ($W->{"args"}{"back"}) {
        }
 
 
-My::Web->footer();
+exit;
 }
 1;