aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Server
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Server/Handlers/Simulation/AgentHandlers.cs61
1 files changed, 2 insertions, 59 deletions
diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
index 40a34c6..17a8ef4 100644
--- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
+++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
@@ -90,12 +90,7 @@ namespace OpenSim.Server.Handlers.Simulation
90 90
91 // Next, let's parse the verb 91 // Next, let's parse the verb
92 string method = (string)request["http-method"]; 92 string method = (string)request["http-method"];
93 if (method.Equals("GET")) 93 if (method.Equals("DELETE"))
94 {
95 DoAgentGet(request, responsedata, agentID, regionID);
96 return responsedata;
97 }
98 else if (method.Equals("DELETE"))
99 { 94 {
100 DoAgentDelete(request, responsedata, agentID, action, regionID); 95 DoAgentDelete(request, responsedata, agentID, action, regionID);
101 return responsedata; 96 return responsedata;
@@ -107,7 +102,7 @@ namespace OpenSim.Server.Handlers.Simulation
107 } 102 }
108 else 103 else
109 { 104 {
110 m_log.InfoFormat("[AGENT HANDLER]: method {0} not supported in agent message (caller is {1})", method, Util.GetCallerIP(request)); 105 m_log.ErrorFormat("[AGENT HANDLER]: method {0} not supported in agent message {1} (caller is {2})", method, (string)request["uri"], Util.GetCallerIP(request));
111 responsedata["int_response_code"] = HttpStatusCode.MethodNotAllowed; 106 responsedata["int_response_code"] = HttpStatusCode.MethodNotAllowed;
112 responsedata["str_response_string"] = "Method not allowed"; 107 responsedata["str_response_string"] = "Method not allowed";
113 108
@@ -156,58 +151,6 @@ namespace OpenSim.Server.Handlers.Simulation
156// Console.WriteLine("str_response_string [{0}]", responsedata["str_response_string"]); 151// Console.WriteLine("str_response_string [{0}]", responsedata["str_response_string"]);
157 } 152 }
158 153
159 protected virtual void DoAgentGet(Hashtable request, Hashtable responsedata, UUID id, UUID regionID)
160 {
161 if (m_SimulationService == null)
162 {
163 m_log.Debug("[AGENT HANDLER]: Agent GET called. Harmless but useless.");
164 responsedata["content_type"] = "application/json";
165 responsedata["int_response_code"] = HttpStatusCode.NotImplemented;
166 responsedata["str_response_string"] = string.Empty;
167
168 return;
169 }
170
171 GridRegion destination = new GridRegion();
172 destination.RegionID = regionID;
173
174 IAgentData agent = null;
175 bool result = m_SimulationService.RetrieveAgent(destination, id, out agent);
176 OSDMap map = null;
177 if (result)
178 {
179 if (agent != null) // just to make sure
180 {
181 map = agent.Pack();
182 string strBuffer = "";
183 try
184 {
185 strBuffer = OSDParser.SerializeJsonString(map);
186 }
187 catch (Exception e)
188 {
189 m_log.WarnFormat("[AGENT HANDLER]: Exception thrown on serialization of DoAgentGet: {0}", e.Message);
190 responsedata["int_response_code"] = HttpStatusCode.InternalServerError;
191 // ignore. buffer will be empty, caller should check.
192 }
193
194 responsedata["content_type"] = "application/json";
195 responsedata["int_response_code"] = HttpStatusCode.OK;
196 responsedata["str_response_string"] = strBuffer;
197 }
198 else
199 {
200 responsedata["int_response_code"] = HttpStatusCode.InternalServerError;
201 responsedata["str_response_string"] = "Internal error";
202 }
203 }
204 else
205 {
206 responsedata["int_response_code"] = HttpStatusCode.NotFound;
207 responsedata["str_response_string"] = "Not Found";
208 }
209 }
210
211 protected void DoAgentDelete(Hashtable request, Hashtable responsedata, UUID id, string action, UUID regionID) 154 protected void DoAgentDelete(Hashtable request, Hashtable responsedata, UUID id, string action, UUID regionID)
212 { 155 {
213 m_log.Debug(" >>> DoDelete action:" + action + "; RegionID:" + regionID); 156 m_log.Debug(" >>> DoDelete action:" + action + "; RegionID:" + regionID);