From d3f314b29289f440d5078c78dcd29056bcad4948 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 5 Mar 2026 03:46:28 +0000 Subject: [PATCH] httpclient stream timout ignored under xml deserialize, so waste memory and time getting it all into mem first --- OpenSim/Framework/WebUtil.cs | 10 ++++------ bin/OpenSim.ini.example | 4 ++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index 6ed8a04fc9..0d4f3cc459 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -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( 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( reqnum, respStream, contentLength); } diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 60c6ba1112..bdec825fbf 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -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]