OLD | NEW |
1 #!/usr/bin/perl | 1 #!/usr/bin/perl |
2 # Simple script to that dumps the HTTP request method and all input parameters. | 2 # Simple script to that dumps the HTTP request method and all input parameters. |
3 | 3 |
4 use CGI; | 4 use CGI; |
5 $query = new CGI; | 5 $query = new CGI; |
6 | 6 |
7 print "Content-type: text/html\r\n"; | 7 print "Content-type: text/html\r\n"; |
8 print "\r\n"; | 8 print "\r\n"; |
9 | 9 |
10 $method = $query->request_method(); | 10 $method = $query->request_method(); |
11 | 11 |
12 print <<HEADER; | 12 print <<HEADER; |
13 <body> | 13 <body> |
14 <p>This page was requested with the HTTP method $method.</p> | 14 <p>This page was requested with the HTTP method $method.</p> |
15 | 15 |
16 <p>Parameters:</p> | 16 <p>Parameters:</p> |
17 <ul> | 17 <ul> |
18 HEADER | 18 HEADER |
19 | 19 |
20 @paramNames = $query->param; | 20 @paramNames = $query->param; |
21 | 21 |
22 foreach $paramName (@paramNames) | 22 foreach $paramName (@paramNames) |
23 { | 23 { |
24 print "<li>" . $paramName . " = " . $query->param($paramName) . "</li>" | 24 print "<li>" . $paramName . " = " . $query->param($paramName) . "</li>" |
25 } | 25 } |
26 | 26 |
| 27 print <<HEADER2; |
| 28 </ul> |
| 29 <p>Http headers:</p> |
| 30 <ul> |
| 31 HEADER2 |
| 32 |
| 33 my %headers = map { $_ => $query->http($_) } $query->http(); |
| 34 for my $header ( sort (keys %headers) ) { |
| 35 if (("$header" ne "HTTP_ACCEPT_ENCODING") && |
| 36 ("$header" ne "HTTP_ACCEPT_LANGUAGE") && |
| 37 ("$header" ne "HTTP_ACCEPT") && |
| 38 ("$header" ne "HTTP_USER_AGENT")) { |
| 39 print "<li>$header = $headers{$header}</li>\n"; |
| 40 } |
| 41 } |
| 42 |
27 print <<FOOTER | 43 print <<FOOTER |
28 </ul> | 44 </ul> |
29 <script> | 45 <script> |
30 var isDone = true; | 46 var isDone = true; |
31 if (sessionStorage.formTargetShouldNavAndGoBack) { | 47 if (sessionStorage.formTargetShouldNavAndGoBack) { |
32 if (sessionStorage.didNav) { | 48 if (sessionStorage.didNav) { |
33 delete sessionStorage.didNav; | 49 delete sessionStorage.didNav; |
34 delete sessionStorage.formTargetShouldNavAndGoBack; | 50 delete sessionStorage.formTargetShouldNavAndGoBack; |
35 } else { | 51 } else { |
36 isDone = false; | 52 isDone = false; |
(...skipping 13 matching lines...) Expand all Loading... |
50 }; | 66 }; |
51 } | 67 } |
52 } | 68 } |
53 | 69 |
54 if (isDone && window.testRunner) | 70 if (isDone && window.testRunner) |
55 testRunner.notifyDone(); | 71 testRunner.notifyDone(); |
56 | 72 |
57 </script> | 73 </script> |
58 </body> | 74 </body> |
59 FOOTER | 75 FOOTER |
OLD | NEW |