From 96917538c6b6fad688dd40c2a8f0cc9127053b24 Mon Sep 17 00:00:00 2001 From: Mike Rylander Date: Wed, 30 Jul 2014 13:29:46 -0400 Subject: [PATCH] LP#1350457: Pass caller's session to subrequests called via method_lookup In the process of looking up a method for an internal subrequest, we lose session info. This is a problem when the subrequest makes a remote request, because then the subrequest can't look up the proper locale, among other things. The forthcoming branch passes the caller's session to the subrequest. Signed-off-by: Mike Rylander Signed-off-by: Galen Charlton --- src/perl/lib/OpenSRF/Application.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/perl/lib/OpenSRF/Application.pm b/src/perl/lib/OpenSRF/Application.pm index 5ae98bf..d409957 100644 --- a/src/perl/lib/OpenSRF/Application.pm +++ b/src/perl/lib/OpenSRF/Application.pm @@ -171,6 +171,7 @@ sub handler { if (ref $coderef) { my @args = $app_msg->params; + $coderef->session( $session ); my $appreq = OpenSRF::AppRequest->new( $session ); $appreq->max_chunk_size( $coderef->max_chunk_size ); $appreq->max_chunk_count( $coderef->max_chunk_count ); @@ -558,6 +559,7 @@ sub method_lookup { $meth = $self->method_lookup($method,$proto,1); } + $meth->session($self->session) if $meth; # Pass the caller's session return $meth; } @@ -571,9 +573,7 @@ sub run { if ( !UNIVERSAL::isa($req, 'OpenSRF::AppRequest') ) { $log->debug("Creating a SubRequest object", DEBUG); unshift @params, $req; - $req = OpenSRF::AppSubrequest->new; - $req->session( $self->session ) if ($self->session); - + $req = OpenSRF::AppSubrequest->new( session => $self->session ); } else { $log->debug("This is a top level request", DEBUG); } -- 2.43.2