From d56727763be63a52ad47d023ca7c44de9a684ac9 Mon Sep 17 00:00:00 2001 From: "bryce-mozilla%nextbus.com" <> Date: Thu, 1 Jul 1999 10:45:43 +0000 Subject: The next logical extension of the fixes for non-Netscape browsers from the last checkin. Non-serverpush browsers have always been sent incorrect HTML headers, causing assorted problems (see Bug #8069 affecting MSIE). The code paths are very convoluted, but I think I have now straightened them out. --- buglist.cgi | 118 +++++++++++++++++++++++++++--------------------------------- 1 file changed, 53 insertions(+), 65 deletions(-) diff --git a/buglist.cgi b/buglist.cgi index d0f21a6c2..6297e2150 100755 --- a/buglist.cgi +++ b/buglist.cgi @@ -25,23 +25,6 @@ use strict; require "CGI.pl"; use Date::Parse; -my $serverpush = 0; - -if ($ENV{'HTTP_USER_AGENT'} =~ /Mozilla.[3-9]/ && $ENV{'HTTP_USER_AGENT'} !~ /[Cc]ompatible/ ) { - # Search for real Netscape 3 and up. http://www.browsercaps.org used as source of - # browsers compatbile with server-push. It's a Netscape hack, incompatbile - # with MSIE and Lynx (at least). - $serverpush = 1; -} - -if ($serverpush) { - print "Content-type: multipart/x-mixed-replace;boundary=thisrandomstring\n"; - print "\n"; - print "--thisrandomstring\n"; -} - -# Shut up misguided -w warnings about "used only once": - use vars @::legal_platform, @::versions, @::legal_product, @@ -57,12 +40,12 @@ use vars @::legal_platform, ConnectToDatabase(); + if (!defined $::FORM{'cmdtype'}) { # This can happen if there's an old bookmark to a query... $::FORM{'cmdtype'} = 'doit'; } - CMD: for ($::FORM{'cmdtype'}) { /^runnamed$/ && do { $::buffer = $::COOKIE{"QUERY_" . $::FORM{"namedcmd"}}; @@ -133,6 +116,24 @@ individual query. } +my $serverpush = 0; +if ($ENV{'HTTP_USER_AGENT'} =~ /Mozilla.[3-9]/ && $ENV{'HTTP_USER_AGENT'} !~ /[Cc]ompatible/ ) { + # Search for real Netscape 3 and up. http://www.browsercaps.org used as source of + # browsers compatbile with server-push. It's a Netscape hack, incompatbile + # with MSIE and Lynx (at least). Even Communicator 4.51 has bugs with it, + # especially during page reload. + $serverpush = 1; + + print "Content-type: multipart/x-mixed-replace;boundary=thisrandomstring\n\n"; + print "--thisrandomstring\n"; + print "Content-type: text/html\n\n"; + print "

Please stand by ...

\n"; + # Note! HTML header is complete! +} else { + print "Content-type: text/html\n"; + # Note! Don't finish HTML header yet! Only one newline so far! +} + sub DefCol { my ($name, $k, $t, $s, $q) = (@_); @@ -189,11 +190,8 @@ if ($dotweak) { } -print "Content-type: text/html\n\n"; - my $query = "select bugs.bug_id, bugs.groupset"; - foreach my $c (@collist) { if (exists $::needquote{$c}) { $query .= ", @@ -320,7 +318,8 @@ foreach my $id ("1", "2") { $lead = " or "; } if (!$foundone) { - print "You must specify one or more fields in which to search for $email.\n"; + print "\n\n

You must specify one or more fields in which to search for $email.\n"; + print "

Please click the Back button and try again.\n"; exit; } if ($lead eq " or ") { @@ -336,12 +335,10 @@ if (defined $::FORM{'changedin'}) { my $c = trim($::FORM{'changedin'}); if ($c ne "") { if ($c !~ /^[0-9]*$/) { - print " -The 'changed in last ___ days' field must be a simple number. You entered -\"$c\", which doesn't cut it. -

-Click the Back button and try again."; - exit; + print "\n\n

The 'changed in last ___ days' field must be a simple "; + print "number. You entered \"$c\", which doesn't cut it."; + print "

Please click the Back button and try again.\n"; + exit; } $query .= "and to_days(now()) - to_days(bugs.delta_ts) <= $c "; } @@ -357,7 +354,7 @@ sub SqlifyDate { } my $date = str2time($str); if (!defined $date) { - print "The string '$str' is not a legal date.\n"; + print "\n\n

The string '$str' is not a legal date.\n"; print "

Please click the Back button and try again.\n"; exit; } @@ -459,12 +456,6 @@ if (defined $::FORM{'order'} && $::FORM{'order'} ne "") { $query .= $::FORM{'order'}; } -if ($serverpush) { - print "Please stand by ...

\n"; - if (defined $::FORM{'debug'}) { - print "

$query
\n"; - } -} if (Param('expectbigqueries')) { SendSQL("set option SQL_BIG_TABLES=1"); @@ -573,30 +564,42 @@ while (@row = FetchSQLData()) { pnl "\n"; } } - - my $buglist = join(":", @bugarray); +# This is stupid. We really really need to move the quip list into the DB! +my $quip; +if (open (COMMENTS, ") { + push @cdata, $_; + } + close COMMENTS; + $quip = $cdata[int(rand($#cdata + 1))]; +} +if (!defined $quip) { + $quip = "Bugzilla would like to put a random quip here, but nobody has entered any."; +} + + +# We've done all we can without any output. If we can server push it is time +# take down the waiting page and put up the real one. if ($serverpush) { print "\n"; print "--thisrandomstring\n"; + print "Content-type: text/html\n"; + # Note! HTML header not yet closed } - - my $toolong = 0; -print "Content-type: text/html\n"; if (length($buglist) < 4000) { - print "Set-Cookie: BUGLIST=$buglist\n"; + print "Set-Cookie: BUGLIST=$buglist\n\n"; } else { - print "Set-Cookie: BUGLIST=\n"; + print "Set-Cookie: BUGLIST=\n\n"; $toolong = 1; } - -print "\n"; - PutHeader("Bug List"); + print "
" . time2str("%a %b %e %T %Z %Y", time()) . ""; @@ -610,22 +613,6 @@ if ($toolong) { print "Next/Prev/First/Last buttons won't appear.\n"; } -# This is stupid. We really really need to move the quip list into the DB! - -my $quip; -if (open (COMMENTS, ") { - push @cdata, $_; - } - close COMMENTS; - $quip = $cdata[int(rand($#cdata + 1))]; -} -if (!defined $quip) { - $quip = "Bugzilla would like to put a random quip here, but nobody has entered any."; -} - - print "
$quip\n"; print "
\n"; print "
$tablestart\n"; @@ -830,12 +817,13 @@ if ($count > 0) { Query Page -   Enter New Bug -   Change columns -"; +  Enter New Bug +  Change columns"; if (!$dotweak && $count > 1) { - print "Change several bugs at once\n"; + print "  "; + print "Change several bugs at once\n"; } + print "\n"; } if ($serverpush) { print "\n--thisrandomstring--\n"; -- cgit v1.2.3-24-g4f1b