aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Servers/BaseHttpServer.cs48
1 files changed, 31 insertions, 17 deletions
diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs
index 4eb776e..c3cf5e1 100644
--- a/OpenSim/Framework/Servers/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/BaseHttpServer.cs
@@ -35,6 +35,7 @@ using System.Text.RegularExpressions;
35using System.Threading; 35using System.Threading;
36using Nwc.XmlRpc; 36using Nwc.XmlRpc;
37using OpenSim.Framework.Console; 37using OpenSim.Framework.Console;
38using System.Xml;
38 39
39namespace OpenSim.Framework.Servers 40namespace OpenSim.Framework.Servers
40{ 41{
@@ -153,31 +154,44 @@ namespace OpenSim.Framework.Servers
153 reader.Close(); 154 reader.Close();
154 requestStream.Close(); 155 requestStream.Close();
155 156
156 XmlRpcRequest xmlRprcRequest = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(requestBody); 157 string responseString = String.Empty;
158 XmlRpcRequest xmlRprcRequest = null;
157 159
158 string methodName = xmlRprcRequest.MethodName; 160 try
159
160 XmlRpcResponse xmlRpcResponse;
161
162 XmlRpcMethod method;
163 if (this.m_rpcHandlers.TryGetValue(methodName, out method))
164 { 161 {
165 xmlRpcResponse = method(xmlRprcRequest); 162 xmlRprcRequest = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(requestBody);
166 } 163 }
167 else 164 catch ( XmlException e )
165 {
166 responseString = String.Format( "XmlException:\n{0}",e.Message );
167 }
168
169 if (xmlRprcRequest != null)
168 { 170 {
169 xmlRpcResponse = new XmlRpcResponse(); 171 string methodName = xmlRprcRequest.MethodName;
170 Hashtable unknownMethodError = new Hashtable(); 172
171 unknownMethodError["reason"] = "XmlRequest"; ; 173 XmlRpcResponse xmlRpcResponse;
172 unknownMethodError["message"] = "Unknown Rpc Request ["+methodName+"]"; 174
173 unknownMethodError["login"] = "false"; 175 XmlRpcMethod method;
174 xmlRpcResponse.Value = unknownMethodError; 176 if (this.m_rpcHandlers.TryGetValue(methodName, out method))
177 {
178 xmlRpcResponse = method(xmlRprcRequest);
179 }
180 else
181 {
182 xmlRpcResponse = new XmlRpcResponse();
183 Hashtable unknownMethodError = new Hashtable();
184 unknownMethodError["reason"] = "XmlRequest"; ;
185 unknownMethodError["message"] = "Unknown Rpc Request [" + methodName + "]";
186 unknownMethodError["login"] = "false";
187 xmlRpcResponse.Value = unknownMethodError;
188 }
189
190 responseString = XmlRpcResponseSerializer.Singleton.Serialize(xmlRpcResponse);
175 } 191 }
176 192
177 response.AddHeader("Content-type", "text/xml"); 193 response.AddHeader("Content-type", "text/xml");
178 194
179 string responseString = XmlRpcResponseSerializer.Singleton.Serialize(xmlRpcResponse);
180
181 byte[] buffer = Encoding.UTF8.GetBytes(responseString); 195 byte[] buffer = Encoding.UTF8.GetBytes(responseString);
182 196
183 response.SendChunked = false; 197 response.SendChunked = false;