diff options
Diffstat (limited to 'share/perl/asset.cgi')
-rw-r--r-- | share/perl/asset.cgi | 43 |
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 | |||
3 | use strict; | ||
4 | use Carp; | ||
5 | use MyCGI; | ||
6 | use OpenSim::Config; | ||
7 | use OpenSim::Utility; | ||
8 | use OpenSim::AssetServer; | ||
9 | |||
10 | # !! | ||
11 | # TODO: ERROR code | ||
12 | # | ||
13 | my $param = &MyCGI::getParam(); | ||
14 | my $response = "<ERROR />"; | ||
15 | if ($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 | |||
36 | sub 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 | |||