Bugzilla – Attachment 25730 Details for
Bug 11369
Too many search cursor cookies overflow HTTP-header size, when making multiple searches in the staff client.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11369 - Too many search cursor cookies overflow HTTP-header size, when making multiple searches in the staff client.
Bug-11369---Too-many-search-cursor-cookies-overflo.patch (text/plain), 3.60 KB, created by
Kyle M Hall (khall)
on 2014-02-28 16:46:27 UTC
(
hide
)
Description:
Bug 11369 - Too many search cursor cookies overflow HTTP-header size, when making multiple searches in the staff client.
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2014-02-28 16:46:27 UTC
Size:
3.60 KB
patch
obsolete
>From c2772c37389cb07636ee5bbea31c46128055582d Mon Sep 17 00:00:00 2001 >From: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> >Date: Wed, 11 Dec 2013 14:28:53 +0200 >Subject: [PATCH] Bug 11369 - Too many search cursor cookies overflow HTTP-header size, when making multiple searches in the staff client. > >To replicate this issue, make multiple searches in catalogue/search.pl. >50+ Should be enough to cause the HTTP-request header to overgrow. >One can verify this issue by observing the searchCookie growth in >browser's stored cookies. > >------------- >- TEST PLAN - >------------- > >Keep making searches. >One should never have more than 10 searchCookies. Browser might display only 9, >because for some reason the newest js-generated cookie is not included in >Firefox's cookies listing. > >------------ >- DRAWBACK - >------------ > >Removing these cookies disables the search cursor for traversing search >results (next/previous) for the removed cookie. This maybe be problematic >in some cases, >(for ex when multiple search tabs need to be open and they need to be traversed) >One easy solution is to grow the amount of stored searchCookies from 10 to 20, >but 10 is chosen so there will be plenty of room for other cookies as well. > >Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com> >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > catalogue/search.pl | 11 +++++++++-- > koha-tmpl/intranet-tmpl/js/browser.js | 13 +++++++++++++ > 2 files changed, 22 insertions(+), 2 deletions(-) > >diff --git a/catalogue/search.pl b/catalogue/search.pl >index 892ff15..a484743 100755 >--- a/catalogue/search.pl >+++ b/catalogue/search.pl >@@ -675,8 +675,15 @@ for (my $i=0;$i<@servers;$i++) { > } #/end of the for loop > #$template->param(FEDERATED_RESULTS => \@results_array); > >-$template->{'VARS'}->{'searchid'} = $cgi->param('searchid') >- || String::Random::random_string('ssssssss'); >+if ($cgi->param('searchid')) { >+ $template->{'VARS'}->{'searchid'} = $cgi->param('searchid'); >+} >+else { >+ my $dt = DateTime->now(time_zone => 'local'); >+ #We are generating a clean numeric datetime representation so we can easily compare them using the default javascript lexigraphic sorter. >+ $template->{'VARS'}->{'searchid'} = 'scs_'.$dt->ymd('').$dt->hms(''); #scs == Staff Client >+} >+ > my $gotonumber = $cgi->param('gotoNumber'); > if ($gotonumber eq 'last' || $gotonumber eq 'first') { > $template->{'VARS'}->{'gotoNumber'} = $gotonumber; >diff --git a/koha-tmpl/intranet-tmpl/js/browser.js b/koha-tmpl/intranet-tmpl/js/browser.js >index c3c1516..c203d3e 100644 >--- a/koha-tmpl/intranet-tmpl/js/browser.js >+++ b/koha-tmpl/intranet-tmpl/js/browser.js >@@ -40,6 +40,19 @@ KOHA.browser = function (searchid, biblionumber) { > pagelen: newresults.length, > results: newresults > }; >+ >+ //Bug_11369 Cleaning up excess searchCookies to prevent cookie overflow in the browser memory. >+ var allVisibleCookieKeys = Object.keys( $.cookie() ); >+ var scsCookieKeys = $.grep( allVisibleCookieKeys, >+ function(elementOfArray, indexInArray) { >+ return ( elementOfArray.search(/^scs_\d/) != -1 ); //We are looking for specifically staff client searchCookies. >+ } >+ ); >+ if (scsCookieKeys.length >= 10) { >+ scsCookieKeys.sort(); //Make sure they are in order, oldest first! >+ $.removeCookie( scsCookieKeys[0], { path: '/' } ); >+ } >+ //EO Bug_11369 > } > $.cookie(me.searchid, JSON.stringify(me.searchCookie), { path: '/' }); > $(document).ready(function () { >-- >1.7.2.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 11369
:
23389
|
23390
|
25662
|
25663
|
25667
|
25669
|
25729
|
25730
|
25731
|
25732
|
26501
|
26502
|
26503
|
26504