sub do_redirect_cgi ($$$$) {
my ($c, $r, $new_url, $cookie) = @_;
- my @ha = ('text/html',
- -status => '303 See other',
- -location => $new_url);
- push @ha, (-cookie => $cookie) if defined $cookie;
- $r->_print($c->header(@ha),
+ $r->_print($c->header($r->_cgi_header_args($cookie,
+ -status => '303 See other',
+ -location => $new_url)),
$r->_ch('gen_start_html',$r->_gt('Redirection')),
'<a href="'.escapeHTML($new_url).'">',
$r->_gt("If you aren't redirected, click to continue."),
my $sz = 'size="'.$r->{S}{form_entry_size}.'"';
foreach my $up (@{ $r->{S}{username_param_names}}) {
push @form, ('<tr><td>',$r->_gt(ucfirst $up),'</td>',
- '<td><input type="text" ',$sz.
- ' name=',$up,'></td></tr>');
+ '<td><input type="text" '.$sz.
+ ' name='.$up.'></td></tr>');
}
push @form, ('<tr><td>'.$r->_gt('Password'),'</td>',
'<td><input type="password" '.$sz.
my ($r, $cookv) = @_;
return undef unless $cookv;
my $c = $r->{Cgi};
- my $cookt = $c->cookie(-name => $r->{S}{cookie_name},
+ my $cookie = $c->cookie(-name => $r->{S}{cookie_name},
-value => $cookv,
-path => $r->{S}{cookie_path},
-domain => $r->_ch('get_cookie_domain'),
-expires => '+'.$r->{S}{login_timeout}.'s',
-secure => $r->{S}{encrypted_only});
-print STDERR "CC $r $c $cookv $cookt\n";
- return $cookt;
+print STDERR "CC $r $c $cookv $cookie\n";
+ return $cookie;
}
# pages/param-sets are
# -/n n POST r u user not logged in
# fail
-#fixme make parameter values hash of cookie values
-
sub _check_divert_core ($) {
my ($r) = @_;
return $uri->as_string();
}
+sub _cgi_header_args ($$@) {
+ my ($r, $cookie, @ha) = @_;
+ unshift @ha, qw(-type text/html);
+ push @ha, (-cookie => $cookie) if defined $cookie;
+ print STDERR "_cgi_header_args ",join('|',@ha),".\n";
+ return @ha;
+}
+
sub check_ok ($) {
my ($r) = @_;
my $kind = $divert->{Kind};
my $cookieval = $divert->{CookieVal};
my $params = $divert->{Params};
+ my $cookie = $r->construct_cookie($cookieval);
if ($kind =~ m/^REDIRECT-/) {
# for redirects, we honour stored NextParams and SetCookie,
die;
}
my $new_url = $r->url_with_query_params($params);
- my $cookie = $r->construct_cookie($r, $cookieval);
$r->_ch('do_redirect',$new_url, $cookie);
return 0;
}
die $kind;
}
- $r->_print($r->{Cgi}->header('text/html'),
+ $r->_print($r->{Cgi}->header($r->_cgi_header_args($cookie)),
$r->_ch('gen_start_html',$title),
@body,
$r->_ch('gen_end_html'));
close $rsf;
my $out = unpack "H*", $bin;
print STDERR "_random out $out\n";
+ return $out;
}
sub _fresh_cookie ($) {