Bugzilla – Attachment 137517 Details for
Bug 31104
Pagination generates HTTP "Link:" header which is over 8192 bytes apache's limit
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31104: Put each link on a separate header
Bug-31104-Put-each-link-on-a-separate-header.patch (text/plain), 2.34 KB, created by
Martin Renvoize (ashimema)
on 2022-07-11 14:31:37 UTC
(
hide
)
Description:
Bug 31104: Put each link on a separate header
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2022-07-11 14:31:37 UTC
Size:
2.34 KB
patch
obsolete
>From c73be17262cc46e4f86aef4149102f885c315462 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Wed, 6 Jul 2022 16:27:23 -0300 >Subject: [PATCH] Bug 31104: Put each link on a separate header > >This patch makes the Pagination helper put each Link entry on the >response headers on a separate header. In practice, this leads to >shorter headers and will avoid apache default/reasonable limits. > >To test: >1. Open the patron search page >2. Open the koha logs: > $ tail -f /var/log/koha/kohadev/*.log >3. On the 'Search for patron' input, use a really long string, like > 'superlongstringthatistoolongforapacheyeahsuperlong' >=> SUCCESS: There's no user with an attribute with that content :-D >=> FAIL: You get an error like (28)No space left on device: [client 127.0.0.1:60330] AH10124: header size is over the limit allowed by ResponseFieldSize (8192 bytes). Bad response header: 'Link:...' >4. Apply this patch >5. Restart all: > $ restart_all >6. Repeat 2 and 3 >=> SUCCESS: No results >=> SUCCESS: No error in the logs >7. Run: > $ kshell > k$ prove t/Koha/REST/Plugin/Pagination.t \ > t/db_dependent/api/v1/*.t >=> SUCCESS: Tests pass! > >Note 1: The Link header is expected to be in CSV format, which is >usually the way libraries treat repeated headers anyway. > >Note 2: Apache is not rejecting the response, just stripping out the >'bad header'. So this is not a critical issue. > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >Signed-off-by: Michal Urban <michalurban177@gmail.com> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > Koha/REST/Plugin/Pagination.pm | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > >diff --git a/Koha/REST/Plugin/Pagination.pm b/Koha/REST/Plugin/Pagination.pm >index 90d220c1cf..1176c834b6 100644 >--- a/Koha/REST/Plugin/Pagination.pm >+++ b/Koha/REST/Plugin/Pagination.pm >@@ -111,7 +111,9 @@ If page size is omitted, it defaults to the value of the RESTdefaultPageSize sys > { page => $pages, per_page => $per_page, rel => 'last', params => $args->{params} } ); > > # Add Link header >- $c->res->headers->add( 'Link' => join( ',', @links ) ); >+ foreach my $link (@links) { >+ $c->res->headers->add( 'Link' => $link ); >+ } > > # Add X-Total-Count header > $c->res->headers->add( 'X-Total-Count' => $total ); >-- >2.20.1
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 31104
:
137240
|
137433
| 137517 |
137610
|
137628