aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
authorlbsa712007-09-10 04:30:11 +0000
committerlbsa712007-09-10 04:30:11 +0000
commit7adc2212c7e92a46483934e060bb14194f3b0e38 (patch)
treed38b5d653c0952ae59e535d304eaa7fa1447b0dc /OpenSim/Framework
parentadded avatar updates for physics movement -- fixes gravity & avatar collision... (diff)
downloadopensim-SC-7adc2212c7e92a46483934e060bb14194f3b0e38.zip
opensim-SC-7adc2212c7e92a46483934e060bb14194f3b0e38.tar.gz
opensim-SC-7adc2212c7e92a46483934e060bb14194f3b0e38.tar.bz2
opensim-SC-7adc2212c7e92a46483934e060bb14194f3b0e38.tar.xz
* Fixed: Accessing xmlrpc with invalid xml data would crash the sim.
* Ignored some bins and gens
Diffstat (limited to 'OpenSim/Framework')
-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;