diff options
Added some error handling (and console output) to BaseHttpServer.
a few other bits of refactoring.
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r-- | OpenSim/Framework/Servers/BaseHttpServer.cs | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs index e645e7b..baf5add 100644 --- a/OpenSim/Framework/Servers/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/BaseHttpServer.cs | |||
@@ -185,26 +185,34 @@ namespace OpenSim.Framework.Servers | |||
185 | if (xmlRprcRequest != null) | 185 | if (xmlRprcRequest != null) |
186 | { | 186 | { |
187 | string methodName = xmlRprcRequest.MethodName; | 187 | string methodName = xmlRprcRequest.MethodName; |
188 | if (methodName != null) | ||
189 | { | ||
188 | 190 | ||
189 | XmlRpcResponse xmlRpcResponse; | 191 | XmlRpcResponse xmlRpcResponse; |
190 | 192 | ||
191 | XmlRpcMethod method; | 193 | XmlRpcMethod method; |
192 | if (m_rpcHandlers.TryGetValue(methodName, out method)) | 194 | if (m_rpcHandlers.TryGetValue(methodName, out method)) |
193 | { | 195 | { |
194 | xmlRpcResponse = method(xmlRprcRequest); | 196 | xmlRpcResponse = method(xmlRprcRequest); |
197 | } | ||
198 | else | ||
199 | { | ||
200 | xmlRpcResponse = new XmlRpcResponse(); | ||
201 | Hashtable unknownMethodError = new Hashtable(); | ||
202 | unknownMethodError["reason"] = "XmlRequest"; | ||
203 | ; | ||
204 | unknownMethodError["message"] = "Unknown Rpc Request [" + methodName + "]"; | ||
205 | unknownMethodError["login"] = "false"; | ||
206 | xmlRpcResponse.Value = unknownMethodError; | ||
207 | } | ||
208 | |||
209 | responseString = XmlRpcResponseSerializer.Singleton.Serialize(xmlRpcResponse); | ||
195 | } | 210 | } |
196 | else | 211 | else |
197 | { | 212 | { |
198 | xmlRpcResponse = new XmlRpcResponse(); | 213 | System.Console.WriteLine("Handler not found for http request " +request.RawUrl); |
199 | Hashtable unknownMethodError = new Hashtable(); | 214 | responseString = "Error"; |
200 | unknownMethodError["reason"] = "XmlRequest"; | ||
201 | ; | ||
202 | unknownMethodError["message"] = "Unknown Rpc Request [" + methodName + "]"; | ||
203 | unknownMethodError["login"] = "false"; | ||
204 | xmlRpcResponse.Value = unknownMethodError; | ||
205 | } | 215 | } |
206 | |||
207 | responseString = XmlRpcResponseSerializer.Singleton.Serialize(xmlRpcResponse); | ||
208 | } | 216 | } |
209 | 217 | ||
210 | response.AddHeader("Content-type", "text/xml"); | 218 | response.AddHeader("Content-type", "text/xml"); |