aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/WebUtil.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/WebUtil.cs')
-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 1d9e2ce..a03d626 100644
--- a/OpenSim/Framework/WebUtil.cs
+++ b/OpenSim/Framework/WebUtil.cs
@@ -235,6 +235,7 @@ namespace OpenSim.Framework
235 catch (Exception ex) 235 catch (Exception ex)
236 { 236 {
237 errorMessage = ex.Message; 237 errorMessage = ex.Message;
238 m_log.Debug("[WEB UTIL]: Exception making request: " + ex.ToString());
238 } 239 }
239 finally 240 finally
240 { 241 {
@@ -318,7 +319,7 @@ namespace OpenSim.Framework
318 /// </summary> 319 /// </summary>
319 public static OSDMap PostToService(string url, NameValueCollection data) 320 public static OSDMap PostToService(string url, NameValueCollection data)
320 { 321 {
321 return ServiceFormRequest(url,data,10000); 322 return ServiceFormRequest(url,data, 20000);
322 } 323 }
323 324
324 public static OSDMap ServiceFormRequest(string url, NameValueCollection data, int timeout) 325 public static OSDMap ServiceFormRequest(string url, NameValueCollection data, int timeout)
@@ -717,6 +718,13 @@ namespace OpenSim.Framework
717 public static void MakeRequest<TRequest, TResponse>(string verb, 718 public static void MakeRequest<TRequest, TResponse>(string verb,
718 string requestUrl, TRequest obj, Action<TResponse> action) 719 string requestUrl, TRequest obj, Action<TResponse> action)
719 { 720 {
721 MakeRequest<TRequest, TResponse>(verb, requestUrl, obj, action, 0);
722 }
723
724 public static void MakeRequest<TRequest, TResponse>(string verb,
725 string requestUrl, TRequest obj, Action<TResponse> action,
726 int maxConnections)
727 {
720 int reqnum = WebUtil.RequestNumber++; 728 int reqnum = WebUtil.RequestNumber++;
721 729
722 if (WebUtil.DebugLevel >= 3) 730 if (WebUtil.DebugLevel >= 3)
@@ -730,6 +738,10 @@ namespace OpenSim.Framework
730 Type type = typeof(TRequest); 738 Type type = typeof(TRequest);
731 739
732 WebRequest request = WebRequest.Create(requestUrl); 740 WebRequest request = WebRequest.Create(requestUrl);
741 HttpWebRequest ht = (HttpWebRequest)request;
742 if (maxConnections > 0 && ht.ServicePoint.ConnectionLimit < maxConnections)
743 ht.ServicePoint.ConnectionLimit = maxConnections;
744
733 WebResponse response = null; 745 WebResponse response = null;
734 TResponse deserial = default(TResponse); 746 TResponse deserial = default(TResponse);
735 XmlSerializer deserializer = new XmlSerializer(typeof(TResponse)); 747 XmlSerializer deserializer = new XmlSerializer(typeof(TResponse));
@@ -1036,6 +1048,16 @@ namespace OpenSim.Framework
1036 /// the request. You'll want to make sure you deal with this as they're not uncommon</exception> 1048 /// the request. You'll want to make sure you deal with this as they're not uncommon</exception>
1037 public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj) 1049 public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj)
1038 { 1050 {
1051 return MakeRequest<TRequest, TResponse>(verb, requestUrl, obj, 0);
1052 }
1053
1054 public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj, int pTimeout)
1055 {
1056 return MakeRequest<TRequest, TResponse>(verb, requestUrl, obj, pTimeout, 0);
1057 }
1058
1059 public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj, int pTimeout, int maxConnections)
1060 {
1039 int reqnum = WebUtil.RequestNumber++; 1061 int reqnum = WebUtil.RequestNumber++;
1040 1062
1041 if (WebUtil.DebugLevel >= 3) 1063 if (WebUtil.DebugLevel >= 3)
@@ -1050,7 +1072,13 @@ namespace OpenSim.Framework
1050 TResponse deserial = default(TResponse); 1072 TResponse deserial = default(TResponse);
1051 1073
1052 WebRequest request = WebRequest.Create(requestUrl); 1074 WebRequest request = WebRequest.Create(requestUrl);
1075 HttpWebRequest ht = (HttpWebRequest)request;
1076 if (maxConnections > 0 && ht.ServicePoint.ConnectionLimit < maxConnections)
1077 ht.ServicePoint.ConnectionLimit = maxConnections;
1078
1053 request.Method = verb; 1079 request.Method = verb;
1080 if (pTimeout != 0)
1081 request.Timeout = pTimeout * 1000;
1054 MemoryStream buffer = null; 1082 MemoryStream buffer = null;
1055 1083
1056 if ((verb == "POST") || (verb == "PUT")) 1084 if ((verb == "POST") || (verb == "PUT"))
@@ -1172,4 +1200,4 @@ namespace OpenSim.Framework
1172 return deserial; 1200 return deserial;
1173 } 1201 }
1174 } 1202 }
1175} \ No newline at end of file 1203}