diff options
Diffstat (limited to 'OpenSim/Framework/WebUtil.cs')
-rw-r--r-- | OpenSim/Framework/WebUtil.cs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index 10a2560..89181a9 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs | |||
@@ -250,9 +250,12 @@ namespace OpenSim.Framework | |||
250 | 250 | ||
251 | byte[] buffer = System.Text.Encoding.UTF8.GetBytes(strBuffer); | 251 | byte[] buffer = System.Text.Encoding.UTF8.GetBytes(strBuffer); |
252 | 252 | ||
253 | request.ContentType = "application/json"; | ||
254 | |||
253 | if (compressed) | 255 | if (compressed) |
254 | { | 256 | { |
255 | request.ContentType = "application/x-gzip"; | 257 | request.Headers["X-Content-Encoding"] = "gzip"; // can't set "Content-Encoding" because old OpenSims fail if they get an unrecognized Content-Encoding |
258 | |||
256 | using (MemoryStream ms = new MemoryStream()) | 259 | using (MemoryStream ms = new MemoryStream()) |
257 | { | 260 | { |
258 | using (GZipStream comp = new GZipStream(ms, CompressionMode.Compress)) | 261 | using (GZipStream comp = new GZipStream(ms, CompressionMode.Compress)) |
@@ -270,10 +273,9 @@ namespace OpenSim.Framework | |||
270 | } | 273 | } |
271 | else | 274 | else |
272 | { | 275 | { |
273 | request.ContentType = "application/json"; | ||
274 | request.ContentLength = buffer.Length; //Count bytes to send | 276 | request.ContentLength = buffer.Length; //Count bytes to send |
275 | using (Stream requestStream = request.GetRequestStream()) | 277 | using (Stream requestStream = request.GetRequestStream()) |
276 | requestStream.Write(buffer, 0, buffer.Length); //Send it | 278 | requestStream.Write(buffer, 0, buffer.Length); //Send it |
277 | } | 279 | } |
278 | } | 280 | } |
279 | 281 | ||
@@ -1024,7 +1026,7 @@ namespace OpenSim.Framework | |||
1024 | } | 1026 | } |
1025 | catch (Exception e) | 1027 | catch (Exception e) |
1026 | { | 1028 | { |
1027 | m_log.ErrorFormat("[FORMS]: Error sending request to {0}: {1}. Request: {2}", requestUrl, e.Message, | 1029 | m_log.InfoFormat("[FORMS]: Error sending request to {0}: {1}. Request: {2}", requestUrl, e.Message, |
1028 | obj.Length > WebUtil.MaxRequestDiagLength ? obj.Remove(WebUtil.MaxRequestDiagLength) : obj); | 1030 | obj.Length > WebUtil.MaxRequestDiagLength ? obj.Remove(WebUtil.MaxRequestDiagLength) : obj); |
1029 | throw e; | 1031 | throw e; |
1030 | } | 1032 | } |
@@ -1052,7 +1054,7 @@ namespace OpenSim.Framework | |||
1052 | } | 1054 | } |
1053 | catch (Exception e) | 1055 | catch (Exception e) |
1054 | { | 1056 | { |
1055 | m_log.ErrorFormat("[FORMS]: Error receiving response from {0}: {1}. Request: {2}", requestUrl, e.Message, | 1057 | m_log.InfoFormat("[FORMS]: Error receiving response from {0}: {1}. Request: {2}", requestUrl, e.Message, |
1056 | obj.Length > WebUtil.MaxRequestDiagLength ? obj.Remove(WebUtil.MaxRequestDiagLength) : obj); | 1058 | obj.Length > WebUtil.MaxRequestDiagLength ? obj.Remove(WebUtil.MaxRequestDiagLength) : obj); |
1057 | throw e; | 1059 | throw e; |
1058 | } | 1060 | } |