summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2011-01-07 13:12:58 -0600
committerJesse Luehrs <doy@tozt.net>2011-01-07 13:12:58 -0600
commitabbbda554cd5c2b54435dc695694a7169baf3fc9 (patch)
tree0776fe0d3bcf3057508652c9e44b76b2b740505b
parentb519d7b6f2f43a096cbc2bc1fe10f40b98d85e79 (diff)
downloadplack-client-abbbda554cd5c2b54435dc695694a7169baf3fc9.tar.gz
plack-client-abbbda554cd5c2b54435dc695694a7169baf3fc9.zip
don't keep recreating the ::Proxy object
-rw-r--r--lib/Plack/Client.pm9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/Plack/Client.pm b/lib/Plack/Client.pm
index 118e818..ba12ba9 100644
--- a/lib/Plack/Client.pm
+++ b/lib/Plack/Client.pm
@@ -80,7 +80,8 @@ sub new {
if exists($params{apps}) && ref($params{apps}) ne 'HASH';
bless {
- apps => $params{apps},
+ apps => $params{apps},
+ proxy => Plack::App::Proxy->new,
}, $class;
}
@@ -92,7 +93,8 @@ Returns the C<apps> hashref that was passed to the constructor.
=cut
-sub apps { shift->{apps} }
+sub apps { shift->{apps} }
+sub _proxy { shift->{proxy} }
=method app_for
@@ -252,7 +254,8 @@ sub _app_from_req {
elsif ($scheme eq 'http' || $scheme eq 'https') {
my $uri = $uri->clone;
$uri->path('/');
- $app = Plack::App::Proxy->new(remote => $uri->as_string)->to_app;
+ $req->env->{'plack.proxy.remote'} = $uri->as_string;
+ $app = $self->_proxy;
}
die "Couldn't find app" unless $app;