Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / http / tests / security / resources / escape-form-data-field-names.cgi
1 #!/usr/bin/perl -wT
2
3 print "Content-type: text/html\n\n"; 
4
5 print "<p>Test for <a href='https://bugs.webkit.org/show_bug.cgi?id=30723'>bug 30723</a>: Input names added to multipart/form-data headers need to be escaped</p>";
6 print "<pre>";
7
8 if ($ENV{'REQUEST_METHOD'} eq "POST") {
9     read(STDIN, $request, $ENV{'CONTENT_LENGTH'})
10                 || die "Could not get query\n";
11     print $request;
12 } else {
13     print "Wrong method: " . $ENV{'REQUEST_METHOD'} . "\n";
14
15
16 print "</pre><script>\n";
17 print "var pre = document.getElementsByTagName('pre')[0];\n";
18 print "if (pre.textContent.match('\\nContent-Type'))\n";
19 print "  document.write('FAIL')\n";
20 print "else\n";
21 print "  document.write('PASS')\n";
22 print "if (window.testRunner) {\n";
23 print "  pre.setAttribute('style', 'display:none');\n";
24 print "  testRunner.notifyDone();\n";
25 print "}\n";
26 print "</script>\n";