in reply to Re: How redirect the page in CGI programming?
in thread How redirect the page in CGI programming?
Well, sure, but technically, if that is being sent directly to the browser (say, from a lightweight server using a direct socket), you need to send "\cM\cJ" not just "\n", according to the RFCs.print "Status: 302 Found\n", "Location: http://www.perlmonks.com/\n\n";
This is why it's better to use CGI.pm... all that stuff just works:
localhost:~ % perl -MCGI=redirect -e 'print redirect("/somewhere")' | +od -c 0000000 S t a t u s : 3 0 2 M o v + e 0000020 d \r \n L o c a t i o n : / s + o 0000040 m e w h e r e \r \n \r \n + 0000053
-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: How redirect the page in CGI programming?
by ambrus (Abbot) on Jun 21, 2005 at 11:54 UTC |