Unverified Commit 832c348e authored by Dave Miller's avatar Dave Miller Committed by GitHub

Bug 1922411: Remove server-push from buglist.cgi (#219)

Co-authored-by: 's avatarMartin Renvoize <martin.renvoize@openfifth.co.uk> Portions by justdave r=mrenvoize Portions by mrenvoize r=justdave
parent 0323a187
......@@ -292,38 +292,10 @@ sub check_etag {
return 0;
}
# Have to add the cookies in.
sub multipart_start {
my $self = shift;
# We have to explicitly pass the charset.
my $headers = $self->SUPER::multipart_start(@_, -charset => $self->charset());
# Eliminate the one extra CRLF at the end.
$headers =~ s/$CGI::CRLF$//;
# Add the cookies. We have to do it this way instead of
# passing them to multipart_start, because CGI.pm's multipart_start
# doesn't understand a '-cookie' argument pointing to an arrayref.
foreach my $cookie (@{$self->{Bugzilla_cookie_list}}) {
$headers .= "Set-Cookie: ${cookie}${CGI::CRLF}";
}
$headers .= $CGI::CRLF;
$self->{_multipart_in_progress} = 1;
return $headers;
}
sub close_standby_message {
my ($self, $contenttype, $disp, $disp_prefix, $extension) = @_;
$self->set_dated_content_disp($disp, $disp_prefix, $extension);
if ($self->{_multipart_in_progress}) {
print $self->multipart_end();
print $self->multipart_start(-type => $contenttype);
}
elsif (!$self->{_header_done}) {
print $self->header($contenttype);
}
print $self->header($contenttype) if !$self->{_header_done};
}
our $ALLOW_UNSAFE_RESPONSE = 0;
......@@ -819,14 +791,10 @@ instead of calling this directly.
Redirects from the current URL to one prefixed by the urlbase parameter.
=item C<multipart_start>
Starts a new part of the multipart document using the specified MIME type.
If not specified, text/html is assumed.
=item C<close_standby_message>
Ends a part of the multipart document, and starts another part.
Sets the content disposition header and sends the response header if it has
not already been sent.
=item C<set_dated_content_disp>
......
......@@ -96,7 +96,6 @@ sub _throw_error {
my $cgi = Bugzilla->cgi;
$cgi->close_standby_message('text/html', 'inline', 'error', 'html');
print $message;
print $cgi->multipart_final() if $cgi->{_multipart_in_progress};
}
elsif (Bugzilla->error_mode == ERROR_MODE_TEST) {
die Dumper($vars);
......
......@@ -471,23 +471,6 @@ my $format = $template->get_format(
scalar $params->param('ctype')
);
# Use server push to display a "Please wait..." message for the user while
# executing their query if their browser supports it and they are viewing
# the bug list as HTML and they have not disabled it by adding &serverpush=0
# to the URL.
#
# Server push is compatible with Gecko-based browsers and Opera, but not with
# MSIE, Lynx or Safari (bug 441496).
my $serverpush
= $format->{'extension'} eq "html"
&& exists $ENV{'HTTP_USER_AGENT'}
&& $ENV{'HTTP_USER_AGENT'} =~ /(Mozilla.[3-9]|Opera)/
&& $ENV{'HTTP_USER_AGENT'} !~ /compatible/i
&& $ENV{'HTTP_USER_AGENT'} !~ /(?:WebKit|Trident|KHTML)/
&& !defined($cgi->param('serverpush')) || $cgi->param('serverpush');
# Generate a reasonable filename for the user agent to suggest to the user
# when the user saves the bug list. Uses the name of the remembered query
# if available. We have to do this now, even though we return HTTP headers
......@@ -718,27 +701,6 @@ $params->delete('limit') if $vars->{'default_limited'};
# Query Execution
################################################################################
# Time to use server push to display an interim message to the user until
# the query completes and we can display the bug list.
if ($serverpush) {
print $cgi->multipart_init();
print $cgi->multipart_start(-type => 'text/html');
# Generate and return the UI (HTML page) from the appropriate template.
$template->process("list/server-push.html.tmpl", $vars)
|| ThrowTemplateError($template->error());
# Under mod_perl, flush stdout so that the page actually shows up.
if ($ENV{MOD_PERL}) {
require Apache2::RequestUtil;
Apache2::RequestUtil->request->rflush();
}
# Don't do multipart_end() until we're ready to display the replacement
# page, otherwise any errors that happen before then (like SQL errors)
# will result in a blank page being shown to the user instead of the error.
}
# Connect to the shadow database if this installation is using one to improve
# query performance.
$dbh = Bugzilla->switch_to_shadow_db();
......@@ -1156,5 +1118,3 @@ $template->process($format->{'template'}, $vars)
################################################################################
# Script Conclusion
################################################################################
print $cgi->multipart_final() if $serverpush;
......@@ -926,12 +926,6 @@ div.user_match {
display: none;
}
#serverpush_msg {
margin-top: 20%;
text-align: center;
font-size: xx-large;
}
/* Rules specific for printing */
@media print {
#header, #footer {
......
[%# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# This Source Code Form is "Incompatible With Secondary Licenses", as
# defined by the Mozilla Public License, v. 2.0.
#%]
[%# INTERFACE:
# debug: boolean. True if we want the search displayed while we wait.
# query: string. The SQL query which makes the buglist.
#%]
<!DOCTYPE html>
<html>
<head>
<title>[% terms.Bugzilla %] is pondering your search</title>
<link href="[% 'skins/standard/global.css' FILTER mtime %]"
rel="stylesheet" type="text/css">
</head>
<body>
<h1 id="serverpush_msg">Please stand by ...</h1>
<p class="center">
<progress>Data is being retrieved...</progress>
</p>
[% IF debug %]
<p>[% query FILTER html %]</p>
[% IF query_explain.defined %]
<pre>[% query_explain FILTER html %]</pre>
[% END %]
[% END %]
</body>
</html>
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