diff options
author | Kitto Flora | 2011-03-22 20:33:24 +0000 |
---|---|---|
committer | Kitto Flora | 2011-03-22 20:33:24 +0000 |
commit | 764e8c2a4371c24d1a0bd067c0bcbc806562064d (patch) | |
tree | 03dfb1bfe16c420fdbb6a1aa723c9203771d1beb /OpenSim/Framework | |
parent | Merge branch 'careminster-presence-refactor' of ssh://3dhosting.de/var/git/ca... (diff) | |
parent | Add some more fields to Estate settings and make them work. (diff) | |
download | opensim-SC-764e8c2a4371c24d1a0bd067c0bcbc806562064d.zip opensim-SC-764e8c2a4371c24d1a0bd067c0bcbc806562064d.tar.gz opensim-SC-764e8c2a4371c24d1a0bd067c0bcbc806562064d.tar.bz2 opensim-SC-764e8c2a4371c24d1a0bd067c0bcbc806562064d.tar.xz |
Merge branch 'careminster-presence-refactor' of ssh://3dhosting.de/var/git/careminster into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r-- | OpenSim/Framework/AgentCircuitData.cs | 30 | ||||
-rw-r--r-- | OpenSim/Framework/Capabilities/Caps.cs | 1 | ||||
-rw-r--r-- | OpenSim/Framework/Capabilities/CapsHandlers.cs | 2 | ||||
-rw-r--r-- | OpenSim/Framework/EstateSettings.cs | 33 | ||||
-rw-r--r-- | OpenSim/Framework/IMoneyModule.cs | 1 | ||||
-rw-r--r-- | OpenSim/Framework/PrimitiveBaseShape.cs | 2 | ||||
-rw-r--r-- | OpenSim/Framework/Serialization/External/OspResolver.cs | 19 | ||||
-rw-r--r-- | OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs | 2 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/BaseOpenSimServer.cs | 27 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 74 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/OSHttpHandler.cs | 2 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/Tests/OSHttpTests.cs | 1 | ||||
-rw-r--r-- | OpenSim/Framework/Tests/AnimationTests.cs | 1 | ||||
-rw-r--r-- | OpenSim/Framework/Tests/PrimeNumberHelperTests.cs | 3 | ||||
-rw-r--r-- | OpenSim/Framework/Tests/UtilTest.cs | 1 | ||||
-rw-r--r-- | OpenSim/Framework/Util.cs | 23 | ||||
-rw-r--r-- | OpenSim/Framework/WebUtil.cs | 20 |
17 files changed, 194 insertions, 48 deletions
diff --git a/OpenSim/Framework/AgentCircuitData.cs b/OpenSim/Framework/AgentCircuitData.cs index 1600bdc..3dbc215 100644 --- a/OpenSim/Framework/AgentCircuitData.cs +++ b/OpenSim/Framework/AgentCircuitData.cs | |||
@@ -220,6 +220,8 @@ namespace OpenSim.Framework | |||
220 | args["packed_appearance"] = appmap; | 220 | args["packed_appearance"] = appmap; |
221 | } | 221 | } |
222 | 222 | ||
223 | // Old, bad way. Keeping it fow now for backwards compatibility | ||
224 | // OBSOLETE -- soon to be deleted | ||
223 | if (ServiceURLs != null && ServiceURLs.Count > 0) | 225 | if (ServiceURLs != null && ServiceURLs.Count > 0) |
224 | { | 226 | { |
225 | OSDArray urls = new OSDArray(ServiceURLs.Count * 2); | 227 | OSDArray urls = new OSDArray(ServiceURLs.Count * 2); |
@@ -232,6 +234,19 @@ namespace OpenSim.Framework | |||
232 | args["service_urls"] = urls; | 234 | args["service_urls"] = urls; |
233 | } | 235 | } |
234 | 236 | ||
237 | // again, this time the right way | ||
238 | if (ServiceURLs != null && ServiceURLs.Count > 0) | ||
239 | { | ||
240 | OSDMap urls = new OSDMap(); | ||
241 | foreach (KeyValuePair<string, object> kvp in ServiceURLs) | ||
242 | { | ||
243 | //System.Console.WriteLine("XXX " + kvp.Key + "=" + kvp.Value); | ||
244 | urls[kvp.Key] = OSD.FromString((kvp.Value == null) ? string.Empty : kvp.Value.ToString()); | ||
245 | } | ||
246 | args["serviceurls"] = urls; | ||
247 | } | ||
248 | |||
249 | |||
235 | return args; | 250 | return args; |
236 | } | 251 | } |
237 | 252 | ||
@@ -327,7 +342,20 @@ namespace OpenSim.Framework | |||
327 | } | 342 | } |
328 | 343 | ||
329 | ServiceURLs = new Dictionary<string, object>(); | 344 | ServiceURLs = new Dictionary<string, object>(); |
330 | if (args.ContainsKey("service_urls") && args["service_urls"] != null && (args["service_urls"]).Type == OSDType.Array) | 345 | // Try parse the new way, OSDMap |
346 | if (args.ContainsKey("serviceurls") && args["serviceurls"] != null && (args["serviceurls"]).Type == OSDType.Map) | ||
347 | { | ||
348 | OSDMap urls = (OSDMap)(args["serviceurls"]); | ||
349 | foreach (KeyValuePair<String, OSD> kvp in urls) | ||
350 | { | ||
351 | ServiceURLs[kvp.Key] = kvp.Value.AsString(); | ||
352 | //System.Console.WriteLine("XXX " + kvp.Key + "=" + ServiceURLs[kvp.Key]); | ||
353 | |||
354 | } | ||
355 | } | ||
356 | // else try the old way, OSDArray | ||
357 | // OBSOLETE -- soon to be deleted | ||
358 | else if (args.ContainsKey("service_urls") && args["service_urls"] != null && (args["service_urls"]).Type == OSDType.Array) | ||
331 | { | 359 | { |
332 | OSDArray urls = (OSDArray)(args["service_urls"]); | 360 | OSDArray urls = (OSDArray)(args["service_urls"]); |
333 | for (int i = 0; i < urls.Count / 2; i++) | 361 | for (int i = 0; i < urls.Count / 2; i++) |
diff --git a/OpenSim/Framework/Capabilities/Caps.cs b/OpenSim/Framework/Capabilities/Caps.cs index c2f9c3a..3be97b5 100644 --- a/OpenSim/Framework/Capabilities/Caps.cs +++ b/OpenSim/Framework/Capabilities/Caps.cs | |||
@@ -181,7 +181,6 @@ namespace OpenSim.Framework.Capabilities | |||
181 | 181 | ||
182 | RegisterRegionServiceHandlers(capsBase); | 182 | RegisterRegionServiceHandlers(capsBase); |
183 | RegisterInventoryServiceHandlers(capsBase); | 183 | RegisterInventoryServiceHandlers(capsBase); |
184 | |||
185 | } | 184 | } |
186 | 185 | ||
187 | public void RegisterRegionServiceHandlers(string capsBase) | 186 | public void RegisterRegionServiceHandlers(string capsBase) |
diff --git a/OpenSim/Framework/Capabilities/CapsHandlers.cs b/OpenSim/Framework/Capabilities/CapsHandlers.cs index 864e6dd..e1c800e 100644 --- a/OpenSim/Framework/Capabilities/CapsHandlers.cs +++ b/OpenSim/Framework/Capabilities/CapsHandlers.cs | |||
@@ -88,8 +88,8 @@ namespace OpenSim.Framework.Capabilities | |||
88 | /// handler to be removed</param> | 88 | /// handler to be removed</param> |
89 | public void Remove(string capsName) | 89 | public void Remove(string capsName) |
90 | { | 90 | { |
91 | // This line must be here, or caps will break! | ||
92 | m_httpListener.RemoveStreamHandler("POST", m_capsHandlers[capsName].Path); | 91 | m_httpListener.RemoveStreamHandler("POST", m_capsHandlers[capsName].Path); |
92 | m_httpListener.RemoveStreamHandler("GET", m_capsHandlers[capsName].Path); | ||
93 | m_capsHandlers.Remove(capsName); | 93 | m_capsHandlers.Remove(capsName); |
94 | } | 94 | } |
95 | 95 | ||
diff --git a/OpenSim/Framework/EstateSettings.cs b/OpenSim/Framework/EstateSettings.cs index f9c13f3..afbdd49 100644 --- a/OpenSim/Framework/EstateSettings.cs +++ b/OpenSim/Framework/EstateSettings.cs | |||
@@ -58,6 +58,30 @@ namespace OpenSim.Framework | |||
58 | set { m_EstateName = value; } | 58 | set { m_EstateName = value; } |
59 | } | 59 | } |
60 | 60 | ||
61 | private bool m_AllowLandmark = true; | ||
62 | |||
63 | public bool AllowLandmark | ||
64 | { | ||
65 | get { return m_AllowLandmark; } | ||
66 | set { m_AllowLandmark = value; } | ||
67 | } | ||
68 | |||
69 | private bool m_AllowParcelChanges = true; | ||
70 | |||
71 | public bool AllowParcelChanges | ||
72 | { | ||
73 | get { return m_AllowParcelChanges; } | ||
74 | set { m_AllowParcelChanges = value; } | ||
75 | } | ||
76 | |||
77 | private bool m_AllowSetHome = true; | ||
78 | |||
79 | public bool AllowSetHome | ||
80 | { | ||
81 | get { return m_AllowSetHome; } | ||
82 | set { m_AllowSetHome = value; } | ||
83 | } | ||
84 | |||
61 | private uint m_ParentEstateID = 1; | 85 | private uint m_ParentEstateID = 1; |
62 | 86 | ||
63 | public uint ParentEstateID | 87 | public uint ParentEstateID |
@@ -392,5 +416,14 @@ namespace OpenSim.Framework | |||
392 | 416 | ||
393 | return l_EstateAccess.Contains(user); | 417 | return l_EstateAccess.Contains(user); |
394 | } | 418 | } |
419 | |||
420 | public void SetFromFlags(ulong regionFlags) | ||
421 | { | ||
422 | ResetHomeOnTeleport = ((regionFlags & (ulong)RegionFlags.ResetHomeOnTeleport) == (ulong)RegionFlags.ResetHomeOnTeleport); | ||
423 | BlockDwell = ((regionFlags & (ulong)RegionFlags.BlockDwell) == (ulong)RegionFlags.BlockDwell); | ||
424 | AllowLandmark = ((regionFlags & (ulong)RegionFlags.AllowLandmark) == (ulong)RegionFlags.AllowLandmark); | ||
425 | AllowParcelChanges = ((regionFlags & (ulong)RegionFlags.AllowParcelChanges) == (ulong)RegionFlags.AllowParcelChanges); | ||
426 | AllowSetHome = ((regionFlags & (ulong)RegionFlags.AllowSetHome) == (ulong)RegionFlags.AllowSetHome); | ||
427 | } | ||
395 | } | 428 | } |
396 | } | 429 | } |
diff --git a/OpenSim/Framework/IMoneyModule.cs b/OpenSim/Framework/IMoneyModule.cs index 3d4873d..ea6ed4b 100644 --- a/OpenSim/Framework/IMoneyModule.cs +++ b/OpenSim/Framework/IMoneyModule.cs | |||
@@ -40,6 +40,7 @@ namespace OpenSim.Framework | |||
40 | bool AmountCovered(IClientAPI client, int amount); | 40 | bool AmountCovered(IClientAPI client, int amount); |
41 | void ApplyCharge(UUID agentID, int amount, string text); | 41 | void ApplyCharge(UUID agentID, int amount, string text); |
42 | void ApplyUploadCharge(UUID agentID, int amount, string text); | 42 | void ApplyUploadCharge(UUID agentID, int amount, string text); |
43 | void MoveMoney(UUID fromUser, UUID toUser, int amount, string text); | ||
43 | 44 | ||
44 | int UploadCharge { get; } | 45 | int UploadCharge { get; } |
45 | int GroupCreationCharge { get; } | 46 | int GroupCreationCharge { get; } |
diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs index 9a38f23..44f484e 100644 --- a/OpenSim/Framework/PrimitiveBaseShape.cs +++ b/OpenSim/Framework/PrimitiveBaseShape.cs | |||
@@ -250,7 +250,7 @@ namespace OpenSim.Framework | |||
250 | { | 250 | { |
251 | get | 251 | get |
252 | { | 252 | { |
253 | //m_log.DebugFormat("[SHAPE]: get m_textureEntry length {0}", m_textureEntry.Length); | 253 | // m_log.DebugFormat("[SHAPE]: get m_textureEntry length {0}", m_textureEntry.Length); |
254 | try { return new Primitive.TextureEntry(m_textureEntry, 0, m_textureEntry.Length); } | 254 | try { return new Primitive.TextureEntry(m_textureEntry, 0, m_textureEntry.Length); } |
255 | catch { } | 255 | catch { } |
256 | 256 | ||
diff --git a/OpenSim/Framework/Serialization/External/OspResolver.cs b/OpenSim/Framework/Serialization/External/OspResolver.cs index 7e3dd1b..d31d27c 100644 --- a/OpenSim/Framework/Serialization/External/OspResolver.cs +++ b/OpenSim/Framework/Serialization/External/OspResolver.cs | |||
@@ -66,6 +66,8 @@ namespace OpenSim.Framework.Serialization | |||
66 | UserAccount account = userService.GetUserAccount(UUID.Zero, userId); | 66 | UserAccount account = userService.GetUserAccount(UUID.Zero, userId); |
67 | if (account != null) | 67 | if (account != null) |
68 | return MakeOspa(account.FirstName, account.LastName); | 68 | return MakeOspa(account.FirstName, account.LastName); |
69 | // else | ||
70 | // m_log.WarnFormat("[OSP RESOLVER]: No user account for {0}", userId); | ||
69 | 71 | ||
70 | return null; | 72 | return null; |
71 | } | 73 | } |
@@ -77,6 +79,8 @@ namespace OpenSim.Framework.Serialization | |||
77 | /// <returns></returns> | 79 | /// <returns></returns> |
78 | public static string MakeOspa(string firstName, string lastName) | 80 | public static string MakeOspa(string firstName, string lastName) |
79 | { | 81 | { |
82 | // m_log.DebugFormat("[OSP RESOLVER]: Making OSPA for {0} {1}", firstName, lastName); | ||
83 | |||
80 | return | 84 | return |
81 | OSPA_PREFIX + OSPA_NAME_KEY + OSPA_PAIR_SEPARATOR + firstName + OSPA_NAME_VALUE_SEPARATOR + lastName; | 85 | OSPA_PREFIX + OSPA_NAME_KEY + OSPA_PAIR_SEPARATOR + firstName + OSPA_NAME_VALUE_SEPARATOR + lastName; |
82 | } | 86 | } |
@@ -97,7 +101,10 @@ namespace OpenSim.Framework.Serialization | |||
97 | public static UUID ResolveOspa(string ospa, IUserAccountService userService) | 101 | public static UUID ResolveOspa(string ospa, IUserAccountService userService) |
98 | { | 102 | { |
99 | if (!ospa.StartsWith(OSPA_PREFIX)) | 103 | if (!ospa.StartsWith(OSPA_PREFIX)) |
100 | return UUID.Zero; | 104 | { |
105 | // m_log.DebugFormat("[OSP RESOLVER]: ResolveOspa() got unrecognized format [{0}]", ospa); | ||
106 | return UUID.Zero; | ||
107 | } | ||
101 | 108 | ||
102 | // m_log.DebugFormat("[OSP RESOLVER]: Resolving {0}", ospa); | 109 | // m_log.DebugFormat("[OSP RESOLVER]: Resolving {0}", ospa); |
103 | 110 | ||
@@ -161,7 +168,17 @@ namespace OpenSim.Framework.Serialization | |||
161 | 168 | ||
162 | UserAccount account = userService.GetUserAccount(UUID.Zero, firstName, lastName); | 169 | UserAccount account = userService.GetUserAccount(UUID.Zero, firstName, lastName); |
163 | if (account != null) | 170 | if (account != null) |
171 | { | ||
172 | // m_log.DebugFormat( | ||
173 | // "[OSP RESOLVER]: Found user account with uuid {0} for {1} {2}", | ||
174 | // account.PrincipalID, firstName, lastName); | ||
175 | |||
164 | return account.PrincipalID; | 176 | return account.PrincipalID; |
177 | } | ||
178 | // else | ||
179 | // { | ||
180 | // m_log.DebugFormat("[OSP RESOLVER]: No resolved OSPA user account for {0}", name); | ||
181 | // } | ||
165 | 182 | ||
166 | // XXX: Disable temporary user profile creation for now as implementation is incomplete - justincc | 183 | // XXX: Disable temporary user profile creation for now as implementation is incomplete - justincc |
167 | /* | 184 | /* |
diff --git a/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs b/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs index d5e84c7..f138437 100644 --- a/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs +++ b/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs | |||
@@ -303,7 +303,7 @@ namespace OpenSim.Framework.Serialization.External | |||
303 | writer.WriteStartElement("GroupOwned"); | 303 | writer.WriteStartElement("GroupOwned"); |
304 | writer.WriteString(inventoryItem.GroupOwned.ToString()); | 304 | writer.WriteString(inventoryItem.GroupOwned.ToString()); |
305 | writer.WriteEndElement(); | 305 | writer.WriteEndElement(); |
306 | if (inventoryItem.CreatorData != null && inventoryItem.CreatorData != string.Empty) | 306 | if (options.ContainsKey("creators") && inventoryItem.CreatorData != null && inventoryItem.CreatorData != string.Empty) |
307 | writer.WriteElementString("CreatorData", inventoryItem.CreatorData); | 307 | writer.WriteElementString("CreatorData", inventoryItem.CreatorData); |
308 | else if (options.ContainsKey("profile")) | 308 | else if (options.ContainsKey("profile")) |
309 | { | 309 | { |
diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index ebf7ded..5c3cad4 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs | |||
@@ -319,18 +319,21 @@ namespace OpenSim.Framework.Servers | |||
319 | return; | 319 | return; |
320 | } | 320 | } |
321 | 321 | ||
322 | string rawLevel = cmd[3]; | 322 | if (cmd.Length > 3) |
323 | 323 | { | |
324 | ILoggerRepository repository = LogManager.GetRepository(); | 324 | string rawLevel = cmd[3]; |
325 | Level consoleLevel = repository.LevelMap[rawLevel]; | 325 | |
326 | 326 | ILoggerRepository repository = LogManager.GetRepository(); | |
327 | if (consoleLevel != null) | 327 | Level consoleLevel = repository.LevelMap[rawLevel]; |
328 | m_consoleAppender.Threshold = consoleLevel; | 328 | |
329 | else | 329 | if (consoleLevel != null) |
330 | Notice( | 330 | m_consoleAppender.Threshold = consoleLevel; |
331 | String.Format( | 331 | else |
332 | "{0} is not a valid logging level. Valid logging levels are ALL, DEBUG, INFO, WARN, ERROR, FATAL, OFF", | 332 | Notice( |
333 | rawLevel)); | 333 | String.Format( |
334 | "{0} is not a valid logging level. Valid logging levels are ALL, DEBUG, INFO, WARN, ERROR, FATAL, OFF", | ||
335 | rawLevel)); | ||
336 | } | ||
334 | 337 | ||
335 | Notice(String.Format("Console log level is {0}", m_consoleAppender.Threshold)); | 338 | Notice(String.Format("Console log level is {0}", m_consoleAppender.Threshold)); |
336 | } | 339 | } |
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index d4ee7ba..ccec9b7 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | |||
@@ -143,6 +143,11 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
143 | } | 143 | } |
144 | } | 144 | } |
145 | 145 | ||
146 | public List<string> GetStreamHandlerKeys() | ||
147 | { | ||
148 | return new List<string>(m_streamHandlers.Keys); | ||
149 | } | ||
150 | |||
146 | private static string GetHandlerKey(string httpMethod, string path) | 151 | private static string GetHandlerKey(string httpMethod, string path) |
147 | { | 152 | { |
148 | return httpMethod + ":" + path; | 153 | return httpMethod + ":" + path; |
@@ -179,6 +184,11 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
179 | } | 184 | } |
180 | } | 185 | } |
181 | 186 | ||
187 | public List<string> GetXmlRpcHandlerKeys() | ||
188 | { | ||
189 | return new List<string>(m_rpcHandlers.Keys); | ||
190 | } | ||
191 | |||
182 | public bool AddHTTPHandler(string methodName, GenericHTTPMethod handler) | 192 | public bool AddHTTPHandler(string methodName, GenericHTTPMethod handler) |
183 | { | 193 | { |
184 | //m_log.DebugFormat("[BASE HTTP SERVER]: Registering {0}", methodName); | 194 | //m_log.DebugFormat("[BASE HTTP SERVER]: Registering {0}", methodName); |
@@ -196,6 +206,12 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
196 | return false; | 206 | return false; |
197 | } | 207 | } |
198 | 208 | ||
209 | public List<string> GetHTTPHandlerKeys() | ||
210 | { | ||
211 | return new List<string>(m_HTTPHandlers.Keys); | ||
212 | } | ||
213 | |||
214 | |||
199 | public bool AddPollServiceHTTPHandler(string methodName, GenericHTTPMethod handler, PollServiceEventArgs args) | 215 | public bool AddPollServiceHTTPHandler(string methodName, GenericHTTPMethod handler, PollServiceEventArgs args) |
200 | { | 216 | { |
201 | bool pollHandlerResult = false; | 217 | bool pollHandlerResult = false; |
@@ -214,6 +230,12 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
214 | return false; | 230 | return false; |
215 | } | 231 | } |
216 | 232 | ||
233 | public List<string> GetPollServiceHandlerKeys() | ||
234 | { | ||
235 | return new List<string>(m_pollHandlers.Keys); | ||
236 | } | ||
237 | |||
238 | |||
217 | // Note that the agent string is provided simply to differentiate | 239 | // Note that the agent string is provided simply to differentiate |
218 | // the handlers - it is NOT required to be an actual agent header | 240 | // the handlers - it is NOT required to be an actual agent header |
219 | // value. | 241 | // value. |
@@ -232,6 +254,11 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
232 | return false; | 254 | return false; |
233 | } | 255 | } |
234 | 256 | ||
257 | public List<string> GetAgentHandlerKeys() | ||
258 | { | ||
259 | return new List<string>(m_agentHandlers.Keys); | ||
260 | } | ||
261 | |||
235 | public bool AddLLSDHandler(string path, LLSDMethod handler) | 262 | public bool AddLLSDHandler(string path, LLSDMethod handler) |
236 | { | 263 | { |
237 | lock (m_llsdHandlers) | 264 | lock (m_llsdHandlers) |
@@ -245,6 +272,11 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
245 | return false; | 272 | return false; |
246 | } | 273 | } |
247 | 274 | ||
275 | public List<string> GetLLSDHandlerKeys() | ||
276 | { | ||
277 | return new List<string>(m_llsdHandlers.Keys); | ||
278 | } | ||
279 | |||
248 | public bool SetDefaultLLSDHandler(DefaultLLSDMethod handler) | 280 | public bool SetDefaultLLSDHandler(DefaultLLSDMethod handler) |
249 | { | 281 | { |
250 | m_defaultLlsdHandler = handler; | 282 | m_defaultLlsdHandler = handler; |
@@ -346,6 +378,22 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
346 | /// <param name="response"></param> | 378 | /// <param name="response"></param> |
347 | public virtual void HandleRequest(OSHttpRequest request, OSHttpResponse response) | 379 | public virtual void HandleRequest(OSHttpRequest request, OSHttpResponse response) |
348 | { | 380 | { |
381 | if (request.HttpMethod == String.Empty) // Can't handle empty requests, not wasting a thread | ||
382 | { | ||
383 | try | ||
384 | { | ||
385 | SendHTML500(response); | ||
386 | } | ||
387 | catch | ||
388 | { | ||
389 | } | ||
390 | |||
391 | return; | ||
392 | } | ||
393 | |||
394 | string requestMethod = request.HttpMethod; | ||
395 | string uriString = request.RawUrl; | ||
396 | |||
349 | string reqnum = "unknown"; | 397 | string reqnum = "unknown"; |
350 | int tickstart = Environment.TickCount; | 398 | int tickstart = Environment.TickCount; |
351 | 399 | ||
@@ -463,7 +511,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
463 | 511 | ||
464 | request.InputStream.Close(); | 512 | request.InputStream.Close(); |
465 | 513 | ||
466 | // HTTP IN support. The script engine taes it from here | 514 | // HTTP IN support. The script engine takes it from here |
467 | // Nothing to worry about for us. | 515 | // Nothing to worry about for us. |
468 | // | 516 | // |
469 | if (buffer == null) | 517 | if (buffer == null) |
@@ -577,19 +625,19 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
577 | { | 625 | { |
578 | m_log.ErrorFormat("[BASE HTTP SERVER]: HandleRequest() threw ", e); | 626 | m_log.ErrorFormat("[BASE HTTP SERVER]: HandleRequest() threw ", e); |
579 | } | 627 | } |
580 | catch (InvalidOperationException e) | 628 | catch (Exception e) |
581 | { | 629 | { |
582 | m_log.ErrorFormat("[BASE HTTP SERVER]: HandleRequest() threw {0}", e); | 630 | m_log.ErrorFormat("[BASE HTTP SERVER]: HandleRequest() threw " + e.ToString()); |
583 | SendHTML500(response); | 631 | SendHTML500(response); |
584 | } | 632 | } |
585 | finally | 633 | finally |
586 | { | 634 | { |
587 | // Every month or so this will wrap and give bad numbers, not really a problem | 635 | // Every month or so this will wrap and give bad numbers, not really a problem |
588 | // since its just for reporting, 200ms limit can be adjusted | 636 | // since its just for reporting, tickdiff limit can be adjusted |
589 | int tickdiff = Environment.TickCount - tickstart; | 637 | int tickdiff = Environment.TickCount - tickstart; |
590 | if (tickdiff > 500) | 638 | if (tickdiff > 3000) |
591 | m_log.InfoFormat( | 639 | m_log.InfoFormat( |
592 | "[BASE HTTP SERVER]: slow request <{0}> for {1} took {2} ms", reqnum, request.RawUrl, tickdiff); | 640 | "[BASE HTTP SERVER]: slow {0} request for {1} from {2} took {3} ms", requestMethod, uriString, request.RemoteIPEndPoint.ToString(), tickdiff); |
593 | } | 641 | } |
594 | } | 642 | } |
595 | 643 | ||
@@ -753,7 +801,19 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
753 | if (methodWasFound) | 801 | if (methodWasFound) |
754 | { | 802 | { |
755 | xmlRprcRequest.Params.Add(request.Url); // Param[2] | 803 | xmlRprcRequest.Params.Add(request.Url); // Param[2] |
756 | xmlRprcRequest.Params.Add(request.Headers.Get("X-Forwarded-For")); // Param[3] | 804 | |
805 | string xff = "X-Forwarded-For"; | ||
806 | string xfflower = xff.ToLower(); | ||
807 | foreach (string s in request.Headers.AllKeys) | ||
808 | { | ||
809 | if (s != null && s.Equals(xfflower)) | ||
810 | { | ||
811 | xff = xfflower; | ||
812 | break; | ||
813 | } | ||
814 | } | ||
815 | xmlRprcRequest.Params.Add(request.Headers.Get(xff)); // Param[3] | ||
816 | |||
757 | 817 | ||
758 | try | 818 | try |
759 | { | 819 | { |
diff --git a/OpenSim/Framework/Servers/HttpServer/OSHttpHandler.cs b/OpenSim/Framework/Servers/HttpServer/OSHttpHandler.cs index 129a544..2c2b47d 100644 --- a/OpenSim/Framework/Servers/HttpServer/OSHttpHandler.cs +++ b/OpenSim/Framework/Servers/HttpServer/OSHttpHandler.cs | |||
@@ -83,7 +83,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
83 | /// <summary> | 83 | /// <summary> |
84 | /// Regular expression used to match against path of the | 84 | /// Regular expression used to match against path of the |
85 | /// incoming HTTP request. If you want to match any string | 85 | /// incoming HTTP request. If you want to match any string |
86 | /// either use '.*' or null. To match on the emtpy string use | 86 | /// either use '.*' or null. To match on the empty string use |
87 | /// '^$'. | 87 | /// '^$'. |
88 | /// </summary> | 88 | /// </summary> |
89 | public virtual Regex Path | 89 | public virtual Regex Path |
diff --git a/OpenSim/Framework/Servers/Tests/OSHttpTests.cs b/OpenSim/Framework/Servers/Tests/OSHttpTests.cs index e62407a..dc4eb8f 100644 --- a/OpenSim/Framework/Servers/Tests/OSHttpTests.cs +++ b/OpenSim/Framework/Servers/Tests/OSHttpTests.cs | |||
@@ -34,7 +34,6 @@ using System.Text; | |||
34 | using HttpServer; | 34 | using HttpServer; |
35 | using HttpServer.FormDecoders; | 35 | using HttpServer.FormDecoders; |
36 | using NUnit.Framework; | 36 | using NUnit.Framework; |
37 | using NUnit.Framework.SyntaxHelpers; | ||
38 | using OpenSim.Framework.Servers.HttpServer; | 37 | using OpenSim.Framework.Servers.HttpServer; |
39 | 38 | ||
40 | namespace OpenSim.Framework.Servers.Tests | 39 | namespace OpenSim.Framework.Servers.Tests |
diff --git a/OpenSim/Framework/Tests/AnimationTests.cs b/OpenSim/Framework/Tests/AnimationTests.cs index 719ddce..9aa95af 100644 --- a/OpenSim/Framework/Tests/AnimationTests.cs +++ b/OpenSim/Framework/Tests/AnimationTests.cs | |||
@@ -28,7 +28,6 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Reflection; | 29 | using System.Reflection; |
30 | using NUnit.Framework; | 30 | using NUnit.Framework; |
31 | using NUnit.Framework.SyntaxHelpers; | ||
32 | using OpenMetaverse; | 31 | using OpenMetaverse; |
33 | using OpenMetaverse.StructuredData; | 32 | using OpenMetaverse.StructuredData; |
34 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
diff --git a/OpenSim/Framework/Tests/PrimeNumberHelperTests.cs b/OpenSim/Framework/Tests/PrimeNumberHelperTests.cs index d741f91..36bc6e7 100644 --- a/OpenSim/Framework/Tests/PrimeNumberHelperTests.cs +++ b/OpenSim/Framework/Tests/PrimeNumberHelperTests.cs | |||
@@ -28,7 +28,6 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Reflection; | 29 | using System.Reflection; |
30 | using NUnit.Framework; | 30 | using NUnit.Framework; |
31 | using NUnit.Framework.SyntaxHelpers; | ||
32 | using OpenMetaverse; | 31 | using OpenMetaverse; |
33 | using OpenMetaverse.StructuredData; | 32 | using OpenMetaverse.StructuredData; |
34 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
@@ -38,8 +37,6 @@ namespace OpenSim.Framework.Tests | |||
38 | [TestFixture] | 37 | [TestFixture] |
39 | public class PrimeNumberHelperTests | 38 | public class PrimeNumberHelperTests |
40 | { | 39 | { |
41 | |||
42 | |||
43 | [Test] | 40 | [Test] |
44 | public void TestGetPrime() | 41 | public void TestGetPrime() |
45 | { | 42 | { |
diff --git a/OpenSim/Framework/Tests/UtilTest.cs b/OpenSim/Framework/Tests/UtilTest.cs index 89f5c0c..5eac411 100644 --- a/OpenSim/Framework/Tests/UtilTest.cs +++ b/OpenSim/Framework/Tests/UtilTest.cs | |||
@@ -27,7 +27,6 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using NUnit.Framework; | 29 | using NUnit.Framework; |
30 | using NUnit.Framework.SyntaxHelpers; | ||
31 | using OpenMetaverse; | 30 | using OpenMetaverse; |
32 | using OpenSim.Tests.Common; | 31 | using OpenSim.Tests.Common; |
33 | 32 | ||
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 96292ff..3f676f9 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs | |||
@@ -471,10 +471,17 @@ namespace OpenSim.Framework | |||
471 | /// <param name="oldy">Old region y-coord</param> | 471 | /// <param name="oldy">Old region y-coord</param> |
472 | /// <param name="newy">New region y-coord</param> | 472 | /// <param name="newy">New region y-coord</param> |
473 | /// <returns></returns> | 473 | /// <returns></returns> |
474 | public static bool IsOutsideView(uint oldx, uint newx, uint oldy, uint newy) | 474 | public static bool IsOutsideView(float drawdist, uint oldx, uint newx, uint oldy, uint newy) |
475 | { | 475 | { |
476 | // Eventually this will be a function of the draw distance / camera position too. | 476 | int dd = (int)((drawdist + Constants.RegionSize - 1) / Constants.RegionSize); |
477 | return (((int)Math.Abs((int)(oldx - newx)) > 1) || ((int)Math.Abs((int)(oldy - newy)) > 1)); | 477 | |
478 | int startX = (int)oldx - dd; | ||
479 | int startY = (int)oldy - dd; | ||
480 | |||
481 | int endX = (int)oldx + dd; | ||
482 | int endY = (int)oldy + dd; | ||
483 | |||
484 | return (newx < startX || endX < newx || newy < startY || endY < newy); | ||
478 | } | 485 | } |
479 | 486 | ||
480 | public static string FieldToString(byte[] bytes) | 487 | public static string FieldToString(byte[] bytes) |
@@ -1346,6 +1353,11 @@ namespace OpenSim.Framework | |||
1346 | return (ipaddr1 != null) ? "http://" + ipaddr1.ToString() + ":" + port1 : uri; | 1353 | return (ipaddr1 != null) ? "http://" + ipaddr1.ToString() + ":" + port1 : uri; |
1347 | } | 1354 | } |
1348 | 1355 | ||
1356 | public static byte[] StringToBytes256(string str, params object[] args) | ||
1357 | { | ||
1358 | return StringToBytes256(string.Format(str, args)); | ||
1359 | } | ||
1360 | |||
1349 | public static byte[] StringToBytes256(string str) | 1361 | public static byte[] StringToBytes256(string str) |
1350 | { | 1362 | { |
1351 | if (String.IsNullOrEmpty(str)) { return Utils.EmptyBytes; } | 1363 | if (String.IsNullOrEmpty(str)) { return Utils.EmptyBytes; } |
@@ -1364,6 +1376,11 @@ namespace OpenSim.Framework | |||
1364 | return data; | 1376 | return data; |
1365 | } | 1377 | } |
1366 | 1378 | ||
1379 | public static byte[] StringToBytes1024(string str, params object[] args) | ||
1380 | { | ||
1381 | return StringToBytes1024(string.Format(str, args)); | ||
1382 | } | ||
1383 | |||
1367 | public static byte[] StringToBytes1024(string str) | 1384 | public static byte[] StringToBytes1024(string str) |
1368 | { | 1385 | { |
1369 | if (String.IsNullOrEmpty(str)) { return Utils.EmptyBytes; } | 1386 | if (String.IsNullOrEmpty(str)) { return Utils.EmptyBytes; } |
diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index 0593341..4f5add9 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs | |||
@@ -29,6 +29,7 @@ using System; | |||
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Collections.Specialized; | 31 | using System.Collections.Specialized; |
32 | using System.Globalization; | ||
32 | using System.IO; | 33 | using System.IO; |
33 | using System.Net; | 34 | using System.Net; |
34 | using System.Net.Security; | 35 | using System.Net.Security; |
@@ -557,34 +558,27 @@ namespace OpenSim.Framework | |||
557 | { | 558 | { |
558 | float qx = GetQ(x); | 559 | float qx = GetQ(x); |
559 | float qy = GetQ(y); | 560 | float qy = GetQ(y); |
560 | if (qx < qy) | 561 | return qy.CompareTo(qx); // descending order |
561 | return -1; | ||
562 | if (qx == qy) | ||
563 | return 0; | ||
564 | return 1; | ||
565 | } | 562 | } |
566 | 563 | ||
567 | private float GetQ(Object o) | 564 | private float GetQ(Object o) |
568 | { | 565 | { |
569 | // Example: image/png;q=0.9 | 566 | // Example: image/png;q=0.9 |
570 | 567 | ||
568 | float qvalue = 1F; | ||
571 | if (o is String) | 569 | if (o is String) |
572 | { | 570 | { |
573 | string mime = (string)o; | 571 | string mime = (string)o; |
574 | string[] parts = mime.Split(new char[] { ';' }); | 572 | string[] parts = mime.Split(';'); |
575 | if (parts.Length > 1) | 573 | if (parts.Length > 1) |
576 | { | 574 | { |
577 | string[] kvp = parts[1].Split(new char[] { '=' }); | 575 | string[] kvp = parts[1].Split('='); |
578 | if (kvp.Length == 2 && kvp[0] == "q") | 576 | if (kvp.Length == 2 && kvp[0] == "q") |
579 | { | 577 | float.TryParse(kvp[1], NumberStyles.Number, CultureInfo.InvariantCulture, out qvalue); |
580 | float qvalue = 1F; | ||
581 | float.TryParse(kvp[1], out qvalue); | ||
582 | return qvalue; | ||
583 | } | ||
584 | } | 578 | } |
585 | } | 579 | } |
586 | 580 | ||
587 | return 1F; | 581 | return qvalue; |
588 | } | 582 | } |
589 | } | 583 | } |
590 | 584 | ||