diff options
author | John Hurliman | 2009-09-30 15:28:23 -0700 |
---|---|---|
committer | John Hurliman | 2009-09-30 15:28:23 -0700 |
commit | acfe2d9f4e5a55d38b16cac7d0d0a25b64b6b009 (patch) | |
tree | 305349e1bd0a5849fd7f96483e24d5e07b24b8f4 /OpenSim/Server/Base | |
parent | * Adding Scale to EntityBase * Fixing the incorrect initialization of EntityB... (diff) | |
parent | Formatting cleanup. (diff) | |
download | opensim-SC_OLD-acfe2d9f4e5a55d38b16cac7d0d0a25b64b6b009.zip opensim-SC_OLD-acfe2d9f4e5a55d38b16cac7d0d0a25b64b6b009.tar.gz opensim-SC_OLD-acfe2d9f4e5a55d38b16cac7d0d0a25b64b6b009.tar.bz2 opensim-SC_OLD-acfe2d9f4e5a55d38b16cac7d0d0a25b64b6b009.tar.xz |
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Server/Base/HttpServerBase.cs | 28 | ||||
-rw-r--r-- | OpenSim/Server/Base/ProtocolVersions.cs (renamed from OpenSim/Grid/AssetServer/Properties/AssemblyInfo.cs) | 67 | ||||
-rw-r--r-- | OpenSim/Server/Base/ServerUtils.cs | 120 |
3 files changed, 176 insertions, 39 deletions
diff --git a/OpenSim/Server/Base/HttpServerBase.cs b/OpenSim/Server/Base/HttpServerBase.cs index 791e1ef..ed0210f 100644 --- a/OpenSim/Server/Base/HttpServerBase.cs +++ b/OpenSim/Server/Base/HttpServerBase.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | ||
29 | using System.Threading; | 30 | using System.Threading; |
30 | using System.Reflection; | 31 | using System.Reflection; |
31 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
@@ -40,17 +41,40 @@ namespace OpenSim.Server.Base | |||
40 | { | 41 | { |
41 | // Logger | 42 | // Logger |
42 | // | 43 | // |
43 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 44 | private static readonly ILog m_Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
44 | 45 | ||
45 | // The http server instance | 46 | // The http server instance |
46 | // | 47 | // |
47 | protected BaseHttpServer m_HttpServer = null; | 48 | protected BaseHttpServer m_HttpServer = null; |
49 | protected uint m_Port = 0; | ||
50 | protected Dictionary<uint, BaseHttpServer> m_Servers = | ||
51 | new Dictionary<uint, BaseHttpServer>(); | ||
48 | 52 | ||
49 | public IHttpServer HttpServer | 53 | public IHttpServer HttpServer |
50 | { | 54 | { |
51 | get { return m_HttpServer; } | 55 | get { return m_HttpServer; } |
52 | } | 56 | } |
53 | 57 | ||
58 | public uint DefaultPort | ||
59 | { | ||
60 | get { return m_Port; } | ||
61 | } | ||
62 | |||
63 | public IHttpServer GetHttpServer(uint port) | ||
64 | { | ||
65 | m_Log.InfoFormat("[SERVER]: Requested port {0}", port); | ||
66 | if (port == m_Port) | ||
67 | return HttpServer; | ||
68 | |||
69 | if (m_Servers.ContainsKey(port)) | ||
70 | return m_Servers[port]; | ||
71 | |||
72 | m_Servers[port] = new BaseHttpServer(port); | ||
73 | m_Servers[port].Start(); | ||
74 | |||
75 | return m_Servers[port]; | ||
76 | } | ||
77 | |||
54 | // Handle all the automagical stuff | 78 | // Handle all the automagical stuff |
55 | // | 79 | // |
56 | public HttpServerBase(string prompt, string[] args) : base(prompt, args) | 80 | public HttpServerBase(string prompt, string[] args) : base(prompt, args) |
@@ -74,6 +98,8 @@ namespace OpenSim.Server.Base | |||
74 | Thread.CurrentThread.Abort(); | 98 | Thread.CurrentThread.Abort(); |
75 | } | 99 | } |
76 | 100 | ||
101 | m_Port = port; | ||
102 | |||
77 | m_HttpServer = new BaseHttpServer(port); | 103 | m_HttpServer = new BaseHttpServer(port); |
78 | 104 | ||
79 | MainServer.Instance = m_HttpServer; | 105 | MainServer.Instance = m_HttpServer; |
diff --git a/OpenSim/Grid/AssetServer/Properties/AssemblyInfo.cs b/OpenSim/Server/Base/ProtocolVersions.cs index 5d67e3f..488a9e6 100644 --- a/OpenSim/Grid/AssetServer/Properties/AssemblyInfo.cs +++ b/OpenSim/Server/Base/ProtocolVersions.cs | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
@@ -25,39 +25,32 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System.Reflection; | 28 | namespace OpenSim.Server.Base |
29 | using System.Runtime.InteropServices; | 29 | { |
30 | 30 | public class ProtocolVersions | |
31 | // General information about an assembly is controlled through the following | 31 | { |
32 | // set of attributes. Change these attribute values to modify the information | 32 | /// <value> |
33 | // associated with an assembly. | 33 | /// This is the external protocol versions. It is separate from the OpenSimulator project version. |
34 | 34 | /// | |
35 | [assembly : AssemblyTitle("OGS-AssetServer")] | 35 | /// These version numbers should be increased by 1 every time a code |
36 | [assembly : AssemblyDescription("")] | 36 | /// change in the Service.Connectors and Server.Handlers, espectively, |
37 | [assembly : AssemblyConfiguration("")] | 37 | /// makes the previous OpenSimulator revision incompatible |
38 | [assembly : AssemblyCompany("http://opensimulator.org")] | 38 | /// with the new revision. |
39 | [assembly : AssemblyProduct("OGS-AssetServer")] | 39 | /// |
40 | [assembly : AssemblyCopyright("Copyright (c) OpenSimulator.org Developers 2007-2009")] | 40 | /// Changes which are compatible with an older revision (e.g. older revisions experience degraded functionality |
41 | [assembly : AssemblyTrademark("")] | 41 | /// but not outright failure) do not need a version number increment. |
42 | [assembly : AssemblyCulture("")] | 42 | /// |
43 | 43 | /// Having this version number allows the grid service to reject connections from regions running a version | |
44 | // Setting ComVisible to false makes the types in this assembly not visible | 44 | /// of the code that is too old. |
45 | // to COM components. If you need to access a type in this assembly from | 45 | /// |
46 | // COM, set the ComVisible attribute to true on that type. | 46 | /// </value> |
47 | 47 | ||
48 | [assembly : ComVisible(false)] | 48 | // The range of acceptable servers for client-side connectors |
49 | 49 | public readonly static int ClientProtocolVersionMin = 0; | |
50 | // The following GUID is for the ID of the typelib if this project is exposed to COM | 50 | public readonly static int ClientProtocolVersionMax = 0; |
51 | 51 | ||
52 | [assembly : Guid("b541b244-3d1d-4625-9003-bc2a3a6a39a4")] | 52 | // The range of acceptable clients in server-side handlers |
53 | 53 | public readonly static int ServerProtocolVersionMin = 0; | |
54 | // Version information for an assembly consists of the following four values: | 54 | public readonly static int ServerProtocolVersionMax = 0; |
55 | // | 55 | } |
56 | // Major Version | 56 | } |
57 | // Minor Version | ||
58 | // Build Number | ||
59 | // Revision | ||
60 | // | ||
61 | |||
62 | [assembly : AssemblyVersion("0.6.5.*")] | ||
63 | [assembly : AssemblyFileVersion("0.6.5.0")] | ||
diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs index 0a36bbe..9beadd8 100644 --- a/OpenSim/Server/Base/ServerUtils.cs +++ b/OpenSim/Server/Base/ServerUtils.cs | |||
@@ -141,7 +141,9 @@ namespace OpenSim.Server.Base | |||
141 | } | 141 | } |
142 | catch (Exception e) | 142 | catch (Exception e) |
143 | { | 143 | { |
144 | m_log.ErrorFormat("Error loading plugin from {0}, exception {1}", dllName, e.InnerException); | 144 | if (!(e is System.MissingMethodException)) |
145 | m_log.ErrorFormat("Error loading plugin from {0}, exception {1}", dllName, e.InnerException); | ||
146 | return null; | ||
145 | } | 147 | } |
146 | 148 | ||
147 | return plug; | 149 | return plug; |
@@ -183,5 +185,121 @@ namespace OpenSim.Server.Base | |||
183 | 185 | ||
184 | return result; | 186 | return result; |
185 | } | 187 | } |
188 | |||
189 | public static string BuildQueryString(Dictionary<string, string> data) | ||
190 | { | ||
191 | string qstring = String.Empty; | ||
192 | |||
193 | foreach (KeyValuePair<string, string> kvp in data) | ||
194 | { | ||
195 | string part; | ||
196 | if (kvp.Value != String.Empty) | ||
197 | { | ||
198 | part = System.Web.HttpUtility.UrlEncode(kvp.Key) + | ||
199 | "=" + System.Web.HttpUtility.UrlEncode(kvp.Value); | ||
200 | } | ||
201 | else | ||
202 | { | ||
203 | part = System.Web.HttpUtility.UrlEncode(kvp.Key); | ||
204 | } | ||
205 | |||
206 | if (qstring != String.Empty) | ||
207 | qstring += "&"; | ||
208 | |||
209 | qstring += part; | ||
210 | } | ||
211 | |||
212 | return qstring; | ||
213 | } | ||
214 | |||
215 | public static string BuildXmlResponse(Dictionary<string, object> data) | ||
216 | { | ||
217 | XmlDocument doc = new XmlDocument(); | ||
218 | |||
219 | XmlNode xmlnode = doc.CreateNode(XmlNodeType.XmlDeclaration, | ||
220 | "", ""); | ||
221 | |||
222 | doc.AppendChild(xmlnode); | ||
223 | |||
224 | XmlElement rootElement = doc.CreateElement("", "ServerResponse", | ||
225 | ""); | ||
226 | |||
227 | doc.AppendChild(rootElement); | ||
228 | |||
229 | BuildXmlData(rootElement, data); | ||
230 | |||
231 | return doc.InnerXml; | ||
232 | } | ||
233 | |||
234 | private static void BuildXmlData(XmlElement parent, Dictionary<string, object> data) | ||
235 | { | ||
236 | foreach (KeyValuePair<string, object> kvp in data) | ||
237 | { | ||
238 | XmlElement elem = parent.OwnerDocument.CreateElement("", | ||
239 | kvp.Key, ""); | ||
240 | |||
241 | if (kvp.Value is Dictionary<string, object>) | ||
242 | { | ||
243 | XmlAttribute type = parent.OwnerDocument.CreateAttribute("", | ||
244 | "type", ""); | ||
245 | type.Value = "List"; | ||
246 | |||
247 | elem.Attributes.Append(type); | ||
248 | |||
249 | BuildXmlData(elem, (Dictionary<string, object>)kvp.Value); | ||
250 | } | ||
251 | else | ||
252 | { | ||
253 | elem.AppendChild(parent.OwnerDocument.CreateTextNode( | ||
254 | kvp.Value.ToString())); | ||
255 | } | ||
256 | |||
257 | parent.AppendChild(elem); | ||
258 | } | ||
259 | } | ||
260 | |||
261 | public static Dictionary<string, object> ParseXmlResponse(string data) | ||
262 | { | ||
263 | //m_log.DebugFormat("[XXX]: received xml string: {0}", data); | ||
264 | |||
265 | Dictionary<string, object> ret = new Dictionary<string, object>(); | ||
266 | |||
267 | XmlDocument doc = new XmlDocument(); | ||
268 | |||
269 | doc.LoadXml(data); | ||
270 | |||
271 | XmlNodeList rootL = doc.GetElementsByTagName("ServerResponse"); | ||
272 | |||
273 | if (rootL.Count != 1) | ||
274 | return ret; | ||
275 | |||
276 | XmlNode rootNode = rootL[0]; | ||
277 | |||
278 | ret = ParseElement(rootNode); | ||
279 | |||
280 | return ret; | ||
281 | } | ||
282 | |||
283 | private static Dictionary<string, object> ParseElement(XmlNode element) | ||
284 | { | ||
285 | Dictionary<string, object> ret = new Dictionary<string, object>(); | ||
286 | |||
287 | XmlNodeList partL = element.ChildNodes; | ||
288 | |||
289 | foreach (XmlNode part in partL) | ||
290 | { | ||
291 | XmlNode type = part.Attributes.GetNamedItem("type"); | ||
292 | if (type == null || type.Value != "List") | ||
293 | { | ||
294 | ret[part.Name] = part.InnerText; | ||
295 | } | ||
296 | else | ||
297 | { | ||
298 | ret[part.Name] = ParseElement(part); | ||
299 | } | ||
300 | } | ||
301 | |||
302 | return ret; | ||
303 | } | ||
186 | } | 304 | } |
187 | } | 305 | } |