From 6a2588454a1ac4bb484ad0b9ee648e9ac156f8db Mon Sep 17 00:00:00 2001
From: lbsa71
Date: Wed, 4 Jul 2007 14:12:32 +0000
Subject: * Removed AssetHttpServer, using BaseHttpServer instead * Removed
legacy REST handling * Created two custom IStreamHandlers for asset
up/download * Removed quite a lot of double and triple encodings, trying to
work towards binary only and direct write into storage. * Introduced
BaseStreamHandler with GetParam() and some other goodies
---
OpenSim/Grid/AssetServer/AssetHttpServer.cs | 125 ----------------------------
1 file changed, 125 deletions(-)
delete mode 100644 OpenSim/Grid/AssetServer/AssetHttpServer.cs
(limited to 'OpenSim/Grid/AssetServer/AssetHttpServer.cs')
diff --git a/OpenSim/Grid/AssetServer/AssetHttpServer.cs b/OpenSim/Grid/AssetServer/AssetHttpServer.cs
deleted file mode 100644
index 9546891..0000000
--- a/OpenSim/Grid/AssetServer/AssetHttpServer.cs
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
-* Copyright (c) Contributors, http://www.openmetaverse.org/
-* See CONTRIBUTORS.TXT for a full list of copyright holders.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-* * Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-* * Redistributions in binary form must reproduce the above copyright
-* notice, this list of conditions and the following disclaimer in the
-* documentation and/or other materials provided with the distribution.
-* * Neither the name of the OpenSim Project nor the
-* names of its contributors may be used to endorse or promote products
-* derived from this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
-* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
-* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*
-*/
-using System;
-using System.IO;
-using System.Net;
-using System.Text;
-using System.Text.RegularExpressions;
-using OpenSim.Framework.Servers;
-
-namespace OpenSim.Grid.AssetServer
-{
- ///
- /// An HTTP server for sending assets
- ///
- public class AssetHttpServer :BaseHttpServer
- {
- ///
- /// Creates the new asset server
- ///
- /// Port to initalise on
- public AssetHttpServer(int port)
- : base(port)
- {
- }
-
- ///
- /// Handles an HTTP request
- ///
- /// HTTP State Info
- public override void HandleRequest(Object stateinfo)
- {
- try
- {
- HttpListenerContext context = (HttpListenerContext)stateinfo;
-
- HttpListenerRequest request = context.Request;
- HttpListenerResponse response = context.Response;
-
- response.KeepAlive = false;
- response.SendChunked = false;
-
- Stream body = request.InputStream;
- Encoding encoding = Encoding.UTF8;
- StreamReader reader = new StreamReader(body, encoding);
-
- string requestBody = reader.ReadToEnd();
- body.Close();
- reader.Close();
-
- //Console.WriteLine(request.HttpMethod + " " + request.RawUrl + " Http/" + request.ProtocolVersion.ToString() + " content type: " + request.ContentType);
- //Console.WriteLine(requestBody);
-
- string responseString = "";
- switch (request.ContentType)
- {
- case "text/xml":
- // must be XML-RPC, so pass to the XML-RPC parser
-
- responseString = ParseXMLRPC(requestBody);
- responseString = Regex.Replace(responseString, "utf-16", "utf-8");
-
- response.AddHeader("Content-type", "text/xml");
- break;
-
- case "application/xml":
- // probably LLSD we hope, otherwise it should be ignored by the parser
- responseString = ParseREST(requestBody, request.RawUrl, request.HttpMethod);
- response.AddHeader("Content-type", "application/xml");
- break;
-
- case "application/x-www-form-urlencoded":
- // a form data POST so send to the REST parser
- responseString = ParseREST(requestBody, request.RawUrl, request.HttpMethod);
- response.AddHeader("Content-type", "text/plain");
- break;
-
- case null:
- // must be REST or invalid crap, so pass to the REST parser
- responseString = ParseREST(requestBody, request.RawUrl, request.HttpMethod);
- response.AddHeader("Content-type", "text/plain");
- break;
-
- }
-
- Encoding Windows1252Encoding = Encoding.GetEncoding(1252);
- byte[] buffer = Windows1252Encoding.GetBytes(responseString);
- Stream output = response.OutputStream;
- response.SendChunked = false;
- response.ContentLength64 = buffer.Length;
- output.Write(buffer, 0, buffer.Length);
- output.Close();
- }
- catch (Exception e)
- {
- Console.WriteLine(e.ToString());
- }
- }
-
- }
-}
--
cgit v1.1