Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: CGI Redirect with Status

by Ovid (Cardinal)
on Jun 04, 2003 at 20:40 UTC ( #263142=note: print w/replies, xml ) Need Help??


in reply to CGI Redirect with Status

I've never been quite sure why this is, but CGI.pm hard-codes the redirection value:

sub redirect { my($self,@p) = self_or_default(@_); my($url,$target,$cookie,$nph,@other) = rearrange([[LOCATION,URI,UR +L],TARGET,['COOKIE','COOKIES'],NPH],@p); $url ||= $self->self_url; my(@o); foreach (@other) { tr/\"//d; push(@o,split("=",$_,2)); } unshift(@o, '-Status' => '302 Moved', '-Location'=> $url, '-nph' => $nph); unshift(@o,'-Target'=>$target) if $target; unshift(@o,'-Type'=>''); my @unescaped; unshift(@unescaped,'-Cookie'=>$cookie) if $cookie; return $self->header((map {$self->unescapeHTML($_)} @o),@unescaped +); }

There are various ways to deal with this, none of them completely satisfactory. Perhaps the easiest would be to generate your own redirect header rather than rely on CGI.pm.

Cheers,
Ovid

New address of my CGI Course.
Silence is Evil (feel free to copy and distribute widely - note copyright text)

Replies are listed 'Best First'.
•Re: Re: CGI Redirect with Status
by merlyn (Sage) on Jun 04, 2003 at 23:44 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://263142]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (8)
As of 2017-10-23 08:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My fridge is mostly full of:

















    Results (277 votes). Check out past polls.

    Notices?