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.cs36
1 files changed, 21 insertions, 15 deletions
diff --git a/OpenSim/Framework/RestClient.cs b/OpenSim/Framework/RestClient.cs
index 7080ca5..4939cf7 100644
--- a/OpenSim/Framework/RestClient.cs
+++ b/OpenSim/Framework/RestClient.cs
@@ -156,7 +156,7 @@ namespace OpenSim.Framework
156 public void Dispose() 156 public void Dispose()
157 { 157 {
158 Dispose(true); 158 Dispose(true);
159 GC.SuppressFinalize(this); 159 GC.SuppressFinalize(this);
160 } 160 }
161 161
162 protected virtual void Dispose(bool disposing) 162 protected virtual void Dispose(bool disposing)
@@ -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,18 +428,23 @@ 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
432
433 byte[] buf = new byte[1024];
434 int length = src.Read(buf, 0, 1024);
435 while (length > 0)
436 {
437 dst.Write(buf, 0, length);
438 length = src.Read(buf, 0, 1024);
439 }
440
441 try 432 try
442 { 433 {
434 using (Stream dst = _request.GetRequestStream())
435 {
436// m_log.Debug("[REST]: GetRequestStream is ok");
437
438 byte[] buf = new byte[1024];
439 int length = src.Read(buf, 0, 1024);
440// m_log.Debug("[REST]: First Read is ok");
441 while (length > 0)
442 {
443 dst.Write(buf, 0, length);
444 length = src.Read(buf, 0, 1024);
445 }
446 }
447
443 _response = (HttpWebResponse)_request.GetResponse(); 448 _response = (HttpWebResponse)_request.GetResponse();
444 } 449 }
445 catch (WebException e) 450 catch (WebException e)
@@ -468,7 +473,8 @@ namespace OpenSim.Framework
468 } 473 }
469 } 474 }
470 475
471 _response.Close(); 476 if (_response != null)
477 _response.Close();
472 478
473// IAsyncResult responseAsyncResult = _request.BeginGetResponse(new AsyncCallback(ResponseIsReadyDelegate), _request); 479// IAsyncResult responseAsyncResult = _request.BeginGetResponse(new AsyncCallback(ResponseIsReadyDelegate), _request);
474 480
@@ -673,4 +679,4 @@ namespace OpenSim.Framework
673 } 679 }
674 } 680 }
675 681
676} \ No newline at end of file 682}