]> sipb.mit.edu Git - ikiwiki.git/commitdiff
CGI: pad error responses with 512 bytes of spaces so IE will display them
authorSimon McVittie <smcv@ http://smcv.pseudorandom.co.uk/>
Sat, 31 Jan 2009 18:26:37 +0000 (18:26 +0000)
committerSimon McVittie <smcv@ http://smcv.pseudorandom.co.uk/>
Sat, 31 Jan 2009 18:26:37 +0000 (18:26 +0000)
IE displays its own error responses unless the server's was >= 512 bytes.
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q294807

IkiWiki/CGI.pm

index 7e968d966455c06eb2749252c2cd639c6a17acc5..8734cdd494ece0d4f1a2229d0bed37542519495e 100644 (file)
@@ -239,6 +239,9 @@ sub check_banned ($$) {
                        print $q->header(-status => "403 Forbidden");
                        $session->delete();
                        print gettext("You are banned.");
                        print $q->header(-status => "403 Forbidden");
                        $session->delete();
                        print gettext("You are banned.");
+                       # Internet Explorer won't show custom 404 responses
+                       # unless they're >= 512 bytes
+                       print " " x 512;
                        cgi_savesession($session);
                        exit;
                }
                        cgi_savesession($session);
                        exit;
                }
@@ -323,7 +326,10 @@ sub cgi_goto ($;$) {
                        "<p>".
                        sprintf(gettext("The page %s does not exist."),
                                htmllink("", "", $page)).
                        "<p>".
                        sprintf(gettext("The page %s does not exist."),
                                htmllink("", "", $page)).
-                       "</p>");
+                       "</p>".
+                       # Internet Explorer won't show custom 404 responses
+                       # unless they're >= 512 bytes
+                       (" " x 512));
        }
        else {
                redirect($q, urlto($link, undef, 1));
        }
        else {
                redirect($q, urlto($link, undef, 1));