diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs | 77 |
1 files changed, 35 insertions, 42 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs index b21082f..9ae7452 100644 --- a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs | |||
@@ -1290,9 +1290,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles | |||
1290 | webRequest.ContentType = "application/json-rpc"; | 1290 | webRequest.ContentType = "application/json-rpc"; |
1291 | webRequest.Method = "POST"; | 1291 | webRequest.Method = "POST"; |
1292 | 1292 | ||
1293 | Stream dataStream = webRequest.GetRequestStream(); | 1293 | using (Stream dataStream = webRequest.GetRequestStream()) |
1294 | dataStream.Write(content, 0, content.Length); | 1294 | dataStream.Write(content, 0, content.Length); |
1295 | dataStream.Close(); | ||
1296 | 1295 | ||
1297 | WebResponse webResponse = null; | 1296 | WebResponse webResponse = null; |
1298 | try | 1297 | try |
@@ -1306,26 +1305,18 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles | |||
1306 | return false; | 1305 | return false; |
1307 | } | 1306 | } |
1308 | 1307 | ||
1309 | Stream rstream = webResponse.GetResponseStream(); | 1308 | using (webResponse) |
1310 | 1309 | using (Stream rstream = webResponse.GetResponseStream()) | |
1311 | OSDMap mret = new OSDMap(); | ||
1312 | try | ||
1313 | { | ||
1314 | mret = (OSDMap)OSDParser.DeserializeJson(rstream); | ||
1315 | } | ||
1316 | catch (Exception e) | ||
1317 | { | 1310 | { |
1318 | m_log.DebugFormat("[PROFILES]: JsonRpcRequest Error {0} - remote user with legacy profiles?", e.Message); | 1311 | OSDMap mret = (OSDMap)OSDParser.DeserializeJson(rstream); |
1319 | return false; | ||
1320 | } | ||
1321 | 1312 | ||
1313 | if (mret.ContainsKey("error")) | ||
1314 | return false; | ||
1322 | 1315 | ||
1323 | if (mret.ContainsKey("error")) | 1316 | // get params... |
1324 | return false; | 1317 | OSD.DeserializeMembers(ref parameters, (OSDMap)mret["result"]); |
1325 | 1318 | return true; | |
1326 | // get params... | 1319 | } |
1327 | OSD.DeserializeMembers(ref parameters, (OSDMap) mret["result"]); | ||
1328 | return true; | ||
1329 | } | 1320 | } |
1330 | 1321 | ||
1331 | /// <summary> | 1322 | /// <summary> |
@@ -1366,9 +1357,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles | |||
1366 | webRequest.ContentType = "application/json-rpc"; | 1357 | webRequest.ContentType = "application/json-rpc"; |
1367 | webRequest.Method = "POST"; | 1358 | webRequest.Method = "POST"; |
1368 | 1359 | ||
1369 | Stream dataStream = webRequest.GetRequestStream(); | 1360 | using (Stream dataStream = webRequest.GetRequestStream()) |
1370 | dataStream.Write(content, 0, content.Length); | 1361 | dataStream.Write(content, 0, content.Length); |
1371 | dataStream.Close(); | ||
1372 | 1362 | ||
1373 | WebResponse webResponse = null; | 1363 | WebResponse webResponse = null; |
1374 | try | 1364 | try |
@@ -1382,29 +1372,32 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles | |||
1382 | return false; | 1372 | return false; |
1383 | } | 1373 | } |
1384 | 1374 | ||
1385 | Stream rstream = webResponse.GetResponseStream(); | 1375 | using (webResponse) |
1386 | 1376 | using (Stream rstream = webResponse.GetResponseStream()) | |
1387 | OSDMap response = new OSDMap(); | ||
1388 | try | ||
1389 | { | ||
1390 | response = (OSDMap)OSDParser.DeserializeJson(rstream); | ||
1391 | } | ||
1392 | catch (Exception e) | ||
1393 | { | 1377 | { |
1394 | m_log.DebugFormat("[PROFILES]: JsonRpcRequest Error {0} - remote user with legacy profiles?", e.Message); | 1378 | OSDMap response = new OSDMap(); |
1395 | return false; | 1379 | try |
1396 | } | 1380 | { |
1381 | response = (OSDMap)OSDParser.DeserializeJson(rstream); | ||
1382 | } | ||
1383 | catch (Exception e) | ||
1384 | { | ||
1385 | m_log.DebugFormat("[PROFILES]: JsonRpcRequest Error {0} - remote user with legacy profiles?", e.Message); | ||
1386 | return false; | ||
1387 | } | ||
1397 | 1388 | ||
1398 | if(response.ContainsKey("error")) | 1389 | if (response.ContainsKey("error")) |
1399 | { | 1390 | { |
1400 | data = response["error"]; | 1391 | data = response["error"]; |
1401 | return false; | 1392 | return false; |
1402 | } | 1393 | } |
1403 | 1394 | ||
1404 | data = response; | 1395 | data = response; |
1405 | 1396 | ||
1406 | return true; | 1397 | return true; |
1398 | } | ||
1407 | } | 1399 | } |
1400 | |||
1408 | #endregion Web Util | 1401 | #endregion Web Util |
1409 | } | 1402 | } |
1410 | } \ No newline at end of file | 1403 | } |