Force use of $config{url} as top URL in w3mmode
authorSimon McVittie <smcv@debian.org>
Sun, 5 Oct 2014 14:19:55 +0000 (15:19 +0100)
committerSimon McVittie <smcv@debian.org>
Sun, 5 Oct 2014 14:19:55 +0000 (15:19 +0100)
IkiWiki/CGI.pm
doc/bugs/W3MMode_still_uses_http:__47____47__localhost__63__.mdwn
t/relativity.t

index cb83319e62ee893d92fd1d5f64695c23144d2614..b6f47a3a7f73c2e0c8cba26f859ea47b334a8ad9 100644 (file)
@@ -58,7 +58,10 @@ sub cgitemplate ($$$;@) {
        
        my $template=template("page.tmpl");
 
        
        my $template=template("page.tmpl");
 
-       my $topurl = defined $cgi ? $cgi->url : $config{url};
+       my $topurl = $config{url};
+       if (defined $cgi && ! $config{w3mmode}) {
+               $topurl = $cgi->url;
+       }
 
        my $page="";
        if (exists $params{page}) {
 
        my $page="";
        if (exists $params{page}) {
index 34eecef8c59db55b775792cb64e90d2cf2b2ea4c..c21329bae61cc52f228d6d9fd58e502b175db988 100644 (file)
@@ -32,3 +32,5 @@ The problem is that IkiWiki::CGI::cgitemplate() and IkiWiki::CGI::redirect() use
 A quick workaround might be to force the use of $config{url} instead of $cgi->url as a base for URLs when w3mmode is set.
 
 -- Martin
 A quick workaround might be to force the use of $config{url} instead of $cgi->url as a base for URLs when w3mmode is set.
 
 -- Martin
+
+> [[Fixed|done]] --[[smcv]]
index 8903d03cc05bbf6c963ccd960e56715967662f9c..0f7d014c578f416f5e6760b515da189ba991bf04 100755 (executable)
@@ -521,11 +521,8 @@ run(["./t/tmp/ikiwiki.cgi"], \undef, \$content, init => sub {
 %bits = parse_cgi_content($content);
 like($bits{tophref}, qr{^(?:\Q$pwd\E/t/tmp/out|\.)/$});
 like($bits{cgihref}, qr{^(?:file://)?/\$LIB/ikiwiki-w3m.cgi/ikiwiki.cgi$});
 %bits = parse_cgi_content($content);
 like($bits{tophref}, qr{^(?:\Q$pwd\E/t/tmp/out|\.)/$});
 like($bits{cgihref}, qr{^(?:file://)?/\$LIB/ikiwiki-w3m.cgi/ikiwiki.cgi$});
-TODO: {
-local $TODO = "should be file:///";
 like($bits{basehref}, qr{^(?:(?:file:)?//)?\Q$pwd\E/t/tmp/out/$});
 like($bits{stylehref}, qr{^(?:(?:(?:file:)?//)?\Q$pwd\E/t/tmp/out|\.)/style.css$});
 like($bits{basehref}, qr{^(?:(?:file:)?//)?\Q$pwd\E/t/tmp/out/$});
 like($bits{stylehref}, qr{^(?:(?:(?:file:)?//)?\Q$pwd\E/t/tmp/out|\.)/style.css$});
-}
 
 #######################################################################
 # site 6: we're behind a reverse-proxy
 
 #######################################################################
 # site 6: we're behind a reverse-proxy