aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Communications
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Communications')
-rw-r--r--OpenSim/Framework/Communications/RestClient.cs48
1 files changed, 44 insertions, 4 deletions
diff --git a/OpenSim/Framework/Communications/RestClient.cs b/OpenSim/Framework/Communications/RestClient.cs
index 6f517b6..4403f40 100644
--- a/OpenSim/Framework/Communications/RestClient.cs
+++ b/OpenSim/Framework/Communications/RestClient.cs
@@ -389,9 +389,32 @@ namespace OpenSim.Framework.Communications
389 } 389 }
390 } 390 }
391 391
392 if (_response != null)
393 _response.Close();
394
392 return null; 395 return null;
393 } 396 }
394 397
398<<<<<<< HEAD
399=======
400 using (Stream src = _response.GetResponseStream())
401 {
402 int length = src.Read(_readbuf, 0, BufferSize);
403 while (length > 0)
404 {
405 _resource.Write(_readbuf, 0, length);
406 length = src.Read(_readbuf, 0, BufferSize);
407 }
408 }
409
410 // TODO! Implement timeout, without killing the server
411 // this line implements the timeout, if there is a timeout, the callback fires and the request becomes aborted
412 //ThreadPool.RegisterWaitForSingleObject(responseAsyncResult.AsyncWaitHandle, new WaitOrTimerCallback(TimeoutCallback), _request, DefaultTimeout, true);
413
414// _allDone.WaitOne();
415 if (_response != null)
416 _response.Close();
417>>>>>>> avn/ubitvar
395 if (_asyncException != null) 418 if (_asyncException != null)
396 throw _asyncException; 419 throw _asyncException;
397 420
@@ -413,7 +436,7 @@ namespace OpenSim.Framework.Communications
413 _request = (HttpWebRequest) WebRequest.Create(buildUri()); 436 _request = (HttpWebRequest) WebRequest.Create(buildUri());
414 _request.KeepAlive = false; 437 _request.KeepAlive = false;
415 _request.ContentType = "application/xml"; 438 _request.ContentType = "application/xml";
416 _request.Timeout = 900000; 439 _request.Timeout = 30000;
417 _request.Method = RequestMethod; 440 _request.Method = RequestMethod;
418 _asyncException = null; 441 _asyncException = null;
419 _request.ContentLength = src.Length; 442 _request.ContentLength = src.Length;
@@ -421,6 +444,7 @@ namespace OpenSim.Framework.Communications
421 auth.AddAuthorization(_request.Headers); 444 auth.AddAuthorization(_request.Headers);
422 445
423 src.Seek(0, SeekOrigin.Begin); 446 src.Seek(0, SeekOrigin.Begin);
447<<<<<<< HEAD
424 448
425 int reqnum = WebUtil.RequestNumber++; 449 int reqnum = WebUtil.RequestNumber++;
426 if (WebUtil.DebugLevel >= 3) 450 if (WebUtil.DebugLevel >= 3)
@@ -433,9 +457,22 @@ namespace OpenSim.Framework.Communications
433 byte[] buf = new byte[1024]; 457 byte[] buf = new byte[1024];
434 int length = src.Read(buf, 0, 1024); 458 int length = src.Read(buf, 0, 1024);
435 while (length > 0) 459 while (length > 0)
460=======
461 m_log.Info("[REST]: Seek is ok");
462
463 using (Stream dst = _request.GetRequestStream())
464>>>>>>> avn/ubitvar
436 { 465 {
437 dst.Write(buf, 0, length); 466 m_log.Info("[REST]: GetRequestStream is ok");
438 length = src.Read(buf, 0, 1024); 467
468 byte[] buf = new byte[1024];
469 int length = src.Read(buf, 0, 1024);
470 m_log.Info("[REST]: First Read is ok");
471 while (length > 0)
472 {
473 dst.Write(buf, 0, length);
474 length = src.Read(buf, 0, 1024);
475 }
439 } 476 }
440 477
441 try 478 try
@@ -470,6 +507,9 @@ namespace OpenSim.Framework.Communications
470 507
471 _response.Close(); 508 _response.Close();
472 509
510 if (_response != null)
511 _response.Close();
512
473// IAsyncResult responseAsyncResult = _request.BeginGetResponse(new AsyncCallback(ResponseIsReadyDelegate), _request); 513// IAsyncResult responseAsyncResult = _request.BeginGetResponse(new AsyncCallback(ResponseIsReadyDelegate), _request);
474 514
475 // TODO! Implement timeout, without killing the server 515 // TODO! Implement timeout, without killing the server
@@ -519,4 +559,4 @@ namespace OpenSim.Framework.Communications
519 559
520 #endregion Async Invocation 560 #endregion Async Invocation
521 } 561 }
522} \ No newline at end of file 562}