aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDiva Canto2014-04-24 14:12:04 -0700
committerDiva Canto2014-04-24 14:12:04 -0700
commitcf54df3ecf7c83817d7f5c654b622a14291ac9ae (patch)
treef155b54fa2f08acc540b9a754b10991d77671d36
parentFixes a long-standing bug related to god-mode change ownership of objects per... (diff)
parentRevert "When linking a Hypergrid region, set the region's flags on the in-mem... (diff)
downloadopensim-SC_OLD-cf54df3ecf7c83817d7f5c654b622a14291ac9ae.zip
opensim-SC_OLD-cf54df3ecf7c83817d7f5c654b622a14291ac9ae.tar.gz
opensim-SC_OLD-cf54df3ecf7c83817d7f5c654b622a14291ac9ae.tar.bz2
opensim-SC_OLD-cf54df3ecf7c83817d7f5c654b622a14291ac9ae.tar.xz
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
-rw-r--r--OpenSim/Data/MySQL/MySQLUserProfilesData.cs5
-rw-r--r--OpenSim/Data/SQLite/SQLiteUserProfilesData.cs6
-rw-r--r--OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs2
-rw-r--r--OpenSim/Framework/Servers/HttpServer/JsonRpcRequestManager.cs175
-rw-r--r--OpenSim/Framework/WebUtil.cs236
-rw-r--r--OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs68
-rw-r--r--OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs10
-rw-r--r--OpenSim/Services/GridService/HypergridLinker.cs4
-rw-r--r--OpenSim/Services/Interfaces/OpenProfileClient.cs (renamed from OpenSim/Region/CoreModules/Avatar/UserProfiles/OpenProfileClient.cs)71
-rw-r--r--prebuild.xml2
10 files changed, 280 insertions, 299 deletions
diff --git a/OpenSim/Data/MySQL/MySQLUserProfilesData.cs b/OpenSim/Data/MySQL/MySQLUserProfilesData.cs
index cc4c5b0..e301bbe 100644
--- a/OpenSim/Data/MySQL/MySQLUserProfilesData.cs
+++ b/OpenSim/Data/MySQL/MySQLUserProfilesData.cs
@@ -634,8 +634,6 @@ namespace OpenSim.Data.MySQL
634 { 634 {
635 if(reader.HasRows) 635 if(reader.HasRows)
636 { 636 {
637 m_log.DebugFormat("[PROFILES_DATA]" +
638 ": Getting data for {0}.", props.UserId);
639 reader.Read(); 637 reader.Read();
640 props.WebUrl = (string)reader["profileURL"]; 638 props.WebUrl = (string)reader["profileURL"];
641 UUID.TryParse((string)reader["profileImage"], out props.ImageId); 639 UUID.TryParse((string)reader["profileImage"], out props.ImageId);
@@ -651,9 +649,6 @@ namespace OpenSim.Data.MySQL
651 } 649 }
652 else 650 else
653 { 651 {
654 m_log.DebugFormat("[PROFILES_DATA]" +
655 ": No data for {0}", props.UserId);
656
657 props.WebUrl = string.Empty; 652 props.WebUrl = string.Empty;
658 props.ImageId = UUID.Zero; 653 props.ImageId = UUID.Zero;
659 props.AboutText = string.Empty; 654 props.AboutText = string.Empty;
diff --git a/OpenSim/Data/SQLite/SQLiteUserProfilesData.cs b/OpenSim/Data/SQLite/SQLiteUserProfilesData.cs
index 0f5b4c8..5494091 100644
--- a/OpenSim/Data/SQLite/SQLiteUserProfilesData.cs
+++ b/OpenSim/Data/SQLite/SQLiteUserProfilesData.cs
@@ -584,9 +584,6 @@ namespace OpenSim.Data.SQLite
584 } 584 }
585 if(reader != null && reader.Read()) 585 if(reader != null && reader.Read())
586 { 586 {
587 m_log.DebugFormat("[PROFILES_DATA]" +
588 ": Getting data for {0}.", props.UserId);
589
590 props.WebUrl = (string)reader["profileURL"]; 587 props.WebUrl = (string)reader["profileURL"];
591 UUID.TryParse((string)reader["profileImage"], out props.ImageId); 588 UUID.TryParse((string)reader["profileImage"], out props.ImageId);
592 props.AboutText = (string)reader["profileAboutText"]; 589 props.AboutText = (string)reader["profileAboutText"];
@@ -601,9 +598,6 @@ namespace OpenSim.Data.SQLite
601 } 598 }
602 else 599 else
603 { 600 {
604 m_log.DebugFormat("[PROFILES_DATA]" +
605 ": No data for {0}", props.UserId);
606
607 props.WebUrl = string.Empty; 601 props.WebUrl = string.Empty;
608 props.ImageId = UUID.Zero; 602 props.ImageId = UUID.Zero;
609 props.AboutText = string.Empty; 603 props.AboutText = string.Empty;
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
index 4f71db9..e8aa278 100644
--- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
@@ -705,7 +705,7 @@ namespace OpenSim.Framework.Servers.HttpServer
705 } 705 }
706 } 706 }
707 707
708 WebUtil.LogResponseDetail(output); 708 WebUtil.LogResponseDetail(null, output);
709 } 709 }
710 710
711 if (!response.SendChunked && response.ContentLength64 <= 0) 711 if (!response.SendChunked && response.ContentLength64 <= 0)
diff --git a/OpenSim/Framework/Servers/HttpServer/JsonRpcRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/JsonRpcRequestManager.cs
index a44f471..ed6a14c 100644
--- a/OpenSim/Framework/Servers/HttpServer/JsonRpcRequestManager.cs
+++ b/OpenSim/Framework/Servers/HttpServer/JsonRpcRequestManager.cs
@@ -48,7 +48,6 @@ namespace OpenSim.Framework.Servers.HttpServer
48 { 48 {
49 } 49 }
50 50
51 #region Web Util
52 /// <summary> 51 /// <summary>
53 /// Sends json-rpc request with a serializable type. 52 /// Sends json-rpc request with a serializable type.
54 /// </summary> 53 /// </summary>
@@ -70,64 +69,62 @@ namespace OpenSim.Framework.Servers.HttpServer
70 public bool JsonRpcRequest(ref object parameters, string method, string uri, string jsonId) 69 public bool JsonRpcRequest(ref object parameters, string method, string uri, string jsonId)
71 { 70 {
72 if (jsonId == null) 71 if (jsonId == null)
73 throw new ArgumentNullException ("jsonId"); 72 throw new ArgumentNullException("jsonId");
74 if (uri == null) 73 if (uri == null)
75 throw new ArgumentNullException ("uri"); 74 throw new ArgumentNullException("uri");
76 if (method == null) 75 if (method == null)
77 throw new ArgumentNullException ("method"); 76 throw new ArgumentNullException("method");
78 if (parameters == null) 77 if (parameters == null)
79 throw new ArgumentNullException ("parameters"); 78 throw new ArgumentNullException("parameters");
80 79
81 // Prep our payload 80 OSDMap request = new OSDMap();
82 OSDMap json = new OSDMap(); 81 request.Add("jsonrpc", OSD.FromString("2.0"));
83 82 request.Add("id", OSD.FromString(jsonId));
84 json.Add("jsonrpc", OSD.FromString("2.0")); 83 request.Add("method", OSD.FromString(method));
85 json.Add("id", OSD.FromString(jsonId)); 84 request.Add("params", OSD.SerializeMembers(parameters));
86 json.Add("method", OSD.FromString(method)); 85
87 86 OSDMap response;
88 json.Add("params", OSD.SerializeMembers(parameters));
89
90 string jsonRequestData = OSDParser.SerializeJsonString(json);
91 byte[] content = Encoding.UTF8.GetBytes(jsonRequestData);
92
93 HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(uri);
94
95 webRequest.ContentType = "application/json-rpc";
96 webRequest.Method = "POST";
97
98 //Stream dataStream = webRequest.GetRequestStream();
99 //dataStream.Write(content, 0, content.Length);
100 //dataStream.Close();
101
102 using (Stream dataStream = webRequest.GetRequestStream())
103 dataStream.Write(content, 0, content.Length);
104
105 WebResponse webResponse = null;
106 try 87 try
107 { 88 {
108 webResponse = webRequest.GetResponse(); 89 response = WebUtil.PostToService(uri, request, 10000, true);
90 }
91 catch (Exception e)
92 {
93 m_log.Debug(string.Format("JsonRpc request '{0}' failed", method), e);
94 return false;
95 }
96
97 if (!response.ContainsKey("_Result"))
98 {
99 m_log.DebugFormat("JsonRpc request '{0}' returned an invalid response: {1}",
100 method, OSDParser.SerializeJsonString(response));
101 return false;
109 } 102 }
110 catch (WebException e) 103 response = (OSDMap)response["_Result"];
104
105 OSD data;
106
107 if (response.ContainsKey("error"))
111 { 108 {
112 Console.WriteLine("Web Error" + e.Message); 109 data = response["error"];
113 Console.WriteLine ("Please check input"); 110 m_log.DebugFormat("JsonRpc request '{0}' returned an error: {1}",
111 method, OSDParser.SerializeJsonString(data));
114 return false; 112 return false;
115 } 113 }
116 114
117 using (webResponse) 115 if (!response.ContainsKey("result"))
118 using (Stream rstream = webResponse.GetResponseStream())
119 { 116 {
120 OSDMap mret = (OSDMap)OSDParser.DeserializeJson(rstream); 117 m_log.DebugFormat("JsonRpc request '{0}' returned an invalid response: {1}",
121 118 method, OSDParser.SerializeJsonString(response));
122 if (mret.ContainsKey("error")) 119 return false;
123 return false;
124
125 // get params...
126 OSD.DeserializeMembers(ref parameters, (OSDMap)mret["result"]);
127 return true;
128 } 120 }
121
122 data = response["result"];
123 OSD.DeserializeMembers(ref parameters, (OSDMap)data);
124
125 return true;
129 } 126 }
130 127
131 /// <summary> 128 /// <summary>
132 /// Sends json-rpc request with OSD parameter. 129 /// Sends json-rpc request with OSD parameter.
133 /// </summary> 130 /// </summary>
@@ -135,7 +132,7 @@ namespace OpenSim.Framework.Servers.HttpServer
135 /// The rpc request. 132 /// The rpc request.
136 /// </returns> 133 /// </returns>
137 /// <param name='data'> 134 /// <param name='data'>
138 /// data - incoming as parameters, outgong as result/error 135 /// data - incoming as parameters, outgoing as result/error
139 /// </param> 136 /// </param>
140 /// <param name='method'> 137 /// <param name='method'>
141 /// Json-rpc method to call. 138 /// Json-rpc method to call.
@@ -148,64 +145,46 @@ namespace OpenSim.Framework.Servers.HttpServer
148 /// </param> 145 /// </param>
149 public bool JsonRpcRequest(ref OSD data, string method, string uri, string jsonId) 146 public bool JsonRpcRequest(ref OSD data, string method, string uri, string jsonId)
150 { 147 {
151 OSDMap map = new OSDMap(); 148 if (string.IsNullOrEmpty(jsonId))
152 149 jsonId = UUID.Random().ToString();
153 map["jsonrpc"] = "2.0"; 150
154 if(string.IsNullOrEmpty(jsonId)) 151 OSDMap request = new OSDMap();
155 map["id"] = UUID.Random().ToString(); 152 request.Add("jsonrpc", OSD.FromString("2.0"));
156 else 153 request.Add("id", OSD.FromString(jsonId));
157 map["id"] = jsonId; 154 request.Add("method", OSD.FromString(method));
158 155 request.Add("params", data);
159 map["method"] = method; 156
160 map["params"] = data; 157 OSDMap response;
161
162 string jsonRequestData = OSDParser.SerializeJsonString(map);
163 byte[] content = Encoding.UTF8.GetBytes(jsonRequestData);
164
165 HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(uri);
166 webRequest.ContentType = "application/json-rpc";
167 webRequest.Method = "POST";
168
169 using (Stream dataStream = webRequest.GetRequestStream())
170 dataStream.Write(content, 0, content.Length);
171
172 WebResponse webResponse = null;
173 try 158 try
174 { 159 {
175 webResponse = webRequest.GetResponse(); 160 response = WebUtil.PostToService(uri, request, 10000, true);
176 } 161 }
177 catch (WebException e) 162 catch (Exception e)
178 { 163 {
179 Console.WriteLine("Web Error" + e.Message); 164 m_log.Debug(string.Format("JsonRpc request '{0}' failed", method), e);
180 Console.WriteLine ("Please check input");
181 return false; 165 return false;
182 } 166 }
183 167
184 using (webResponse) 168 if (!response.ContainsKey("_Result"))
185 using (Stream rstream = webResponse.GetResponseStream())
186 { 169 {
187 OSDMap response = new OSDMap(); 170 m_log.DebugFormat("JsonRpc request '{0}' returned an invalid response: {1}",
188 try 171 method, OSDParser.SerializeJsonString(response));
189 { 172 return false;
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 } 173 }
174 response = (OSDMap)response["_Result"];
175
176 if (response.ContainsKey("error"))
177 {
178 data = response["error"];
179 m_log.DebugFormat("JsonRpc request '{0}' returned an error: {1}",
180 method, OSDParser.SerializeJsonString(data));
181 return false;
182 }
183
184 data = response;
185
186 return true;
208 } 187 }
209 #endregion Web Util 188
210 } 189 }
211} 190}
diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs
index 768ff16..d7f6bc8 100644
--- a/OpenSim/Framework/WebUtil.cs
+++ b/OpenSim/Framework/WebUtil.cs
@@ -39,7 +39,9 @@ using System.Text;
39using System.Web; 39using System.Web;
40using System.Xml; 40using System.Xml;
41using System.Xml.Serialization; 41using System.Xml.Serialization;
42using System.Xml.Linq;
42using log4net; 43using log4net;
44using Nwc.XmlRpc;
43using OpenMetaverse.StructuredData; 45using OpenMetaverse.StructuredData;
44using XMLResponseHelper = OpenSim.Framework.SynchronousRestObjectRequester.XMLResponseHelper; 46using XMLResponseHelper = OpenSim.Framework.SynchronousRestObjectRequester.XMLResponseHelper;
45 47
@@ -127,41 +129,41 @@ namespace OpenSim.Framework
127 /// </summary> 129 /// </summary>
128 public static OSDMap PutToServiceCompressed(string url, OSDMap data, int timeout) 130 public static OSDMap PutToServiceCompressed(string url, OSDMap data, int timeout)
129 { 131 {
130 return ServiceOSDRequest(url,data, "PUT", timeout, true); 132 return ServiceOSDRequest(url,data, "PUT", timeout, true, false);
131 } 133 }
132 134
133 public static OSDMap PutToService(string url, OSDMap data, int timeout) 135 public static OSDMap PutToService(string url, OSDMap data, int timeout)
134 { 136 {
135 return ServiceOSDRequest(url,data, "PUT", timeout, false); 137 return ServiceOSDRequest(url,data, "PUT", timeout, false, false);
136 } 138 }
137 139
138 public static OSDMap PostToService(string url, OSDMap data, int timeout) 140 public static OSDMap PostToService(string url, OSDMap data, int timeout, bool rpc)
139 { 141 {
140 return ServiceOSDRequest(url, data, "POST", timeout, false); 142 return ServiceOSDRequest(url, data, "POST", timeout, false, rpc);
141 } 143 }
142 144
143 public static OSDMap PostToServiceCompressed(string url, OSDMap data, int timeout) 145 public static OSDMap PostToServiceCompressed(string url, OSDMap data, int timeout)
144 { 146 {
145 return ServiceOSDRequest(url, data, "POST", timeout, true); 147 return ServiceOSDRequest(url, data, "POST", timeout, true, false);
146 } 148 }
147 149
148 public static OSDMap GetFromService(string url, int timeout) 150 public static OSDMap GetFromService(string url, int timeout)
149 { 151 {
150 return ServiceOSDRequest(url, null, "GET", timeout, false); 152 return ServiceOSDRequest(url, null, "GET", timeout, false, false);
151 } 153 }
152 154
153 public static OSDMap ServiceOSDRequest(string url, OSDMap data, string method, int timeout, bool compressed) 155 public static OSDMap ServiceOSDRequest(string url, OSDMap data, string method, int timeout, bool compressed, bool rpc)
154 { 156 {
155 if (SerializeOSDRequestsPerEndpoint) 157 if (SerializeOSDRequestsPerEndpoint)
156 { 158 {
157 lock (EndPointLock(url)) 159 lock (EndPointLock(url))
158 { 160 {
159 return ServiceOSDRequestWorker(url, data, method, timeout, compressed); 161 return ServiceOSDRequestWorker(url, data, method, timeout, compressed, rpc);
160 } 162 }
161 } 163 }
162 else 164 else
163 { 165 {
164 return ServiceOSDRequestWorker(url, data, method, timeout, compressed); 166 return ServiceOSDRequestWorker(url, data, method, timeout, compressed, rpc);
165 } 167 }
166 } 168 }
167 169
@@ -191,9 +193,9 @@ namespace OpenSim.Framework
191 } 193 }
192 } 194 }
193 195
194 public static void LogOutgoingDetail(string output) 196 public static void LogOutgoingDetail(string type, int reqnum, string output)
195 { 197 {
196 LogOutgoingDetail("", output); 198 LogOutgoingDetail(string.Format("{0} {1}: ", type, reqnum), output);
197 } 199 }
198 200
199 public static void LogOutgoingDetail(string context, string output) 201 public static void LogOutgoingDetail(string context, string output)
@@ -207,24 +209,24 @@ namespace OpenSim.Framework
207 m_log.DebugFormat("[LOGHTTP]: {0}{1}", context, Util.BinaryToASCII(output)); 209 m_log.DebugFormat("[LOGHTTP]: {0}{1}", context, Util.BinaryToASCII(output));
208 } 210 }
209 211
210 public static void LogResponseDetail(Stream inputStream) 212 public static void LogResponseDetail(int reqnum, Stream inputStream)
211 { 213 {
212 LogOutgoingDetail("RESPONSE: ", inputStream); 214 LogOutgoingDetail(string.Format("RESPONSE {0}: ", reqnum), inputStream);
213 } 215 }
214 216
215 public static void LogResponseDetail(string input) 217 public static void LogResponseDetail(int? reqnum, string input)
216 { 218 {
217 LogOutgoingDetail("RESPONSE: ", input); 219 string context = (reqnum == null) ? "" : string.Format("RESPONSE {0}: ", reqnum.Value);
220 LogOutgoingDetail(context, input);
218 } 221 }
219 222
220 private static OSDMap ServiceOSDRequestWorker(string url, OSDMap data, string method, int timeout, bool compressed) 223 private static OSDMap ServiceOSDRequestWorker(string url, OSDMap data, string method, int timeout, bool compressed, bool rpc)
221 { 224 {
222 int reqnum = RequestNumber++; 225 int reqnum = RequestNumber++;
223 226
224 if (DebugLevel >= 3) 227 if (DebugLevel >= 3)
225 m_log.DebugFormat( 228 m_log.DebugFormat("[LOGHTTP]: HTTP OUT {0} JSON-RPC {1} to {2}",
226 "[LOGHTTP]: HTTP OUT {0} ServiceOSD {1} {2} (timeout {3}, compressed {4})", 229 reqnum, method, url);
227 reqnum, method, url, timeout, compressed);
228 230
229 string errorMessage = "unknown error"; 231 string errorMessage = "unknown error";
230 int tickstart = Util.EnvironmentTickCount(); 232 int tickstart = Util.EnvironmentTickCount();
@@ -247,11 +249,11 @@ namespace OpenSim.Framework
247 strBuffer = OSDParser.SerializeJsonString(data); 249 strBuffer = OSDParser.SerializeJsonString(data);
248 250
249 if (DebugLevel >= 5) 251 if (DebugLevel >= 5)
250 LogOutgoingDetail(strBuffer); 252 LogOutgoingDetail("SEND", reqnum, strBuffer);
251 253
252 byte[] buffer = System.Text.Encoding.UTF8.GetBytes(strBuffer); 254 byte[] buffer = System.Text.Encoding.UTF8.GetBytes(strBuffer);
253 255
254 request.ContentType = "application/json"; 256 request.ContentType = rpc ? "application/json-rpc" : "application/json";
255 257
256 if (compressed) 258 if (compressed)
257 { 259 {
@@ -291,9 +293,8 @@ namespace OpenSim.Framework
291 using (StreamReader reader = new StreamReader(responseStream)) 293 using (StreamReader reader = new StreamReader(responseStream))
292 { 294 {
293 string responseStr = reader.ReadToEnd(); 295 string responseStr = reader.ReadToEnd();
294 // m_log.DebugFormat("[LOGHTTP]: <{0}> response is <{1}>",reqnum,responseStr);
295 if (WebUtil.DebugLevel >= 5) 296 if (WebUtil.DebugLevel >= 5)
296 WebUtil.LogResponseDetail(responseStr); 297 WebUtil.LogResponseDetail(reqnum, responseStr);
297 return CanonicalizeResults(responseStr); 298 return CanonicalizeResults(responseStr);
298 } 299 }
299 } 300 }
@@ -316,24 +317,23 @@ namespace OpenSim.Framework
316 { 317 {
317 int tickdiff = Util.EnvironmentTickCountSubtract(tickstart); 318 int tickdiff = Util.EnvironmentTickCountSubtract(tickstart);
318 if (tickdiff > LongCallTime) 319 if (tickdiff > LongCallTime)
320 {
319 m_log.InfoFormat( 321 m_log.InfoFormat(
320 "[LOGHTTP]: Slow ServiceOSD request {0} {1} {2} took {3}ms, {4}ms writing, {5}", 322 "[LOGHTTP]: Slow JSON-RPC request {0} {1} to {2} took {3}ms, {4}ms writing, {5}",
321 reqnum, 323 reqnum, method, url, tickdiff, tickdata,
322 method,
323 url,
324 tickdiff,
325 tickdata,
326 strBuffer != null 324 strBuffer != null
327 ? (strBuffer.Length > MaxRequestDiagLength ? strBuffer.Remove(MaxRequestDiagLength) : strBuffer) 325 ? (strBuffer.Length > MaxRequestDiagLength ? strBuffer.Remove(MaxRequestDiagLength) : strBuffer)
328 : ""); 326 : "");
327 }
329 else if (DebugLevel >= 4) 328 else if (DebugLevel >= 4)
330 m_log.DebugFormat( 329 {
331 "[LOGHTTP]: HTTP OUT {0} took {1}ms, {2}ms writing", 330 m_log.DebugFormat("[LOGHTTP]: HTTP OUT {0} took {1}ms, {2}ms writing",
332 reqnum, tickdiff, tickdata); 331 reqnum, tickdiff, tickdata);
332 }
333 } 333 }
334 334
335 m_log.DebugFormat( 335 m_log.DebugFormat(
336 "[LOGHTTP]: ServiceOSD request {0} {1} {2} FAILED: {3}", reqnum, url, method, errorMessage); 336 "[LOGHTTP]: JSON-RPC request {0} {1} to {2} FAILED: {3}", reqnum, method, url, errorMessage);
337 337
338 return ErrorResponseMap(errorMessage); 338 return ErrorResponseMap(errorMessage);
339 } 339 }
@@ -411,9 +411,8 @@ namespace OpenSim.Framework
411 string method = (data != null && data["RequestMethod"] != null) ? data["RequestMethod"] : "unknown"; 411 string method = (data != null && data["RequestMethod"] != null) ? data["RequestMethod"] : "unknown";
412 412
413 if (DebugLevel >= 3) 413 if (DebugLevel >= 3)
414 m_log.DebugFormat( 414 m_log.DebugFormat("[LOGHTTP]: HTTP OUT {0} ServiceForm '{1}' to {2}",
415 "[LOGHTTP]: HTTP OUT {0} ServiceForm {1} {2} (timeout {3})", 415 reqnum, method, url);
416 reqnum, method, url, timeout);
417 416
418 string errorMessage = "unknown error"; 417 string errorMessage = "unknown error";
419 int tickstart = Util.EnvironmentTickCount(); 418 int tickstart = Util.EnvironmentTickCount();
@@ -435,7 +434,7 @@ namespace OpenSim.Framework
435 queryString = BuildQueryString(data); 434 queryString = BuildQueryString(data);
436 435
437 if (DebugLevel >= 5) 436 if (DebugLevel >= 5)
438 LogOutgoingDetail(queryString); 437 LogOutgoingDetail("SEND", reqnum, queryString);
439 438
440 byte[] buffer = System.Text.Encoding.UTF8.GetBytes(queryString); 439 byte[] buffer = System.Text.Encoding.UTF8.GetBytes(queryString);
441 440
@@ -457,7 +456,7 @@ namespace OpenSim.Framework
457 { 456 {
458 string responseStr = reader.ReadToEnd(); 457 string responseStr = reader.ReadToEnd();
459 if (WebUtil.DebugLevel >= 5) 458 if (WebUtil.DebugLevel >= 5)
460 WebUtil.LogResponseDetail(responseStr); 459 WebUtil.LogResponseDetail(reqnum, responseStr);
461 OSD responseOSD = OSDParser.Deserialize(responseStr); 460 OSD responseOSD = OSDParser.Deserialize(responseStr);
462 461
463 if (responseOSD.Type == OSDType.Map) 462 if (responseOSD.Type == OSDType.Map)
@@ -483,23 +482,22 @@ namespace OpenSim.Framework
483 { 482 {
484 int tickdiff = Util.EnvironmentTickCountSubtract(tickstart); 483 int tickdiff = Util.EnvironmentTickCountSubtract(tickstart);
485 if (tickdiff > LongCallTime) 484 if (tickdiff > LongCallTime)
485 {
486 m_log.InfoFormat( 486 m_log.InfoFormat(
487 "[LOGHTTP]: Slow ServiceForm request {0} {1} {2} took {3}ms, {4}ms writing, {5}", 487 "[LOGHTTP]: Slow ServiceForm request {0} '{1}' to {2} took {3}ms, {4}ms writing, {5}",
488 reqnum, 488 reqnum, method, url, tickdiff, tickdata,
489 method,
490 url,
491 tickdiff,
492 tickdata,
493 queryString != null 489 queryString != null
494 ? (queryString.Length > MaxRequestDiagLength) ? queryString.Remove(MaxRequestDiagLength) : queryString 490 ? (queryString.Length > MaxRequestDiagLength) ? queryString.Remove(MaxRequestDiagLength) : queryString
495 : ""); 491 : "");
492 }
496 else if (DebugLevel >= 4) 493 else if (DebugLevel >= 4)
497 m_log.DebugFormat( 494 {
498 "[LOGHTTP]: HTTP OUT {0} took {1}ms, {2}ms writing", 495 m_log.DebugFormat("[LOGHTTP]: HTTP OUT {0} took {1}ms, {2}ms writing",
499 reqnum, tickdiff, tickdata); 496 reqnum, tickdiff, tickdata);
497 }
500 } 498 }
501 499
502 m_log.WarnFormat("[LOGHTTP]: ServiceForm request {0} {1} {2} failed: {2}", reqnum, method, url, errorMessage); 500 m_log.WarnFormat("[LOGHTTP]: ServiceForm request {0} '{1}' to {2} failed: {3}", reqnum, method, url, errorMessage);
503 501
504 return ErrorResponseMap(errorMessage); 502 return ErrorResponseMap(errorMessage);
505 } 503 }
@@ -779,8 +777,7 @@ namespace OpenSim.Framework
779 int reqnum = WebUtil.RequestNumber++; 777 int reqnum = WebUtil.RequestNumber++;
780 778
781 if (WebUtil.DebugLevel >= 3) 779 if (WebUtil.DebugLevel >= 3)
782 m_log.DebugFormat( 780 m_log.DebugFormat("[LOGHTTP]: HTTP OUT {0} AsynchronousRequestObject {1} to {2}",
783 "[LOGHTTP]: HTTP OUT {0} AsynchronousRequestObject {1} {2}",
784 reqnum, verb, requestUrl); 781 reqnum, verb, requestUrl);
785 782
786 int tickstart = Util.EnvironmentTickCount(); 783 int tickstart = Util.EnvironmentTickCount();
@@ -822,7 +819,7 @@ namespace OpenSim.Framework
822 byte[] data = buffer.ToArray(); 819 byte[] data = buffer.ToArray();
823 820
824 if (WebUtil.DebugLevel >= 5) 821 if (WebUtil.DebugLevel >= 5)
825 WebUtil.LogOutgoingDetail(System.Text.Encoding.UTF8.GetString(data)); 822 WebUtil.LogOutgoingDetail("SEND", reqnum, System.Text.Encoding.UTF8.GetString(data));
826 823
827 request.BeginGetRequestStream(delegate(IAsyncResult res) 824 request.BeginGetRequestStream(delegate(IAsyncResult res)
828 { 825 {
@@ -840,7 +837,8 @@ namespace OpenSim.Framework
840 { 837 {
841 using (Stream respStream = response.GetResponseStream()) 838 using (Stream respStream = response.GetResponseStream())
842 { 839 {
843 deserial = XMLResponseHelper.LogAndDeserialize<TRequest, TResponse>(respStream, response.ContentLength); 840 deserial = XMLResponseHelper.LogAndDeserialize<TRequest, TResponse>(
841 reqnum, respStream, response.ContentLength);
844 } 842 }
845 } 843 }
846 catch (System.InvalidOperationException) 844 catch (System.InvalidOperationException)
@@ -867,7 +865,8 @@ namespace OpenSim.Framework
867 { 865 {
868 using (Stream respStream = response.GetResponseStream()) 866 using (Stream respStream = response.GetResponseStream())
869 { 867 {
870 deserial = XMLResponseHelper.LogAndDeserialize<TRequest, TResponse>(respStream, response.ContentLength); 868 deserial = XMLResponseHelper.LogAndDeserialize<TRequest, TResponse>(
869 reqnum, respStream, response.ContentLength);
871 } 870 }
872 } 871 }
873 catch (System.InvalidOperationException) 872 catch (System.InvalidOperationException)
@@ -938,18 +937,13 @@ namespace OpenSim.Framework
938 } 937 }
939 938
940 m_log.InfoFormat( 939 m_log.InfoFormat(
941 "[LOGHTTP]: [ASYNC REQUEST]: Slow request {0} {1} {2} took {3}ms, {4}ms writing, {5}", 940 "[LOGHTTP]: Slow AsynchronousRequestObject request {0} {1} to {2} took {3}ms, {4}ms writing, {5}",
942 reqnum, 941 reqnum, verb, requestUrl, tickdiff, tickdata,
943 verb,
944 requestUrl,
945 tickdiff,
946 tickdata,
947 originalRequest); 942 originalRequest);
948 } 943 }
949 else if (WebUtil.DebugLevel >= 4) 944 else if (WebUtil.DebugLevel >= 4)
950 { 945 {
951 m_log.DebugFormat( 946 m_log.DebugFormat("[LOGHTTP]: HTTP OUT {0} took {1}ms, {2}ms writing",
952 "[LOGHTTP]: HTTP OUT {0} took {1}ms, {2}ms writing",
953 reqnum, tickdiff, tickdata); 947 reqnum, tickdiff, tickdata);
954 } 948 }
955 } 949 }
@@ -981,8 +975,7 @@ namespace OpenSim.Framework
981 int reqnum = WebUtil.RequestNumber++; 975 int reqnum = WebUtil.RequestNumber++;
982 976
983 if (WebUtil.DebugLevel >= 3) 977 if (WebUtil.DebugLevel >= 3)
984 m_log.DebugFormat( 978 m_log.DebugFormat("[LOGHTTP]: HTTP OUT {0} SynchronousRestForms {1} to {2}",
985 "[LOGHTTP]: HTTP OUT {0} SynchronousRestForms {1} {2}",
986 reqnum, verb, requestUrl); 979 reqnum, verb, requestUrl);
987 980
988 int tickstart = Util.EnvironmentTickCount(); 981 int tickstart = Util.EnvironmentTickCount();
@@ -1012,7 +1005,7 @@ namespace OpenSim.Framework
1012 byte[] data = buffer.ToArray(); 1005 byte[] data = buffer.ToArray();
1013 1006
1014 if (WebUtil.DebugLevel >= 5) 1007 if (WebUtil.DebugLevel >= 5)
1015 WebUtil.LogOutgoingDetail(System.Text.Encoding.UTF8.GetString(data)); 1008 WebUtil.LogOutgoingDetail("SEND", reqnum, System.Text.Encoding.UTF8.GetString(data));
1016 1009
1017 Stream requestStream = null; 1010 Stream requestStream = null;
1018 try 1011 try
@@ -1058,21 +1051,20 @@ namespace OpenSim.Framework
1058 1051
1059 int tickdiff = Util.EnvironmentTickCountSubtract(tickstart); 1052 int tickdiff = Util.EnvironmentTickCountSubtract(tickstart);
1060 if (tickdiff > WebUtil.LongCallTime) 1053 if (tickdiff > WebUtil.LongCallTime)
1054 {
1061 m_log.InfoFormat( 1055 m_log.InfoFormat(
1062 "[LOGHTTP]: [FORMS]: Slow request {0} {1} {2} took {3}ms, {4}ms writing, {5}", 1056 "[LOGHTTP]: Slow SynchronousRestForms request {0} {1} to {2} took {3}ms, {4}ms writing, {5}",
1063 reqnum, 1057 reqnum, verb, requestUrl, tickdiff, tickdata,
1064 verb,
1065 requestUrl,
1066 tickdiff,
1067 tickdata,
1068 obj.Length > WebUtil.MaxRequestDiagLength ? obj.Remove(WebUtil.MaxRequestDiagLength) : obj); 1058 obj.Length > WebUtil.MaxRequestDiagLength ? obj.Remove(WebUtil.MaxRequestDiagLength) : obj);
1059 }
1069 else if (WebUtil.DebugLevel >= 4) 1060 else if (WebUtil.DebugLevel >= 4)
1070 m_log.DebugFormat( 1061 {
1071 "[LOGHTTP]: HTTP OUT {0} took {1}ms, {2}ms writing", 1062 m_log.DebugFormat("[LOGHTTP]: HTTP OUT {0} took {1}ms, {2}ms writing",
1072 reqnum, tickdiff, tickdata); 1063 reqnum, tickdiff, tickdata);
1064 }
1073 1065
1074 if (WebUtil.DebugLevel >= 5) 1066 if (WebUtil.DebugLevel >= 5)
1075 WebUtil.LogResponseDetail(respstring); 1067 WebUtil.LogResponseDetail(reqnum, respstring);
1076 1068
1077 return respstring; 1069 return respstring;
1078 } 1070 }
@@ -1114,8 +1106,7 @@ namespace OpenSim.Framework
1114 int reqnum = WebUtil.RequestNumber++; 1106 int reqnum = WebUtil.RequestNumber++;
1115 1107
1116 if (WebUtil.DebugLevel >= 3) 1108 if (WebUtil.DebugLevel >= 3)
1117 m_log.DebugFormat( 1109 m_log.DebugFormat("[LOGHTTP]: HTTP OUT {0} SynchronousRestObject {1} to {2}",
1118 "[LOGHTTP]: HTTP OUT {0} SynchronousRestObject {1} {2}",
1119 reqnum, verb, requestUrl); 1110 reqnum, verb, requestUrl);
1120 1111
1121 int tickstart = Util.EnvironmentTickCount(); 1112 int tickstart = Util.EnvironmentTickCount();
@@ -1155,7 +1146,7 @@ namespace OpenSim.Framework
1155 byte[] data = buffer.ToArray(); 1146 byte[] data = buffer.ToArray();
1156 1147
1157 if (WebUtil.DebugLevel >= 5) 1148 if (WebUtil.DebugLevel >= 5)
1158 WebUtil.LogOutgoingDetail(System.Text.Encoding.UTF8.GetString(data)); 1149 WebUtil.LogOutgoingDetail("SEND", reqnum, System.Text.Encoding.UTF8.GetString(data));
1159 1150
1160 try 1151 try
1161 { 1152 {
@@ -1185,7 +1176,8 @@ namespace OpenSim.Framework
1185 { 1176 {
1186 using (Stream respStream = resp.GetResponseStream()) 1177 using (Stream respStream = resp.GetResponseStream())
1187 { 1178 {
1188 deserial = XMLResponseHelper.LogAndDeserialize<TRequest, TResponse>(respStream, resp.ContentLength); 1179 deserial = XMLResponseHelper.LogAndDeserialize<TRequest, TResponse>(
1180 reqnum, respStream, resp.ContentLength);
1189 } 1181 }
1190 } 1182 }
1191 else 1183 else
@@ -1236,18 +1228,13 @@ namespace OpenSim.Framework
1236 } 1228 }
1237 1229
1238 m_log.InfoFormat( 1230 m_log.InfoFormat(
1239 "[LOGHTTP]: [SynchronousRestObjectRequester]: Slow request {0} {1} {2} took {3}ms, {4}ms writing, {5}", 1231 "[LOGHTTP]: Slow SynchronousRestObject request {0} {1} to {2} took {3}ms, {4}ms writing, {5}",
1240 reqnum, 1232 reqnum, verb, requestUrl, tickdiff, tickdata,
1241 verb,
1242 requestUrl,
1243 tickdiff,
1244 tickdata,
1245 originalRequest); 1233 originalRequest);
1246 } 1234 }
1247 else if (WebUtil.DebugLevel >= 4) 1235 else if (WebUtil.DebugLevel >= 4)
1248 { 1236 {
1249 m_log.DebugFormat( 1237 m_log.DebugFormat("[LOGHTTP]: HTTP OUT {0} took {1}ms, {2}ms writing",
1250 "[LOGHTTP]: HTTP OUT {0} took {1}ms, {2}ms writing",
1251 reqnum, tickdiff, tickdata); 1238 reqnum, tickdiff, tickdata);
1252 } 1239 }
1253 } 1240 }
@@ -1263,7 +1250,7 @@ namespace OpenSim.Framework
1263 1250
1264 public static class XMLResponseHelper 1251 public static class XMLResponseHelper
1265 { 1252 {
1266 public static TResponse LogAndDeserialize<TRequest, TResponse>(Stream respStream, long contentLength) 1253 public static TResponse LogAndDeserialize<TRequest, TResponse>(int reqnum, Stream respStream, long contentLength)
1267 { 1254 {
1268 XmlSerializer deserializer = new XmlSerializer(typeof(TResponse)); 1255 XmlSerializer deserializer = new XmlSerializer(typeof(TResponse));
1269 1256
@@ -1272,7 +1259,7 @@ namespace OpenSim.Framework
1272 byte[] data = new byte[contentLength]; 1259 byte[] data = new byte[contentLength];
1273 Util.ReadStream(respStream, data); 1260 Util.ReadStream(respStream, data);
1274 1261
1275 WebUtil.LogResponseDetail(System.Text.Encoding.UTF8.GetString(data)); 1262 WebUtil.LogResponseDetail(reqnum, System.Text.Encoding.UTF8.GetString(data));
1276 1263
1277 using (MemoryStream temp = new MemoryStream(data)) 1264 using (MemoryStream temp = new MemoryStream(data))
1278 return (TResponse)deserializer.Deserialize(temp); 1265 return (TResponse)deserializer.Deserialize(temp);
@@ -1284,4 +1271,81 @@ namespace OpenSim.Framework
1284 } 1271 }
1285 } 1272 }
1286 } 1273 }
1274
1275
1276 public static class XMLRPCRequester
1277 {
1278 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
1279
1280 public static Hashtable SendRequest(Hashtable ReqParams, string method, string url)
1281 {
1282 int reqnum = WebUtil.RequestNumber++;
1283
1284 if (WebUtil.DebugLevel >= 3)
1285 m_log.DebugFormat("[LOGHTTP]: HTTP OUT {0} XML-RPC '{1}' to {2}",
1286 reqnum, method, url);
1287
1288 int tickstart = Util.EnvironmentTickCount();
1289 string responseStr = null;
1290
1291 try
1292 {
1293 ArrayList SendParams = new ArrayList();
1294 SendParams.Add(ReqParams);
1295
1296 XmlRpcRequest Req = new XmlRpcRequest(method, SendParams);
1297
1298 if (WebUtil.DebugLevel >= 5)
1299 {
1300 string str = Req.ToString();
1301 str = XElement.Parse(str).ToString(SaveOptions.DisableFormatting);
1302 WebUtil.LogOutgoingDetail("SEND", reqnum, str);
1303 }
1304
1305 XmlRpcResponse Resp = Req.Send(url, 30000);
1306
1307 try
1308 {
1309 responseStr = Resp.ToString();
1310 responseStr = XElement.Parse(responseStr).ToString(SaveOptions.DisableFormatting);
1311
1312 if (WebUtil.DebugLevel >= 5)
1313 WebUtil.LogResponseDetail(reqnum, responseStr);
1314 }
1315 catch (Exception e)
1316 {
1317 m_log.Error("Error parsing XML-RPC response", e);
1318 }
1319
1320 if (Resp.IsFault)
1321 {
1322 m_log.DebugFormat(
1323 "[LOGHTTP]: XML-RPC request {0} '{1}' to {2} FAILED: FaultCode={3}, FaultMessage={4}",
1324 reqnum, method, url, Resp.FaultCode, Resp.FaultString);
1325 return null;
1326 }
1327
1328 Hashtable RespData = (Hashtable)Resp.Value;
1329 return RespData;
1330 }
1331 finally
1332 {
1333 int tickdiff = Util.EnvironmentTickCountSubtract(tickstart);
1334 if (tickdiff > WebUtil.LongCallTime)
1335 {
1336 m_log.InfoFormat(
1337 "[LOGHTTP]: Slow XML-RPC request {0} '{1}' to {2} took {3}ms, {4}",
1338 reqnum, method, url, tickdiff,
1339 responseStr != null
1340 ? (responseStr.Length > WebUtil.MaxRequestDiagLength ? responseStr.Remove(WebUtil.MaxRequestDiagLength) : responseStr)
1341 : "");
1342 }
1343 else if (WebUtil.DebugLevel >= 4)
1344 {
1345 m_log.DebugFormat("[LOGHTTP]: HTTP OUT {0} took {1}ms", reqnum, tickdiff);
1346 }
1347 }
1348 }
1349
1350 }
1287} 1351}
diff --git a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs
index d05b1f6..1ee2a7b 100644
--- a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs
@@ -47,6 +47,7 @@ using OpenSim.Services.Interfaces;
47using Mono.Addins; 47using Mono.Addins;
48using OpenSim.Services.Connectors.Hypergrid; 48using OpenSim.Services.Connectors.Hypergrid;
49using OpenSim.Framework.Servers.HttpServer; 49using OpenSim.Framework.Servers.HttpServer;
50using OpenSim.Services.UserProfilesService;
50 51
51namespace OpenSim.Region.CoreModules.Avatar.UserProfiles 52namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
52{ 53{
@@ -64,6 +65,8 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
64 Dictionary<UUID, UUID> m_classifiedCache = new Dictionary<UUID, UUID>(); 65 Dictionary<UUID, UUID> m_classifiedCache = new Dictionary<UUID, UUID>();
65 Dictionary<UUID, int> m_classifiedInterest = new Dictionary<UUID, int>(); 66 Dictionary<UUID, int> m_classifiedInterest = new Dictionary<UUID, int>();
66 67
68 private JsonRpcRequestManager rpc = new JsonRpcRequestManager();
69
67 public Scene Scene 70 public Scene Scene
68 { 71 {
69 get; private set; 72 get; private set;
@@ -113,7 +116,6 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
113 set; 116 set;
114 } 117 }
115 118
116 JsonRpcRequestManager rpc = new JsonRpcRequestManager();
117 119
118 #region IRegionModuleBase implementation 120 #region IRegionModuleBase implementation
119 /// <summary> 121 /// <summary>
@@ -919,7 +921,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
919 921
920 public void RequestAvatarProperties(IClientAPI remoteClient, UUID avatarID) 922 public void RequestAvatarProperties(IClientAPI remoteClient, UUID avatarID)
921 { 923 {
922 if ( String.IsNullOrEmpty(avatarID.ToString()) || String.IsNullOrEmpty(remoteClient.AgentId.ToString())) 924 if (String.IsNullOrEmpty(avatarID.ToString()) || String.IsNullOrEmpty(remoteClient.AgentId.ToString()))
923 { 925 {
924 // Looking for a reason that some viewers are sending null Id's 926 // Looking for a reason that some viewers are sending null Id's
925 m_log.DebugFormat("[PROFILES]: This should not happen remoteClient.AgentId {0} - avatarID {1}", remoteClient.AgentId, avatarID); 927 m_log.DebugFormat("[PROFILES]: This should not happen remoteClient.AgentId {0} - avatarID {1}", remoteClient.AgentId, avatarID);
@@ -997,29 +999,10 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
997 999
998 props.UserId = avatarID; 1000 props.UserId = avatarID;
999 1001
1000 try 1002 if (!GetProfileData(ref props, foreign, out result))
1001 {
1002 GetProfileData(ref props, out result);
1003 }
1004 catch (Exception e)
1005 { 1003 {
1006 if (foreign) 1004 m_log.DebugFormat("Error getting profile for {0}: {1}", avatarID, result);
1007 { 1005 return;
1008 // Check if the foreign grid is using OpenProfile.
1009 // If any error occurs then discard it, and report the original error.
1010 try
1011 {
1012 OpenProfileClient client = new OpenProfileClient(serverURI);
1013 if (!client.RequestAvatarPropertiesUsingOpenProfile(ref props))
1014 throw e;
1015 }
1016 catch (Exception)
1017 {
1018 throw e;
1019 }
1020 }
1021 else
1022 throw;
1023 } 1006 }
1024 1007
1025 remoteClient.SendAvatarProperties(props.UserId, props.AboutText, born, charterMember , props.FirstLifeText, flags, 1008 remoteClient.SendAvatarProperties(props.UserId, props.AboutText, born, charterMember , props.FirstLifeText, flags,
@@ -1073,10 +1056,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
1073 /// <returns> 1056 /// <returns>
1074 /// The profile data. 1057 /// The profile data.
1075 /// </returns> 1058 /// </returns>
1076 /// <param name='userID'> 1059 bool GetProfileData(ref UserProfileProperties properties, bool foreign, out string message)
1077 /// User I.
1078 /// </param>
1079 bool GetProfileData(ref UserProfileProperties properties, out string message)
1080 { 1060 {
1081 // Can't handle NPC yet... 1061 // Can't handle NPC yet...
1082 ScenePresence p = FindPresence(properties.UserId); 1062 ScenePresence p = FindPresence(properties.UserId);
@@ -1095,14 +1075,42 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
1095 1075
1096 // This is checking a friend on the home grid 1076 // This is checking a friend on the home grid
1097 // Not HG friend 1077 // Not HG friend
1098 if ( String.IsNullOrEmpty(serverURI)) 1078 if (String.IsNullOrEmpty(serverURI))
1099 { 1079 {
1100 message = "No Presence - foreign friend"; 1080 message = "No Presence - foreign friend";
1101 return false; 1081 return false;
1102 } 1082 }
1103 1083
1104 object Prop = (object)properties; 1084 object Prop = (object)properties;
1105 rpc.JsonRpcRequest(ref Prop, "avatar_properties_request", serverURI, UUID.Random().ToString()); 1085 if (!rpc.JsonRpcRequest(ref Prop, "avatar_properties_request", serverURI, UUID.Random().ToString()))
1086 {
1087 // If it's a foreign user then try again using OpenProfile, in case that's what the grid is using
1088 bool secondChanceSuccess = false;
1089 if (foreign)
1090 {
1091 try
1092 {
1093 OpenProfileClient client = new OpenProfileClient(serverURI);
1094 if (client.RequestAvatarPropertiesUsingOpenProfile(ref properties))
1095 secondChanceSuccess = true;
1096 }
1097 catch (Exception e)
1098 {
1099 m_log.Debug(string.Format("Request using the OpenProfile API to {0} failed", serverURI), e);
1100 // Allow the return 'message' to say "JsonRpcRequest" and not "OpenProfile", because
1101 // the most likely reason that OpenProfile failed is that the remote server
1102 // doesn't support OpenProfile, and that's not very interesting.
1103 }
1104 }
1105
1106 if (!secondChanceSuccess)
1107 {
1108 message = string.Format("JsonRpcRequest to {0} failed", serverURI);
1109 return false;
1110 }
1111 // else, continue below
1112 }
1113
1106 properties = (UserProfileProperties)Prop; 1114 properties = (UserProfileProperties)Prop;
1107 1115
1108 message = "Success"; 1116 message = "Success";
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
index a5520c4..d9fe5a0 100644
--- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
@@ -136,7 +136,7 @@ namespace OpenSim.Services.Connectors.Simulation
136 } 136 }
137 137
138 // Try the old version, uncompressed 138 // Try the old version, uncompressed
139 result = WebUtil.PostToService(uri, args, 30000); 139 result = WebUtil.PostToService(uri, args, 30000, false);
140 140
141 if (result["Success"].AsBoolean()) 141 if (result["Success"].AsBoolean())
142 { 142 {
@@ -302,7 +302,7 @@ namespace OpenSim.Services.Connectors.Simulation
302 302
303 try 303 try
304 { 304 {
305 OSDMap result = WebUtil.ServiceOSDRequest(uri, request, "QUERYACCESS", 30000, false); 305 OSDMap result = WebUtil.ServiceOSDRequest(uri, request, "QUERYACCESS", 30000, false, false);
306 bool success = result["success"].AsBoolean(); 306 bool success = result["success"].AsBoolean();
307 if (result.ContainsKey("_Result")) 307 if (result.ContainsKey("_Result"))
308 { 308 {
@@ -365,7 +365,7 @@ namespace OpenSim.Services.Connectors.Simulation
365 365
366 try 366 try
367 { 367 {
368 WebUtil.ServiceOSDRequest(uri, null, "DELETE", 10000, false); 368 WebUtil.ServiceOSDRequest(uri, null, "DELETE", 10000, false, false);
369 } 369 }
370 catch (Exception e) 370 catch (Exception e)
371 { 371 {
@@ -384,7 +384,7 @@ namespace OpenSim.Services.Connectors.Simulation
384 384
385 try 385 try
386 { 386 {
387 WebUtil.ServiceOSDRequest(uri, null, "DELETE", 10000, false); 387 WebUtil.ServiceOSDRequest(uri, null, "DELETE", 10000, false, false);
388 } 388 }
389 catch (Exception e) 389 catch (Exception e)
390 { 390 {
@@ -431,7 +431,7 @@ namespace OpenSim.Services.Connectors.Simulation
431 args["destination_name"] = OSD.FromString(destination.RegionName); 431 args["destination_name"] = OSD.FromString(destination.RegionName);
432 args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString()); 432 args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString());
433 433
434 OSDMap result = WebUtil.PostToService(uri, args, 40000); 434 OSDMap result = WebUtil.PostToService(uri, args, 40000, false);
435 435
436 if (result == null) 436 if (result == null)
437 return false; 437 return false;
diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs
index bf52660..c6d2ee3 100644
--- a/OpenSim/Services/GridService/HypergridLinker.cs
+++ b/OpenSim/Services/GridService/HypergridLinker.cs
@@ -68,10 +68,6 @@ namespace OpenSim.Services.GridService
68 protected string m_ThisGatekeeper = string.Empty; 68 protected string m_ThisGatekeeper = string.Empty;
69 protected Uri m_ThisGatekeeperURI = null; 69 protected Uri m_ThisGatekeeperURI = null;
70 70
71 // Hyperlink regions are hyperlinks on the map
72 public readonly Dictionary<UUID, GridRegion> m_HyperlinkRegions = new Dictionary<UUID, GridRegion>();
73 protected Dictionary<UUID, ulong> m_HyperlinkHandles = new Dictionary<UUID, ulong>();
74
75 protected GridRegion m_DefaultRegion; 71 protected GridRegion m_DefaultRegion;
76 protected GridRegion DefaultRegion 72 protected GridRegion DefaultRegion
77 { 73 {
diff --git a/OpenSim/Region/CoreModules/Avatar/UserProfiles/OpenProfileClient.cs b/OpenSim/Services/Interfaces/OpenProfileClient.cs
index 23de3f5..4126c35 100644
--- a/OpenSim/Region/CoreModules/Avatar/UserProfiles/OpenProfileClient.cs
+++ b/OpenSim/Services/Interfaces/OpenProfileClient.cs
@@ -35,11 +35,10 @@ using System.Reflection;
35using System.Text; 35using System.Text;
36using System.Xml; 36using System.Xml;
37using log4net; 37using log4net;
38using Nwc.XmlRpc;
39using OpenMetaverse; 38using OpenMetaverse;
40using OpenSim.Framework; 39using OpenSim.Framework;
41 40
42namespace OpenSim.Region.CoreModules.Avatar.UserProfiles 41namespace OpenSim.Services.UserProfilesService
43{ 42{
44 /// <summary> 43 /// <summary>
45 /// A client for accessing a profile server using the OpenProfile protocol. 44 /// A client for accessing a profile server using the OpenProfile protocol.
@@ -79,7 +78,12 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
79 Hashtable ReqHash = new Hashtable(); 78 Hashtable ReqHash = new Hashtable();
80 ReqHash["avatar_id"] = props.UserId.ToString(); 79 ReqHash["avatar_id"] = props.UserId.ToString();
81 80
82 Hashtable profileData = GenericXMLRPCRequest(ReqHash, "avatar_properties_request", m_serverURI); 81 Hashtable profileData = XMLRPCRequester.SendRequest(ReqHash, "avatar_properties_request", m_serverURI);
82
83 if (profileData == null)
84 return false;
85 if (!profileData.ContainsKey("data"))
86 return false;
83 87
84 ArrayList dataArray = (ArrayList)profileData["data"]; 88 ArrayList dataArray = (ArrayList)profileData["data"];
85 89
@@ -128,66 +132,5 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
128 132
129 return true; 133 return true;
130 } 134 }
131
132 private Hashtable GenericXMLRPCRequest(Hashtable ReqParams, string method, string server)
133 {
134 ArrayList SendParams = new ArrayList();
135 SendParams.Add(ReqParams);
136
137 XmlRpcResponse Resp;
138 try
139 {
140 XmlRpcRequest Req = new XmlRpcRequest(method, SendParams);
141 Resp = Req.Send(server, 30000);
142 }
143 catch (WebException ex)
144 {
145 m_log.ErrorFormat("[PROFILE]: Unable to connect to Profile " +
146 "Server {0}. Exception {1}", server, ex);
147
148 Hashtable ErrorHash = new Hashtable();
149 ErrorHash["success"] = false;
150 ErrorHash["errorMessage"] = "Unable to fetch profile data at this time. ";
151 ErrorHash["errorURI"] = "";
152
153 return ErrorHash;
154 }
155 catch (SocketException ex)
156 {
157 m_log.ErrorFormat(
158 "[PROFILE]: Unable to connect to Profile Server {0}. Method {1}, params {2}. " +
159 "Exception {3}", server, method, ReqParams, ex);
160
161 Hashtable ErrorHash = new Hashtable();
162 ErrorHash["success"] = false;
163 ErrorHash["errorMessage"] = "Unable to fetch profile data at this time. ";
164 ErrorHash["errorURI"] = "";
165
166 return ErrorHash;
167 }
168 catch (XmlException ex)
169 {
170 m_log.ErrorFormat(
171 "[PROFILE]: Unable to connect to Profile Server {0}. Method {1}, params {2}. " +
172 "Exception {3}", server, method, ReqParams.ToString(), ex);
173 Hashtable ErrorHash = new Hashtable();
174 ErrorHash["success"] = false;
175 ErrorHash["errorMessage"] = "Unable to fetch profile data at this time. ";
176 ErrorHash["errorURI"] = "";
177
178 return ErrorHash;
179 }
180 if (Resp.IsFault)
181 {
182 Hashtable ErrorHash = new Hashtable();
183 ErrorHash["success"] = false;
184 ErrorHash["errorMessage"] = "Unable to fetch profile data at this time. ";
185 ErrorHash["errorURI"] = "";
186 return ErrorHash;
187 }
188 Hashtable RespData = (Hashtable)Resp.Value;
189
190 return RespData;
191 }
192 } 135 }
193} 136}
diff --git a/prebuild.xml b/prebuild.xml
index 09c429a..9a419eb 100644
--- a/prebuild.xml
+++ b/prebuild.xml
@@ -93,6 +93,7 @@
93 <Reference name="System"/> 93 <Reference name="System"/>
94 <Reference name="System.Core"/> 94 <Reference name="System.Core"/>
95 <Reference name="System.Xml"/> 95 <Reference name="System.Xml"/>
96 <Reference name="System.Xml.Linq"/>
96 <Reference name="System.Data"/> 97 <Reference name="System.Data"/>
97 <Reference name="System.Drawing"/> 98 <Reference name="System.Drawing"/>
98 <Reference name="System.Web"/> 99 <Reference name="System.Web"/>
@@ -133,6 +134,7 @@
133 <Reference name="OpenSim.Framework"/> 134 <Reference name="OpenSim.Framework"/>
134 <Reference name="OpenSim.Framework.Console"/> 135 <Reference name="OpenSim.Framework.Console"/>
135 <Reference name="OpenSim.Framework.Servers.HttpServer"/> 136 <Reference name="OpenSim.Framework.Servers.HttpServer"/>
137 <Reference name="System.Xml"/>
136 <Reference name="Nini" path="../../../bin/"/> 138 <Reference name="Nini" path="../../../bin/"/>
137 <Reference name="log4net" path="../../../bin/"/> 139 <Reference name="log4net" path="../../../bin/"/>
138 140