diff options
author | Kitto Flora | 2010-09-06 21:45:17 +0000 |
---|---|---|
committer | Kitto Flora | 2010-09-06 21:45:17 +0000 |
commit | cfaefad754642677dbddfcbe743c3fa5e058785d (patch) | |
tree | 48ac26cc5289d8c0459837cd7d6936152216403b /OpenSim/Framework | |
parent | Falling animation fix, comment out instrumentation. (diff) | |
parent | Fix yet another cause of "Ghost attachments" (diff) | |
download | opensim-SC-cfaefad754642677dbddfcbe743c3fa5e058785d.zip opensim-SC-cfaefad754642677dbddfcbe743c3fa5e058785d.tar.gz opensim-SC-cfaefad754642677dbddfcbe743c3fa5e058785d.tar.bz2 opensim-SC-cfaefad754642677dbddfcbe743c3fa5e058785d.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/LandData.cs | 14 | ||||
-rw-r--r-- | OpenSim/Framework/RegionInfo.cs | 15 | ||||
-rw-r--r-- | OpenSim/Framework/Serialization/External/LandDataSerializer.cs | 5 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 12 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs | 109 | ||||
-rw-r--r-- | OpenSim/Framework/Util.cs | 44 |
6 files changed, 118 insertions, 81 deletions
diff --git a/OpenSim/Framework/LandData.cs b/OpenSim/Framework/LandData.cs index 4440c94..5bb0413 100644 --- a/OpenSim/Framework/LandData.cs +++ b/OpenSim/Framework/LandData.cs | |||
@@ -88,7 +88,6 @@ namespace OpenSim.Framework | |||
88 | private UUID _snapshotID = UUID.Zero; | 88 | private UUID _snapshotID = UUID.Zero; |
89 | private Vector3 _userLocation = new Vector3(); | 89 | private Vector3 _userLocation = new Vector3(); |
90 | private Vector3 _userLookAt = new Vector3(); | 90 | private Vector3 _userLookAt = new Vector3(); |
91 | private int _dwell = 0; | ||
92 | private int _otherCleanTime = 0; | 91 | private int _otherCleanTime = 0; |
93 | private string _mediaType = "none/none"; | 92 | private string _mediaType = "none/none"; |
94 | private string _mediaDescription = ""; | 93 | private string _mediaDescription = ""; |
@@ -620,18 +619,6 @@ namespace OpenSim.Framework | |||
620 | } | 619 | } |
621 | 620 | ||
622 | /// <summary> | 621 | /// <summary> |
623 | /// Deprecated idea. Number of visitors ~= free money | ||
624 | /// </summary> | ||
625 | public int Dwell { | ||
626 | get { | ||
627 | return _dwell; | ||
628 | } | ||
629 | set { | ||
630 | _dwell = value; | ||
631 | } | ||
632 | } | ||
633 | |||
634 | /// <summary> | ||
635 | /// Number of minutes to return SceneObjectGroup that are owned by someone who doesn't own | 622 | /// Number of minutes to return SceneObjectGroup that are owned by someone who doesn't own |
636 | /// the parcel and isn't set to the same 'group' as the parcel. | 623 | /// the parcel and isn't set to the same 'group' as the parcel. |
637 | /// </summary> | 624 | /// </summary> |
@@ -703,7 +690,6 @@ namespace OpenSim.Framework | |||
703 | landData._userLocation = _userLocation; | 690 | landData._userLocation = _userLocation; |
704 | landData._userLookAt = _userLookAt; | 691 | landData._userLookAt = _userLookAt; |
705 | landData._otherCleanTime = _otherCleanTime; | 692 | landData._otherCleanTime = _otherCleanTime; |
706 | landData._dwell = _dwell; | ||
707 | landData._mediaType = _mediaType; | 693 | landData._mediaType = _mediaType; |
708 | landData._mediaDescription = _mediaDescription; | 694 | landData._mediaDescription = _mediaDescription; |
709 | landData._mediaWidth = _mediaWidth; | 695 | landData._mediaWidth = _mediaWidth; |
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index ec25118..e36a72b 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs | |||
@@ -806,7 +806,7 @@ namespace OpenSim.Framework | |||
806 | IConfig config = source.Configs[RegionName]; | 806 | IConfig config = source.Configs[RegionName]; |
807 | 807 | ||
808 | if (config != null) | 808 | if (config != null) |
809 | source.Configs.Remove(RegionName); | 809 | source.Configs.Remove(config); |
810 | 810 | ||
811 | config = source.AddConfig(RegionName); | 811 | config = source.AddConfig(RegionName); |
812 | 812 | ||
@@ -865,10 +865,15 @@ namespace OpenSim.Framework | |||
865 | 865 | ||
866 | return; | 866 | return; |
867 | } | 867 | } |
868 | configMember = new ConfigurationMember(filename, description, loadConfigurationOptionsFromMe, | 868 | else if (filename.ToLower().EndsWith(".xml")) |
869 | ignoreIncomingConfiguration, false); | 869 | { |
870 | configMember.performConfigurationRetrieve(); | 870 | configMember = new ConfigurationMember(filename, description, loadConfigurationOptionsFromMe, |
871 | RegionFile = filename; | 871 | ignoreIncomingConfiguration, false); |
872 | configMember.performConfigurationRetrieve(); | ||
873 | RegionFile = filename; | ||
874 | } | ||
875 | else | ||
876 | throw new Exception("Invalid file type for region persistence."); | ||
872 | } | 877 | } |
873 | 878 | ||
874 | public void loadConfigurationOptionsFromMe() | 879 | public void loadConfigurationOptionsFromMe() |
diff --git a/OpenSim/Framework/Serialization/External/LandDataSerializer.cs b/OpenSim/Framework/Serialization/External/LandDataSerializer.cs index ff0afc8..fc0387b 100644 --- a/OpenSim/Framework/Serialization/External/LandDataSerializer.cs +++ b/OpenSim/Framework/Serialization/External/LandDataSerializer.cs | |||
@@ -118,7 +118,8 @@ namespace OpenSim.Framework.Serialization.External | |||
118 | landData.SnapshotID = UUID.Parse( xtr.ReadElementString("SnapshotID")); | 118 | landData.SnapshotID = UUID.Parse( xtr.ReadElementString("SnapshotID")); |
119 | landData.UserLocation = Vector3.Parse( xtr.ReadElementString("UserLocation")); | 119 | landData.UserLocation = Vector3.Parse( xtr.ReadElementString("UserLocation")); |
120 | landData.UserLookAt = Vector3.Parse( xtr.ReadElementString("UserLookAt")); | 120 | landData.UserLookAt = Vector3.Parse( xtr.ReadElementString("UserLookAt")); |
121 | landData.Dwell = Convert.ToInt32( xtr.ReadElementString("Dwell")); | 121 | // No longer used here |
122 | xtr.ReadElementString("Dwell"); | ||
122 | landData.OtherCleanTime = Convert.ToInt32( xtr.ReadElementString("OtherCleanTime")); | 123 | landData.OtherCleanTime = Convert.ToInt32( xtr.ReadElementString("OtherCleanTime")); |
123 | 124 | ||
124 | xtr.ReadEndElement(); | 125 | xtr.ReadEndElement(); |
@@ -177,7 +178,7 @@ namespace OpenSim.Framework.Serialization.External | |||
177 | xtw.WriteElementString("SnapshotID", landData.SnapshotID.ToString()); | 178 | xtw.WriteElementString("SnapshotID", landData.SnapshotID.ToString()); |
178 | xtw.WriteElementString("UserLocation", landData.UserLocation.ToString()); | 179 | xtw.WriteElementString("UserLocation", landData.UserLocation.ToString()); |
179 | xtw.WriteElementString("UserLookAt", landData.UserLookAt.ToString()); | 180 | xtw.WriteElementString("UserLookAt", landData.UserLookAt.ToString()); |
180 | xtw.WriteElementString("Dwell", Convert.ToString(landData.Dwell)); | 181 | xtw.WriteElementString("Dwell", "0"); |
181 | xtw.WriteElementString("OtherCleanTime", Convert.ToString(landData.OtherCleanTime)); | 182 | xtw.WriteElementString("OtherCleanTime", Convert.ToString(landData.OtherCleanTime)); |
182 | 183 | ||
183 | xtw.WriteEndElement(); | 184 | xtw.WriteEndElement(); |
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 016ab73..d20f8c9 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | |||
@@ -28,6 +28,7 @@ | |||
28 | using System; | 28 | 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.IO; | 32 | using System.IO; |
32 | using System.Net; | 33 | using System.Net; |
33 | using System.Net.Sockets; | 34 | using System.Net.Sockets; |
@@ -338,19 +339,25 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
338 | // HandleRequest(request,resp); | 339 | // HandleRequest(request,resp); |
339 | // } | 340 | // } |
340 | 341 | ||
342 | /// <summary> | ||
343 | /// This methods is the start of incoming HTTP request handling. | ||
344 | /// </summary> | ||
345 | /// <param name="request"></param> | ||
346 | /// <param name="response"></param> | ||
341 | public virtual void HandleRequest(OSHttpRequest request, OSHttpResponse response) | 347 | public virtual void HandleRequest(OSHttpRequest request, OSHttpResponse response) |
342 | { | 348 | { |
343 | try | 349 | try |
344 | { | 350 | { |
351 | // m_log.Debug("[BASE HTTP SERVER]: Handling request to " + request.RawUrl); | ||
352 | |||
345 | Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", true); | 353 | Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", true); |
354 | |||
346 | // This is the REST agent interface. We require an agent to properly identify | 355 | // This is the REST agent interface. We require an agent to properly identify |
347 | // itself. If the REST handler recognizes the prefix it will attempt to | 356 | // itself. If the REST handler recognizes the prefix it will attempt to |
348 | // satisfy the request. If it is not recognizable, and no damage has occurred | 357 | // satisfy the request. If it is not recognizable, and no damage has occurred |
349 | // the request can be passed through to the other handlers. This is a low | 358 | // the request can be passed through to the other handlers. This is a low |
350 | // probability event; if a request is matched it is normally expected to be | 359 | // probability event; if a request is matched it is normally expected to be |
351 | // handled | 360 | // handled |
352 | // m_log.Debug("[BASE HTTP SERVER]: Handling request to " + request.RawUrl); | ||
353 | |||
354 | IHttpAgentHandler agentHandler; | 361 | IHttpAgentHandler agentHandler; |
355 | 362 | ||
356 | if (TryGetAgentHandler(request, response, out agentHandler)) | 363 | if (TryGetAgentHandler(request, response, out agentHandler)) |
@@ -731,6 +738,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
731 | if (methodWasFound) | 738 | if (methodWasFound) |
732 | { | 739 | { |
733 | xmlRprcRequest.Params.Add(request.Url); // Param[2] | 740 | xmlRprcRequest.Params.Add(request.Url); // Param[2] |
741 | xmlRprcRequest.Params.Add(request.Headers.Get("X-Forwarded-For")); // Param[3] | ||
734 | 742 | ||
735 | try | 743 | try |
736 | { | 744 | { |
diff --git a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs index f955df7..41ece86 100644 --- a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs +++ b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs | |||
@@ -57,80 +57,73 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
57 | { | 57 | { |
58 | WebRequest request = WebRequest.Create(requestUrl); | 58 | WebRequest request = WebRequest.Create(requestUrl); |
59 | request.Method = verb; | 59 | request.Method = verb; |
60 | string respstring = String.Empty; | ||
60 | 61 | ||
61 | if ((verb == "POST") || (verb == "PUT")) | 62 | using (MemoryStream buffer = new MemoryStream()) |
62 | { | 63 | { |
63 | request.ContentType = "text/www-form-urlencoded"; | 64 | if ((verb == "POST") || (verb == "PUT")) |
64 | |||
65 | MemoryStream buffer = new MemoryStream(); | ||
66 | int length = 0; | ||
67 | using (StreamWriter writer = new StreamWriter(buffer)) | ||
68 | { | 65 | { |
69 | writer.Write(obj); | 66 | request.ContentType = "text/www-form-urlencoded"; |
70 | writer.Flush(); | ||
71 | } | ||
72 | 67 | ||
73 | length = (int)obj.Length; | 68 | int length = 0; |
74 | request.ContentLength = length; | 69 | using (StreamWriter writer = new StreamWriter(buffer)) |
70 | { | ||
71 | writer.Write(obj); | ||
72 | writer.Flush(); | ||
73 | } | ||
75 | 74 | ||
76 | Stream requestStream = null; | 75 | length = (int)obj.Length; |
77 | try | 76 | request.ContentLength = length; |
78 | { | ||
79 | requestStream = request.GetRequestStream(); | ||
80 | requestStream.Write(buffer.ToArray(), 0, length); | ||
81 | } | ||
82 | catch (Exception e) | ||
83 | { | ||
84 | m_log.DebugFormat("[FORMS]: exception occured on sending request to {0}: " + e.ToString(), requestUrl); | ||
85 | } | ||
86 | finally | ||
87 | { | ||
88 | // If this is closed, it will be disposed internally, | ||
89 | // but the above write is asynchronous and may hit after | ||
90 | // we're through here. So the thread handling that will | ||
91 | // throw and put us back into the catch above. Isn't | ||
92 | // .NET great? | ||
93 | //if (requestStream != null) | ||
94 | // requestStream.Close(); | ||
95 | // Let's not close this | ||
96 | //buffer.Close(); | ||
97 | 77 | ||
78 | Stream requestStream = null; | ||
79 | try | ||
80 | { | ||
81 | requestStream = request.GetRequestStream(); | ||
82 | requestStream.Write(buffer.ToArray(), 0, length); | ||
83 | } | ||
84 | catch (Exception e) | ||
85 | { | ||
86 | m_log.DebugFormat("[FORMS]: exception occured on sending request to {0}: " + e.ToString(), requestUrl); | ||
87 | } | ||
88 | finally | ||
89 | { | ||
90 | if (requestStream != null) | ||
91 | requestStream.Close(); | ||
92 | } | ||
98 | } | 93 | } |
99 | } | ||
100 | |||
101 | string respstring = String.Empty; | ||
102 | 94 | ||
103 | try | 95 | try |
104 | { | ||
105 | using (WebResponse resp = request.GetResponse()) | ||
106 | { | 96 | { |
107 | if (resp.ContentLength != 0) | 97 | using (WebResponse resp = request.GetResponse()) |
108 | { | 98 | { |
109 | Stream respStream = null; | 99 | if (resp.ContentLength != 0) |
110 | try | ||
111 | { | 100 | { |
112 | respStream = resp.GetResponseStream(); | 101 | Stream respStream = null; |
113 | using (StreamReader reader = new StreamReader(respStream)) | 102 | try |
114 | { | 103 | { |
115 | respstring = reader.ReadToEnd(); | 104 | respStream = resp.GetResponseStream(); |
105 | using (StreamReader reader = new StreamReader(respStream)) | ||
106 | { | ||
107 | respstring = reader.ReadToEnd(); | ||
108 | } | ||
109 | } | ||
110 | catch (Exception e) | ||
111 | { | ||
112 | m_log.DebugFormat("[FORMS]: exception occured on receiving reply " + e.ToString()); | ||
113 | } | ||
114 | finally | ||
115 | { | ||
116 | if (respStream != null) | ||
117 | respStream.Close(); | ||
116 | } | 118 | } |
117 | } | ||
118 | catch (Exception e) | ||
119 | { | ||
120 | m_log.DebugFormat("[FORMS]: exception occured on receiving reply " + e.ToString()); | ||
121 | } | ||
122 | finally | ||
123 | { | ||
124 | if (respStream != null) | ||
125 | respStream.Close(); | ||
126 | } | 119 | } |
127 | } | 120 | } |
128 | } | 121 | } |
129 | } | 122 | catch (System.InvalidOperationException) |
130 | catch (System.InvalidOperationException) | 123 | { |
131 | { | 124 | // This is what happens when there is invalid XML |
132 | // This is what happens when there is invalid XML | 125 | m_log.DebugFormat("[FORMS]: InvalidOperationException on receiving request"); |
133 | m_log.DebugFormat("[FORMS]: InvalidOperationException on receiving request"); | 126 | } |
134 | } | 127 | } |
135 | return respstring; | 128 | return respstring; |
136 | } | 129 | } |
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index af5a0ce..b66d826 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs | |||
@@ -1495,5 +1495,49 @@ namespace OpenSim.Framework | |||
1495 | } | 1495 | } |
1496 | } | 1496 | } |
1497 | 1497 | ||
1498 | /// <summary> | ||
1499 | /// Gets the client IP address | ||
1500 | /// </summary> | ||
1501 | /// <param name="xff"></param> | ||
1502 | /// <returns></returns> | ||
1503 | public static IPEndPoint GetClientIPFromXFF(string xff) | ||
1504 | { | ||
1505 | if (xff == string.Empty) | ||
1506 | return null; | ||
1507 | |||
1508 | string[] parts = xff.Split(new char[] { ',' }); | ||
1509 | if (parts.Length > 0) | ||
1510 | { | ||
1511 | try | ||
1512 | { | ||
1513 | return new IPEndPoint(IPAddress.Parse(parts[0]), 0); | ||
1514 | } | ||
1515 | catch (Exception e) | ||
1516 | { | ||
1517 | m_log.WarnFormat("[UTIL]: Exception parsing XFF header {0}: {1}", xff, e.Message); | ||
1518 | } | ||
1519 | } | ||
1520 | |||
1521 | return null; | ||
1522 | } | ||
1523 | |||
1524 | public static string GetCallerIP(Hashtable req) | ||
1525 | { | ||
1526 | if (req.ContainsKey("headers")) | ||
1527 | { | ||
1528 | try | ||
1529 | { | ||
1530 | Hashtable headers = (Hashtable)req["headers"]; | ||
1531 | if (headers.ContainsKey("remote_addr") && headers["remote_addr"] != null) | ||
1532 | return headers["remote_addr"].ToString(); | ||
1533 | } | ||
1534 | catch (Exception e) | ||
1535 | { | ||
1536 | m_log.WarnFormat("[UTIL]: exception in GetCallerIP: {0}", e.Message); | ||
1537 | } | ||
1538 | } | ||
1539 | return string.Empty; | ||
1540 | } | ||
1541 | |||
1498 | } | 1542 | } |
1499 | } | 1543 | } |