diff options
author | onefang | 2019-05-19 21:24:15 +1000 |
---|---|---|
committer | onefang | 2019-05-19 21:24:15 +1000 |
commit | 5e4d6cab00cb29cd088ab7b62ab13aff103b64cb (patch) | |
tree | a9fbc62df9eb2d1d9ba2698d8552eae71eca20d8 /OpenSim/Framework/RestClient.cs | |
parent | Add a build script. (diff) | |
download | opensim-SC-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.zip opensim-SC-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.gz opensim-SC-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.bz2 opensim-SC-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.xz |
Dump OpenSim 0.9.0.1 into it's own branch.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/RestClient.cs | 36 |
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 | } |