summaryrefslogtreecommitdiffstats
path: root/lib/Plack/Client
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2011-01-11 13:57:50 -0600
committerJesse Luehrs <doy@tozt.net>2011-01-11 14:02:47 -0600
commit935312b7f10857f0ece01697355ec7bf2247e461 (patch)
tree8c8848f165d4fa5dd9d3171b3a634cf371fd43c2 /lib/Plack/Client
parent811c7f969dba4962943550c0b74e5ad179860683 (diff)
downloadplack-client-935312b7f10857f0ece01697355ec7bf2247e461.tar.gz
plack-client-935312b7f10857f0ece01697355ec7bf2247e461.zip
just save the entire original uri
Diffstat (limited to 'lib/Plack/Client')
-rw-r--r--lib/Plack/Client/Backend/psgi_local.pm8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Plack/Client/Backend/psgi_local.pm b/lib/Plack/Client/Backend/psgi_local.pm
index 68f6eff..1da572b 100644
--- a/lib/Plack/Client/Backend/psgi_local.pm
+++ b/lib/Plack/Client/Backend/psgi_local.pm
@@ -78,11 +78,15 @@ sub app_from_request {
my $self = shift;
my ($req) = @_;
- my $app_name = $req->env->{'plack.client.authority'};
- if (!defined $app_name) {
+ my $app_name;
+ if (my $uri = $req->env->{'plack.client.original_uri'}) {
+ $app_name = $uri->authority;
+ }
+ else {
$app_name = $req->uri->authority;
$app_name =~ s/(.*):.*/$1/; # in case a port was added at some point
}
+
my $app = $self->app_for($app_name);
croak "Unknown app: $app_name" unless $app;
return Plack::Middleware::ContentLength->wrap($app);