OLD | NEW |
1 #!/usr/bin/perl | 1 #!/usr/bin/perl |
2 # Simple script to generate a 302 HTTP redirect to a page that triggers a | 2 # Simple script to generate a 302 HTTP redirect to a page that triggers a |
3 # navigation back (only if POST is used). | 3 # navigation back (only if POST is used). |
4 | 4 |
5 use CGI; | 5 use CGI; |
6 $query = new CGI; | 6 $query = new CGI; |
7 | 7 |
8 $method = $query->request_method(); | 8 $method = $query->request_method(); |
9 | 9 |
10 if ($method eq "POST") { | 10 if ($method eq "POST") { |
11 print "Status: 302 Moved Temporarily\r\n"; | 11 print "Status: 302 Moved Temporarily\r\n"; |
12 print "Location: top-go-back.html\r\n"; | 12 print "Location: top-go-back.html\r\n"; |
13 print "\r\n"; | 13 print "\r\n"; |
14 } else { | 14 } else { |
15 print "Status: 405 Method not allowed\r\n"; | 15 print "Status: 405 Method not allowed\r\n"; |
16 print "Content-type: text/plain\r\n"; | 16 print "Content-type: text/plain\r\n"; |
17 print "\r\n"; | 17 print "\r\n"; |
18 print "This should only be requested via POST ($method was used)." | 18 print "This should only be requested via POST ($method was used)." |
19 } | 19 } |
OLD | NEW |