Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / http / tests / xmlhttprequest / resources / access-control-basic-get-fail-non-simple.cgi
1 #!/usr/bin/perl -wT
2 use strict;
3
4 my $method = $ENV{'REQUEST_METHOD'};
5
6 if ($method eq "OPTIONS") {
7   # Reject preflights.
8   print <<EOF
9 Status: 403 Forbidden
10 Content-Type: text/plain
11
12 EOF
13 } elsif ($method eq "GET") {
14   # Respond to simple cross-origin requests.
15   print <<EOF
16 Status: 200 OK
17 Content-Type: text/plain
18 Access-Control-Allow-Credentials: true
19 Access-Control-Allow-Origin: http://127.0.0.1:8000
20
21 Hello
22 EOF
23 } else {
24   # Return a status code that is different from the OPTIONS case so that
25   # layout tests can utilize it.
26   print <<EOF
27 Status: 400 Bad Request
28 Content-Type: text/plain
29
30 EOF
31 }