allow setting of MaxResponseContentBufferSize per instance ofglobal httpclient; limit it to 1MB on webrtc

This commit is contained in:
UbitUmarov
2026-03-18 23:11:29 +00:00
parent ea7eb715a2
commit 82c32eac18
4 changed files with 24 additions and 28 deletions

View File

@@ -244,23 +244,23 @@ namespace OpenSim.Framework
SharedSocketsHttpHandler = shh;
}
public static HttpClient GetNewGlobalHttpClient(int timeout)
public static HttpClient GetNewGlobalHttpClient(int timeout, int maxBufferSize = 250 * 1024 * 1024)
{
var client = new HttpClient(SharedSocketsHttpHandler, false)
{
Timeout = TimeSpan.FromMilliseconds(timeout > 0 ? timeout : 30000),
MaxResponseContentBufferSize = 250 * 1024 * 1024,
MaxResponseContentBufferSize = maxBufferSize,
};
client.DefaultRequestHeaders.ExpectContinue = false;
return client;
}
public static HttpClient GetGlobalNoRedirHttpClient(int timeout)
public static HttpClient GetGlobalNoRedirHttpClient(int timeout, int maxBufferSize = 250 * 1024 * 1024)
{
var client = new HttpClient(SharedSocketsHttpHandlerNoRedir, false)
{
Timeout = TimeSpan.FromMilliseconds(timeout > 0 ? timeout : 30000),
MaxResponseContentBufferSize = 250 * 1024 * 1024,
MaxResponseContentBufferSize = maxBufferSize,
};
client.DefaultRequestHeaders.ExpectContinue = false;
return client;