From: Kohei Yoshino Date: Wed, 19 Jun 2019 23:04:51 +0000 (-0400) Subject: Bug 1560187 - Remove legacy server push code X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2880f33ab2709a39ceff2e4af94ec66ac0c335b0;p=thirdparty%2Fbugzilla.git Bug 1560187 - Remove legacy server push code --- diff --git a/Bugzilla/CGI.pm b/Bugzilla/CGI.pm index e6da5a2a2..a16c21fa5 100644 --- a/Bugzilla/CGI.pm +++ b/Bugzilla/CGI.pm @@ -284,82 +284,6 @@ sub check_etag { return 0; } -# Overwrite to ensure nph doesn't get set, and unset HEADERS_ONCE -sub multipart_init { - my $self = shift; - - # Keys are case-insensitive, map to lowercase - my %args = @_; - my %param; - foreach my $key (keys %args) { - $param{lc $key} = $args{$key}; - } - - # Set the MIME boundary and content-type - my $boundary - = $param{'-boundary'} || '------- =_' . generate_random_password(16); - delete $param{'-boundary'}; - $self->{'separator'} = "\r\n--$boundary\r\n"; - $self->{'final_separator'} = "\r\n--$boundary--\r\n"; - $param{'-type'} = CGI::SERVER_PUSH($boundary); - - # Note: CGI.pm::multipart_init up to v3.04 explicitly set nph to 0 - # CGI.pm::multipart_init v3.05 explicitly sets nph to 1 - # CGI.pm's header() sets nph according to a param or $CGI::NPH, which - # is the desired behaviour. - - return - $self->header(%param,) - . "WARNING: YOUR BROWSER DOESN'T SUPPORT THIS SERVER-PUSH TECHNOLOGY." - . $self->multipart_end; -} - -# Have to add the cookies in. -sub multipart_start { - my $self = shift; - - my %args = @_; - - # CGI.pm::multipart_start doesn't honour its own charset information, so - # we do it ourselves here - if (defined $self->charset() && defined $args{-type}) { - - # Remove any existing charset specifier - $args{-type} =~ s/;.*$//; - - # and add the specified one - $args{-type} .= '; charset=' . $self->charset(); - } - - my $headers = $self->SUPER::multipart_start(%args); - - # 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 multpart_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); - } - else { - print $self->header($contenttype); - } -} - our $ALLOW_UNSAFE_RESPONSE = 0; # responding to text/plain or text/html is safe diff --git a/Bugzilla/Error.pm b/Bugzilla/Error.pm index d47498372..c7bfd1924 100644 --- a/Bugzilla/Error.pm +++ b/Bugzilla/Error.pm @@ -88,9 +88,9 @@ sub _throw_error { if (Bugzilla->error_mode == ERROR_MODE_WEBPAGE) { Bugzilla->check_rate_limit("webpage_errors", remote_ip(), sub { $vars->{rate_limit_error} = 1 }); my $cgi = Bugzilla->cgi; - $cgi->close_standby_message('text/html', 'inline', 'error', 'html'); + $cgi->set_dated_content_disp('inline', 'error', 'html'); + print $cgi->header('text/html'); $template->process($name, $vars) || ThrowTemplateError($template->error()); - print $cgi->multipart_final() if $cgi->{_multipart_in_progress}; $logfunc->("webpage error: $error"); } elsif (Bugzilla->error_mode == ERROR_MODE_TEST) { diff --git a/buglist.cgi b/buglist.cgi index 7f40bc640..a5f67fdbb 100755 --- a/buglist.cgi +++ b/buglist.cgi @@ -745,9 +745,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. - # Connect to the shadow database if this installation is using one to improve # query performance. $dbh = Bugzilla->switch_to_shadow_db(); @@ -1132,8 +1129,8 @@ if ($format->{'extension'} eq "csv") { $vars->{'human'} = $cgi->param('human'); } -$cgi->close_standby_message($contenttype, $disposition, $disp_prefix, - $format->{'extension'}); +$cgi->set_dated_content_disp($disposition, $disp_prefix, $format->{extension}); +print $cgi->header($contenttype); ################################################################################ # Content Generation diff --git a/template/en/default/list/server-push.html.tmpl b/template/en/default/list/server-push.html.tmpl deleted file mode 100644 index 914d827a9..000000000 --- a/template/en/default/list/server-push.html.tmpl +++ /dev/null @@ -1,42 +0,0 @@ -[%# The contents of this file are subject to the Mozilla Public - # License Version 1.1 (the "License"); you may not use this file - # except in compliance with the License. You may obtain a copy of - # the License at http://www.mozilla.org/MPL/ - # - # Software distributed under the License is distributed on an "AS - # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - # implied. See the License for the specific language governing - # rights and limitations under the License. - # - # The Original Code is the Bugzilla Bug Tracking System. - # - # The Initial Developer of the Original Code is Netscape Communications - # Corporation. Portions created by Netscape are - # Copyright (C) 1998 Netscape Communications Corporation. All - # Rights Reserved. - # - # Contributor(s): Myk Melez - #%] - -[%# INTERFACE: - # debug: boolean. True if we want the search displayed while we wait. - # query: string. The SQL query which makes the buglist. - #%] - -[% PROCESS global/variables.none.tmpl %] - - - - [% terms.Bugzilla %] is pondering your search - - -

Please stand by ...

- - [% IF debug %] -

[% query FILTER html %]

- [% IF query_explain.defined %] -
[% query_explain FILTER html %]
- [% END %] - [% END %] - -