summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
446373a)
Fixed redirect_request so it works.
Needs testing on MP1.
git-svn-id: http://svn.maypole.perl.org/Maypole/trunk@472
48953598-375a-da11-a14b-
00016c27c3ee
our $MODPERL2;
our $modperl_version;
our $MODPERL2;
our $modperl_version;
+# pjs -- fixed to use standard way from perl.apache.org
- eval 'use Apache;';
- if ($@) {
- eval 'use mod_perl2; $modperl_version = $mod_perl2::VERSION; ';
- if ($@) {
- $modperl_version = $Apache2::RequestRec::VERSION;
- }
- require Apache2::RequestIO;
- require Apache2::RequestRec;
- require Apache2::RequestUtil;
- require APR::URI;
- require HTTP::Body;
- $MODPERL2 = 1;
+ #eval 'use Apache;'; # could fuck shit up if you have some file na
+ # named Apache.pm in your path forex CGI/Apache.pm
+ $MODPERL2 = ( exists $ENV{MOD_PERL_API_VERSION} and
+ $ENV{MOD_PERL_API_VERSION} >= 2 );
+ if ($MODPERL2) {
+ eval 'use mod_perl2; $modperl_version = $mod_perl2::VERSION;';
+ if ($@) {
+ $modperl_version = $Apache2::RequestRec::VERSION;
+ }
+ require Apache2::RequestIO;
+ require Apache2::RequestRec;
+ require Apache2::RequestUtil;
+ eval 'use Apache2::Const -compile => qw/REDIRECT/;'; # -compile 4 no import
+ require APR::URI;
+ require HTTP::Body;
- eval ' use mod_perl; ';
- require Apache;
- require Apache::Request;
- $MODPERL2 = 0;
- $modperl_version = 1;
+ eval ' use mod_perl; ';
+ require Apache;
+ require Apache::Request;
+ eval 'use Apache::Constants -compile => qw/REDIRECT/;';
+ $modperl_version = 1;
=head1 NAME
Apache::MVC - Apache front-end to Maypole
=head1 NAME
Apache::MVC - Apache front-end to Maypole
=cut
# FIXME: use headers_in to gather host and other information?
=cut
# FIXME: use headers_in to gather host and other information?
+# pjs 4-7-06 fixed so it works but did not fix headers_in issue
+sub redirect_request
{
my $r = shift;
my $redirect_url = $_[0];
{
my $r = shift;
my $redirect_url = $_[0];
+ my $status = $MODPERL2 ? eval 'Apache2::Const::REDIRECT;' :
+ eval 'Apache::Constants::REDIRECT;'; # why have to eval this?
if ($_[1]) {
my %args = @_;
if ($args{url}) {
if ($_[1]) {
my %args = @_;
if ($args{url}) {
$status = $args{status} if ($args{status});
}
$status = $args{status} if ($args{status});
}
- $r->headers_out->set('Status' => $status);
- $r->headers_out->set('Location' => $redirect_url);
+ $r->ar->status($status);
+ $r->ar->headers_out->set('Location' => $redirect_url);
+ #$r->output("");