a few changes to lsl http headers

This commit is contained in:
UbitUmarov
2020-12-09 18:04:10 +00:00
parent 90ef92158a
commit 25c9e66906
3 changed files with 49 additions and 83 deletions

View File

@@ -52,48 +52,14 @@ using Amib.Threading;
* Implements the llHttpRequest and http_response
* callback.
*
* Some stuff was already in LSLLongCmdHandler, and then
* there was this file with a stub class in it. So,
* I am moving some of the objects and functions out of
* LSLLongCmdHandler, such as the HttpRequestClass, the
* start and stop methods, and setting up pending and
* completed queues. These are processed in the
* LSLLongCmdHandler polling loop. Similiar to the
* XMLRPCModule, since that seems to work.
*
* //TODO
*
* This probably needs some throttling mechanism but
* it's wide open right now. This applies to both
* number of requests and data volume.
*
* Linden puts all kinds of header fields in the requests.
* Not doing any of that:
* User-Agent
* X-SecondLife-Shard
* X-SecondLife-Object-Name
* X-SecondLife-Object-Key
* X-SecondLife-Region
* X-SecondLife-Local-Position
* X-SecondLife-Local-Velocity
* X-SecondLife-Local-Rotation
* X-SecondLife-Owner-Name
* X-SecondLife-Owner-Key
*
* HTTPS support
*
* Configurable timeout?
* Configurable max response size?
* Configurable
*
* **************************************************/
* **************************************************/
namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
{
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "HttpRequestModule")]
public class HttpRequestModule : ISharedRegionModule, IHttpRequestModule
{
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private readonly object m_httpListLock = new object();
private int m_httpTimeout = 30000;

View File

@@ -95,6 +95,9 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
protected IHttpServer m_HttpServer = null;
protected IHttpServer m_HttpsServer = null;
private string m_lsl_shard = "OpenSim";
private string m_lsl_user_agent = string.Empty;
public string ExternalHostNameForLSL { get; protected set; }
/// <summary>
@@ -124,6 +127,9 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
if (networkConfig != null)
{
m_lsl_shard = networkConfig.GetString("shard", m_lsl_shard);
m_lsl_user_agent = networkConfig.GetString("user_agent", m_lsl_user_agent);
ExternalHostNameForLSL = config.Configs["Network"].GetString("ExternalHostNameForLSL", null);
bool ssl_enabled = config.Configs["Network"].GetBoolean("https_listener", false);
@@ -656,7 +662,8 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
Vector3 velocity = sop.Velocity;
Quaternion rotation = sop.GetWorldRotation();
//headers["X-SecondLife-Shard"] = shard;
if (!string.IsNullOrWhiteSpace(m_lsl_shard))
headers["X-SecondLife-Shard"] = m_lsl_shard;
headers["X-SecondLife-Object-Name"] = sop.Name;
headers["X-SecondLife-Object-Key"] = sop.UUID.ToString();
headers["X-SecondLife-Region"] = string.Format("{0} ({1}, {2})", ri.RegionName, ri.WorldLocX, ri.WorldLocY);
@@ -665,9 +672,8 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
headers["X-SecondLife-Local-Rotation"] = string.Format("({0:0.000000}, {1:0.000000}, {2:0.000000}, {3:0.000000})", rotation.X, rotation.Y, rotation.Z, rotation.W);
//headers["X-SecondLife-Owner-Name"] = ownerName;
headers["X-SecondLife-Owner-Key"] = sop.OwnerID.ToString();
//string userAgent = config.Configs["Network"].GetString("user_agent", null);
//if (userAgent != null)
// httpHeaders["User-Agent"] = userAgent;
if (!string.IsNullOrWhiteSpace(m_lsl_user_agent))
headers["User-Agent"] = m_lsl_user_agent;
}
}
if(url.isSsl)