aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/share/perl/asset.cgi
diff options
context:
space:
mode:
Diffstat (limited to 'share/perl/asset.cgi')
-rw-r--r--share/perl/asset.cgi43
1 files changed, 0 insertions, 43 deletions
diff --git a/share/perl/asset.cgi b/share/perl/asset.cgi
deleted file mode 100644
index 318e06f..0000000
--- a/share/perl/asset.cgi
+++ /dev/null
@@ -1,43 +0,0 @@
1#!/usr/bin/perl -w
2
3use strict;
4use Carp;
5use MyCGI;
6use OpenSim::Config;
7use OpenSim::Utility;
8use OpenSim::AssetServer;
9
10# !!
11# TODO: ERROR code
12#
13my $param = &MyCGI::getParam();
14my $response = "<ERROR />";
15if ($ENV{REQUEST_METHOD} eq "POST") {
16 my $request = $param->{'POSTDATA'};
17 #&OpenSim::Utility::Log("asset", "request", $ENV{REQUEST_URI}, $request);
18 $response = &OpenSim::AssetServer::saveAsset($request);
19} else { # get
20 eval {
21 my $rest_param = &getRestParam();
22 #&OpenSim::Utility::Log("asset", "request", $ENV{REQUEST_URI});
23 my $rest_param_count = @$rest_param;
24 if ($rest_param_count < 2) {
25 Carp::croak($OpenSim::Config::SYS_MSG{FATAL});
26 }
27 $response = &OpenSim::AssetServer::getAsset($rest_param->[$#$rest_param], $param);
28 };
29 if ($@) {
30 $response = "<ERROR>$@</ERROR>"; # TODO: better return message needed.
31 }
32}
33#&OpenSim::Utility::Log("asset", "response", $response);
34&MyCGI::outputXml("utf-8", $response);
35
36sub getRestParam {
37 my $uri = $ENV{REQUEST_URI} || Carp::croak($OpenSim::Config::SYS_MSG{FATAL});
38 my ($request_uri, undef) = split(/\?/, $uri);
39 $request_uri =~ s/\/$//;
40 my @param = split(/\//, $request_uri);
41 return \@param;
42}
43