httpclient stream timout ignored under xml deserialize, so waste memory and time getting it all into mem first

This commit is contained in:
UbitUmarov
2026-03-05 03:46:28 +00:00
parent 18f652ee8d
commit d3f314b292
2 changed files with 6 additions and 8 deletions

View File

@@ -1424,15 +1424,14 @@ namespace OpenSim.Framework
request.Content.Headers.TryAddWithoutValidation("Content-Length", sendlen.ToString());
}
responseMessage = client.Send(request, HttpCompletionOption.ResponseHeadersRead);
responseMessage = client.Send(request, HttpCompletionOption.ResponseContentRead);
responseMessage.EnsureSuccessStatusCode();
int rcvlen = 0;
if ((responseMessage.Content.Headers.ContentLength is long contentLength) && contentLength != 0)
{
rcvlen = (int)contentLength;
using CancellationTokenSource cts = new(30000);
using Stream respStream = responseMessage.Content.ReadAsStream(cts.Token);
using Stream respStream = responseMessage.Content.ReadAsStream();
deserial = XMLResponseHelper.LogAndDeserialize<TResponse>(
reqnum, respStream, contentLength);
}
@@ -1519,15 +1518,14 @@ namespace OpenSim.Framework
//else
// request.Headers.TryAddWithoutValidation("Connection", "close");
responseMessage = client.Send(request, HttpCompletionOption.ResponseHeadersRead);
responseMessage = client.Send(request, HttpCompletionOption.ResponseContentRead);
responseMessage.EnsureSuccessStatusCode();
int rcvlen = 0;
if ((responseMessage.Content.Headers.ContentLength is long contentLength) && contentLength != 0)
{
rcvlen = (int)contentLength;
using CancellationTokenSource cts = new(30000);
using Stream respStream = responseMessage.Content.ReadAsStream(cts.Token);
using Stream respStream = responseMessage.Content.ReadAsStream();
deserial = XMLResponseHelper.LogAndDeserialize<TResponse>(
reqnum, respStream, contentLength);
}

View File

@@ -364,10 +364,10 @@
;; you can also bypass the hostname or domain verification
;# {NoVerifyCertHostname} {} {do not verify SSL Cert name versus peer name} {true false} true
; NoVerifyCertHostname = true
;; having both options true does provide encryption but with low security
;; having both options true does provide encryption but with lower security
;; set both true if you don't care to use SSL, they are needed to contact regions or grids that do use it.
;; list of stun servers, for now to tell viewers for webrtc support
;; comma separated list of stun servers (in host:port format), for webrtc support, possible other uses in future
StunServers = stun.l.google.com:19302, stun.cloudflare.com:3478
[AccessControl]