From 081adce03bb6636db6daebdd351d1f20bd24e0a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Oudot?= Date: Tue, 8 Jan 2013 14:42:48 +0000 Subject: [PATCH] Fix POST replay with different target URL (#550) --- .../lib/Lemonldap/NG/Handler/Simple.pm | 10 +++++----- lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Vhost.pm | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Simple.pm b/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Simple.pm index 7e9e3435d..9c575ee8a 100644 --- a/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Simple.pm +++ b/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Simple.pm @@ -829,7 +829,8 @@ sub hideCookie { $tmp =~ s/$cookieName(http)?=[^,;]*[,;\s]*//og; if ($tmp) { $class->lmSetHeaderIn( $apacheRequest, 'Cookie' => $tmp ); - } else { + } + else { $class->lmUnsetHeaderIn( $apacheRequest, 'Cookie' ); } } @@ -1500,8 +1501,7 @@ sub postUrlInit { $d->{postUrl} ||= $url; # Register POST form for POST URL - $transform->{ $d->{postUrl} } = - sub { $class->buildPostForm( $d->{postUrl} ) } + $transform->{$url} = sub { $class->buildPostForm( $d->{postUrl} ) } if ( $url ne $d->{postUrl} ); # Get datas to POST @@ -1527,8 +1527,8 @@ sub postUrlInit { } $class->lmLog( "Compiling POST request for $url", 'debug' ); - $transform->{$url} = sub { - return $class->buildPostForm($url) + $transform->{ $d->{postUrl} } = sub { + return $class->buildPostForm( $d->{postUrl} ) if ( $apacheRequest->method ne 'POST' ); $apacheRequest->add_input_filter( sub { diff --git a/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Vhost.pm b/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Vhost.pm index 942724e43..b315dd54a 100644 --- a/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Vhost.pm +++ b/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Vhost.pm @@ -13,7 +13,7 @@ use Lemonldap::NG::Handler::Simple qw(:locationRules :headers :post :apache) use MIME::Base64; use constant SAFEWRAP => ( Safe->can("wrap_code_ref") ? 1 : 0 ); -our $VERSION = '1.1.2'; +our $VERSION = '1.2.3'; ## @imethod protected void defaultValuesInit(hashRef args) # Set default values for non-customized variables @@ -254,7 +254,7 @@ sub postUrlInit { $d->{postUrl} ||= $url; # Register POST form for POST URL - $transform->{$vhost}->{ $d->{postUrl} } = + $transform->{$vhost}->{$url} = sub { $class->buildPostForm( $d->{postUrl} ) } if ( $url ne $d->{postUrl} ); @@ -283,8 +283,8 @@ sub postUrlInit { $class->lmLog( "Compiling POST request for $url (vhost $vhost)", 'debug' ); - $transform->{$vhost}->{$url} = sub { - return $class->buildPostForm($url) + $transform->{$vhost}->{ $d->{postUrl} } = sub { + return $class->buildPostForm( $d->{postUrl} ) if ( $apacheRequest->method ne 'POST' ); $apacheRequest->add_input_filter( sub {