diff options
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/AsynchronousRestObjectRequester.cs | 1 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs | 31 |
2 files changed, 28 insertions, 4 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/AsynchronousRestObjectRequester.cs b/OpenSim/Framework/Servers/HttpServer/AsynchronousRestObjectRequester.cs index e52ef9e..6c8d7cf 100644 --- a/OpenSim/Framework/Servers/HttpServer/AsynchronousRestObjectRequester.cs +++ b/OpenSim/Framework/Servers/HttpServer/AsynchronousRestObjectRequester.cs | |||
@@ -82,6 +82,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
82 | serializer.Serialize(writer, obj); | 82 | serializer.Serialize(writer, obj); |
83 | writer.Flush(); | 83 | writer.Flush(); |
84 | } | 84 | } |
85 | buffer.Close(); | ||
85 | 86 | ||
86 | int length = (int) buffer.Length; | 87 | int length = (int) buffer.Length; |
87 | request.ContentLength = length; | 88 | request.ContentLength = length; |
diff --git a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs index a0d4008..85622a1 100644 --- a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs +++ b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs | |||
@@ -66,8 +66,20 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
66 | length = (int)obj.Length; | 66 | length = (int)obj.Length; |
67 | request.ContentLength = length; | 67 | request.ContentLength = length; |
68 | 68 | ||
69 | Stream requestStream = request.GetRequestStream(); | 69 | Stream requestStream = null; |
70 | requestStream.Write(buffer.ToArray(), 0, length); | 70 | try |
71 | { | ||
72 | requestStream = request.GetRequestStream(); | ||
73 | requestStream.Write(buffer.ToArray(), 0, length); | ||
74 | } | ||
75 | catch | ||
76 | { | ||
77 | } | ||
78 | finally | ||
79 | { | ||
80 | if (requestStream != null) | ||
81 | requestStream.Close(); | ||
82 | } | ||
71 | } | 83 | } |
72 | 84 | ||
73 | string respstring = String.Empty; | 85 | string respstring = String.Empty; |
@@ -78,9 +90,20 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
78 | { | 90 | { |
79 | if (resp.ContentLength > 0) | 91 | if (resp.ContentLength > 0) |
80 | { | 92 | { |
81 | using (StreamReader reader = new StreamReader(resp.GetResponseStream())) | 93 | Stream respStream = null; |
94 | try | ||
95 | { | ||
96 | respStream = resp.GetResponseStream(); | ||
97 | using (StreamReader reader = new StreamReader(respStream)) | ||
98 | { | ||
99 | respstring = reader.ReadToEnd(); | ||
100 | } | ||
101 | } | ||
102 | catch { } | ||
103 | finally | ||
82 | { | 104 | { |
83 | respstring = reader.ReadToEnd(); | 105 | if (respStream != null) |
106 | respStream.Close(); | ||
84 | } | 107 | } |
85 | } | 108 | } |
86 | } | 109 | } |