Bug 32551: HTTP_ACCEPT_LANGUAGE legacy CGI variable not set in Mojolicious
authorTomas Cohen Arazi <tomascohen@theke.io>
Thu, 28 Dec 2023 14:41:39 +0000 (14:41 +0000)
committerLucas Gass <lucas@bywatersolutions.com>
Fri, 19 Jan 2024 22:35:50 +0000 (22:35 +0000)
commit9051088ec078d15f080585a73fee2bfea6d5b9f0
tree88d73a76affe8e11d1aab8608ad54839738c57ed
parenta9025d9d7c12a055548fce84e5b300b91e721ba8
Bug 32551: HTTP_ACCEPT_LANGUAGE legacy CGI variable not set in Mojolicious

This patch addresses the fact some of our code still relies on those CGI-era ENV variables.
In particular, C4::Laguages::getlanguage expects it to calculate the most suitable language.

As this is reported as required, I provide a fix.

I did a `git grep HTTP_` on the codebase, and the only other occurences are:

* C4::Output (HTTP_X_REQUESTED_WITH)
* C4::Context (HTTP_USER_AGENT, HTTP_X_FORWARDED_FOR)
* C4::Auth_with_shibboleth (using HTTP_ variables for matchpoints)
* Some handling on the 'Koha as a Mojo app' code
* Some .pl script not relevant to this report

I decided to limit this patch to the requested header which seems harmless. I leave the
other cases.

To test:
1. Apply the regression tests patch
2. Run:
   $ ktd --shell
  k$ qa -c 1
=> FAIL: Tests fail!
3. Apply this patch
4. Run:
  k$ qa -c 2
=> SUCCESS: Tests pass! All green!
5. Sign off :-D

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit d6e072fb5f2a0cd47661e759142e59e887724cc6)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit c1ba60ce4dc5be6b2f808cd4b8ce57e8e583cc71)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Koha/REST/V1/Auth.pm