chiark / gitweb /
Pass srcdump request parameter when redirecting etc.
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 2 Nov 2015 17:39:38 +0000 (17:39 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 3 Nov 2015 18:36:04 +0000 (18:36 +0000)
For most of CAF's purposes, the srcdump request parameter is not
really for srcdump, since it is not related to authentication.

Rather, it exists simply because we do not own the application path
namespace.  So when generating (or requesting) redirects etc. we
should treat it as a form parameter relating to the application.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
caf.pod
cgi-auth-flexible.pm

diff --git a/caf.pod b/caf.pod
index 4d2b3f67869ca0371e9e7f78b0826ca47479c03d..6ddc56e647929e40678f68ceb2f33877b6e4ae7b 100644 (file)
--- a/caf.pod
+++ b/caf.pod
@@ -492,7 +492,8 @@ yourself (and indeed you must do so if you use C<check_divert>).
 
 Returns a hash of the "relevant" parameters to this request, in a form
 suitable for C<url_with_query_params>.  This is all of the query
 
 Returns a hash of the "relevant" parameters to this request, in a form
 suitable for C<url_with_query_params>.  This is all of the query
-parameters which are not related to CGI::Auth::Flexible.  The
+parameters which are not related to CGI::Auth::Flexible's authentication
+arrangements.  (The srcdump request parameters B<are> included.)  The
 PATH_INFO from the request is returned as the parameter C<< '' >>.
 
 =back
 PATH_INFO from the request is returned as the parameter C<< '' >>.
 
 =back
@@ -669,7 +670,8 @@ the form used by C<url_with_query_params>.
 
 The contents of this hashref does not include the CAF-specific
 parameters such as the secret cookie, those which follow from the kind
 
 The contents of this hashref does not include the CAF-specific
 parameters such as the secret cookie, those which follow from the kind
-of diversion requested, etc.
+of diversion requested, etc.  (But they may include the
+srcdump_param_name, so that srcdump_needlogin can work properly.)
 
 It is correct to always include the contents of C<Params> as hidden
 parameters in the urls for all redirections, and as hidden input
 
 It is correct to always include the contents of C<Params> as hidden
 parameters in the urls for all redirections, and as hidden input
index 95c58ac221af22101106bc191c73c603fe615ed3..74c20b69b347d7327a69cc8bbf62623a8c4678af 100644 (file)
@@ -801,9 +801,11 @@ sub _check_divert_core ($) {
            Params => { },
        };
     }
            Params => { },
        };
     }
-    if ($srcdump || !$r->{S}{srcdump_needlogin}) {
+    print STDERR "$r->{S}{srcdump_needlogin}\n";
+    if ($srcdump && !$r->{S}{srcdump_needlogin}) {
        return ($srcdump);
     }
        return ($srcdump);
     }
+    print STDERR "NOT NOW\n";
 
     my $cooksraw = $r->_ch('get_cookie');
     my $cooks = $r->_unblind($cooksraw);
 
     my $cooksraw = $r->_ch('get_cookie');
     my $cooks = $r->_unblind($cooksraw);
@@ -953,7 +955,9 @@ sub chain_params ($) {
     my %p = %{ $r->_ch('get_params') };
     foreach my $pncn (keys %{ $r->{S} }) {
        my $names;
     my %p = %{ $r->_ch('get_params') };
     foreach my $pncn (keys %{ $r->{S} }) {
        my $names;
-       if ($pncn =~ m/_param_name$/) {
+       if ($pncn =~ m/^srcdump_/) {
+           next;
+       } elsif ($pncn =~ m/_param_name$/) {
            my $name = $r->{S}{$pncn};
            die "$pncn ?" if ref $name;
            $names = [ $name ];
            my $name = $r->{S}{$pncn};
            die "$pncn ?" if ref $name;
            $names = [ $name ];