diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs | 2 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs | 19 |
2 files changed, 18 insertions, 3 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs index 41ece86..d5646d0 100644 --- a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs +++ b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs | |||
@@ -83,7 +83,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
83 | } | 83 | } |
84 | catch (Exception e) | 84 | catch (Exception e) |
85 | { | 85 | { |
86 | m_log.DebugFormat("[FORMS]: exception occured on sending request to {0}: " + e.ToString(), requestUrl); | 86 | m_log.DebugFormat("[FORMS]: exception occured on sending request to {0}: with {1} " + e.ToString(), requestUrl,obj); |
87 | } | 87 | } |
88 | finally | 88 | finally |
89 | { | 89 | { |
diff --git a/OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs b/OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs index eab463c..077a1e8 100644 --- a/OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs +++ b/OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs | |||
@@ -57,11 +57,27 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
57 | /// the request. You'll want to make sure you deal with this as they're not uncommon</exception> | 57 | /// the request. You'll want to make sure you deal with this as they're not uncommon</exception> |
58 | public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj) | 58 | public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj) |
59 | { | 59 | { |
60 | return MakeRequest<TRequest, TResponse>(verb, requestUrl, obj, 100); | ||
61 | } | ||
62 | /// <summary> | ||
63 | /// Perform a synchronous REST request. | ||
64 | /// </summary> | ||
65 | /// <param name="verb"></param> | ||
66 | /// <param name="requestUrl"></param> | ||
67 | /// <param name="obj"> </param> | ||
68 | /// <param name="timeout"> </param> | ||
69 | /// <returns></returns> | ||
70 | /// | ||
71 | /// <exception cref="System.Net.WebException">Thrown if we encounter a network issue while posting | ||
72 | /// the request. You'll want to make sure you deal with this as they're not uncommon</exception> | ||
73 | public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj, int pTimeout) | ||
74 | { | ||
60 | Type type = typeof (TRequest); | 75 | Type type = typeof (TRequest); |
61 | TResponse deserial = default(TResponse); | 76 | TResponse deserial = default(TResponse); |
62 | 77 | ||
63 | WebRequest request = WebRequest.Create(requestUrl); | 78 | WebRequest request = WebRequest.Create(requestUrl); |
64 | request.Method = verb; | 79 | request.Method = verb; |
80 | request.Timeout = pTimeout * 1000; | ||
65 | 81 | ||
66 | if ((verb == "POST") || (verb == "PUT")) | 82 | if ((verb == "POST") || (verb == "PUT")) |
67 | { | 83 | { |
@@ -81,7 +97,6 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
81 | 97 | ||
82 | int length = (int) buffer.Length; | 98 | int length = (int) buffer.Length; |
83 | request.ContentLength = length; | 99 | request.ContentLength = length; |
84 | |||
85 | Stream requestStream = null; | 100 | Stream requestStream = null; |
86 | try | 101 | try |
87 | { | 102 | { |
@@ -103,7 +118,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
103 | { | 118 | { |
104 | using (WebResponse resp = request.GetResponse()) | 119 | using (WebResponse resp = request.GetResponse()) |
105 | { | 120 | { |
106 | if (resp.ContentLength > 0) | 121 | if (resp.ContentLength != 0) |
107 | { | 122 | { |
108 | Stream respStream = resp.GetResponseStream(); | 123 | Stream respStream = resp.GetResponseStream(); |
109 | XmlSerializer deserializer = new XmlSerializer(typeof(TResponse)); | 124 | XmlSerializer deserializer = new XmlSerializer(typeof(TResponse)); |