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.
parent 74cfcf36
...@@ -25,23 +25,6 @@ use strict; ...@@ -25,23 +25,6 @@ use strict;
require "CGI.pl"; require "CGI.pl";
use Date::Parse; 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, use vars @::legal_platform,
@::versions, @::versions,
@::legal_product, @::legal_product,
...@@ -57,12 +40,12 @@ use vars @::legal_platform, ...@@ -57,12 +40,12 @@ use vars @::legal_platform,
ConnectToDatabase(); ConnectToDatabase();
if (!defined $::FORM{'cmdtype'}) { if (!defined $::FORM{'cmdtype'}) {
# This can happen if there's an old bookmark to a query... # This can happen if there's an old bookmark to a query...
$::FORM{'cmdtype'} = 'doit'; $::FORM{'cmdtype'} = 'doit';
} }
CMD: for ($::FORM{'cmdtype'}) { CMD: for ($::FORM{'cmdtype'}) {
/^runnamed$/ && do { /^runnamed$/ && do {
$::buffer = $::COOKIE{"QUERY_" . $::FORM{"namedcmd"}}; $::buffer = $::COOKIE{"QUERY_" . $::FORM{"namedcmd"}};
...@@ -133,6 +116,24 @@ individual query. ...@@ -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 "<p>Please stand by ... <p>\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 { sub DefCol {
my ($name, $k, $t, $s, $q) = (@_); my ($name, $k, $t, $s, $q) = (@_);
...@@ -189,11 +190,8 @@ if ($dotweak) { ...@@ -189,11 +190,8 @@ if ($dotweak) {
} }
print "Content-type: text/html\n\n";
my $query = "select bugs.bug_id, bugs.groupset"; my $query = "select bugs.bug_id, bugs.groupset";
foreach my $c (@collist) { foreach my $c (@collist) {
if (exists $::needquote{$c}) { if (exists $::needquote{$c}) {
$query .= ", $query .= ",
...@@ -320,7 +318,8 @@ foreach my $id ("1", "2") { ...@@ -320,7 +318,8 @@ foreach my $id ("1", "2") {
$lead = " or "; $lead = " or ";
} }
if (!$foundone) { if (!$foundone) {
print "You must specify one or more fields in which to search for <tt>$email</tt>.\n"; print "\n\n<P>You must specify one or more fields in which to search for <tt>$email</tt>.\n";
print "<P>Please click the <B>Back</B> button and try again.\n";
exit; exit;
} }
if ($lead eq " or ") { if ($lead eq " or ") {
...@@ -336,12 +335,10 @@ if (defined $::FORM{'changedin'}) { ...@@ -336,12 +335,10 @@ if (defined $::FORM{'changedin'}) {
my $c = trim($::FORM{'changedin'}); my $c = trim($::FORM{'changedin'});
if ($c ne "") { if ($c ne "") {
if ($c !~ /^[0-9]*$/) { if ($c !~ /^[0-9]*$/) {
print " print "\n\n<P>The 'changed in last ___ days' field must be a simple ";
The 'changed in last ___ days' field must be a simple number. You entered print "number. You entered \"$c\", which doesn't cut it.";
\"$c\", which doesn't cut it. print "<P>Please click the <B>Back</B> button and try again.\n";
<P> exit;
Click the <B>Back</B> button and try again.";
exit;
} }
$query .= "and to_days(now()) - to_days(bugs.delta_ts) <= $c "; $query .= "and to_days(now()) - to_days(bugs.delta_ts) <= $c ";
} }
...@@ -357,7 +354,7 @@ sub SqlifyDate { ...@@ -357,7 +354,7 @@ sub SqlifyDate {
} }
my $date = str2time($str); my $date = str2time($str);
if (!defined $date) { if (!defined $date) {
print "The string '<tt>$str</tt>' is not a legal date.\n"; print "\n\n<P>The string '<tt>$str</tt>' is not a legal date.\n";
print "<P>Please click the <B>Back</B> button and try again.\n"; print "<P>Please click the <B>Back</B> button and try again.\n";
exit; exit;
} }
...@@ -459,12 +456,6 @@ if (defined $::FORM{'order'} && $::FORM{'order'} ne "") { ...@@ -459,12 +456,6 @@ if (defined $::FORM{'order'} && $::FORM{'order'} ne "") {
$query .= $::FORM{'order'}; $query .= $::FORM{'order'};
} }
if ($serverpush) {
print "Please stand by ... <p>\n";
if (defined $::FORM{'debug'}) {
print "<pre>$query</pre>\n";
}
}
if (Param('expectbigqueries')) { if (Param('expectbigqueries')) {
SendSQL("set option SQL_BIG_TABLES=1"); SendSQL("set option SQL_BIG_TABLES=1");
...@@ -573,30 +564,42 @@ while (@row = FetchSQLData()) { ...@@ -573,30 +564,42 @@ while (@row = FetchSQLData()) {
pnl "\n"; pnl "\n";
} }
} }
my $buglist = join(":", @bugarray); my $buglist = join(":", @bugarray);
# This is stupid. We really really need to move the quip list into the DB!
my $quip;
if (open (COMMENTS, "<data/comments")) {
my @cdata;
while (<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) { if ($serverpush) {
print "\n"; print "\n";
print "--thisrandomstring\n"; print "--thisrandomstring\n";
print "Content-type: text/html\n";
# Note! HTML header not yet closed
} }
my $toolong = 0; my $toolong = 0;
print "Content-type: text/html\n";
if (length($buglist) < 4000) { if (length($buglist) < 4000) {
print "Set-Cookie: BUGLIST=$buglist\n"; print "Set-Cookie: BUGLIST=$buglist\n\n";
} else { } else {
print "Set-Cookie: BUGLIST=\n"; print "Set-Cookie: BUGLIST=\n\n";
$toolong = 1; $toolong = 1;
} }
print "\n";
PutHeader("Bug List"); PutHeader("Bug List");
print " print "
<CENTER> <CENTER>
<B>" . time2str("%a %b %e %T %Z %Y", time()) . "</B>"; <B>" . time2str("%a %b %e %T %Z %Y", time()) . "</B>";
...@@ -610,22 +613,6 @@ if ($toolong) { ...@@ -610,22 +613,6 @@ if ($toolong) {
print "Next/Prev/First/Last buttons won't appear.</h2>\n"; print "Next/Prev/First/Last buttons won't appear.</h2>\n";
} }
# This is stupid. We really really need to move the quip list into the DB!
my $quip;
if (open (COMMENTS, "<data/comments")) {
my @cdata;
while (<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 "<HR><I><A HREF=newquip.html>$quip\n"; print "<HR><I><A HREF=newquip.html>$quip\n";
print "</I></A></CENTER>\n"; print "</I></A></CENTER>\n";
print "<HR SIZE=10>$tablestart\n"; print "<HR SIZE=10>$tablestart\n";
...@@ -830,12 +817,13 @@ if ($count > 0) { ...@@ -830,12 +817,13 @@ if ($count > 0) {
<INPUT TYPE=HIDDEN NAME=buglist VALUE=$buglist> <INPUT TYPE=HIDDEN NAME=buglist VALUE=$buglist>
<INPUT TYPE=SUBMIT VALUE=\"Long Format\"> <INPUT TYPE=SUBMIT VALUE=\"Long Format\">
<A HREF=\"query.cgi\">Query Page</A> <A HREF=\"query.cgi\">Query Page</A>
&nbsp;&nbsp;&nbsp;<A HREF=\"enter_bug.cgi\">Enter New Bug</A> &nbsp;&nbsp;<A HREF=\"enter_bug.cgi\">Enter New Bug</A>
&nbsp;&nbsp;&nbsp;<A HREF=\"colchange.cgi?$::buffer\">Change columns</A> &nbsp;&nbsp;<A HREF=\"colchange.cgi?$::buffer\">Change columns</A>";
</FORM>";
if (!$dotweak && $count > 1) { if (!$dotweak && $count > 1) {
print "<A HREF=\"buglist.cgi?$fields&tweak=1\">Change several bugs at once</A>\n"; print "&nbsp;&nbsp;<A HREF=\"buglist.cgi?$fields&tweak=1\">";
print "Change several bugs at once</A>\n";
} }
print "</FORM>\n";
} }
if ($serverpush) { if ($serverpush) {
print "\n--thisrandomstring--\n"; print "\n--thisrandomstring--\n";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment