chiark
/
gitweb
/
~ian
/
cgi-auth-flexible.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
1a02b97
)
wip, finish path handling, seems to work well now
author
Ian Jackson
<ian.jackson@eu.citrix.com>
Fri, 11 Jan 2013 16:47:39 +0000
(16:47 +0000)
committer
Ian Jackson
<Ian.Jackson@eu.citrix.com>
Fri, 11 Jan 2013 16:47:39 +0000
(16:47 +0000)
cgi-auth-flexible.pm
patch
|
blob
|
history
diff --git
a/cgi-auth-flexible.pm
b/cgi-auth-flexible.pm
index 00b766aec90bf5a416ecdbe73ff640efc6777173..af4c30b48b2c7938412f6208172fe218da46305d 100644
(file)
--- a/
cgi-auth-flexible.pm
+++ b/
cgi-auth-flexible.pm
@@
-54,6
+54,7
@@
sub flatten_params ($) {
my ($p) = @_;
my @p;
foreach my $k (keys %$p) {
my ($p) = @_;
my @p;
foreach my $k (keys %$p) {
+ next if $k eq '';
foreach my $v (@{ $p->{$k} }) {
push @p, $k, $v;
}
foreach my $v (@{ $p->{$k} }) {
push @p, $k, $v;
}
@@
-113,10
+114,13
@@
sub gen_some_form ($$) {
# Calls $bodyfn->($c,$r) which returns @formbits
my $c = $r->{Cgi};
my @form;
# Calls $bodyfn->($c,$r) which returns @formbits
my $c = $r->{Cgi};
my @form;
+ my $pathinfo = '';
+ $pathinfo .= $params->{''}[0] if $params->{''};
push @form, ('<form method="POST" action="'.
push @form, ('<form method="POST" action="'.
- escapeHTML($r->_ch('get_url')).'">');
+ escapeHTML($r->_ch('get_url')
.$pathinfo
).'">');
push @form, $bodyfn->($c,$r);
foreach my $n (keys %$params) {
push @form, $bodyfn->($c,$r);
foreach my $n (keys %$params) {
+ next if $n eq '';
foreach my $val (@{ $params->{$n} }) {
push @form, ('<input type="hidden"'.
' name="'.escapeHTML($n).'"'.
foreach my $val (@{ $params->{$n} }) {
push @form, ('<input type="hidden"'.
' name="'.escapeHTML($n).'"'.
@@
-199,6
+203,7
@@
sub new_verifier {
promise_check_mutate => 0,
get_param => sub { $_[0]->param($_[2]) },
get_params => sub { $_[1]->get_params() },
promise_check_mutate => 0,
get_param => sub { $_[0]->param($_[2]) },
get_params => sub { $_[1]->get_params() },
+ get_path_info => sub { $_[0]->path_info() },
get_cookie => sub { $_[0]->cookie($_[1]->{S}{cookie_name}) },
get_method => sub { $_[0]->request_method() },
get_url => sub { $_[0]->url(); },
get_cookie => sub { $_[0]->cookie($_[1]->{S}{cookie_name}) },
get_method => sub { $_[0]->request_method() },
get_url => sub { $_[0]->url(); },
@@
-619,6
+624,8
@@
sub chain_params ($) {
foreach my $name (grep /^$dummy_prefix/, keys %p) {
delete $p{$name};
}
foreach my $name (grep /^$dummy_prefix/, keys %p) {
delete $p{$name};
}
+ die if exists $p{''};
+ $p{''} = [ $r->_ch('get_path_info') ];
return \%p;
}
return \%p;
}
@@
-722,6
+729,7
@@
sub url_with_query_params ($$) {
my ($r, $params) = @_;
print STDERR "PARAMS ",Dumper($params);
my $uri = URI->new($r->_ch('get_url'));
my ($r, $params) = @_;
print STDERR "PARAMS ",Dumper($params);
my $uri = URI->new($r->_ch('get_url'));
+ $uri->path($uri->path() . $params->{''}[0]) if $params->{''};
$uri->query_form(flatten_params($params));
return $uri->as_string();
}
$uri->query_form(flatten_params($params));
return $uri->as_string();
}
@@
-748,10
+756,6
@@
sub check_ok ($) {
my $params = $divert->{Params};
my $cookie = $r->construct_cookie($cookiesecret);
my $params = $divert->{Params};
my $cookie = $r->construct_cookie($cookiesecret);
- if (defined $cookiesecret) {
- $params->{$r->{S}{assoc_param_name}} = [ $r->hash($cookiesecret) ];
- }
-
if ($kind =~ m/^REDIRECT-/) {
# for redirects, we honour stored NextParams and SetCookie,
# as we would for non-divert
if ($kind =~ m/^REDIRECT-/) {
# for redirects, we honour stored NextParams and SetCookie,
# as we would for non-divert
@@
-768,6
+772,10
@@
sub check_ok ($) {
return 0;
}
return 0;
}
+ if (defined $cookiesecret) {
+ $params->{$r->{S}{assoc_param_name}} = [ $r->hash($cookiesecret) ];
+ }
+
my ($title, @body);
if ($kind =~ m/^LOGIN-/) {
$title = $r->_gt('Login');
my ($title, @body);
if ($kind =~ m/^LOGIN-/) {
$title = $r->_gt('Login');