From 50ee6eb2ff149ab3f3b67af839680a0e2ea9eedc Mon Sep 17 00:00:00 2001 From: Frédéric Buclin Date: Mon, 27 Feb 2012 14:54:13 +0100 Subject: Bug 730670: Do not redirect in buglist.cgi to improve performance r=glob a=LpSolit --- Bugzilla/CGI.pm | 10 ++++++++- buglist.cgi | 5 +++-- template/en/default/global/common-links.html.tmpl | 7 ++++++ template/en/default/list/list.html.tmpl | 26 ++++++++++++++++++++-- template/en/default/search/form.html.tmpl | 5 +++++ .../en/default/search/search-specific.html.tmpl | 7 ++++++ 6 files changed, 55 insertions(+), 5 deletions(-) diff --git a/Bugzilla/CGI.pm b/Bugzilla/CGI.pm index 9f50aba32..98fa3d79b 100644 --- a/Bugzilla/CGI.pm +++ b/Bugzilla/CGI.pm @@ -189,7 +189,10 @@ sub clean_search_url { # list_id is added in buglist.cgi after calling clean_search_url, # and doesn't need to be saved in saved searches. - $self->delete('list_id'); + $self->delete('list_id'); + + # no_redirect is used internally by redirect_search_url(). + $self->delete('no_redirect'); # And now finally, if query_format is our only parameter, that # really means we have no parameters, so we should delete query_format. @@ -445,6 +448,7 @@ sub redirect_search_url { return; } + my $no_redirect = $self->param('no_redirect'); $self->clean_search_url(); # Make sure we still have params still after cleaning otherwise we @@ -458,6 +462,10 @@ sub redirect_search_url { $self->param('list_id', $recent_search->id); } + # Browsers which support history.replaceState do not need to be + # redirected. We can fix the URL on the fly. + return if $no_redirect; + # GET requests that lacked a list_id are always redirected. POST requests # are only redirected if they're under the CGI_URI_LIMIT though. my $uri_length = length($self->self_url()); diff --git a/buglist.cgi b/buglist.cgi index 0350ba7ef..98b10a75d 100755 --- a/buglist.cgi +++ b/buglist.cgi @@ -37,19 +37,20 @@ my $cgi = Bugzilla->cgi; my $dbh = Bugzilla->dbh; my $template = Bugzilla->template; my $vars = {}; -my $buffer = $cgi->query_string(); # We have to check the login here to get the correct footer if an error is # thrown and to prevent a logged out user to use QuickSearch if 'requirelogin' # is turned 'on'. my $user = Bugzilla->login(); +$cgi->redirect_search_url(); + +my $buffer = $cgi->query_string(); if (length($buffer) == 0) { print $cgi->header(-refresh=> '10; URL=query.cgi'); ThrowUserError("buglist_parameters_required"); } -$cgi->redirect_search_url(); # Determine whether this is a quicksearch query. my $searchstring = $cgi->param('quicksearch'); diff --git a/template/en/default/global/common-links.html.tmpl b/template/en/default/global/common-links.html.tmpl index cbfa7c77a..5af02afa6 100644 --- a/template/en/default/global/common-links.html.tmpl +++ b/template/en/default/global/common-links.html.tmpl @@ -21,6 +21,13 @@ onsubmit="if (this.quicksearch.value == '') { alert('Please enter one or more search terms first.'); return false; } return true;"> + + -- cgit v1.2.3-24-g4f1b