aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/WebUtil.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/WebUtil.cs32
1 files changed, 30 insertions, 2 deletions
diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs
index 2aa4af5..8094b6d 100644
--- a/OpenSim/Framework/WebUtil.cs
+++ b/OpenSim/Framework/WebUtil.cs
@@ -223,6 +223,7 @@ namespace OpenSim.Framework
223 catch (Exception ex) 223 catch (Exception ex)
224 { 224 {
225 errorMessage = ex.Message; 225 errorMessage = ex.Message;
226 m_log.Debug("[WEB UTIL]: Exception making request: " + ex.ToString());
226 } 227 }
227 finally 228 finally
228 { 229 {
@@ -302,7 +303,7 @@ namespace OpenSim.Framework
302 /// </summary> 303 /// </summary>
303 public static OSDMap PostToService(string url, NameValueCollection data) 304 public static OSDMap PostToService(string url, NameValueCollection data)
304 { 305 {
305 return ServiceFormRequest(url,data,10000); 306 return ServiceFormRequest(url,data, 20000);
306 } 307 }
307 308
308 public static OSDMap ServiceFormRequest(string url, NameValueCollection data, int timeout) 309 public static OSDMap ServiceFormRequest(string url, NameValueCollection data, int timeout)
@@ -694,6 +695,13 @@ namespace OpenSim.Framework
694 public static void MakeRequest<TRequest, TResponse>(string verb, 695 public static void MakeRequest<TRequest, TResponse>(string verb,
695 string requestUrl, TRequest obj, Action<TResponse> action) 696 string requestUrl, TRequest obj, Action<TResponse> action)
696 { 697 {
698 MakeRequest<TRequest, TResponse>(verb, requestUrl, obj, action, 0);
699 }
700
701 public static void MakeRequest<TRequest, TResponse>(string verb,
702 string requestUrl, TRequest obj, Action<TResponse> action,
703 int maxConnections)
704 {
697 int reqnum = WebUtil.RequestNumber++; 705 int reqnum = WebUtil.RequestNumber++;
698 // m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method); 706 // m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method);
699 707
@@ -705,6 +713,10 @@ namespace OpenSim.Framework
705 Type type = typeof(TRequest); 713 Type type = typeof(TRequest);
706 714
707 WebRequest request = WebRequest.Create(requestUrl); 715 WebRequest request = WebRequest.Create(requestUrl);
716 HttpWebRequest ht = (HttpWebRequest)request;
717 if (maxConnections > 0 && ht.ServicePoint.ConnectionLimit < maxConnections)
718 ht.ServicePoint.ConnectionLimit = maxConnections;
719
708 WebResponse response = null; 720 WebResponse response = null;
709 TResponse deserial = default(TResponse); 721 TResponse deserial = default(TResponse);
710 XmlSerializer deserializer = new XmlSerializer(typeof(TResponse)); 722 XmlSerializer deserializer = new XmlSerializer(typeof(TResponse));
@@ -997,6 +1009,16 @@ namespace OpenSim.Framework
997 /// the request. You'll want to make sure you deal with this as they're not uncommon</exception> 1009 /// the request. You'll want to make sure you deal with this as they're not uncommon</exception>
998 public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj) 1010 public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj)
999 { 1011 {
1012 return MakeRequest<TRequest, TResponse>(verb, requestUrl, obj, 0);
1013 }
1014
1015 public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj, int pTimeout)
1016 {
1017 return MakeRequest<TRequest, TResponse>(verb, requestUrl, obj, pTimeout, 0);
1018 }
1019
1020 public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj, int pTimeout, int maxConnections)
1021 {
1000 int reqnum = WebUtil.RequestNumber++; 1022 int reqnum = WebUtil.RequestNumber++;
1001 // m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method); 1023 // m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method);
1002 1024
@@ -1007,7 +1029,13 @@ namespace OpenSim.Framework
1007 TResponse deserial = default(TResponse); 1029 TResponse deserial = default(TResponse);
1008 1030
1009 WebRequest request = WebRequest.Create(requestUrl); 1031 WebRequest request = WebRequest.Create(requestUrl);
1032 HttpWebRequest ht = (HttpWebRequest)request;
1033 if (maxConnections > 0 && ht.ServicePoint.ConnectionLimit < maxConnections)
1034 ht.ServicePoint.ConnectionLimit = maxConnections;
1035
1010 request.Method = verb; 1036 request.Method = verb;
1037 if (pTimeout != 0)
1038 request.Timeout = pTimeout * 1000;
1011 MemoryStream buffer = null; 1039 MemoryStream buffer = null;
1012 1040
1013 if ((verb == "POST") || (verb == "PUT")) 1041 if ((verb == "POST") || (verb == "PUT"))
@@ -1123,4 +1151,4 @@ namespace OpenSim.Framework
1123 return deserial; 1151 return deserial;
1124 } 1152 }
1125 } 1153 }
1126} \ No newline at end of file 1154}