aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/share/perl/asset.cgi
diff options
context:
space:
mode:
authorAdam Frisby2008-03-25 16:29:54 +0000
committerAdam Frisby2008-03-25 16:29:54 +0000
commit8c05b81d6860d8e0da4098cc6f59f630d7c53037 (patch)
tree3325e09660ee8ad5a12cc19c8da6c4bd8bff5c21 /share/perl/asset.cgi
parent* On Ray casting. Now returning the face normal of the collision face. (diff)
downloadopensim-SC-8c05b81d6860d8e0da4098cc6f59f630d7c53037.zip
opensim-SC-8c05b81d6860d8e0da4098cc6f59f630d7c53037.tar.gz
opensim-SC-8c05b81d6860d8e0da4098cc6f59f630d7c53037.tar.bz2
opensim-SC-8c05b81d6860d8e0da4098cc6f59f630d7c53037.tar.xz
* Committing Lulurun's Cgi/Perl implementation of the UGAI servers.
* I love you long time.
Diffstat (limited to 'share/perl/asset.cgi')
-rw-r--r--share/perl/asset.cgi43
1 files changed, 43 insertions, 0 deletions
diff --git a/share/perl/asset.cgi b/share/perl/asset.cgi
new file mode 100644
index 0000000..318e06f
--- /dev/null
+++ b/share/perl/asset.cgi
@@ -0,0 +1,43 @@
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