https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41892 --- Comment #6 from David Cook <dcook@prosentient.com.au> --- (In reply to Tomás Cohen Arazi (tcohen) from comment #3)
Yeah, we need to check how this is to be used as `Koha::Middleware::RealIP` does the same thing.
It's supposed to be used for non-Plack CGI scripts, because they're not covered by the Koha::Middleware::RealIP middleware. That said, I don't know why we have "require CGI" and "CGI->http" as we could just use $ENV{HTTP_X_FORWARDED_FOR}. I think it executes for Plack scripts too but wouldn't do anything as the REMOTE_ADDR would've already been rewritten. We could check for PSGI env variables though. All Jonathan is doing here is moving C4::Context->set_remote_address to Koha::Context::RemoteAddress->set, and updating some preference lookups. I think it's a reasonable change as is. -- Overall, I think $ENV{REMOTE_ADDR} is the right place to check. (Note that instead of Koha::Middleware::RealIP, a person could just use mod_remoteip with Apache.) I reckon creating a Koha::Context singleton would likely bloat over time and just get us back to where we are now. The hard part when we have 1 object doing many things is that it ends up having many dependencies which then leads to circular dependencies. -- You are receiving this mail because: You are watching all bug changes.