diff options
author | Melanie | 2013-02-27 18:05:04 +0000 |
---|---|---|
committer | Melanie | 2013-02-27 18:05:04 +0000 |
commit | 578174d21c82e7249016e31f0c63215e67f92f17 (patch) | |
tree | c9c970d2ce4836dcf894922172d784d16cbc2837 /OpenSim | |
parent | Merge branch 'master' into careminster (diff) | |
parent | Improve description of GenerateMapTiles config option (diff) | |
download | opensim-SC_OLD-578174d21c82e7249016e31f0c63215e67f92f17.zip opensim-SC_OLD-578174d21c82e7249016e31f0c63215e67f92f17.tar.gz opensim-SC_OLD-578174d21c82e7249016e31f0c63215e67f92f17.tar.bz2 opensim-SC_OLD-578174d21c82e7249016e31f0c63215e67f92f17.tar.xz |
Merge branch 'master' into careminster
Conflicts:
OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs
OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
Diffstat (limited to 'OpenSim')
20 files changed, 301 insertions, 216 deletions
diff --git a/OpenSim/ConsoleClient/Requester.cs b/OpenSim/ConsoleClient/Requester.cs index aabb02c..0a21328 100644 --- a/OpenSim/ConsoleClient/Requester.cs +++ b/OpenSim/ConsoleClient/Requester.cs | |||
@@ -44,7 +44,6 @@ namespace OpenSim.ConsoleClient | |||
44 | ReplyDelegate action) | 44 | ReplyDelegate action) |
45 | { | 45 | { |
46 | WebRequest request = WebRequest.Create(requestUrl); | 46 | WebRequest request = WebRequest.Create(requestUrl); |
47 | WebResponse response = null; | ||
48 | 47 | ||
49 | request.Method = "POST"; | 48 | request.Method = "POST"; |
50 | 49 | ||
@@ -64,16 +63,18 @@ namespace OpenSim.ConsoleClient | |||
64 | { | 63 | { |
65 | string reply = String.Empty; | 64 | string reply = String.Empty; |
66 | 65 | ||
67 | response = request.EndGetResponse(ar); | 66 | using (WebResponse response = request.EndGetResponse(ar)) |
68 | |||
69 | try | ||
70 | { | 67 | { |
71 | StreamReader r = new StreamReader(response.GetResponseStream()); | 68 | try |
72 | reply = r.ReadToEnd(); | 69 | { |
70 | using (Stream s = response.GetResponseStream()) | ||
71 | using (StreamReader r = new StreamReader(s)) | ||
72 | reply = r.ReadToEnd(); | ||
73 | 73 | ||
74 | } | 74 | } |
75 | catch (System.InvalidOperationException) | 75 | catch (System.InvalidOperationException) |
76 | { | 76 | { |
77 | } | ||
77 | } | 78 | } |
78 | 79 | ||
79 | action(requestUrl, data, reply); | 80 | action(requestUrl, data, reply); |
diff --git a/OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs b/OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs index 3dce578..6681c37 100644 --- a/OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs +++ b/OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs | |||
@@ -65,23 +65,27 @@ namespace OpenSim.Framework.Configuration.HTTP | |||
65 | byte[] buf = new byte[8192]; | 65 | byte[] buf = new byte[8192]; |
66 | HttpWebRequest request = | 66 | HttpWebRequest request = |
67 | (HttpWebRequest) WebRequest.Create(remoteConfigSettings.baseConfigURL + configFileName); | 67 | (HttpWebRequest) WebRequest.Create(remoteConfigSettings.baseConfigURL + configFileName); |
68 | HttpWebResponse response = (HttpWebResponse) request.GetResponse(); | 68 | using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) |
69 | |||
70 | Stream resStream = response.GetResponseStream(); | ||
71 | |||
72 | string tempString = null; | ||
73 | int count = 0; | ||
74 | |||
75 | do | ||
76 | { | 69 | { |
77 | count = resStream.Read(buf, 0, buf.Length); | 70 | using (Stream resStream = response.GetResponseStream()) |
78 | if (count != 0) | ||
79 | { | 71 | { |
80 | tempString = Util.UTF8.GetString(buf, 0, count); | 72 | string tempString = null; |
81 | sb.Append(tempString); | 73 | int count = 0; |
74 | |||
75 | do | ||
76 | { | ||
77 | count = resStream.Read(buf, 0, buf.Length); | ||
78 | if (count != 0) | ||
79 | { | ||
80 | tempString = Util.UTF8.GetString(buf, 0, count); | ||
81 | sb.Append(tempString); | ||
82 | } | ||
83 | } | ||
84 | while (count > 0); | ||
85 | |||
86 | LoadDataFromString(sb.ToString()); | ||
82 | } | 87 | } |
83 | } while (count > 0); | 88 | } |
84 | LoadDataFromString(sb.ToString()); | ||
85 | } | 89 | } |
86 | catch (WebException) | 90 | catch (WebException) |
87 | { | 91 | { |
diff --git a/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs b/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs index 19c03a8..edcd134 100644 --- a/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs +++ b/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs | |||
@@ -101,20 +101,11 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
101 | using (WebResponse resp = request.GetResponse()) | 101 | using (WebResponse resp = request.GetResponse()) |
102 | { | 102 | { |
103 | XmlSerializer deserializer = new XmlSerializer(typeof(TResponse)); | 103 | XmlSerializer deserializer = new XmlSerializer(typeof(TResponse)); |
104 | Stream respStream = null; | 104 | |
105 | try | 105 | using (Stream respStream = resp.GetResponseStream()) |
106 | { | ||
107 | respStream = resp.GetResponseStream(); | ||
108 | deserial = (TResponse)deserializer.Deserialize(respStream); | 106 | deserial = (TResponse)deserializer.Deserialize(respStream); |
109 | } | ||
110 | catch { } | ||
111 | finally | ||
112 | { | ||
113 | if (respStream != null) | ||
114 | respStream.Close(); | ||
115 | resp.Close(); | ||
116 | } | ||
117 | } | 107 | } |
108 | |||
118 | return deserial; | 109 | return deserial; |
119 | } | 110 | } |
120 | } | 111 | } |
diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index b85d93d..bf57fd4 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs | |||
@@ -228,8 +228,8 @@ namespace OpenSim.Framework | |||
228 | errorMessage = we.Message; | 228 | errorMessage = we.Message; |
229 | if (we.Status == WebExceptionStatus.ProtocolError) | 229 | if (we.Status == WebExceptionStatus.ProtocolError) |
230 | { | 230 | { |
231 | HttpWebResponse webResponse = (HttpWebResponse)we.Response; | 231 | using (HttpWebResponse webResponse = (HttpWebResponse)we.Response) |
232 | errorMessage = String.Format("[{0}] {1}",webResponse.StatusCode,webResponse.StatusDescription); | 232 | errorMessage = String.Format("[{0}] {1}", webResponse.StatusCode, webResponse.StatusDescription); |
233 | } | 233 | } |
234 | } | 234 | } |
235 | catch (Exception ex) | 235 | catch (Exception ex) |
@@ -388,8 +388,8 @@ namespace OpenSim.Framework | |||
388 | errorMessage = we.Message; | 388 | errorMessage = we.Message; |
389 | if (we.Status == WebExceptionStatus.ProtocolError) | 389 | if (we.Status == WebExceptionStatus.ProtocolError) |
390 | { | 390 | { |
391 | HttpWebResponse webResponse = (HttpWebResponse)we.Response; | 391 | using (HttpWebResponse webResponse = (HttpWebResponse)we.Response) |
392 | errorMessage = String.Format("[{0}] {1}",webResponse.StatusCode,webResponse.StatusDescription); | 392 | errorMessage = String.Format("[{0}] {1}",webResponse.StatusCode,webResponse.StatusDescription); |
393 | } | 393 | } |
394 | } | 394 | } |
395 | catch (Exception ex) | 395 | catch (Exception ex) |
@@ -837,15 +837,16 @@ namespace OpenSim.Framework | |||
837 | { | 837 | { |
838 | if (e.Response is HttpWebResponse) | 838 | if (e.Response is HttpWebResponse) |
839 | { | 839 | { |
840 | HttpWebResponse httpResponse = (HttpWebResponse)e.Response; | 840 | using (HttpWebResponse httpResponse = (HttpWebResponse)e.Response) |
841 | 841 | { | |
842 | if (httpResponse.StatusCode != HttpStatusCode.NotFound) | 842 | if (httpResponse.StatusCode != HttpStatusCode.NotFound) |
843 | { | 843 | { |
844 | // We don't appear to be handling any other status codes, so log these feailures to that | 844 | // We don't appear to be handling any other status codes, so log these feailures to that |
845 | // people don't spend unnecessary hours hunting phantom bugs. | 845 | // people don't spend unnecessary hours hunting phantom bugs. |
846 | m_log.DebugFormat( | 846 | m_log.DebugFormat( |
847 | "[ASYNC REQUEST]: Request {0} {1} failed with unexpected status code {2}", | 847 | "[ASYNC REQUEST]: Request {0} {1} failed with unexpected status code {2}", |
848 | verb, requestUrl, httpResponse.StatusCode); | 848 | verb, requestUrl, httpResponse.StatusCode); |
849 | } | ||
849 | } | 850 | } |
850 | } | 851 | } |
851 | } | 852 | } |
@@ -995,11 +996,9 @@ namespace OpenSim.Framework | |||
995 | Stream respStream = null; | 996 | Stream respStream = null; |
996 | try | 997 | try |
997 | { | 998 | { |
998 | respStream = resp.GetResponseStream(); | 999 | using (respStream = resp.GetResponseStream()) |
999 | using (StreamReader reader = new StreamReader(respStream)) | 1000 | using (StreamReader reader = new StreamReader(respStream)) |
1000 | { | 1001 | respstring = reader.ReadToEnd(); |
1001 | respstring = reader.ReadToEnd(); | ||
1002 | } | ||
1003 | } | 1002 | } |
1004 | catch (Exception e) | 1003 | catch (Exception e) |
1005 | { | 1004 | { |
@@ -1142,10 +1141,11 @@ namespace OpenSim.Framework | |||
1142 | { | 1141 | { |
1143 | if (resp.ContentLength != 0) | 1142 | if (resp.ContentLength != 0) |
1144 | { | 1143 | { |
1145 | Stream respStream = resp.GetResponseStream(); | 1144 | using (Stream respStream = resp.GetResponseStream()) |
1146 | XmlSerializer deserializer = new XmlSerializer(typeof(TResponse)); | 1145 | { |
1147 | deserial = (TResponse)deserializer.Deserialize(respStream); | 1146 | XmlSerializer deserializer = new XmlSerializer(typeof(TResponse)); |
1148 | respStream.Close(); | 1147 | deserial = (TResponse)deserializer.Deserialize(respStream); |
1148 | } | ||
1149 | } | 1149 | } |
1150 | else | 1150 | else |
1151 | { | 1151 | { |
@@ -1157,14 +1157,15 @@ namespace OpenSim.Framework | |||
1157 | } | 1157 | } |
1158 | catch (WebException e) | 1158 | catch (WebException e) |
1159 | { | 1159 | { |
1160 | HttpWebResponse hwr = (HttpWebResponse)e.Response; | 1160 | using (HttpWebResponse hwr = (HttpWebResponse)e.Response) |
1161 | 1161 | { | |
1162 | if (hwr != null && hwr.StatusCode == HttpStatusCode.NotFound) | 1162 | if (hwr != null && hwr.StatusCode == HttpStatusCode.NotFound) |
1163 | return deserial; | 1163 | return deserial; |
1164 | else | 1164 | else |
1165 | m_log.ErrorFormat( | 1165 | m_log.ErrorFormat( |
1166 | "[SynchronousRestObjectRequester]: WebException for {0} {1} {2}: {3} {4}", | 1166 | "[SynchronousRestObjectRequester]: WebException for {0} {1} {2}: {3} {4}", |
1167 | verb, requestUrl, typeof(TResponse).ToString(), e.Message, e.StackTrace); | 1167 | verb, requestUrl, typeof(TResponse).ToString(), e.Message, e.StackTrace); |
1168 | } | ||
1168 | } | 1169 | } |
1169 | catch (System.InvalidOperationException) | 1170 | catch (System.InvalidOperationException) |
1170 | { | 1171 | { |
diff --git a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs index 60b7190..b9c373b 100644 --- a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs | |||
@@ -88,15 +88,11 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
88 | /// </summary> | 88 | /// </summary> |
89 | private int m_TotalUrls = 15000; | 89 | private int m_TotalUrls = 15000; |
90 | 90 | ||
91 | private uint https_port = 0; | 91 | private uint m_HttpsPort = 0; |
92 | private IHttpServer m_HttpServer = null; | 92 | private IHttpServer m_HttpServer = null; |
93 | private IHttpServer m_HttpsServer = null; | 93 | private IHttpServer m_HttpsServer = null; |
94 | 94 | ||
95 | private string m_ExternalHostNameForLSL = ""; | 95 | public string ExternalHostNameForLSL { get; private set; } |
96 | public string ExternalHostNameForLSL | ||
97 | { | ||
98 | get { return m_ExternalHostNameForLSL; } | ||
99 | } | ||
100 | 96 | ||
101 | public Type ReplaceableInterface | 97 | public Type ReplaceableInterface |
102 | { | 98 | { |
@@ -110,13 +106,21 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
110 | 106 | ||
111 | public void Initialise(IConfigSource config) | 107 | public void Initialise(IConfigSource config) |
112 | { | 108 | { |
113 | m_ExternalHostNameForLSL = config.Configs["Network"].GetString("ExternalHostNameForLSL", System.Environment.MachineName); | 109 | IConfig networkConfig = config.Configs["Network"]; |
114 | bool ssl_enabled = config.Configs["Network"].GetBoolean("https_listener",false); | 110 | |
115 | if (ssl_enabled) | 111 | if (networkConfig != null) |
116 | { | 112 | { |
117 | https_port = (uint) config.Configs["Network"].GetInt("https_port",0); | 113 | ExternalHostNameForLSL = config.Configs["Network"].GetString("ExternalHostNameForLSL", null); |
114 | |||
115 | bool ssl_enabled = config.Configs["Network"].GetBoolean("https_listener", false); | ||
116 | |||
117 | if (ssl_enabled) | ||
118 | m_HttpsPort = (uint)config.Configs["Network"].GetInt("https_port", (int)m_HttpsPort); | ||
118 | } | 119 | } |
119 | 120 | ||
121 | if (ExternalHostNameForLSL == null) | ||
122 | ExternalHostNameForLSL = System.Environment.MachineName; | ||
123 | |||
120 | IConfig llFunctionsConfig = config.Configs["LL-Functions"]; | 124 | IConfig llFunctionsConfig = config.Configs["LL-Functions"]; |
121 | 125 | ||
122 | if (llFunctionsConfig != null) | 126 | if (llFunctionsConfig != null) |
@@ -136,9 +140,9 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
136 | m_HttpServer = MainServer.Instance; | 140 | m_HttpServer = MainServer.Instance; |
137 | // | 141 | // |
138 | // We can use the https if it is enabled | 142 | // We can use the https if it is enabled |
139 | if (https_port > 0) | 143 | if (m_HttpsPort > 0) |
140 | { | 144 | { |
141 | m_HttpsServer = MainServer.GetHttpServer(https_port); | 145 | m_HttpsServer = MainServer.GetHttpServer(m_HttpsPort); |
142 | } | 146 | } |
143 | } | 147 | } |
144 | 148 | ||
@@ -176,7 +180,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
176 | engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" }); | 180 | engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" }); |
177 | return urlcode; | 181 | return urlcode; |
178 | } | 182 | } |
179 | string url = "http://" + m_ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + "/lslhttp/" + urlcode.ToString(); | 183 | string url = "http://" + ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + "/lslhttp/" + urlcode.ToString(); |
180 | 184 | ||
181 | UrlData urlData = new UrlData(); | 185 | UrlData urlData = new UrlData(); |
182 | urlData.hostID = host.UUID; | 186 | urlData.hostID = host.UUID; |
@@ -221,7 +225,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
221 | engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" }); | 225 | engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" }); |
222 | return urlcode; | 226 | return urlcode; |
223 | } | 227 | } |
224 | string url = "https://" + m_ExternalHostNameForLSL + ":" + m_HttpsServer.Port.ToString() + "/lslhttps/" + urlcode.ToString(); | 228 | string url = "https://" + ExternalHostNameForLSL + ":" + m_HttpsServer.Port.ToString() + "/lslhttps/" + urlcode.ToString(); |
225 | 229 | ||
226 | UrlData urlData = new UrlData(); | 230 | UrlData urlData = new UrlData(); |
227 | urlData.hostID = host.UUID; | 231 | urlData.hostID = host.UUID; |
@@ -542,7 +546,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
542 | { | 546 | { |
543 | Hashtable headers = (Hashtable)request["headers"]; | 547 | Hashtable headers = (Hashtable)request["headers"]; |
544 | 548 | ||
545 | // string uri_full = "http://" + m_ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + uri;// "/lslhttp/" + urlcode.ToString() + "/"; | 549 | // string uri_full = "http://" + ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + uri;// "/lslhttp/" + urlcode.ToString() + "/"; |
546 | 550 | ||
547 | int pos1 = uri.IndexOf("/");// /lslhttp | 551 | int pos1 = uri.IndexOf("/");// /lslhttp |
548 | int pos2 = uri.IndexOf("/", pos1 + 1);// /lslhttp/ | 552 | int pos2 = uri.IndexOf("/", pos1 + 1);// /lslhttp/ |
@@ -558,10 +562,10 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
558 | UrlData url = null; | 562 | UrlData url = null; |
559 | string urlkey; | 563 | string urlkey; |
560 | if (!is_ssl) | 564 | if (!is_ssl) |
561 | urlkey = "http://" + m_ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + uri_tmp; | 565 | urlkey = "http://" + ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + uri_tmp; |
562 | //m_UrlMap[]; | 566 | //m_UrlMap[]; |
563 | else | 567 | else |
564 | urlkey = "https://" + m_ExternalHostNameForLSL + ":" + m_HttpsServer.Port.ToString() + uri_tmp; | 568 | urlkey = "https://" + ExternalHostNameForLSL + ":" + m_HttpsServer.Port.ToString() + uri_tmp; |
565 | 569 | ||
566 | if (m_UrlMap.ContainsKey(urlkey)) | 570 | if (m_UrlMap.ContainsKey(urlkey)) |
567 | { | 571 | { |
diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs index f395441..14304a7 100644 --- a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs | |||
@@ -838,13 +838,17 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender | |||
838 | try | 838 | try |
839 | { | 839 | { |
840 | WebRequest request = HttpWebRequest.Create(url); | 840 | WebRequest request = HttpWebRequest.Create(url); |
841 | //Ckrinke: Comment out for now as 'str' is unused. Bring it back into play later when it is used. | 841 | |
842 | //Ckrinke Stream str = null; | 842 | using (HttpWebResponse response = (HttpWebResponse)(request).GetResponse()) |
843 | HttpWebResponse response = (HttpWebResponse)(request).GetResponse(); | ||
844 | if (response.StatusCode == HttpStatusCode.OK) | ||
845 | { | 843 | { |
846 | Bitmap image = new Bitmap(response.GetResponseStream()); | 844 | if (response.StatusCode == HttpStatusCode.OK) |
847 | return image; | 845 | { |
846 | using (Stream s = response.GetResponseStream()) | ||
847 | { | ||
848 | Bitmap image = new Bitmap(s); | ||
849 | return image; | ||
850 | } | ||
851 | } | ||
848 | } | 852 | } |
849 | } | 853 | } |
850 | catch { } | 854 | catch { } |
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index c868ee4..bf18616 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | |||
@@ -94,7 +94,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
94 | if (Util.GetConfigVarFromSections<string>( | 94 | if (Util.GetConfigVarFromSections<string>( |
95 | config, "WorldMapModule", configSections, "WorldMap") == "WorldMap") | 95 | config, "WorldMapModule", configSections, "WorldMap") == "WorldMap") |
96 | m_Enabled = true; | 96 | m_Enabled = true; |
97 | 97 | ||
98 | blacklistTimeout | 98 | blacklistTimeout |
99 | = Util.GetConfigVarFromSections<int>(config, "BlacklistTimeout", configSections, 10 * 60) * 1000; | 99 | = Util.GetConfigVarFromSections<int>(config, "BlacklistTimeout", configSections, 10 * 60) * 1000; |
100 | } | 100 | } |
diff --git a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs index 143af48..ced4e91 100644 --- a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs | |||
@@ -52,7 +52,18 @@ namespace OpenSim.Region.Framework.Interfaces | |||
52 | string GetXMLState(UUID itemID); | 52 | string GetXMLState(UUID itemID); |
53 | bool SetXMLState(UUID itemID, string xml); | 53 | bool SetXMLState(UUID itemID, string xml); |
54 | 54 | ||
55 | /// <summary> | ||
56 | /// Post a script event to a single script. | ||
57 | /// </summary> | ||
58 | /// <returns>true if the post suceeded, false if it did not</returns> | ||
59 | /// <param name='itemID'>The item ID of the script.</param> | ||
60 | /// <param name='name'>The name of the event.</param> | ||
61 | /// <param name='args'> | ||
62 | /// The arguments of the event. These are in the order in which they appear. | ||
63 | /// e.g. for http_request this will be an object array of key request_id, string method, string body | ||
64 | /// </param> | ||
55 | bool PostScriptEvent(UUID itemID, string name, Object[] args); | 65 | bool PostScriptEvent(UUID itemID, string name, Object[] args); |
66 | |||
56 | bool PostObjectEvent(UUID itemID, string name, Object[] args); | 67 | bool PostObjectEvent(UUID itemID, string name, Object[] args); |
57 | 68 | ||
58 | /// <summary> | 69 | /// <summary> |
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs index f292a75..0cec959 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs | |||
@@ -551,13 +551,20 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice | |||
551 | reqStream.Close(); | 551 | reqStream.Close(); |
552 | } | 552 | } |
553 | 553 | ||
554 | HttpWebResponse fwdrsp = (HttpWebResponse)forwardreq.GetResponse(); | 554 | using (HttpWebResponse fwdrsp = (HttpWebResponse)forwardreq.GetResponse()) |
555 | Encoding encoding = Util.UTF8; | 555 | { |
556 | StreamReader fwdresponsestream = new StreamReader(fwdrsp.GetResponseStream(), encoding); | 556 | Encoding encoding = Util.UTF8; |
557 | fwdresponsestr = fwdresponsestream.ReadToEnd(); | 557 | |
558 | fwdresponsecontenttype = fwdrsp.ContentType; | 558 | using (Stream s = fwdrsp.GetResponseStream()) |
559 | fwdresponsecode = (int)fwdrsp.StatusCode; | 559 | { |
560 | fwdresponsestream.Close(); | 560 | using (StreamReader fwdresponsestream = new StreamReader(s)) |
561 | { | ||
562 | fwdresponsestr = fwdresponsestream.ReadToEnd(); | ||
563 | fwdresponsecontenttype = fwdrsp.ContentType; | ||
564 | fwdresponsecode = (int)fwdrsp.StatusCode; | ||
565 | } | ||
566 | } | ||
567 | } | ||
561 | 568 | ||
562 | response["content_type"] = fwdresponsecontenttype; | 569 | response["content_type"] = fwdresponsecontenttype; |
563 | response["str_response_string"] = fwdresponsestr; | 570 | response["str_response_string"] = fwdresponsestr; |
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs index 7da1de6..e756c70 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs | |||
@@ -1123,18 +1123,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice | |||
1123 | // Otherwise prepare the request | 1123 | // Otherwise prepare the request |
1124 | // m_log.DebugFormat("[VivoxVoice] Sending request <{0}>", requrl); | 1124 | // m_log.DebugFormat("[VivoxVoice] Sending request <{0}>", requrl); |
1125 | 1125 | ||
1126 | HttpWebRequest req = (HttpWebRequest)WebRequest.Create(requrl); | 1126 | HttpWebRequest req = (HttpWebRequest)WebRequest.Create(requrl); |
1127 | HttpWebResponse rsp = null; | ||
1128 | 1127 | ||
1129 | // We are sending just parameters, no content | 1128 | // We are sending just parameters, no content |
1130 | req.ContentLength = 0; | 1129 | req.ContentLength = 0; |
1131 | 1130 | ||
1132 | // Send request and retrieve the response | 1131 | // Send request and retrieve the response |
1133 | rsp = (HttpWebResponse)req.GetResponse(); | 1132 | using (HttpWebResponse rsp = (HttpWebResponse)req.GetResponse()) |
1134 | 1133 | using (Stream s = rsp.GetResponseStream()) | |
1135 | XmlTextReader rdr = new XmlTextReader(rsp.GetResponseStream()); | 1134 | using (XmlTextReader rdr = new XmlTextReader(s)) |
1136 | doc.Load(rdr); | 1135 | doc.Load(rdr); |
1137 | rdr.Close(); | ||
1138 | } | 1136 | } |
1139 | catch (Exception e) | 1137 | catch (Exception e) |
1140 | { | 1138 | { |
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs index 1101851..71b24ac 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs | |||
@@ -1146,28 +1146,38 @@ namespace Nwc.XmlRpc | |||
1146 | request.AllowWriteStreamBuffering = true; | 1146 | request.AllowWriteStreamBuffering = true; |
1147 | request.KeepAlive = !_disableKeepAlive; | 1147 | request.KeepAlive = !_disableKeepAlive; |
1148 | 1148 | ||
1149 | Stream stream = request.GetRequestStream(); | 1149 | using (Stream stream = request.GetRequestStream()) |
1150 | XmlTextWriter xml = new XmlTextWriter(stream, Encoding.ASCII); | ||
1151 | _serializer.Serialize(xml, this); | ||
1152 | xml.Flush(); | ||
1153 | xml.Close(); | ||
1154 | |||
1155 | HttpWebResponse response = (HttpWebResponse)request.GetResponse(); | ||
1156 | StreamReader input = new StreamReader(response.GetResponseStream()); | ||
1157 | |||
1158 | string inputXml = input.ReadToEnd(); | ||
1159 | XmlRpcResponse resp; | ||
1160 | try | ||
1161 | { | 1150 | { |
1162 | resp = (XmlRpcResponse)_deserializer.Deserialize(inputXml); | 1151 | using (XmlTextWriter xml = new XmlTextWriter(stream, Encoding.ASCII)) |
1152 | { | ||
1153 | _serializer.Serialize(xml, this); | ||
1154 | xml.Flush(); | ||
1155 | } | ||
1163 | } | 1156 | } |
1164 | catch (Exception e) | 1157 | |
1158 | XmlRpcResponse resp; | ||
1159 | |||
1160 | using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) | ||
1165 | { | 1161 | { |
1166 | RequestResponse = inputXml; | 1162 | using (Stream s = response.GetResponseStream()) |
1167 | throw e; | 1163 | { |
1164 | using (StreamReader input = new StreamReader(s)) | ||
1165 | { | ||
1166 | string inputXml = input.ReadToEnd(); | ||
1167 | |||
1168 | try | ||
1169 | { | ||
1170 | resp = (XmlRpcResponse)_deserializer.Deserialize(inputXml); | ||
1171 | } | ||
1172 | catch (Exception e) | ||
1173 | { | ||
1174 | RequestResponse = inputXml; | ||
1175 | throw e; | ||
1176 | } | ||
1177 | } | ||
1178 | } | ||
1168 | } | 1179 | } |
1169 | input.Close(); | 1180 | |
1170 | response.Close(); | ||
1171 | return resp; | 1181 | return resp; |
1172 | } | 1182 | } |
1173 | } | 1183 | } |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index 4dff927..8f660c4 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | |||
@@ -470,7 +470,7 @@ public class BSPrim : BSPhysObject | |||
470 | // Note that this does not change _mass! | 470 | // Note that this does not change _mass! |
471 | public override void UpdatePhysicalMassProperties(float physMass, bool inWorld) | 471 | public override void UpdatePhysicalMassProperties(float physMass, bool inWorld) |
472 | { | 472 | { |
473 | if (PhysBody.HasPhysicalBody) | 473 | if (PhysBody.HasPhysicalBody && PhysShape.HasPhysicalShape) |
474 | { | 474 | { |
475 | if (IsStatic) | 475 | if (IsStatic) |
476 | { | 476 | { |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt index 49718c4..4dc16f4 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt +++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt | |||
@@ -1,5 +1,12 @@ | |||
1 | CURRENT PRIORITIES | 1 | CURRENT PRIORITIES |
2 | ================================================= | 2 | ================================================= |
3 | Use the HACD convex hull routine in Bullet rather than the C# version. | ||
4 | Speed up hullifying large meshes. | ||
5 | Enable vehicle border crossings (at least as poorly as ODE) | ||
6 | Terrain skirts | ||
7 | Avatar created in previous region and not new region when crossing border | ||
8 | Vehicle recreated in new sim at small Z value (offset from root value?) (DONE) | ||
9 | Lock axis | ||
3 | Deleting a linkset while standing on the root will leave the physical shape of the root behind. | 10 | Deleting a linkset while standing on the root will leave the physical shape of the root behind. |
4 | Not sure if it is because standing on it. Done with large prim linksets. | 11 | Not sure if it is because standing on it. Done with large prim linksets. |
5 | Vehicle angular vertical attraction | 12 | Vehicle angular vertical attraction |
@@ -7,16 +14,11 @@ vehicle angular banking | |||
7 | Center-of-gravity | 14 | Center-of-gravity |
8 | Vehicle angular deflection | 15 | Vehicle angular deflection |
9 | Preferred orientation angular correction fix | 16 | Preferred orientation angular correction fix |
10 | Enable vehicle border crossings (at least as poorly as ODE) | ||
11 | Terrain skirts | ||
12 | Avatar created in previous region and not new region when crossing border | ||
13 | Vehicle recreated in new sim at small Z value (offset from root value?) (DONE) | ||
14 | when should angular and linear motor targets be zeroed? when selected? | 17 | when should angular and linear motor targets be zeroed? when selected? |
15 | Need a vehicle.clear()? Or an 'else' in prestep if not physical. | 18 | Need a vehicle.clear()? Or an 'else' in prestep if not physical. |
16 | Teravus llMoveToTarget script debug | 19 | Teravus llMoveToTarget script debug |
17 | Mixing of hover, buoyancy/gravity, moveToTarget, into one force | 20 | Mixing of hover, buoyancy/gravity, moveToTarget, into one force |
18 | Setting hover height to zero disables hover even if hover flags are on (from SL wiki) | 21 | Setting hover height to zero disables hover even if hover flags are on (from SL wiki) |
19 | Nebadon vehicles turning funny in arena | ||
20 | limitMotorUp calibration (more down?) | 22 | limitMotorUp calibration (more down?) |
21 | llRotLookAt | 23 | llRotLookAt |
22 | llLookAt | 24 | llLookAt |
@@ -66,6 +68,8 @@ Vehicle attributes are not restored when a vehicle is rezzed on region creation | |||
66 | 68 | ||
67 | GENERAL TODO LIST: | 69 | GENERAL TODO LIST: |
68 | ================================================= | 70 | ================================================= |
71 | Resitution of a prim works on another prim but not on terrain. | ||
72 | The dropped prim doesn't bounce properly on the terrain. | ||
69 | Add a sanity check for PIDTarget location. | 73 | Add a sanity check for PIDTarget location. |
70 | Level-of-detail for mesh creation. Prims with circular interiors require lod of 32. | 74 | Level-of-detail for mesh creation. Prims with circular interiors require lod of 32. |
71 | Is much saved with lower LODs? At the moment, all set to 32. | 75 | Is much saved with lower LODs? At the moment, all set to 32. |
@@ -163,7 +167,6 @@ Create tests for different interface components | |||
163 | Have test objects/scripts measure themselves and turn color if correct/bad | 167 | Have test objects/scripts measure themselves and turn color if correct/bad |
164 | Test functions in SL and calibrate correctness there | 168 | Test functions in SL and calibrate correctness there |
165 | Create auto rezzer and tracker to run through the tests | 169 | Create auto rezzer and tracker to run through the tests |
166 | Use the HACD convex hull routine in Bullet rather than the C# version. | ||
167 | Do we need to do convex hulls all the time? Can complex meshes be left meshes? | 170 | Do we need to do convex hulls all the time? Can complex meshes be left meshes? |
168 | There is some problem with meshes and collisions | 171 | There is some problem with meshes and collisions |
169 | Hulls are not as detailed as meshes. Hulled vehicles insides are different shape. | 172 | Hulls are not as detailed as meshes. Hulled vehicles insides are different shape. |
@@ -334,4 +337,5 @@ Child movement in linkset (don't rebuild linkset) (DONE 20130122)) | |||
334 | Avatar standing on a moving object should start to move with the object. (DONE 20130125) | 337 | Avatar standing on a moving object should start to move with the object. (DONE 20130125) |
335 | Angular motion around Z moves the vehicle in world Z and not vehicle Z in ODE. | 338 | Angular motion around Z moves the vehicle in world Z and not vehicle Z in ODE. |
336 | Verify that angular motion specified around Z moves in the vehicle coordinates. | 339 | Verify that angular motion specified around Z moves in the vehicle coordinates. |
337 | DONE 20130120: BulletSim properly applies force in vehicle relative coordinates. \ No newline at end of file | 340 | DONE 20130120: BulletSim properly applies force in vehicle relative coordinates. |
341 | Nebadon vehicles turning funny in arena (DONE) \ No newline at end of file | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 4c6950d..b67db20 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -10201,6 +10201,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10201 | return UUID.Zero.ToString(); | 10201 | return UUID.Zero.ToString(); |
10202 | } | 10202 | } |
10203 | } | 10203 | } |
10204 | |||
10204 | public LSL_String llRequestURL() | 10205 | public LSL_String llRequestURL() |
10205 | { | 10206 | { |
10206 | m_host.AddScriptLPS(1); | 10207 | m_host.AddScriptLPS(1); |
diff --git a/OpenSim/Services/Connectors/Hypergrid/HeloServicesConnector.cs b/OpenSim/Services/Connectors/Hypergrid/HeloServicesConnector.cs index 5c50936..5004d99 100644 --- a/OpenSim/Services/Connectors/Hypergrid/HeloServicesConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/HeloServicesConnector.cs | |||
@@ -73,7 +73,6 @@ namespace OpenSim.Services.Connectors | |||
73 | } | 73 | } |
74 | } | 74 | } |
75 | 75 | ||
76 | |||
77 | public virtual string Helo() | 76 | public virtual string Helo() |
78 | { | 77 | { |
79 | HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(m_ServerURI); | 78 | HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(m_ServerURI); |
@@ -82,10 +81,12 @@ namespace OpenSim.Services.Connectors | |||
82 | 81 | ||
83 | try | 82 | try |
84 | { | 83 | { |
85 | WebResponse response = req.GetResponse(); | 84 | using (WebResponse response = req.GetResponse()) |
86 | if (response.Headers.Get("X-Handlers-Provided") == null) // just in case this ever returns a null | 85 | { |
87 | return string.Empty; | 86 | if (response.Headers.Get("X-Handlers-Provided") == null) // just in case this ever returns a null |
88 | return response.Headers.Get("X-Handlers-Provided"); | 87 | return string.Empty; |
88 | return response.Headers.Get("X-Handlers-Provided"); | ||
89 | } | ||
89 | } | 90 | } |
90 | catch (Exception e) | 91 | catch (Exception e) |
91 | { | 92 | { |
@@ -95,6 +96,5 @@ namespace OpenSim.Services.Connectors | |||
95 | // fail | 96 | // fail |
96 | return string.Empty; | 97 | return string.Empty; |
97 | } | 98 | } |
98 | |||
99 | } | 99 | } |
100 | } | 100 | } \ No newline at end of file |
diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs index c542c29..d7e38f1 100644 --- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs | |||
@@ -169,41 +169,45 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
169 | // Let's wait for the response | 169 | // Let's wait for the response |
170 | //m_log.Info("[USER AGENT CONNECTOR]: Waiting for a reply after DoCreateChildAgentCall"); | 170 | //m_log.Info("[USER AGENT CONNECTOR]: Waiting for a reply after DoCreateChildAgentCall"); |
171 | 171 | ||
172 | WebResponse webResponse = null; | ||
173 | StreamReader sr = null; | ||
174 | try | 172 | try |
175 | { | 173 | { |
176 | webResponse = AgentCreateRequest.GetResponse(); | 174 | using (WebResponse webResponse = AgentCreateRequest.GetResponse()) |
177 | if (webResponse == null) | ||
178 | { | 175 | { |
179 | m_log.Info("[USER AGENT CONNECTOR]: Null reply on DoCreateChildAgentCall post"); | 176 | if (webResponse == null) |
180 | } | ||
181 | else | ||
182 | { | ||
183 | |||
184 | sr = new StreamReader(webResponse.GetResponseStream()); | ||
185 | string response = sr.ReadToEnd().Trim(); | ||
186 | m_log.InfoFormat("[USER AGENT CONNECTOR]: DoCreateChildAgentCall reply was {0} ", response); | ||
187 | |||
188 | if (!String.IsNullOrEmpty(response)) | ||
189 | { | 177 | { |
190 | try | 178 | m_log.Info("[USER AGENT CONNECTOR]: Null reply on DoCreateChildAgentCall post"); |
191 | { | 179 | } |
192 | // we assume we got an OSDMap back | 180 | else |
193 | OSDMap r = Util.GetOSDMap(response); | 181 | { |
194 | bool success = r["success"].AsBoolean(); | 182 | using (Stream s = webResponse.GetResponseStream()) |
195 | reason = r["reason"].AsString(); | ||
196 | return success; | ||
197 | } | ||
198 | catch (NullReferenceException e) | ||
199 | { | 183 | { |
200 | m_log.InfoFormat("[USER AGENT CONNECTOR]: exception on reply of DoCreateChildAgentCall {0}", e.Message); | 184 | using (StreamReader sr = new StreamReader(s)) |
201 | 185 | { | |
202 | // check for old style response | 186 | string response = sr.ReadToEnd().Trim(); |
203 | if (response.ToLower().StartsWith("true")) | 187 | m_log.InfoFormat("[USER AGENT CONNECTOR]: DoCreateChildAgentCall reply was {0} ", response); |
204 | return true; | 188 | |
205 | 189 | if (!String.IsNullOrEmpty(response)) | |
206 | return false; | 190 | { |
191 | try | ||
192 | { | ||
193 | // we assume we got an OSDMap back | ||
194 | OSDMap r = Util.GetOSDMap(response); | ||
195 | bool success = r["success"].AsBoolean(); | ||
196 | reason = r["reason"].AsString(); | ||
197 | return success; | ||
198 | } | ||
199 | catch (NullReferenceException e) | ||
200 | { | ||
201 | m_log.InfoFormat("[USER AGENT CONNECTOR]: exception on reply of DoCreateChildAgentCall {0}", e.Message); | ||
202 | |||
203 | // check for old style response | ||
204 | if (response.ToLower().StartsWith("true")) | ||
205 | return true; | ||
206 | |||
207 | return false; | ||
208 | } | ||
209 | } | ||
210 | } | ||
207 | } | 211 | } |
208 | } | 212 | } |
209 | } | 213 | } |
@@ -214,11 +218,6 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
214 | reason = "Destination did not reply"; | 218 | reason = "Destination did not reply"; |
215 | return false; | 219 | return false; |
216 | } | 220 | } |
217 | finally | ||
218 | { | ||
219 | if (sr != null) | ||
220 | sr.Close(); | ||
221 | } | ||
222 | 221 | ||
223 | return true; | 222 | return true; |
224 | 223 | ||
diff --git a/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs b/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs index 7688e0f..b36fa23 100644 --- a/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs +++ b/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs | |||
@@ -168,22 +168,27 @@ namespace OpenSim.Services.Connectors | |||
168 | // Let's wait for the response | 168 | // Let's wait for the response |
169 | //m_log.Info("[REST COMMS]: Waiting for a reply after DoHelloNeighbourCall"); | 169 | //m_log.Info("[REST COMMS]: Waiting for a reply after DoHelloNeighbourCall"); |
170 | 170 | ||
171 | StreamReader sr = null; | ||
172 | try | 171 | try |
173 | { | 172 | { |
174 | WebResponse webResponse = helloNeighbourRequest.GetResponse(); | 173 | using (WebResponse webResponse = helloNeighbourRequest.GetResponse()) |
175 | if (webResponse == null) | ||
176 | { | 174 | { |
177 | m_log.DebugFormat( | 175 | if (webResponse == null) |
178 | "[REST COMMS]: Null reply on DoHelloNeighbourCall post from {0} to {1}", | 176 | { |
179 | thisRegion.RegionName, region.RegionName); | 177 | m_log.DebugFormat( |
178 | "[REST COMMS]: Null reply on DoHelloNeighbourCall post from {0} to {1}", | ||
179 | thisRegion.RegionName, region.RegionName); | ||
180 | } | ||
181 | |||
182 | using (Stream s = webResponse.GetResponseStream()) | ||
183 | { | ||
184 | using (StreamReader sr = new StreamReader(s)) | ||
185 | { | ||
186 | //reply = sr.ReadToEnd().Trim(); | ||
187 | sr.ReadToEnd().Trim(); | ||
188 | //m_log.InfoFormat("[REST COMMS]: DoHelloNeighbourCall reply was {0} ", reply); | ||
189 | } | ||
190 | } | ||
180 | } | 191 | } |
181 | |||
182 | sr = new StreamReader(webResponse.GetResponseStream()); | ||
183 | //reply = sr.ReadToEnd().Trim(); | ||
184 | sr.ReadToEnd().Trim(); | ||
185 | //m_log.InfoFormat("[REST COMMS]: DoHelloNeighbourCall reply was {0} ", reply); | ||
186 | |||
187 | } | 192 | } |
188 | catch (Exception e) | 193 | catch (Exception e) |
189 | { | 194 | { |
@@ -193,11 +198,6 @@ namespace OpenSim.Services.Connectors | |||
193 | 198 | ||
194 | return false; | 199 | return false; |
195 | } | 200 | } |
196 | finally | ||
197 | { | ||
198 | if (sr != null) | ||
199 | sr.Close(); | ||
200 | } | ||
201 | 201 | ||
202 | return true; | 202 | return true; |
203 | } | 203 | } |
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs index 63a32e7..74b980c 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs | |||
@@ -339,36 +339,38 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
339 | // Simian does not require the asset ID to be in the URL because it's in the post data. | 339 | // Simian does not require the asset ID to be in the URL because it's in the post data. |
340 | // By appending it to the URL also, we allow caching proxies (squid) to invalidate asset URLs | 340 | // By appending it to the URL also, we allow caching proxies (squid) to invalidate asset URLs |
341 | HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(m_serverUrl + asset.FullID.ToString()); | 341 | HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(m_serverUrl + asset.FullID.ToString()); |
342 | |||
343 | HttpWebResponse response = MultipartForm.Post(request, postParameters); | ||
344 | using (Stream responseStream = response.GetResponseStream()) | ||
345 | { | ||
346 | string responseStr = null; | ||
347 | 342 | ||
348 | try | 343 | using (HttpWebResponse response = MultipartForm.Post(request, postParameters)) |
344 | { | ||
345 | using (Stream responseStream = response.GetResponseStream()) | ||
349 | { | 346 | { |
350 | responseStr = responseStream.GetStreamString(); | 347 | string responseStr = null; |
351 | OSD responseOSD = OSDParser.Deserialize(responseStr); | 348 | |
352 | if (responseOSD.Type == OSDType.Map) | 349 | try |
353 | { | 350 | { |
354 | OSDMap responseMap = (OSDMap)responseOSD; | 351 | responseStr = responseStream.GetStreamString(); |
355 | if (responseMap["Success"].AsBoolean()) | 352 | OSD responseOSD = OSDParser.Deserialize(responseStr); |
356 | return asset.ID; | 353 | if (responseOSD.Type == OSDType.Map) |
354 | { | ||
355 | OSDMap responseMap = (OSDMap)responseOSD; | ||
356 | if (responseMap["Success"].AsBoolean()) | ||
357 | return asset.ID; | ||
358 | else | ||
359 | errorMessage = "Upload failed: " + responseMap["Message"].AsString(); | ||
360 | } | ||
357 | else | 361 | else |
358 | errorMessage = "Upload failed: " + responseMap["Message"].AsString(); | 362 | { |
363 | errorMessage = "Response format was invalid:\n" + responseStr; | ||
364 | } | ||
359 | } | 365 | } |
360 | else | 366 | catch (Exception ex) |
361 | { | 367 | { |
362 | errorMessage = "Response format was invalid:\n" + responseStr; | 368 | if (!String.IsNullOrEmpty(responseStr)) |
369 | errorMessage = "Failed to parse the response:\n" + responseStr; | ||
370 | else | ||
371 | errorMessage = "Failed to retrieve the response: " + ex.Message; | ||
363 | } | 372 | } |
364 | } | 373 | } |
365 | catch (Exception ex) | ||
366 | { | ||
367 | if (!String.IsNullOrEmpty(responseStr)) | ||
368 | errorMessage = "Failed to parse the response:\n" + responseStr; | ||
369 | else | ||
370 | errorMessage = "Failed to retrieve the response: " + ex.Message; | ||
371 | } | ||
372 | } | 374 | } |
373 | } | 375 | } |
374 | catch (WebException ex) | 376 | catch (WebException ex) |
@@ -378,6 +380,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
378 | 380 | ||
379 | m_log.WarnFormat("[SIMIAN ASSET CONNECTOR]: Failed to store asset \"{0}\" ({1}, {2}): {3}", | 381 | m_log.WarnFormat("[SIMIAN ASSET CONNECTOR]: Failed to store asset \"{0}\" ({1}, {2}): {3}", |
380 | asset.Name, asset.ID, asset.Metadata.ContentType, errorMessage); | 382 | asset.Name, asset.ID, asset.Metadata.ContentType, errorMessage); |
383 | |||
381 | return null; | 384 | return null; |
382 | } | 385 | } |
383 | 386 | ||
diff --git a/OpenSim/Tests/Common/Mock/MockScriptEngine.cs b/OpenSim/Tests/Common/Mock/MockScriptEngine.cs index 78bab5b..6a53fe7 100644 --- a/OpenSim/Tests/Common/Mock/MockScriptEngine.cs +++ b/OpenSim/Tests/Common/Mock/MockScriptEngine.cs | |||
@@ -40,10 +40,33 @@ namespace OpenSim.Tests.Common | |||
40 | { | 40 | { |
41 | public class MockScriptEngine : INonSharedRegionModule, IScriptModule, IScriptEngine | 41 | public class MockScriptEngine : INonSharedRegionModule, IScriptModule, IScriptEngine |
42 | { | 42 | { |
43 | public IConfigSource ConfigSource { get; private set; } | ||
44 | |||
45 | public IConfig Config { get; private set; } | ||
46 | |||
43 | private Scene m_scene; | 47 | private Scene m_scene; |
44 | 48 | ||
49 | /// <summary> | ||
50 | /// Expose posted events to tests. | ||
51 | /// </summary> | ||
52 | public Dictionary<UUID, List<EventParams>> PostedEvents { get; private set; } | ||
53 | |||
54 | /// <summary> | ||
55 | /// A very primitive way of hooking text cose to a posed event. | ||
56 | /// </summary> | ||
57 | /// <remarks> | ||
58 | /// May be replaced with something that uses more original code in the future. | ||
59 | /// </remarks> | ||
60 | public event Action<UUID, EventParams> PostEventHook; | ||
61 | |||
45 | public void Initialise(IConfigSource source) | 62 | public void Initialise(IConfigSource source) |
46 | { | 63 | { |
64 | ConfigSource = source; | ||
65 | |||
66 | // Can set later on if required | ||
67 | Config = new IniConfig("MockScriptEngine", ConfigSource); | ||
68 | |||
69 | PostedEvents = new Dictionary<UUID, List<EventParams>>(); | ||
47 | } | 70 | } |
48 | 71 | ||
49 | public void Close() | 72 | public void Close() |
@@ -85,7 +108,28 @@ namespace OpenSim.Tests.Common | |||
85 | 108 | ||
86 | public bool PostScriptEvent(UUID itemID, string name, object[] args) | 109 | public bool PostScriptEvent(UUID itemID, string name, object[] args) |
87 | { | 110 | { |
88 | return false; | 111 | // Console.WriteLine("Posting event {0} for {1}", name, itemID); |
112 | |||
113 | EventParams evParams = new EventParams(name, args, null); | ||
114 | |||
115 | List<EventParams> eventsForItem; | ||
116 | |||
117 | if (!PostedEvents.ContainsKey(itemID)) | ||
118 | { | ||
119 | eventsForItem = new List<EventParams>(); | ||
120 | PostedEvents.Add(itemID, eventsForItem); | ||
121 | } | ||
122 | else | ||
123 | { | ||
124 | eventsForItem = PostedEvents[itemID]; | ||
125 | } | ||
126 | |||
127 | eventsForItem.Add(evParams); | ||
128 | |||
129 | if (PostEventHook != null) | ||
130 | PostEventHook(itemID, evParams); | ||
131 | |||
132 | return true; | ||
89 | } | 133 | } |
90 | 134 | ||
91 | public bool PostObjectEvent(UUID itemID, string name, object[] args) | 135 | public bool PostObjectEvent(UUID itemID, string name, object[] args) |
@@ -195,11 +239,7 @@ namespace OpenSim.Tests.Common | |||
195 | 239 | ||
196 | public Scene World { get { return m_scene; } } | 240 | public Scene World { get { return m_scene; } } |
197 | 241 | ||
198 | public IScriptModule ScriptModule { get { throw new System.NotImplementedException(); } } | 242 | public IScriptModule ScriptModule { get { return this; } } |
199 | |||
200 | public IConfig Config { get { throw new System.NotImplementedException (); } } | ||
201 | |||
202 | public IConfigSource ConfigSource { get { throw new System.NotImplementedException (); } } | ||
203 | 243 | ||
204 | public string ScriptEnginePath { get { throw new System.NotImplementedException (); }} | 244 | public string ScriptEnginePath { get { throw new System.NotImplementedException (); }} |
205 | 245 | ||
@@ -210,5 +250,10 @@ namespace OpenSim.Tests.Common | |||
210 | public string[] ScriptReferencedAssemblies { get { throw new System.NotImplementedException (); } } | 250 | public string[] ScriptReferencedAssemblies { get { throw new System.NotImplementedException (); } } |
211 | 251 | ||
212 | public ParameterInfo[] ScriptBaseClassParameters { get { throw new System.NotImplementedException (); } } | 252 | public ParameterInfo[] ScriptBaseClassParameters { get { throw new System.NotImplementedException (); } } |
253 | |||
254 | public void ClearPostedEvents() | ||
255 | { | ||
256 | PostedEvents.Clear(); | ||
257 | } | ||
213 | } | 258 | } |
214 | } \ No newline at end of file | 259 | } \ No newline at end of file |
diff --git a/OpenSim/Tests/ConfigurationLoaderTest.cs b/OpenSim/Tests/ConfigurationLoaderTest.cs index e5186ae..9d63324 100644 --- a/OpenSim/Tests/ConfigurationLoaderTest.cs +++ b/OpenSim/Tests/ConfigurationLoaderTest.cs | |||
@@ -47,6 +47,8 @@ namespace OpenSim.Tests | |||
47 | [SetUp] | 47 | [SetUp] |
48 | public void SetUp() | 48 | public void SetUp() |
49 | { | 49 | { |
50 | base.SetUp(); | ||
51 | |||
50 | m_basePath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); | 52 | m_basePath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); |
51 | string path = Path.Combine(m_basePath, m_testSubdirectory); | 53 | string path = Path.Combine(m_basePath, m_testSubdirectory); |
52 | Directory.CreateDirectory(path); | 54 | Directory.CreateDirectory(path); |