blob: 52af691dab3d8fe233ddb03adb43a9417a28051f [file] [log] [blame]
weinig@apple.com75bb8112008-05-23 00:41:49 +00001#!/usr/bin/perl -wT
2use strict;
3
4my $request;
5
6if ($ENV{'REQUEST_METHOD'} eq "OPTIONS") {
7 print "Content-Type: text/plain\n";
dimich@chromium.orgf5d94572009-02-18 00:21:21 +00008 print "Access-Control-Allow-Credentials: true\n";
weinig@apple.comaa998802008-07-30 19:00:28 +00009 print "Access-Control-Allow-Methods: PUT\n";
dimich@chromium.orgf5d94572009-02-18 00:21:21 +000010 print "Access-Control-Allow-Origin: http://127.0.0.1:8000\n\n";
weinig@apple.comaa998802008-07-30 19:00:28 +000011} elsif ($ENV{'REQUEST_METHOD'} eq "PUT") {
12 print "Content-Type: text/plain\n";
dimich@chromium.orgf5d94572009-02-18 00:21:21 +000013 print "Access-Control-Allow-Credentials: true\n";
14 print "Access-Control-Allow-Origin: http://127.0.0.1:8000\n\n";
weinig@apple.comaa998802008-07-30 19:00:28 +000015
weinig@apple.com75bb8112008-05-23 00:41:49 +000016 print "PASS: Cross-domain access allowed.\n";
17 read(STDIN, $request, $ENV{'CONTENT_LENGTH'}) || die "Could not read in content.\n";
18 print $request;
19} else {
ap@webkit.org6d3b92e2009-03-17 07:29:35 +000020 print "Content-Type: text/plain\n\n";
weinig@apple.com75bb8112008-05-23 00:41:49 +000021 print "Wrong method: " . $ENV{'REQUEST_METHOD'} . "\n";
22}