From: Mike Rylander Date: Wed, 30 Jul 2014 17:29:46 +0000 (-0400) Subject: LP#1350457: Pass caller's session to subrequests called via method_lookup X-Git-Tag: osrf_rel_2_4_0-alpha~8 X-Git-Url: http://git.equinoxoli.org/?p=opensrf-equinox.git;a=commitdiff_plain;h=96917538c6b6fad688dd40c2a8f0cc9127053b24 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 --- 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); }