|
@@ -212,6 +212,7 @@ namespace OpenSim.Framework
|
|
request.MaximumAutomaticRedirections = 10;
|
|
request.MaximumAutomaticRedirections = 10;
|
|
request.ReadWriteTimeout = timeout / 2;
|
|
request.ReadWriteTimeout = timeout / 2;
|
|
request.Headers[OSHeaderRequestID] = reqnum.ToString();
|
|
request.Headers[OSHeaderRequestID] = reqnum.ToString();
|
|
|
|
+ request.AllowWriteStreamBuffering = false;
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
catch (Exception ex)
|
|
{
|
|
{
|
|
@@ -258,7 +259,7 @@ namespace OpenSim.Framework
|
|
buffer = null;
|
|
buffer = null;
|
|
}
|
|
}
|
|
|
|
|
|
- using (WebResponse response = request.GetResponse())
|
|
|
|
|
|
+ using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
|
|
{
|
|
{
|
|
using (StreamReader reader = new StreamReader(response.GetResponseStream()))
|
|
using (StreamReader reader = new StreamReader(response.GetResponseStream()))
|
|
{
|
|
{
|
|
@@ -381,13 +382,14 @@ namespace OpenSim.Framework
|
|
HttpWebRequest request = null;
|
|
HttpWebRequest request = null;
|
|
try
|
|
try
|
|
{
|
|
{
|
|
- request = (HttpWebRequest)HttpWebRequest.Create(url);
|
|
|
|
|
|
+ request = (HttpWebRequest)WebRequest.Create(url);
|
|
request.Method = "POST";
|
|
request.Method = "POST";
|
|
request.Timeout = timeout;
|
|
request.Timeout = timeout;
|
|
request.KeepAlive = false;
|
|
request.KeepAlive = false;
|
|
request.MaximumAutomaticRedirections = 10;
|
|
request.MaximumAutomaticRedirections = 10;
|
|
request.ReadWriteTimeout = timeout / 2;
|
|
request.ReadWriteTimeout = timeout / 2;
|
|
request.Headers[OSHeaderRequestID] = reqnum.ToString();
|
|
request.Headers[OSHeaderRequestID] = reqnum.ToString();
|
|
|
|
+ request.AllowWriteStreamBuffering = false;
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
catch (Exception ex)
|
|
{
|
|
{
|
|
@@ -414,14 +416,14 @@ namespace OpenSim.Framework
|
|
buffer = null;
|
|
buffer = null;
|
|
}
|
|
}
|
|
|
|
|
|
- using (WebResponse response = request.GetResponse())
|
|
|
|
|
|
+ using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
|
|
{
|
|
{
|
|
using (StreamReader reader = new StreamReader(response.GetResponseStream()))
|
|
using (StreamReader reader = new StreamReader(response.GetResponseStream()))
|
|
{
|
|
{
|
|
string responseStr = reader.ReadToEnd();
|
|
string responseStr = reader.ReadToEnd();
|
|
rcvlen = responseStr.Length;
|
|
rcvlen = responseStr.Length;
|
|
- if (WebUtil.DebugLevel >= 5)
|
|
|
|
- WebUtil.LogResponseDetail(reqnum, responseStr);
|
|
|
|
|
|
+ if (DebugLevel >= 5)
|
|
|
|
+ LogResponseDetail(reqnum, responseStr);
|
|
OSD responseOSD = OSDParser.Deserialize(responseStr);
|
|
OSD responseOSD = OSDParser.Deserialize(responseStr);
|
|
|
|
|
|
if (responseOSD.Type == OSDType.Map)
|
|
if (responseOSD.Type == OSDType.Map)
|
|
@@ -784,6 +786,8 @@ namespace OpenSim.Framework
|
|
if (auth != null)
|
|
if (auth != null)
|
|
auth.AddAuthorization(request.Headers);
|
|
auth.AddAuthorization(request.Headers);
|
|
|
|
|
|
|
|
+ request.AllowWriteStreamBuffering = false;
|
|
|
|
+
|
|
if (maxConnections > 0 && request.ServicePoint.ConnectionLimit < maxConnections)
|
|
if (maxConnections > 0 && request.ServicePoint.ConnectionLimit < maxConnections)
|
|
request.ServicePoint.ConnectionLimit = maxConnections;
|
|
request.ServicePoint.ConnectionLimit = maxConnections;
|
|
|
|
|
|
@@ -976,13 +980,14 @@ namespace OpenSim.Framework
|
|
{
|
|
{
|
|
request = (HttpWebRequest)WebRequest.Create(requestUrl);
|
|
request = (HttpWebRequest)WebRequest.Create(requestUrl);
|
|
request.Method = verb;
|
|
request.Method = verb;
|
|
- request.AllowWriteStreamBuffering = false;
|
|
|
|
if (timeoutsecs > 0)
|
|
if (timeoutsecs > 0)
|
|
request.Timeout = timeoutsecs * 1000;
|
|
request.Timeout = timeoutsecs * 1000;
|
|
if(!keepalive)
|
|
if(!keepalive)
|
|
request.KeepAlive = false;
|
|
request.KeepAlive = false;
|
|
if (auth != null)
|
|
if (auth != null)
|
|
auth.AddAuthorization(request.Headers);
|
|
auth.AddAuthorization(request.Headers);
|
|
|
|
+
|
|
|
|
+ request.AllowWriteStreamBuffering = false;
|
|
request.ContentType = "application/x-www-form-urlencoded";
|
|
request.ContentType = "application/x-www-form-urlencoded";
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
catch (Exception e)
|
|
@@ -1079,6 +1084,8 @@ namespace OpenSim.Framework
|
|
request.KeepAlive = false;
|
|
request.KeepAlive = false;
|
|
if (auth != null)
|
|
if (auth != null)
|
|
auth.AddAuthorization(request.Headers);
|
|
auth.AddAuthorization(request.Headers);
|
|
|
|
+
|
|
|
|
+ request.AllowWriteStreamBuffering = false;
|
|
request.ContentType = "application/x-www-form-urlencoded";
|
|
request.ContentType = "application/x-www-form-urlencoded";
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
catch (Exception e)
|
|
@@ -1225,7 +1232,7 @@ namespace OpenSim.Framework
|
|
int reqnum = WebUtil.RequestNumber++;
|
|
int reqnum = WebUtil.RequestNumber++;
|
|
|
|
|
|
if (WebUtil.DebugLevel >= 3)
|
|
if (WebUtil.DebugLevel >= 3)
|
|
- m_log.DebugFormat("[LOGHTTP]: HTTP OUT {0} SynchronousRestObject {1} to {2}",
|
|
|
|
|
|
+ m_log.DebugFormat("[LOGHTTP]: HTTP OUT {0} SRestObjectRequest {1} {2}",
|
|
reqnum, verb, requestUrl);
|
|
reqnum, verb, requestUrl);
|
|
|
|
|
|
int tickstart = Util.EnvironmentTickCount();
|
|
int tickstart = Util.EnvironmentTickCount();
|
|
@@ -1240,24 +1247,21 @@ namespace OpenSim.Framework
|
|
if (auth != null)
|
|
if (auth != null)
|
|
auth.AddAuthorization(request.Headers);
|
|
auth.AddAuthorization(request.Headers);
|
|
|
|
|
|
|
|
+ request.AllowWriteStreamBuffering = false;
|
|
|
|
+
|
|
if (pTimeout != 0)
|
|
if (pTimeout != 0)
|
|
request.Timeout = pTimeout;
|
|
request.Timeout = pTimeout;
|
|
|
|
|
|
- if (maxConnections > 0 && request.ServicePoint.ConnectionLimit < maxConnections)
|
|
|
|
- request.ServicePoint.ConnectionLimit = maxConnections;
|
|
|
|
|
|
|
|
- request.AllowWriteStreamBuffering = false;
|
|
|
|
request.Method = verb;
|
|
request.Method = verb;
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
catch (Exception e)
|
|
{
|
|
{
|
|
- m_log.DebugFormat("[SynchronousRestObjectRequester]: Exception in creating request {0} {1}: {2}{3}",
|
|
|
|
|
|
+ m_log.DebugFormat("[SRestObjectRequest]: Exception in creating request {0} {1}: {2}{3}",
|
|
verb, requestUrl, e.Message, e.StackTrace);
|
|
verb, requestUrl, e.Message, e.StackTrace);
|
|
return deserial;
|
|
return deserial;
|
|
}
|
|
}
|
|
|
|
|
|
- int sendlen = 0;
|
|
|
|
-
|
|
|
|
try
|
|
try
|
|
{
|
|
{
|
|
if ((verb == "POST") || (verb == "PUT"))
|
|
if ((verb == "POST") || (verb == "PUT"))
|
|
@@ -1275,7 +1279,7 @@ namespace OpenSim.Framework
|
|
data = ms.ToArray();
|
|
data = ms.ToArray();
|
|
}
|
|
}
|
|
|
|
|
|
- sendlen = data.Length;
|
|
|
|
|
|
+ int sendlen = data.Length;
|
|
request.ContentLength = sendlen;
|
|
request.ContentLength = sendlen;
|
|
|
|
|
|
if (WebUtil.DebugLevel >= 5)
|
|
if (WebUtil.DebugLevel >= 5)
|
|
@@ -1289,7 +1293,7 @@ namespace OpenSim.Framework
|
|
catch (Exception e)
|
|
catch (Exception e)
|
|
{
|
|
{
|
|
m_log.DebugFormat(
|
|
m_log.DebugFormat(
|
|
- "[SynchronousRestObjectRequester]: Exception in making request {0} {1}: {2}{3}",
|
|
|
|
|
|
+ "[SRestObjectRequest]: Exception in making request {0} {1}: {2}{3}",
|
|
verb, requestUrl, e.Message, e.StackTrace);
|
|
verb, requestUrl, e.Message, e.StackTrace);
|
|
|
|
|
|
return deserial;
|
|
return deserial;
|
|
@@ -1312,7 +1316,7 @@ namespace OpenSim.Framework
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
- m_log.DebugFormat("[SynchronousRestObjectRequester]: Oops! no content found in response stream from {0} {1}",
|
|
|
|
|
|
+ m_log.DebugFormat("[SRestObjectRequest]: Oops! no content found in response stream from {0} {1}",
|
|
verb, requestUrl);
|
|
verb, requestUrl);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1325,38 +1329,38 @@ namespace OpenSim.Framework
|
|
{
|
|
{
|
|
if (hwr.StatusCode == HttpStatusCode.Unauthorized)
|
|
if (hwr.StatusCode == HttpStatusCode.Unauthorized)
|
|
{
|
|
{
|
|
- m_log.ErrorFormat("[SynchronousRestObjectRequester]: Web request {0} requires authentication",
|
|
|
|
|
|
+ m_log.ErrorFormat("[SRestObjectRequest]: {0} requires authentication",
|
|
requestUrl);
|
|
requestUrl);
|
|
}
|
|
}
|
|
else if(hwr.StatusCode != HttpStatusCode.NotFound)
|
|
else if(hwr.StatusCode != HttpStatusCode.NotFound)
|
|
{
|
|
{
|
|
- m_log.WarnFormat("[SynchronousRestObjectRequester]: Web request {0} returned error: {1}",
|
|
|
|
|
|
+ m_log.WarnFormat("[SRestObjectRequest]: {0} returned error: {1}",
|
|
requestUrl, hwr.StatusCode);
|
|
requestUrl, hwr.StatusCode);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else
|
|
else
|
|
m_log.ErrorFormat(
|
|
m_log.ErrorFormat(
|
|
- "[SynchronousRestObjectRequester]: WebException for {0} {1} {2} {3}",
|
|
|
|
|
|
+ "[SRestObjectRequest]: WebException for {0} {1} {2} {3}",
|
|
verb, requestUrl, typeof(TResponse).ToString(), e.Message);
|
|
verb, requestUrl, typeof(TResponse).ToString(), e.Message);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
catch (System.InvalidOperationException)
|
|
catch (System.InvalidOperationException)
|
|
{
|
|
{
|
|
// This is what happens when there is invalid XML
|
|
// This is what happens when there is invalid XML
|
|
- m_log.DebugFormat("[SynchronousRestObjectRequester]: Invalid XML from {0} {1} {2}",
|
|
|
|
|
|
+ m_log.DebugFormat("[SRestObjectRequest]: Invalid XML from {0} {1} {2}",
|
|
verb, requestUrl, typeof(TResponse).ToString());
|
|
verb, requestUrl, typeof(TResponse).ToString());
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
catch (Exception e)
|
|
{
|
|
{
|
|
- m_log.DebugFormat("[SynchronousRestObjectRequester]: Exception on response from {0} {1}: {2}",
|
|
|
|
|
|
+ m_log.DebugFormat("[SRestObjectRequest]: Exception on response from {0} {1}: {2}",
|
|
verb, requestUrl, e.Message);
|
|
verb, requestUrl, e.Message);
|
|
}
|
|
}
|
|
|
|
|
|
int tickdiff = Util.EnvironmentTickCountSubtract(tickstart);
|
|
int tickdiff = Util.EnvironmentTickCountSubtract(tickstart);
|
|
if (tickdiff > WebUtil.LongCallTime)
|
|
if (tickdiff > WebUtil.LongCallTime)
|
|
{
|
|
{
|
|
- m_log.InfoFormat("[LOGHTTP]: Slow SynchronousRestObject request {0} {1} to {2} took {3}ms, {4}/{5}bytes",
|
|
|
|
- reqnum, verb, requestUrl, tickdiff, sendlen, rcvlen);
|
|
|
|
|
|
+ m_log.InfoFormat("[LOGHTTP]: Slow SRestObjectRequest {0} {1} {2} took {3}ms, {4}bytes",
|
|
|
|
+ reqnum, verb, requestUrl, tickdiff, rcvlen);
|
|
}
|
|
}
|
|
else if (WebUtil.DebugLevel >= 4)
|
|
else if (WebUtil.DebugLevel >= 4)
|
|
{
|
|
{
|