Bugzilla – Attachment 54787 Details for
Bug 17084
Automatic debian/control updates (master)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17050: (QA followup) Use Mojo::Transaction to get the remote address
Bug-17050-QA-followup-Use-MojoTransaction-to-get-t.patch (text/plain), 2.46 KB, created by
Nightly Build Bot
on 2016-08-23 22:30:02 UTC
(
hide
)
Description:
Bug 17050: (QA followup) Use Mojo::Transaction to get the remote address
Filename:
MIME Type:
Creator:
Nightly Build Bot
Created:
2016-08-23 22:30:02 UTC
Size:
2.46 KB
patch
obsolete
>From 4ad40081b0a3f0c7bd4bda859308599a75626707 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Fri, 19 Aug 2016 14:59:04 -0300 >Subject: [PATCH] Bug 17050: (QA followup) Use Mojo::Transaction to get the > remote address > >While the original patch fixes the issue, reading at Mojolicious source code, revealed >that Mojo::Transaction already has proper processing for detecting the remote address: > >sub remote_address { > my $self = shift; > > return $self->original_remote_address(@_) if @_; > return $self->original_remote_address unless $self->req->reverse_proxy; > > # Reverse proxy > return ($self->req->headers->header('X-Forwarded-For') // '') =~ /([^,\s]+)$/ > ? $1 > : $self->original_remote_address; >} > >Without this patch, if there's a request without HTTP_X_FORWARDED_FOR, then the remote >address would be empty. Such would be the case of a dev/standard setup without Plack. > >This patch makes Koha::REST::V1::startup use tx->remote_address instead of dealing with the >headers on its own. > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> > >https://bugs.koha-community.org/show_bug.cgi?id=17084 >--- > Koha/REST/V1.pm | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) > >diff --git a/Koha/REST/V1.pm b/Koha/REST/V1.pm >index b16e1e3..84161c3 100644 >--- a/Koha/REST/V1.pm >+++ b/Koha/REST/V1.pm >@@ -28,10 +28,13 @@ sub startup { > my $route = $self->routes->under->to( > cb => sub { > my $c = shift; >+ # Mojo doesn't use %ENV the way CGI apps do >+ # Manually pass the remote_address to check_auth_cookie >+ my $remote_addr = $c->tx->remote_address; >+ my ($status, $sessionID) = check_cookie_auth( >+ $c->cookie('CGISESSID'), undef, >+ { remote_addr => $remote_addr }); > >- # ENV{REMOTE_ADDR} is not set here, we need to read the headers >- my $remote_addr = $c->req->headers->header('x-forwarded-for'); >- my ($status, $sessionID) = check_cookie_auth($c->cookie('CGISESSID'), undef, { remote_addr => $remote_addr }); > if ($status eq "ok") { > my $session = get_session($sessionID); > my $user = Koha::Patrons->find($session->param('number')); >-- >2.1.4
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 17084
:
54283
|
54293
|
54305
|
54320
|
54330
|
54331
|
54400
|
54787
|
56276
|
56277
|
56972
|
56973
|
70820
|
70821
|
75320
|
78317
|
78326
|
80412
|
82350
|
82357
|
89722
|
90762
|
93904
|
94933
|
97236
|
97865
|
98783
|
98799
|
99456
|
105140
|
105298
|
105313
|
105314
|
105409
|
105416
|
105452
|
111587