diff --git a/OpenSim.Framework/Util.cs b/OpenSim.Framework/Util.cs
index 440ce411ef..695cac9d3b 100644
--- a/OpenSim.Framework/Util.cs
+++ b/OpenSim.Framework/Util.cs
@@ -9,7 +9,7 @@ namespace OpenSim.Framework.Utilities
public class Util
{
private static Random randomClass = new Random();
- private static uint nextXferID = 10000;
+ private static uint nextXferID = 5000;
private static object XferLock = new object();
public static ulong UIntsToLong(uint X, uint Y)
diff --git a/OpenSim.RegionServer/AgentAssetUpload.cs b/OpenSim.RegionServer/AgentAssetUpload.cs
index 5d40c88f63..a482e80219 100644
--- a/OpenSim.RegionServer/AgentAssetUpload.cs
+++ b/OpenSim.RegionServer/AgentAssetUpload.cs
@@ -79,7 +79,6 @@ namespace OpenSim
}
- /* for now we will only support uploading of textures
else if (pack.AssetBlock.Type == 13 | pack.AssetBlock.Type == 5)
{
@@ -92,7 +91,7 @@ namespace OpenSim
asset.Data = pack.AssetBlock.AssetData;
- }*/
+ }
if (asset != null)
{
@@ -169,6 +168,22 @@ namespace OpenSim
#endregion
+ public AssetBase AddUploadToAssetCache(LLUUID transactionID)
+ {
+ AssetBase asset = null;
+ if(this.transactions.ContainsKey(transactionID))
+ {
+ AssetTransaction trans = this.transactions[transactionID];
+ if (trans.UploadComplete)
+ {
+ OpenSimRoot.Instance.AssetCache.AddAsset(trans.Asset);
+ asset = trans.Asset;
+ }
+ }
+
+ return asset;
+ }
+
public void CreateInventoryItem(CreateInventoryItemPacket packet)
{
if(this.transactions.ContainsKey(packet.InventoryBlock.TransactionID))
diff --git a/OpenSim.RegionServer/Assets/InventoryCache.cs b/OpenSim.RegionServer/Assets/InventoryCache.cs
index f50047a643..3a4aa367e1 100644
--- a/OpenSim.RegionServer/Assets/InventoryCache.cs
+++ b/OpenSim.RegionServer/Assets/InventoryCache.cs
@@ -57,6 +57,16 @@ namespace OpenSim.Assets
this._agentsInventory.Add(agentInventory.AgentID, agentInventory);
}
+ public AgentInventory GetAgentsInventory(LLUUID agentID)
+ {
+ if (this._agentsInventory.ContainsKey(agentID))
+ {
+ return this._agentsInventory[agentID];
+ }
+
+ return null;
+ }
+
public void ClientLeaving(LLUUID clientID)
{
if (this._agentsInventory.ContainsKey(clientID))
diff --git a/OpenSim.RegionServer/CAPS/SimHttp.cs b/OpenSim.RegionServer/CAPS/SimHttp.cs
index f5a87056ce..77c6bb877a 100644
--- a/OpenSim.RegionServer/CAPS/SimHttp.cs
+++ b/OpenSim.RegionServer/CAPS/SimHttp.cs
@@ -48,12 +48,17 @@ namespace OpenSim.CAPS
{
public Thread HTTPD;
public HttpListener Listener;
+ private string AdminPage;
+ private string NewAccountForm;
+ private string LoginForm;
+ private string passWord = "Admin";
public SimCAPSHTTPServer()
{
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Starting up HTTP Server");
HTTPD = new Thread(new ThreadStart(StartHTTP));
HTTPD.Start();
+ LoadAdminPage();
}
public void StartHTTP()
@@ -79,7 +84,7 @@ namespace OpenSim.CAPS
}
}
- static string ParseXMLRPC(string requestBody)
+ private string ParseXMLRPC(string requestBody)
{
try
{
@@ -111,19 +116,101 @@ namespace OpenSim.CAPS
return "";
}
- static string ParseREST(string requestBody, string requestURL)
+ private string ParseREST(string requestBody, string requestURL, string requestMethod)
{
- return "";
+ string responseString = "";
+ switch (requestURL)
+ {
+ case "/Admin/Accounts":
+ if (requestMethod == "GET")
+ {
+ responseString = "
Account management
";
+ responseString += "
";
+ responseString += " Create New Account
";
+ responseString += NewAccountForm;
+ }
+ break;
+ case "/Admin/Clients":
+ if (requestMethod == "GET")
+ {
+ responseString = " Listing connected Clients
" ;
+ OpenSim.world.Avatar TempAv;
+ foreach (libsecondlife.LLUUID UUID in OpenSimRoot.Instance.LocalWorld.Entities.Keys)
+ {
+ if (OpenSimRoot.Instance.LocalWorld.Entities[UUID].ToString() == "OpenSim.world.Avatar")
+ {
+ TempAv = (OpenSim.world.Avatar)OpenSimRoot.Instance.LocalWorld.Entities[UUID];
+ responseString += "";
+ responseString += String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}", TempAv.firstname, TempAv.lastname, UUID, TempAv.ControllingClient.SessionID, TempAv.ControllingClient.CircuitCode, TempAv.ControllingClient.userEP.ToString());
+ responseString += "
";
+ }
+ }
+ }
+ break;
+ case "/Admin/NewAccount":
+ if (requestMethod == "POST")
+ {
+ string[] comp = new string[10];
+ string[] passw = new string[3];
+ string delimStr = "&";
+ char[] delimiter = delimStr.ToCharArray();
+ string delimStr2 = "=";
+ char[] delimiter2 = delimStr2.ToCharArray();
+
+ //Console.WriteLine(requestBody);
+ comp = requestBody.Split(delimiter);
+ passw = comp[3].Split(delimiter2);
+ if (passw[1] == passWord)
+ {
+ responseString = " New Account created
";
+ }
+ else
+ {
+ responseString = " Admin password is incorrect, please login with the correct password
";
+ responseString += "
" + LoginForm;
+ }
+
+
+ }
+ break;
+ case "/Admin/Login":
+ if (requestMethod == "POST")
+ {
+ Console.WriteLine(requestBody);
+ if (requestBody == passWord)
+ {
+ responseString = " Login Successful
";
+ }
+ else
+ {
+ responseString = " PassWord Error
";
+ responseString += " Please Login with the correct password
";
+ responseString += "
" + LoginForm;
+ }
+ }
+ break;
+ case "/Admin/Welcome":
+ if (requestMethod == "GET")
+ {
+ responseString = "Welcome to the OpenSim Admin Page";
+ responseString += "
" + LoginForm;
+
+ }
+ break;
+ }
+
+ return responseString;
}
- static string ParseLLSDXML(string requestBody)
+ private string ParseLLSDXML(string requestBody)
{
// dummy function for now - IMPLEMENT ME!
return "";
}
- static void HandleRequest(Object stateinfo)
+ public void HandleRequest(Object stateinfo)
{
+ // Console.WriteLine("new http incoming");
HttpListenerContext context = (HttpListenerContext)stateinfo;
HttpListenerRequest request = context.Request;
@@ -140,6 +227,9 @@ namespace OpenSim.CAPS
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)
{
@@ -156,10 +246,26 @@ namespace OpenSim.CAPS
response.AddHeader("Content-type", "application/xml");
break;
- case null:
- // must be REST or invalid crap, so pass to the REST parser
- responseString = ParseREST(request.Url.OriginalString, requestBody);
+ 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/html");
break;
+
+ case null:
+ if ((request.HttpMethod == "GET") && (request.RawUrl == "/Admin"))
+ {
+ responseString = AdminPage;
+ response.AddHeader("Content-type", "text/html");
+ }
+ else
+ {
+ // must be REST or invalid crap, so pass to the REST parser
+ responseString = ParseREST(requestBody, request.RawUrl, request.HttpMethod);
+ response.AddHeader("Content-type", "text/html");
+ }
+ break;
+
}
byte[] buffer = System.Text.Encoding.UTF8.GetBytes(responseString);
@@ -169,6 +275,52 @@ namespace OpenSim.CAPS
output.Write(buffer, 0, buffer.Length);
output.Close();
}
+
+ private void LoadAdminPage()
+ {
+ try
+ {
+ StreamReader SR;
+ string lines;
+ AdminPage = "";
+ NewAccountForm = "";
+ LoginForm = "";
+ SR = File.OpenText("testadmin.htm");
+
+ while (!SR.EndOfStream)
+ {
+ lines = SR.ReadLine();
+ AdminPage += lines + "\n";
+
+ }
+ SR.Close();
+
+ SR = File.OpenText("newaccountform.htm");
+
+ while (!SR.EndOfStream)
+ {
+ lines = SR.ReadLine();
+ NewAccountForm += lines + "\n";
+
+ }
+ SR.Close();
+
+ SR = File.OpenText("login.htm");
+
+ while (!SR.EndOfStream)
+ {
+ lines = SR.ReadLine();
+ LoginForm += lines + "\n";
+
+ }
+ SR.Close();
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine(e.ToString());
+ }
+
+ }
}
diff --git a/OpenSim.RegionServer/SimClient.cs b/OpenSim.RegionServer/SimClient.cs
index dea385c360..811e8b8c08 100644
--- a/OpenSim.RegionServer/SimClient.cs
+++ b/OpenSim.RegionServer/SimClient.cs
@@ -287,7 +287,7 @@ namespace OpenSim
//this.UploadAssets.HandleUploadPacket(request, LLUUID.Random());
//}
//else
- //{*/
+ //{
this.UploadAssets.HandleUploadPacket(request, request.AssetBlock.TransactionID.Combine(this.SecureSessionID));
//}
break;
@@ -318,13 +318,25 @@ namespace OpenSim
OpenSimRoot.Instance.InventoryCache.FetchInventoryDescendents(this, Fetch);
break;
case PacketType.UpdateInventoryItem:
- /* UpdateInventoryItemPacket update = (UpdateInventoryItemPacket)Pack;
+ /*
+ UpdateInventoryItemPacket update = (UpdateInventoryItemPacket)Pack;
for (int i = 0; i < update.InventoryData.Length; i++)
{
if (update.InventoryData[i].TransactionID != LLUUID.Zero)
{
AssetBase asset = OpenSimRoot.Instance.AssetCache.GetAsset(update.InventoryData[i].TransactionID.Combine(this.SecureSessionID));
- OpenSimRoot.Instance.InventoryCache.UpdateInventoryItem(this, update.InventoryData[i].ItemID, asset);
+ if (asset != null)
+ {
+ OpenSimRoot.Instance.InventoryCache.UpdateInventoryItem(this, update.InventoryData[i].ItemID, asset);
+ }
+ else
+ {
+ asset = this.UploadAssets.AddUploadToAssetCache(update.InventoryData[i].TransactionID);
+ if (asset != null)
+ {
+ OpenSimRoot.Instance.InventoryCache.UpdateInventoryItem(this, update.InventoryData[i].ItemID, asset);
+ }
+ }
}
}*/
break;
diff --git a/bin/login.htm b/bin/login.htm
new file mode 100644
index 0000000000..2becee9970
--- /dev/null
+++ b/bin/login.htm
@@ -0,0 +1,5 @@
+
\ No newline at end of file
diff --git a/bin/newaccountform.htm b/bin/newaccountform.htm
new file mode 100644
index 0000000000..d21b9830ac
--- /dev/null
+++ b/bin/newaccountform.htm
@@ -0,0 +1,9 @@
+
\ No newline at end of file
diff --git a/bin/testadmin.htm b/bin/testadmin.htm
new file mode 100644
index 0000000000..4252ffd30e
--- /dev/null
+++ b/bin/testadmin.htm
@@ -0,0 +1,124 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+