aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs
diff options
context:
space:
mode:
authoronefang2019-05-19 21:24:15 +1000
committeronefang2019-05-19 21:24:15 +1000
commit5e4d6cab00cb29cd088ab7b62ab13aff103b64cb (patch)
treea9fbc62df9eb2d1d9ba2698d8552eae71eca20d8 /OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs
parentAdd a build script. (diff)
downloadopensim-SC-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.zip
opensim-SC-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.gz
opensim-SC-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.bz2
opensim-SC-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.xz
Dump OpenSim 0.9.0.1 into it's own branch.
Diffstat (limited to 'OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs')
-rw-r--r--OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs56
1 files changed, 30 insertions, 26 deletions
diff --git a/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs b/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs
index d45962f..673a453 100644
--- a/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs
@@ -98,7 +98,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL
98 return false; 98 return false;
99 } 99 }
100 100
101 public void GetDrawStringSize(string text, string fontName, int fontSize, 101 public void GetDrawStringSize(string text, string fontName, int fontSize,
102 out double xSize, out double ySize) 102 out double xSize, out double ySize)
103 { 103 {
104 xSize = 0; 104 xSize = 0;
@@ -124,7 +124,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL
124 { 124 {
125 if (m_scene == null) 125 if (m_scene == null)
126 m_scene = scene; 126 m_scene = scene;
127 127
128 } 128 }
129 129
130 public void RemoveRegion(Scene scene) 130 public void RemoveRegion(Scene scene)
@@ -166,15 +166,15 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL
166 166
167 HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); 167 HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
168 request.AllowAutoRedirect = false; 168 request.AllowAutoRedirect = false;
169 169
170 if (!string.IsNullOrEmpty(m_proxyurl)) 170 if (!string.IsNullOrEmpty(m_proxyurl))
171 { 171 {
172 if (!string.IsNullOrEmpty(m_proxyexcepts)) 172 if (!string.IsNullOrEmpty(m_proxyexcepts))
173 { 173 {
174 string[] elist = m_proxyexcepts.Split(';'); 174 string[] elist = m_proxyexcepts.Split(';');
175 request.Proxy = new WebProxy(m_proxyurl, true, elist); 175 request.Proxy = new WebProxy(m_proxyurl, true, elist);
176 } 176 }
177 else 177 else
178 { 178 {
179 request.Proxy = new WebProxy(m_proxyurl, true); 179 request.Proxy = new WebProxy(m_proxyurl, true);
180 } 180 }
@@ -253,7 +253,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL
253 { 253 {
254 imageJ2000 = OpenJPEG.EncodeFromImage(resize, true); 254 imageJ2000 = OpenJPEG.EncodeFromImage(resize, true);
255 } 255 }
256 } 256 }
257 catch (Exception) 257 catch (Exception)
258 { 258 {
259 m_log.Error("[LOADIMAGEURLMODULE]: OpenJpeg Conversion Failed. Empty byte data returned!"); 259 m_log.Error("[LOADIMAGEURLMODULE]: OpenJpeg Conversion Failed. Empty byte data returned!");
@@ -268,33 +268,37 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL
268 catch (WebException) 268 catch (WebException)
269 { 269 {
270 } 270 }
271 catch (Exception e)
272 {
273 m_log.ErrorFormat("[LOADIMAGEURLMODULE]: unexpected exception {0}", e.Message);
274 }
271 finally 275 finally
272 { 276 {
273 if (stream != null) 277 if (stream != null)
274 stream.Close(); 278 stream.Close();
275 279
276 if (response != null) 280 if (response != null)
277 response.Close();
278
279 if (
280 response.StatusCode == HttpStatusCode.MovedPermanently
281 || response.StatusCode == HttpStatusCode.Found
282 || response.StatusCode == HttpStatusCode.SeeOther
283 || response.StatusCode == HttpStatusCode.TemporaryRedirect)
284 { 281 {
285 string redirectedUrl = response.Headers["Location"]; 282 if (response.StatusCode == HttpStatusCode.MovedPermanently
283 || response.StatusCode == HttpStatusCode.Found
284 || response.StatusCode == HttpStatusCode.SeeOther
285 || response.StatusCode == HttpStatusCode.TemporaryRedirect)
286 {
287 string redirectedUrl = response.Headers["Location"];
286 288
287 MakeHttpRequest(redirectedUrl, state.RequestID); 289 MakeHttpRequest(redirectedUrl, state.RequestID);
288 } 290 }
289 else 291 else
290 { 292 {
291 m_log.DebugFormat("[LOADIMAGEURLMODULE]: Returning {0} bytes of image data for request {1}", 293 m_log.DebugFormat("[LOADIMAGEURLMODULE]: Returning {0} bytes of image data for request {1}",
292 imageJ2000.Length, state.RequestID); 294 imageJ2000.Length, state.RequestID);
293 295
294 m_textureManager.ReturnData( 296 m_textureManager.ReturnData(
295 state.RequestID, 297 state.RequestID,
296 new OpenSim.Region.CoreModules.Scripting.DynamicTexture.DynamicTexture( 298 new OpenSim.Region.CoreModules.Scripting.DynamicTexture.DynamicTexture(
297 request.RequestUri, null, imageJ2000, newSize, false)); 299 request.RequestUri, null, imageJ2000, newSize, false));
300 }
301 response.Close();
298 } 302 }
299 } 303 }
300 } 304 }