diff options
author | BlueWall | 2014-02-01 07:57:04 -0500 |
---|---|---|
committer | BlueWall | 2014-03-25 11:09:27 -0400 |
commit | 9aec36156eec14d1014af2e5f3c6b0cbff0a87d7 (patch) | |
tree | 33c767653497802d704f4a6dc04f507b10568cb1 /OpenSim/Framework | |
parent | Add the UserProfiles local service module to non-HG Standalone configuration. (diff) | |
download | opensim-SC_OLD-9aec36156eec14d1014af2e5f3c6b0cbff0a87d7.zip opensim-SC_OLD-9aec36156eec14d1014af2e5f3c6b0cbff0a87d7.tar.gz opensim-SC_OLD-9aec36156eec14d1014af2e5f3c6b0cbff0a87d7.tar.bz2 opensim-SC_OLD-9aec36156eec14d1014af2e5f3c6b0cbff0a87d7.tar.xz |
Sync code that has moved in development branch with changes in master
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/JsonRpcRequestManager.cs | 86 |
1 files changed, 41 insertions, 45 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/JsonRpcRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/JsonRpcRequestManager.cs index 1d69dcb..a44f471 100644 --- a/OpenSim/Framework/Servers/HttpServer/JsonRpcRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/JsonRpcRequestManager.cs | |||
@@ -95,9 +95,12 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
95 | webRequest.ContentType = "application/json-rpc"; | 95 | webRequest.ContentType = "application/json-rpc"; |
96 | webRequest.Method = "POST"; | 96 | webRequest.Method = "POST"; |
97 | 97 | ||
98 | Stream dataStream = webRequest.GetRequestStream(); | 98 | //Stream dataStream = webRequest.GetRequestStream(); |
99 | dataStream.Write(content, 0, content.Length); | 99 | //dataStream.Write(content, 0, content.Length); |
100 | dataStream.Close(); | 100 | //dataStream.Close(); |
101 | |||
102 | using (Stream dataStream = webRequest.GetRequestStream()) | ||
103 | dataStream.Write(content, 0, content.Length); | ||
101 | 104 | ||
102 | WebResponse webResponse = null; | 105 | WebResponse webResponse = null; |
103 | try | 106 | try |
@@ -111,26 +114,18 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
111 | return false; | 114 | return false; |
112 | } | 115 | } |
113 | 116 | ||
114 | Stream rstream = webResponse.GetResponseStream(); | 117 | using (webResponse) |
115 | 118 | using (Stream rstream = webResponse.GetResponseStream()) | |
116 | OSDMap mret = new OSDMap(); | ||
117 | try | ||
118 | { | 119 | { |
119 | mret = (OSDMap)OSDParser.DeserializeJson(rstream); | 120 | OSDMap mret = (OSDMap)OSDParser.DeserializeJson(rstream); |
121 | |||
122 | if (mret.ContainsKey("error")) | ||
123 | return false; | ||
124 | |||
125 | // get params... | ||
126 | OSD.DeserializeMembers(ref parameters, (OSDMap)mret["result"]); | ||
127 | return true; | ||
120 | } | 128 | } |
121 | catch (Exception e) | ||
122 | { | ||
123 | m_log.DebugFormat("[JSONRPC]: JsonRpcRequest Error {0}", e.Message); | ||
124 | return false; | ||
125 | } | ||
126 | |||
127 | |||
128 | if (mret.ContainsKey("error")) | ||
129 | return false; | ||
130 | |||
131 | // get params... | ||
132 | OSD.DeserializeMembers(ref parameters, (OSDMap) mret["result"]); | ||
133 | return true; | ||
134 | } | 129 | } |
135 | 130 | ||
136 | /// <summary> | 131 | /// <summary> |
@@ -171,10 +166,9 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
171 | webRequest.ContentType = "application/json-rpc"; | 166 | webRequest.ContentType = "application/json-rpc"; |
172 | webRequest.Method = "POST"; | 167 | webRequest.Method = "POST"; |
173 | 168 | ||
174 | Stream dataStream = webRequest.GetRequestStream(); | 169 | using (Stream dataStream = webRequest.GetRequestStream()) |
175 | dataStream.Write(content, 0, content.Length); | 170 | dataStream.Write(content, 0, content.Length); |
176 | dataStream.Close(); | 171 | |
177 | |||
178 | WebResponse webResponse = null; | 172 | WebResponse webResponse = null; |
179 | try | 173 | try |
180 | { | 174 | { |
@@ -187,28 +181,30 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
187 | return false; | 181 | return false; |
188 | } | 182 | } |
189 | 183 | ||
190 | Stream rstream = webResponse.GetResponseStream(); | 184 | using (webResponse) |
191 | 185 | using (Stream rstream = webResponse.GetResponseStream()) | |
192 | OSDMap response = new OSDMap(); | ||
193 | try | ||
194 | { | ||
195 | response = (OSDMap)OSDParser.DeserializeJson(rstream); | ||
196 | } | ||
197 | catch (Exception e) | ||
198 | { | ||
199 | m_log.DebugFormat("[JSONRPC]: JsonRpcRequest Error {0}", e.Message); | ||
200 | return false; | ||
201 | } | ||
202 | |||
203 | if(response.ContainsKey("error")) | ||
204 | { | 186 | { |
205 | data = response["error"]; | 187 | OSDMap response = new OSDMap(); |
206 | return false; | 188 | try |
189 | { | ||
190 | response = (OSDMap)OSDParser.DeserializeJson(rstream); | ||
191 | } | ||
192 | catch (Exception e) | ||
193 | { | ||
194 | m_log.DebugFormat("[JSONRPC]: JsonRpcRequest Error {0}", e.Message); | ||
195 | return false; | ||
196 | } | ||
197 | |||
198 | if (response.ContainsKey("error")) | ||
199 | { | ||
200 | data = response["error"]; | ||
201 | return false; | ||
202 | } | ||
203 | |||
204 | data = response; | ||
205 | |||
206 | return true; | ||
207 | } | 207 | } |
208 | |||
209 | data = response; | ||
210 | |||
211 | return true; | ||
212 | } | 208 | } |
213 | #endregion Web Util | 209 | #endregion Web Util |
214 | } | 210 | } |