aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/AssetLandmark.cs2
-rw-r--r--OpenSim/Framework/Capabilities/LLSD.cs4
-rw-r--r--OpenSim/Framework/Capabilities/LLSDStreamHandler.cs2
-rw-r--r--OpenSim/Framework/Communications/XMPP/XmppWriter.cs2
-rw-r--r--OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs2
-rw-r--r--OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs2
-rw-r--r--OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs23
-rw-r--r--OpenSim/Framework/Util.cs10
8 files changed, 32 insertions, 15 deletions
diff --git a/OpenSim/Framework/AssetLandmark.cs b/OpenSim/Framework/AssetLandmark.cs
index 7c87c34..fd7a2cd 100644
--- a/OpenSim/Framework/AssetLandmark.cs
+++ b/OpenSim/Framework/AssetLandmark.cs
@@ -49,7 +49,7 @@ namespace OpenSim.Framework
49 49
50 private void InternData() 50 private void InternData()
51 { 51 {
52 string temp = Encoding.UTF8.GetString(Data).Trim(); 52 string temp = Util.UTF8.GetString(Data).Trim();
53 string[] parts = temp.Split('\n'); 53 string[] parts = temp.Split('\n');
54 int.TryParse(parts[0].Substring(17, 1), out Version); 54 int.TryParse(parts[0].Substring(17, 1), out Version);
55 UUID.TryParse(parts[1].Substring(10, 36), out RegionID); 55 UUID.TryParse(parts[1].Substring(10, 36), out RegionID);
diff --git a/OpenSim/Framework/Capabilities/LLSD.cs b/OpenSim/Framework/Capabilities/LLSD.cs
index 84f43c1..eec9e61 100644
--- a/OpenSim/Framework/Capabilities/LLSD.cs
+++ b/OpenSim/Framework/Capabilities/LLSD.cs
@@ -112,7 +112,7 @@ namespace OpenSim.Framework.Capabilities
112 112
113 writer.Close(); 113 writer.Close();
114 114
115 return Encoding.UTF8.GetBytes(sw.ToString()); 115 return Util.UTF8.GetBytes(sw.ToString());
116 } 116 }
117 117
118 /// <summary> 118 /// <summary>
@@ -329,7 +329,7 @@ namespace OpenSim.Framework.Capabilities
329 329
330 reader.Read(); 330 reader.Read();
331 FromBase64Transform b64 = new FromBase64Transform(FromBase64TransformMode.IgnoreWhiteSpaces); 331 FromBase64Transform b64 = new FromBase64Transform(FromBase64TransformMode.IgnoreWhiteSpaces);
332 byte[] inp = Encoding.UTF8.GetBytes(reader.ReadString()); 332 byte[] inp = Util.UTF8.GetBytes(reader.ReadString());
333 ret = b64.TransformFinalBlock(inp, 0, inp.Length); 333 ret = b64.TransformFinalBlock(inp, 0, inp.Length);
334 break; 334 break;
335 } 335 }
diff --git a/OpenSim/Framework/Capabilities/LLSDStreamHandler.cs b/OpenSim/Framework/Capabilities/LLSDStreamHandler.cs
index df48b35..7aaa994 100644
--- a/OpenSim/Framework/Capabilities/LLSDStreamHandler.cs
+++ b/OpenSim/Framework/Capabilities/LLSDStreamHandler.cs
@@ -47,7 +47,7 @@ namespace OpenSim.Framework.Capabilities
47 public override byte[] Handle(string path, Stream request, 47 public override byte[] Handle(string path, Stream request,
48 OSHttpRequest httpRequest, OSHttpResponse httpResponse) 48 OSHttpRequest httpRequest, OSHttpResponse httpResponse)
49 { 49 {
50 //Encoding encoding = Encoding.UTF8; 50 //Encoding encoding = Util.UTF8;
51 //StreamReader streamReader = new StreamReader(request, false); 51 //StreamReader streamReader = new StreamReader(request, false);
52 52
53 //string requestBody = streamReader.ReadToEnd(); 53 //string requestBody = streamReader.ReadToEnd();
diff --git a/OpenSim/Framework/Communications/XMPP/XmppWriter.cs b/OpenSim/Framework/Communications/XMPP/XmppWriter.cs
index b52eda7..415d808 100644
--- a/OpenSim/Framework/Communications/XMPP/XmppWriter.cs
+++ b/OpenSim/Framework/Communications/XMPP/XmppWriter.cs
@@ -38,7 +38,7 @@ namespace OpenSim.Framework.Communications.XMPP
38 { 38 {
39 } 39 }
40 40
41 public XMPPWriter(IOStream stream) : this(stream, Encoding.UTF8) 41 public XMPPWriter(IOStream stream) : this(stream, Util.UTF8)
42 { 42 {
43 } 43 }
44 44
diff --git a/OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs b/OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs
index 318d2c3..3dce578 100644
--- a/OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs
+++ b/OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs
@@ -77,7 +77,7 @@ namespace OpenSim.Framework.Configuration.HTTP
77 count = resStream.Read(buf, 0, buf.Length); 77 count = resStream.Read(buf, 0, buf.Length);
78 if (count != 0) 78 if (count != 0)
79 { 79 {
80 tempString = Encoding.UTF8.GetString(buf, 0, count); 80 tempString = Util.UTF8.GetString(buf, 0, count);
81 sb.Append(tempString); 81 sb.Append(tempString);
82 } 82 }
83 } while (count > 0); 83 } while (count > 0);
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
index 6c63c6c..942fed9 100644
--- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
@@ -979,7 +979,7 @@ namespace OpenSim.Framework.Servers.HttpServer
979 } 979 }
980 980
981 // response.ContentType = "application/llsd+json"; 981 // response.ContentType = "application/llsd+json";
982 // return Encoding.UTF8.GetBytes(OSDParser.SerializeJsonString(llsdResponse)); 982 // return Util.UTF8.GetBytes(OSDParser.SerializeJsonString(llsdResponse));
983 response.ContentType = "application/llsd+xml"; 983 response.ContentType = "application/llsd+xml";
984 return OSDParser.SerializeLLSDXmlBytes(llsdResponse); 984 return OSDParser.SerializeLLSDXmlBytes(llsdResponse);
985 } 985 }
diff --git a/OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs b/OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs
index ec9bd4f..eab463c 100644
--- a/OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs
+++ b/OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs
@@ -58,6 +58,7 @@ namespace OpenSim.Framework.Servers.HttpServer
58 public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj) 58 public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj)
59 { 59 {
60 Type type = typeof (TRequest); 60 Type type = typeof (TRequest);
61 TResponse deserial = default(TResponse);
61 62
62 WebRequest request = WebRequest.Create(requestUrl); 63 WebRequest request = WebRequest.Create(requestUrl);
63 request.Method = verb; 64 request.Method = verb;
@@ -81,19 +82,33 @@ namespace OpenSim.Framework.Servers.HttpServer
81 int length = (int) buffer.Length; 82 int length = (int) buffer.Length;
82 request.ContentLength = length; 83 request.ContentLength = length;
83 84
84 Stream requestStream = request.GetRequestStream(); 85 Stream requestStream = null;
85 requestStream.Write(buffer.ToArray(), 0, length); 86 try
87 {
88 requestStream = request.GetRequestStream();
89 requestStream.Write(buffer.ToArray(), 0, length);
90 }
91 catch (Exception)
92 {
93 return deserial;
94 }
95 finally
96 {
97 if (requestStream != null)
98 requestStream.Close();
99 }
86 } 100 }
87 101
88 TResponse deserial = default(TResponse);
89 try 102 try
90 { 103 {
91 using (WebResponse resp = request.GetResponse()) 104 using (WebResponse resp = request.GetResponse())
92 { 105 {
93 if (resp.ContentLength > 0) 106 if (resp.ContentLength > 0)
94 { 107 {
108 Stream respStream = resp.GetResponseStream();
95 XmlSerializer deserializer = new XmlSerializer(typeof(TResponse)); 109 XmlSerializer deserializer = new XmlSerializer(typeof(TResponse));
96 deserial = (TResponse)deserializer.Deserialize(resp.GetResponseStream()); 110 deserial = (TResponse)deserializer.Deserialize(respStream);
111 respStream.Close();
97 } 112 }
98 } 113 }
99 } 114 }
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 17fc58c..0851d26 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -103,6 +103,8 @@ namespace OpenSim.Framework
103 } 103 }
104 104
105 105
106 public static Encoding UTF8 = Encoding.UTF8;
107
106 /// <value> 108 /// <value>
107 /// Well known UUID for the blank texture used in the Linden SL viewer version 1.20 (and hopefully onwards) 109 /// Well known UUID for the blank texture used in the Linden SL viewer version 1.20 (and hopefully onwards)
108 /// </value> 110 /// </value>
@@ -465,7 +467,7 @@ namespace OpenSim.Framework
465 output.Append(": "); 467 output.Append(": ");
466 } 468 }
467 469
468 output.Append(CleanString(Encoding.UTF8.GetString(bytes, 0, bytes.Length - 1))); 470 output.Append(CleanString(Util.UTF8.GetString(bytes, 0, bytes.Length - 1)));
469 } 471 }
470 else 472 else
471 { 473 {
@@ -826,7 +828,7 @@ namespace OpenSim.Framework
826 828
827 public static string Compress(string text) 829 public static string Compress(string text)
828 { 830 {
829 byte[] buffer = Encoding.UTF8.GetBytes(text); 831 byte[] buffer = Util.UTF8.GetBytes(text);
830 MemoryStream memory = new MemoryStream(); 832 MemoryStream memory = new MemoryStream();
831 using (GZipStream compressor = new GZipStream(memory, CompressionMode.Compress, true)) 833 using (GZipStream compressor = new GZipStream(memory, CompressionMode.Compress, true))
832 { 834 {
@@ -860,7 +862,7 @@ namespace OpenSim.Framework
860 decompressor.Read(buffer, 0, buffer.Length); 862 decompressor.Read(buffer, 0, buffer.Length);
861 } 863 }
862 864
863 return Encoding.UTF8.GetString(buffer); 865 return Util.UTF8.GetString(buffer);
864 } 866 }
865 } 867 }
866 868
@@ -1132,7 +1134,7 @@ namespace OpenSim.Framework
1132 { 1134 {
1133 byte[] data = new byte[length]; 1135 byte[] data = new byte[length];
1134 stream.Read(data, 0, length); 1136 stream.Read(data, 0, length);
1135 string strdata = Encoding.UTF8.GetString(data); 1137 string strdata = Util.UTF8.GetString(data);
1136 OSDMap args = null; 1138 OSDMap args = null;
1137 OSD buffer; 1139 OSD buffer;
1138 buffer = OSDParser.DeserializeJson(strdata); 1140 buffer = OSDParser.DeserializeJson(strdata);