diff options
-rw-r--r-- | OpenGridServices.UserServer/UserHttp.cs | 202 | ||||
-rw-r--r-- | OpenSim.Framework/AgentInventory.cs | 17 | ||||
-rw-r--r-- | OpenSim.RegionServer/AgentAssetUpload.cs | 1 | ||||
-rw-r--r-- | OpenSim.RegionServer/Assets/InventoryCache.cs | 20 | ||||
-rw-r--r-- | OpenSim.RegionServer/CAPS/AdminWebFront.cs | 2 | ||||
-rw-r--r-- | OpenSim.RegionServer/SimClient.cs | 10 |
6 files changed, 150 insertions, 102 deletions
diff --git a/OpenGridServices.UserServer/UserHttp.cs b/OpenGridServices.UserServer/UserHttp.cs index 4dc2358..6fe7fc1 100644 --- a/OpenGridServices.UserServer/UserHttp.cs +++ b/OpenGridServices.UserServer/UserHttp.cs | |||
@@ -44,102 +44,114 @@ using OpenSim.Framework.Console; | |||
44 | 44 | ||
45 | namespace OpenGridServices.UserServer | 45 | namespace OpenGridServices.UserServer |
46 | { | 46 | { |
47 | public class UserHTTPServer { | 47 | public class UserHTTPServer |
48 | public Thread HTTPD; | 48 | { |
49 | public HttpListener Listener; | 49 | public Thread HTTPD; |
50 | 50 | public HttpListener Listener; | |
51 | public UserHTTPServer() { | 51 | |
52 | MainConsole.Instance.WriteLine("Starting up HTTP Server"); | 52 | public UserHTTPServer() |
53 | HTTPD = new Thread(new ThreadStart(StartHTTP)); | 53 | { |
54 | HTTPD.Start(); | 54 | MainConsole.Instance.WriteLine("Starting up HTTP Server"); |
55 | } | 55 | HTTPD = new Thread(new ThreadStart(StartHTTP)); |
56 | 56 | HTTPD.Start(); | |
57 | public void StartHTTP() { | 57 | } |
58 | MainConsole.Instance.WriteLine("UserHttp.cs:StartHTTP() - Spawned main thread OK"); | 58 | |
59 | Listener = new HttpListener(); | 59 | public void StartHTTP() |
60 | 60 | { | |
61 | Listener.Prefixes.Add("http://+:8002/userserver/"); | 61 | MainConsole.Instance.WriteLine("UserHttp.cs:StartHTTP() - Spawned main thread OK"); |
62 | Listener.Prefixes.Add("http://+:8002/usersessions/"); | 62 | Listener = new HttpListener(); |
63 | Listener.Start(); | 63 | |
64 | 64 | Listener.Prefixes.Add("http://+:8002/userserver/"); | |
65 | HttpListenerContext context; | 65 | Listener.Prefixes.Add("http://+:8002/usersessions/"); |
66 | while(true) { | 66 | Listener.Start(); |
67 | context = Listener.GetContext(); | 67 | |
68 | ThreadPool.QueueUserWorkItem(new WaitCallback(HandleRequest), context); | 68 | HttpListenerContext context; |
69 | } | 69 | while (true) |
70 | } | 70 | { |
71 | 71 | context = Listener.GetContext(); | |
72 | static string ParseXMLRPC(string requestBody) { | 72 | ThreadPool.QueueUserWorkItem(new WaitCallback(HandleRequest), context); |
73 | } | ||
74 | } | ||
75 | |||
76 | static string ParseXMLRPC(string requestBody) | ||
77 | { | ||
73 | return OpenUser_Main.userserver._profilemanager.ParseXMLRPC(requestBody); | 78 | return OpenUser_Main.userserver._profilemanager.ParseXMLRPC(requestBody); |
74 | } | 79 | } |
75 | 80 | ||
76 | static string ParseREST(HttpListenerRequest www_req) { | 81 | static string ParseREST(HttpListenerRequest www_req) |
77 | Console.WriteLine("INCOMING REST - " + www_req.RawUrl); | 82 | { |
78 | 83 | Console.WriteLine("INCOMING REST - " + www_req.RawUrl); | |
79 | char[] splitter = {'/'}; | 84 | |
80 | string[] rest_params = www_req.RawUrl.Split(splitter); | 85 | char[] splitter = { '/' }; |
81 | string req_type = rest_params[1]; // First part of the URL is the type of request - usersessions/userprofiles/inventory/blabla | 86 | string[] rest_params = www_req.RawUrl.Split(splitter); |
82 | switch(req_type) { | 87 | string req_type = rest_params[1]; // First part of the URL is the type of request - usersessions/userprofiles/inventory/blabla |
83 | case "usersessions": | 88 | switch (req_type) |
84 | LLUUID sessionid = new LLUUID(rest_params[2]); // get usersessions/sessionid | 89 | { |
85 | if(www_req.HttpMethod=="DELETE") { | 90 | case "usersessions": |
86 | foreach (libsecondlife.LLUUID UUID in OpenUser_Main.userserver._profilemanager.UserProfiles.Keys) { | 91 | LLUUID sessionid = new LLUUID(rest_params[2]); // get usersessions/sessionid |
87 | if(OpenUser_Main.userserver._profilemanager.UserProfiles[UUID].CurrentSessionID==sessionid) { | 92 | if (www_req.HttpMethod == "DELETE") |
88 | OpenUser_Main.userserver._profilemanager.UserProfiles[UUID].CurrentSessionID=null; | 93 | { |
89 | OpenUser_Main.userserver._profilemanager.UserProfiles[UUID].CurrentSecureSessionID=null; | 94 | foreach (libsecondlife.LLUUID UUID in OpenUser_Main.userserver._profilemanager.UserProfiles.Keys) |
90 | OpenUser_Main.userserver._profilemanager.UserProfiles[UUID].Circuits.Clear(); | 95 | { |
91 | } | 96 | if (OpenUser_Main.userserver._profilemanager.UserProfiles[UUID].CurrentSessionID == sessionid) |
92 | } | 97 | { |
93 | 98 | OpenUser_Main.userserver._profilemanager.UserProfiles[UUID].CurrentSessionID = null; | |
94 | } | 99 | OpenUser_Main.userserver._profilemanager.UserProfiles[UUID].CurrentSecureSessionID = null; |
95 | return "OK"; | 100 | OpenUser_Main.userserver._profilemanager.UserProfiles[UUID].Circuits.Clear(); |
96 | } | 101 | } |
97 | 102 | } | |
98 | return ""; | 103 | |
99 | } | 104 | } |
100 | 105 | return "OK"; | |
101 | 106 | } | |
102 | static void HandleRequest(Object stateinfo) { | 107 | |
103 | HttpListenerContext context=(HttpListenerContext)stateinfo; | 108 | return ""; |
104 | 109 | } | |
105 | HttpListenerRequest request = context.Request; | 110 | |
106 | HttpListenerResponse response = context.Response; | 111 | |
107 | 112 | static void HandleRequest(Object stateinfo) | |
108 | response.KeepAlive=false; | 113 | { |
109 | response.SendChunked=false; | 114 | HttpListenerContext context = (HttpListenerContext)stateinfo; |
110 | 115 | ||
111 | System.IO.Stream body = request.InputStream; | 116 | HttpListenerRequest request = context.Request; |
112 | System.Text.Encoding encoding = System.Text.Encoding.UTF8; | 117 | HttpListenerResponse response = context.Response; |
113 | System.IO.StreamReader reader = new System.IO.StreamReader(body, encoding); | 118 | |
114 | 119 | response.KeepAlive = false; | |
115 | string requestBody = reader.ReadToEnd(); | 120 | response.SendChunked = false; |
116 | body.Close(); | 121 | |
117 | reader.Close(); | 122 | System.IO.Stream body = request.InputStream; |
118 | 123 | System.Text.Encoding encoding = System.Text.Encoding.UTF8; | |
119 | string responseString=""; | 124 | System.IO.StreamReader reader = new System.IO.StreamReader(body, encoding); |
120 | switch(request.ContentType) { | 125 | |
121 | case "text/xml": | 126 | string requestBody = reader.ReadToEnd(); |
122 | // must be XML-RPC, so pass to the XML-RPC parser | 127 | body.Close(); |
123 | 128 | reader.Close(); | |
124 | responseString=ParseXMLRPC(requestBody); | 129 | |
125 | response.AddHeader("Content-type","text/xml"); | 130 | string responseString = ""; |
126 | break; | 131 | switch (request.ContentType) |
127 | 132 | { | |
128 | case "text/plaintext": | 133 | case "text/xml": |
129 | responseString=ParseREST(request); | 134 | // must be XML-RPC, so pass to the XML-RPC parser |
130 | response.AddHeader("Content-type","text/plaintext"); | 135 | |
131 | break; | 136 | responseString = ParseXMLRPC(requestBody); |
132 | } | 137 | response.AddHeader("Content-type", "text/xml"); |
133 | 138 | break; | |
134 | 139 | ||
135 | byte[] buffer = System.Text.Encoding.UTF8.GetBytes(responseString); | 140 | case "text/plaintext": |
136 | System.IO.Stream output = response.OutputStream; | 141 | responseString = ParseREST(request); |
137 | response.SendChunked=false; | 142 | response.AddHeader("Content-type", "text/plaintext"); |
138 | response.ContentLength64=buffer.Length; | 143 | break; |
139 | output.Write(buffer,0,buffer.Length); | 144 | } |
140 | output.Close(); | 145 | |
141 | } | 146 | |
142 | } | 147 | byte[] buffer = System.Text.Encoding.UTF8.GetBytes(responseString); |
148 | System.IO.Stream output = response.OutputStream; | ||
149 | response.SendChunked = false; | ||
150 | response.ContentLength64 = buffer.Length; | ||
151 | output.Write(buffer, 0, buffer.Length); | ||
152 | output.Close(); | ||
153 | } | ||
154 | } | ||
143 | 155 | ||
144 | 156 | ||
145 | } | 157 | } |
diff --git a/OpenSim.Framework/AgentInventory.cs b/OpenSim.Framework/AgentInventory.cs index 8032455..f1f5847 100644 --- a/OpenSim.Framework/AgentInventory.cs +++ b/OpenSim.Framework/AgentInventory.cs | |||
@@ -2,6 +2,7 @@ using System; | |||
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using libsecondlife; | 4 | using libsecondlife; |
5 | using libsecondlife.Packets; | ||
5 | using OpenSim.Framework.Assets; | 6 | using OpenSim.Framework.Assets; |
6 | 7 | ||
7 | namespace OpenSim.Framework.Inventory | 8 | namespace OpenSim.Framework.Inventory |
@@ -105,7 +106,7 @@ namespace OpenSim.Framework.Inventory | |||
105 | return false; | 106 | return false; |
106 | } | 107 | } |
107 | 108 | ||
108 | public bool UpdateItem(LLUUID itemID, AssetBase asset) | 109 | public bool UpdateItemAsset(LLUUID itemID, AssetBase asset) |
109 | { | 110 | { |
110 | if(this.InventoryItems.ContainsKey(itemID)) | 111 | if(this.InventoryItems.ContainsKey(itemID)) |
111 | { | 112 | { |
@@ -117,6 +118,20 @@ namespace OpenSim.Framework.Inventory | |||
117 | return true; | 118 | return true; |
118 | } | 119 | } |
119 | 120 | ||
121 | public bool UpdateItemDetails(LLUUID itemID, UpdateInventoryItemPacket.InventoryDataBlock packet) | ||
122 | { | ||
123 | Console.WriteLine("updating inventory item details"); | ||
124 | if (this.InventoryItems.ContainsKey(itemID)) | ||
125 | { | ||
126 | Console.WriteLine("changing name to "+ Helpers.FieldToString(packet.Name)); | ||
127 | InventoryItem Item = this.InventoryItems[itemID]; | ||
128 | Item.Name = Helpers.FieldToString(packet.Name); | ||
129 | Console.WriteLine("updated inventory item " + itemID.ToStringHyphenated()); | ||
130 | //TODO need to update the rest of the info | ||
131 | } | ||
132 | return true; | ||
133 | } | ||
134 | |||
120 | public LLUUID AddToInventory(LLUUID folderID, AssetBase asset) | 135 | public LLUUID AddToInventory(LLUUID folderID, AssetBase asset) |
121 | { | 136 | { |
122 | if (this.InventoryFolders.ContainsKey(folderID)) | 137 | if (this.InventoryFolders.ContainsKey(folderID)) |
diff --git a/OpenSim.RegionServer/AgentAssetUpload.cs b/OpenSim.RegionServer/AgentAssetUpload.cs index dae2191..bf8531a 100644 --- a/OpenSim.RegionServer/AgentAssetUpload.cs +++ b/OpenSim.RegionServer/AgentAssetUpload.cs | |||
@@ -197,6 +197,7 @@ namespace OpenSim | |||
197 | trans.Asset.Description = Helpers.FieldToString(packet.InventoryBlock.Description); | 197 | trans.Asset.Description = Helpers.FieldToString(packet.InventoryBlock.Description); |
198 | trans.Asset.Name = Helpers.FieldToString(packet.InventoryBlock.Name); | 198 | trans.Asset.Name = Helpers.FieldToString(packet.InventoryBlock.Name); |
199 | trans.Asset.Type = packet.InventoryBlock.Type; | 199 | trans.Asset.Type = packet.InventoryBlock.Type; |
200 | trans.Asset.InvType = packet.InventoryBlock.InvType; | ||
200 | if (trans.UploadComplete) | 201 | if (trans.UploadComplete) |
201 | { | 202 | { |
202 | //already complete so we can add it to the inventory | 203 | //already complete so we can add it to the inventory |
diff --git a/OpenSim.RegionServer/Assets/InventoryCache.cs b/OpenSim.RegionServer/Assets/InventoryCache.cs index cc7cc29..c62975a 100644 --- a/OpenSim.RegionServer/Assets/InventoryCache.cs +++ b/OpenSim.RegionServer/Assets/InventoryCache.cs | |||
@@ -141,11 +141,27 @@ namespace OpenSim.Assets | |||
141 | return newItem; | 141 | return newItem; |
142 | } | 142 | } |
143 | 143 | ||
144 | public bool UpdateInventoryItem(SimClient remoteClient, LLUUID itemID, OpenSim.Framework.Assets.AssetBase asset) | 144 | public bool UpdateInventoryItemAsset(SimClient remoteClient, LLUUID itemID, OpenSim.Framework.Assets.AssetBase asset) |
145 | { | 145 | { |
146 | if (this._agentsInventory.ContainsKey(remoteClient.AgentID)) | 146 | if (this._agentsInventory.ContainsKey(remoteClient.AgentID)) |
147 | { | 147 | { |
148 | bool res = _agentsInventory[remoteClient.AgentID].UpdateItem(itemID, asset); | 148 | bool res = _agentsInventory[remoteClient.AgentID].UpdateItemAsset(itemID, asset); |
149 | if (res) | ||
150 | { | ||
151 | InventoryItem Item = this._agentsInventory[remoteClient.AgentID].InventoryItems[itemID]; | ||
152 | this.SendItemUpdateCreate(remoteClient, Item); | ||
153 | } | ||
154 | return res; | ||
155 | } | ||
156 | |||
157 | return false; | ||
158 | } | ||
159 | |||
160 | public bool UpdateInventoryItemDetails(SimClient remoteClient, LLUUID itemID, UpdateInventoryItemPacket.InventoryDataBlock packet) | ||
161 | { | ||
162 | if (this._agentsInventory.ContainsKey(remoteClient.AgentID)) | ||
163 | { | ||
164 | bool res = _agentsInventory[remoteClient.AgentID].UpdateItemDetails(itemID, packet); | ||
149 | if (res) | 165 | if (res) |
150 | { | 166 | { |
151 | InventoryItem Item = this._agentsInventory[remoteClient.AgentID].InventoryItems[itemID]; | 167 | InventoryItem Item = this._agentsInventory[remoteClient.AgentID].InventoryItems[itemID]; |
diff --git a/OpenSim.RegionServer/CAPS/AdminWebFront.cs b/OpenSim.RegionServer/CAPS/AdminWebFront.cs index 6473878..4995e54 100644 --- a/OpenSim.RegionServer/CAPS/AdminWebFront.cs +++ b/OpenSim.RegionServer/CAPS/AdminWebFront.cs | |||
@@ -78,7 +78,7 @@ namespace OpenSim.CAPS | |||
78 | //Console.WriteLine(requestBody); | 78 | //Console.WriteLine(requestBody); |
79 | comp = requestBody.Split(delimiter); | 79 | comp = requestBody.Split(delimiter); |
80 | passw = comp[3].Split(delimiter2); | 80 | passw = comp[3].Split(delimiter2); |
81 | if (passw[1] == passWord) | 81 | if (passw[1] == passWord) // check admin password is correct |
82 | { | 82 | { |
83 | 83 | ||
84 | line = comp[0].Split(delimiter2); //split firstname | 84 | line = comp[0].Split(delimiter2); //split firstname |
diff --git a/OpenSim.RegionServer/SimClient.cs b/OpenSim.RegionServer/SimClient.cs index 068e148..ec6d3dc 100644 --- a/OpenSim.RegionServer/SimClient.cs +++ b/OpenSim.RegionServer/SimClient.cs | |||
@@ -49,7 +49,6 @@ namespace OpenSim | |||
49 | /// </summary> | 49 | /// </summary> |
50 | public class SimClient | 50 | public class SimClient |
51 | { | 51 | { |
52 | |||
53 | public LLUUID AgentID; | 52 | public LLUUID AgentID; |
54 | public LLUUID SessionID; | 53 | public LLUUID SessionID; |
55 | public LLUUID SecureSessionID = LLUUID.Zero; | 54 | public LLUUID SecureSessionID = LLUUID.Zero; |
@@ -354,6 +353,7 @@ namespace OpenSim | |||
354 | break; | 353 | break; |
355 | case PacketType.UpdateInventoryItem: | 354 | case PacketType.UpdateInventoryItem: |
356 | UpdateInventoryItemPacket update = (UpdateInventoryItemPacket)Pack; | 355 | UpdateInventoryItemPacket update = (UpdateInventoryItemPacket)Pack; |
356 | Console.WriteLine(Pack.ToString()); | ||
357 | for (int i = 0; i < update.InventoryData.Length; i++) | 357 | for (int i = 0; i < update.InventoryData.Length; i++) |
358 | { | 358 | { |
359 | if (update.InventoryData[i].TransactionID != LLUUID.Zero) | 359 | if (update.InventoryData[i].TransactionID != LLUUID.Zero) |
@@ -362,7 +362,7 @@ namespace OpenSim | |||
362 | if (asset != null) | 362 | if (asset != null) |
363 | { | 363 | { |
364 | Console.WriteLine("updating inventory item, found asset" + asset.FullID.ToStringHyphenated() + " already in cache"); | 364 | Console.WriteLine("updating inventory item, found asset" + asset.FullID.ToStringHyphenated() + " already in cache"); |
365 | m_inventoryCache.UpdateInventoryItem(this, update.InventoryData[i].ItemID, asset); | 365 | m_inventoryCache.UpdateInventoryItemAsset(this, update.InventoryData[i].ItemID, asset); |
366 | } | 366 | } |
367 | else | 367 | else |
368 | { | 368 | { |
@@ -370,7 +370,7 @@ namespace OpenSim | |||
370 | if (asset != null) | 370 | if (asset != null) |
371 | { | 371 | { |
372 | Console.WriteLine("updating inventory item, adding asset" + asset.FullID.ToStringHyphenated() + " to cache"); | 372 | Console.WriteLine("updating inventory item, adding asset" + asset.FullID.ToStringHyphenated() + " to cache"); |
373 | m_inventoryCache.UpdateInventoryItem(this, update.InventoryData[i].ItemID, asset); | 373 | m_inventoryCache.UpdateInventoryItemAsset(this, update.InventoryData[i].ItemID, asset); |
374 | } | 374 | } |
375 | else | 375 | else |
376 | { | 376 | { |
@@ -378,6 +378,10 @@ namespace OpenSim | |||
378 | } | 378 | } |
379 | } | 379 | } |
380 | } | 380 | } |
381 | else | ||
382 | { | ||
383 | m_inventoryCache.UpdateInventoryItemDetails(this, update.InventoryData[i].ItemID, update.InventoryData[i]); ; | ||
384 | } | ||
381 | } | 385 | } |
382 | break; | 386 | break; |
383 | case PacketType.ViewerEffect: | 387 | case PacketType.ViewerEffect: |