Skip to content
Permalink
Browse files

Item1458: must convert the request into a POST if a valid redirect ca…

…che is present

git-svn-id: http://svn.foswiki.org/branches/Release01x00@3512 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
CrawfordCurrie CrawfordCurrie
CrawfordCurrie authored and CrawfordCurrie committed Apr 18, 2009
1 parent 3cf0968 commit 652808fef0c70dbc2f1de7ea45d850c90dae8e5c
Showing with 34 additions and 35 deletions.
  1. +33 −34 core/lib/Foswiki/UI.pm
  2. +1 −1 core/templates/oopsmore.tmpl
@@ -205,40 +205,6 @@ sub handleRequest {
$sub = $dispatcher->{package} . '::' if $dispatcher->{package};
$sub .= $dispatcher->{function};

if ( UNIVERSAL::isa( $Foswiki::engine, 'Foswiki::Engine::CLI' ) ) {
$dispatcher->{context}->{command_line} = 1;
} elsif ( defined $req->method()
&& (
( defined $dispatcher->{allow}
&& !$dispatcher->{allow}->{uc($req->method())} )
||
( defined $dispatcher->{deny}
&& $dispatcher->{deny}->{uc($req->method())} )
)
) {
$res = new Foswiki::Response();
$res->header( -type => 'text/html', -status => '405' );
$res->print('Bad Request: '.uc($req->method()).' denied for '
.$req->action());
return $res;
}

$res = execute( $req, \&$sub, %{$dispatcher->{context}} );
return $res;
}

=begin TML
---++ StaticMethod execute($req, $sub, %initialContext) -> $res
Creates a Foswiki session object with %initalContext and calls
$sub method. Returns the Foswiki::Response object generated
=cut

sub execute {
my ( $req, $sub, %initialContext ) = @_;

my $cache = $req->param('foswiki_redirect_cache');

# Never trust input data from a query. We will only accept
@@ -264,12 +230,45 @@ sub execute {
$req->delete('foswiki_redirect_cache');
print STDERR "Passthru: Loaded and unlinked $passthruFilename\n"
if TRACE_PASSTHRU;
$req->method('POST');
}
else {
print STDERR "Passthru: Could not find $passthruFilename\n"
if TRACE_PASSTHRU;
}
}
if ( UNIVERSAL::isa( $Foswiki::engine, 'Foswiki::Engine::CLI' ) ) {
$dispatcher->{context}->{command_line} = 1;
} elsif ( defined $req->method()
&& (
( defined $dispatcher->{allow}
&& !$dispatcher->{allow}->{uc($req->method())} )
||
( defined $dispatcher->{deny}
&& $dispatcher->{deny}->{uc($req->method())} )
)
) {
$res = new Foswiki::Response();
$res->header( -type => 'text/html', -status => '405' );
$res->print('Bad Request: '.uc($req->method()).' denied for '
.$req->action());
return $res;
}
$res = _execute( $req, \&$sub, %{$dispatcher->{context}} );
return $res;
}

=begin TML
---++ StaticMethod _execute($req, $sub, %initialContext) -> $res
Creates a Foswiki session object with %initalContext and calls
$sub method. Returns the Foswiki::Response object generated
=cut

sub _execute {
my ( $req, $sub, %initialContext ) = @_;

# DO NOT pass in $req->remoteUser here (even though it appears to be right)
# because it may occlude the login manager.
@@ -18,7 +18,7 @@

%TMPL:DEF{"copy"}%---++ %MAKETEXT{"Copy topic"}%
<p>%MAKETEXT{"Copy text and form data to a new topic (no attachments will be copied though)."}%</p>
<form action="%SCRIPTURL{manage}%/%WEB%/">
<form action="%SCRIPTURL{manage}%/%WEB%/" method="post">
%MAKETEXT{"Name of copy:"}% <input type="text" name="topic" class="foswikiInputField" value="%TOPIC%Copy" size="30" /> <input type="submit" class="foswikiButton" value="%MAKETEXT{"Copy topic"}%" /> <span class="foswikiGrayText">%MAKETEXT{"You will be able to review the copied topic before saving"}%</span>
%TMPL:P{"nonwikiword"}%
<input type="hidden" name="action" value="create" />

0 comments on commit 652808f

Please sign in to comment.
You can’t perform that action at this time.