Summary: | Pagination generates HTTP "Link:" header which is over 8192 bytes apache's limit | ||
---|---|---|---|
Product: | Koha | Reporter: | Andrii Nugged <nugged> |
Component: | REST API | Assignee: | Tomás Cohen Arazi (tcohen) <tomascohen> |
Status: | CLOSED FIXED | QA Contact: | Martin Renvoize (ashimema) <martin.renvoize> |
Severity: | minor | ||
Priority: | P5 - low | CC: | david, george, jonathan.druart, kyle, lari.taskula, lucas, martin.renvoize, tomascohen |
Version: | Main | Keywords: | rel_22_05_candidate |
Hardware: | All | ||
OS: | All | ||
Change sponsored?: | --- | Patch complexity: | Small patch |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: | Version(s) released in: |
22.11.00
|
|
Circulation function: | |||
Attachments: |
Bug 31104: Put each link on a separate header
Bug 31104: Put each link on a separate header Bug 31104: Put each link on a separate header Bug 31104: Add a selenium test Bug 31104: Add a selenium test |
Description
Andrii Nugged
2022-07-05 14:29:49 UTC
Created attachment 137240 [details] [review] 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> I'm not seeing the error described in step 3. Are there some other settings required to generate the error? Testing on master with koha-testing-docker. (In reply to David Nind from comment #2) > I'm not seeing the error described in step 3. I had to put a longer and longer string to reach the limit. Just add some random chars. Created attachment 137433 [details] [review] 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> Created attachment 137517 [details] [review] 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> Nice clear fix Tomas, thanks. All works as expected.. perhaps it might have been nice to see a unit test for it, but otherwise, I'm happy here. Passing QA. Pushed to master for 22.11. Nice work everyone, thanks! Created attachment 137610 [details] [review] Bug 31104: Add a selenium test Thanks, Jonathan! Created attachment 137628 [details] [review] Bug 31104: Add a selenium test No sure what's going on here, but the selenium tests are failing on jenkins. They are passing with and without commit "Bug 31104: Put each link on a separate header" They are failing after bug 31138. And actually this patch does not fix the problem, I am still getting "414 Request-URI Too Long". Tests reverted. |