aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/RestClient.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/RestClient.cs')
-rw-r--r--OpenSim/Framework/RestClient.cs27
1 files changed, 16 insertions, 11 deletions
diff --git a/OpenSim/Framework/RestClient.cs b/OpenSim/Framework/RestClient.cs
index 7080ca5..ca19392 100644
--- a/OpenSim/Framework/RestClient.cs
+++ b/OpenSim/Framework/RestClient.cs
@@ -388,10 +388,10 @@ namespace OpenSim.Framework
388 m_log.Error(string.Format("[REST CLIENT] Error fetching resource from server: {0} ", _request.Address.ToString()), e); 388 m_log.Error(string.Format("[REST CLIENT] Error fetching resource from server: {0} ", _request.Address.ToString()), e);
389 } 389 }
390 } 390 }
391
392 return null; 391 return null;
393 } 392 }
394 393
394
395 if (_asyncException != null) 395 if (_asyncException != null)
396 throw _asyncException; 396 throw _asyncException;
397 397
@@ -413,7 +413,7 @@ namespace OpenSim.Framework
413 _request = (HttpWebRequest) WebRequest.Create(buildUri()); 413 _request = (HttpWebRequest) WebRequest.Create(buildUri());
414 _request.KeepAlive = false; 414 _request.KeepAlive = false;
415 _request.ContentType = "application/xml"; 415 _request.ContentType = "application/xml";
416 _request.Timeout = 900000; 416 _request.Timeout = 90000;
417 _request.Method = RequestMethod; 417 _request.Method = RequestMethod;
418 _asyncException = null; 418 _asyncException = null;
419 _request.ContentLength = src.Length; 419 _request.ContentLength = src.Length;
@@ -428,14 +428,18 @@ namespace OpenSim.Framework
428 if (WebUtil.DebugLevel >= 5) 428 if (WebUtil.DebugLevel >= 5)
429 WebUtil.LogOutgoingDetail(string.Format("SEND {0}: ", reqnum), src); 429 WebUtil.LogOutgoingDetail(string.Format("SEND {0}: ", reqnum), src);
430 430
431 Stream dst = _request.GetRequestStream(); 431 using (Stream dst = _request.GetRequestStream())
432
433 byte[] buf = new byte[1024];
434 int length = src.Read(buf, 0, 1024);
435 while (length > 0)
436 { 432 {
437 dst.Write(buf, 0, length); 433 m_log.Info("[REST]: GetRequestStream is ok");
438 length = src.Read(buf, 0, 1024); 434
435 byte[] buf = new byte[1024];
436 int length = src.Read(buf, 0, 1024);
437 m_log.Info("[REST]: First Read is ok");
438 while (length > 0)
439 {
440 dst.Write(buf, 0, length);
441 length = src.Read(buf, 0, 1024);
442 }
439 } 443 }
440 444
441 try 445 try
@@ -468,7 +472,8 @@ namespace OpenSim.Framework
468 } 472 }
469 } 473 }
470 474
471 _response.Close(); 475 if (_response != null)
476 _response.Close();
472 477
473// IAsyncResult responseAsyncResult = _request.BeginGetResponse(new AsyncCallback(ResponseIsReadyDelegate), _request); 478// IAsyncResult responseAsyncResult = _request.BeginGetResponse(new AsyncCallback(ResponseIsReadyDelegate), _request);
474 479
@@ -673,4 +678,4 @@ namespace OpenSim.Framework
673 } 678 }
674 } 679 }
675 680
676} \ No newline at end of file 681}