CGI: if the page is missing, give the "missing page" a 404 status
[ikiwiki.git] / IkiWiki / CGI.pm
index 949390e681d18a784b6bd6652b6265078b2ffc4f..fe845726229137b8c623cb8fda86100785d82d07 100644 (file)
@@ -318,7 +318,7 @@ sub cgi_goto ($;$) {
        my $link = bestlink("", $page);
 
        if (! length $link) {
-               print "Content-type: text/html\n\n";
+               print $q->header(-status => "404 Not Found");
                print misctemplate(gettext("missing page"),
                        "<p>".
                        sprintf(gettext("The page %s does not exist."),
@@ -359,6 +359,8 @@ sub cgi (;$$) {
                }
        }
 
+       # goto is the preferred name for this; recentchanges_link and
+       # commenter are for compatibility with any saved URLs
        if ($do eq 'goto' || $do eq 'recentchanges_link' ||
            $do eq 'commenter') {
                cgi_goto($q);