aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Servers/OSHttpXmlRpcHandler.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Servers/OSHttpXmlRpcHandler.cs')
-rw-r--r--OpenSim/Framework/Servers/OSHttpXmlRpcHandler.cs28
1 files changed, 14 insertions, 14 deletions
diff --git a/OpenSim/Framework/Servers/OSHttpXmlRpcHandler.cs b/OpenSim/Framework/Servers/OSHttpXmlRpcHandler.cs
index f3f056a..996e5dc 100644
--- a/OpenSim/Framework/Servers/OSHttpXmlRpcHandler.cs
+++ b/OpenSim/Framework/Servers/OSHttpXmlRpcHandler.cs
@@ -54,16 +54,16 @@ namespace OpenSim.Framework.Servers
54 protected bool XmlRpcMethodMatch(OSHttpRequest req) 54 protected bool XmlRpcMethodMatch(OSHttpRequest req)
55 { 55 {
56 XmlRpcRequest xmlRpcRequest = null; 56 XmlRpcRequest xmlRpcRequest = null;
57 57
58 // check whether req is already reified 58 // check whether req is already reified
59 // if not: reify (and post to whiteboard) 59 // if not: reify (and post to whiteboard)
60 try 60 try
61 { 61 {
62 if (req.Whiteboard.ContainsKey("xmlrequest")) 62 if (req.Whiteboard.ContainsKey("xmlrequest"))
63 { 63 {
64 xmlRpcRequest = req.Whiteboard["xmlrequest"] as XmlRpcRequest; 64 xmlRpcRequest = req.Whiteboard["xmlrequest"] as XmlRpcRequest;
65 } 65 }
66 else 66 else
67 { 67 {
68 StreamReader body = new StreamReader(req.InputStream); 68 StreamReader body = new StreamReader(req.InputStream);
69 string requestBody = body.ReadToEnd(); 69 string requestBody = body.ReadToEnd();
@@ -76,22 +76,22 @@ namespace OpenSim.Framework.Servers
76 _log.ErrorFormat("[OSHttpXmlRpcHandler] failed to deserialize XmlRpcRequest from {0}", req.ToString()); 76 _log.ErrorFormat("[OSHttpXmlRpcHandler] failed to deserialize XmlRpcRequest from {0}", req.ToString());
77 return false; 77 return false;
78 } 78 }
79 79
80 // check against methodName 80 // check against methodName
81 if ((null != xmlRpcRequest) 81 if ((null != xmlRpcRequest)
82 && !String.IsNullOrEmpty(xmlRpcRequest.MethodName) 82 && !String.IsNullOrEmpty(xmlRpcRequest.MethodName)
83 && xmlRpcRequest.MethodName == _methodName) 83 && xmlRpcRequest.MethodName == _methodName)
84 { 84 {
85 _log.DebugFormat("[OSHttpXmlRpcHandler] located handler {0} for {1}", _methodName, req.ToString()); 85 _log.DebugFormat("[OSHttpXmlRpcHandler] located handler {0} for {1}", _methodName, req.ToString());
86 return true; 86 return true;
87 } 87 }
88 88
89 return false; 89 return false;
90 } 90 }
91 91
92 // contains handler for processing XmlRpc Request 92 // contains handler for processing XmlRpc Request
93 private XmlRpcMethod _handler; 93 private XmlRpcMethod _handler;
94 94
95 // contains XmlRpc method name 95 // contains XmlRpc method name
96 private string _methodName; 96 private string _methodName;
97 97
@@ -112,9 +112,9 @@ namespace OpenSim.Framework.Servers
112 /// can be null, in which case they are not taken into account 112 /// can be null, in which case they are not taken into account
113 /// when the handler is being looked up. 113 /// when the handler is being looked up.
114 /// </remarks> 114 /// </remarks>
115 public OSHttpXmlRpcHandler(XmlRpcMethod handler, string methodName, Regex path, 115 public OSHttpXmlRpcHandler(XmlRpcMethod handler, string methodName, Regex path,
116 Dictionary<string, Regex> headers, Regex whitelist) 116 Dictionary<string, Regex> headers, Regex whitelist)
117 : base(new Regex(@"^POST$", RegexOptions.IgnoreCase | RegexOptions.Compiled), path, null, headers, 117 : base(new Regex(@"^POST$", RegexOptions.IgnoreCase | RegexOptions.Compiled), path, null, headers,
118 new Regex(@"^(text|application)/xml", RegexOptions.IgnoreCase | RegexOptions.Compiled), 118 new Regex(@"^(text|application)/xml", RegexOptions.IgnoreCase | RegexOptions.Compiled),
119 whitelist) 119 whitelist)
120 { 120 {
@@ -138,7 +138,7 @@ namespace OpenSim.Framework.Servers
138 /// <summary> 138 /// <summary>
139 /// Invoked by OSHttpRequestPump. 139 /// Invoked by OSHttpRequestPump.
140 /// </summary> 140 /// </summary>
141 public override OSHttpHandlerResult Process(OSHttpRequest request) 141 public override OSHttpHandlerResult Process(OSHttpRequest request)
142 { 142 {
143 XmlRpcResponse xmlRpcResponse; 143 XmlRpcResponse xmlRpcResponse;
144 string responseString; 144 string responseString;
@@ -148,13 +148,13 @@ namespace OpenSim.Framework.Servers
148 148
149 149
150 OSHttpResponse resp = new OSHttpResponse(request); 150 OSHttpResponse resp = new OSHttpResponse(request);
151 try 151 try
152 { 152 {
153 // reified XmlRpcRequest must still be on the whiteboard 153 // reified XmlRpcRequest must still be on the whiteboard
154 XmlRpcRequest xmlRpcRequest = request.Whiteboard["xmlrequest"] as XmlRpcRequest; 154 XmlRpcRequest xmlRpcRequest = request.Whiteboard["xmlrequest"] as XmlRpcRequest;
155 xmlRpcResponse = _handler(xmlRpcRequest); 155 xmlRpcResponse = _handler(xmlRpcRequest);
156 responseString = XmlRpcResponseSerializer.Singleton.Serialize(xmlRpcResponse); 156 responseString = XmlRpcResponseSerializer.Singleton.Serialize(xmlRpcResponse);
157 157
158 resp.ContentType = "text/xml"; 158 resp.ContentType = "text/xml";
159 byte[] buffer = Encoding.UTF8.GetBytes(responseString); 159 byte[] buffer = Encoding.UTF8.GetBytes(responseString);
160 160
@@ -176,4 +176,4 @@ namespace OpenSim.Framework.Servers
176 return OSHttpHandlerResult.Done; 176 return OSHttpHandlerResult.Done;
177 } 177 }
178 } 178 }
179} \ No newline at end of file 179}