Mantis#1739. Thank you kindly, Grumly57 for a patch that:
Implements X-SecondLife-* HTTP Headers for llHTTPRequest0.6.0-stable
parent
4476d484c3
commit
00791594ad
|
@ -34,7 +34,7 @@ namespace OpenSim.Region.Environment.Interfaces
|
|||
public interface IHttpRequests
|
||||
{
|
||||
LLUUID MakeHttpRequest(string url, string parameters, string body);
|
||||
LLUUID StartHttpRequest(uint localID, LLUUID itemID, string url, List<string> parameters, string body);
|
||||
LLUUID StartHttpRequest(uint localID, LLUUID itemID, string url, List<string> parameters, Dictionary<string, string> headers, string body);
|
||||
void StopHttpRequest(uint m_localID, LLUUID m_itemID);
|
||||
HttpRequestClass GetNextCompletedRequest();
|
||||
void RemoveCompletedRequest(LLUUID id);
|
||||
|
|
|
@ -37,6 +37,7 @@ using OpenSim.Framework;
|
|||
using OpenSim.Framework.Servers;
|
||||
using OpenSim.Region.Environment.Interfaces;
|
||||
using OpenSim.Region.Environment.Scenes;
|
||||
using System.Collections;
|
||||
|
||||
/*****************************************************
|
||||
*
|
||||
|
@ -105,7 +106,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.HttpRequest
|
|||
return LLUUID.Zero;
|
||||
}
|
||||
|
||||
public LLUUID StartHttpRequest(uint localID, LLUUID itemID, string url, List<string> parameters, string body)
|
||||
public LLUUID StartHttpRequest(uint localID, LLUUID itemID, string url, List<string> parameters, Dictionary<string, string> headers, string body)
|
||||
{
|
||||
LLUUID reqID = LLUUID.Random();
|
||||
HttpRequestClass htc = new HttpRequestClass();
|
||||
|
@ -150,6 +151,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.HttpRequest
|
|||
htc.reqID = reqID;
|
||||
htc.httpTimeout = httpTimeout;
|
||||
htc.outbound_body = body;
|
||||
htc.response_headers = headers;
|
||||
|
||||
lock (HttpListLock)
|
||||
{
|
||||
|
@ -280,6 +282,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.HttpRequest
|
|||
public HttpWebRequest request;
|
||||
public string response_body;
|
||||
public List<string> response_metadata;
|
||||
public Dictionary<string, string> response_headers;
|
||||
public int status;
|
||||
public string url;
|
||||
|
||||
|
@ -314,6 +317,9 @@ namespace OpenSim.Region.Environment.Modules.Scripting.HttpRequest
|
|||
request.Method = httpMethod;
|
||||
request.ContentType = httpMIMEType;
|
||||
|
||||
foreach (KeyValuePair<string, string> entry in response_headers)
|
||||
request.Headers[entry.Key] = entry.Value;
|
||||
|
||||
// Encode outbound data
|
||||
if (outbound_body.Length > 0) {
|
||||
byte[] data = Encoding.UTF8.GetBytes(outbound_body);
|
||||
|
|
|
@ -6868,8 +6868,24 @@ namespace OpenSim.Region.ScriptEngine.Common
|
|||
{
|
||||
param.Add(o.ToString());
|
||||
}
|
||||
|
||||
Dictionary<string, string> httpHeaders = new Dictionary<string, string>();
|
||||
|
||||
httpHeaders["X-SecondLife-Shard"] = "OpenSim";
|
||||
httpHeaders["X-SecondLife-Object-Name"] = m_host.Name;
|
||||
httpHeaders["X-SecondLife-Object-Key"] = m_itemID.ToString();
|
||||
httpHeaders["X-SecondLife-Region"] = World.RegionInfo.RegionName;
|
||||
httpHeaders["X-SecondLife-Local-Position"] = m_host.AbsolutePosition.ToString();
|
||||
httpHeaders["X-SecondLife-Local-Velocity"] = m_host.Velocity.ToString();
|
||||
httpHeaders["X-SecondLife-Local-Rotation"] = m_host.RotationOffset.ToString();
|
||||
|
||||
ScenePresence scenePresence = World.GetScenePresence(m_host.ObjectOwner);
|
||||
httpHeaders["X-SecondLife-Owner-Name"] = scenePresence == null ? string.Empty : scenePresence.Name;
|
||||
|
||||
httpHeaders["X-SecondLife-Owner-Key"] = m_host.ObjectOwner.ToString();
|
||||
|
||||
LLUUID reqID = httpScriptMod.
|
||||
StartHttpRequest(m_localID, m_itemID, url, param, body);
|
||||
StartHttpRequest(m_localID, m_itemID, url, param, httpHeaders, body);
|
||||
|
||||
if (reqID != LLUUID.Zero)
|
||||
return reqID.ToString();
|
||||
|
|
|
@ -6648,8 +6648,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
{
|
||||
param.Add(o.ToString());
|
||||
}
|
||||
|
||||
Dictionary<string, string> httpHeaders = new Dictionary<string, string>();
|
||||
|
||||
httpHeaders["X-SecondLife-Shard"] = "OpenSim";
|
||||
httpHeaders["X-SecondLife-Object-Name"] = m_host.Name;
|
||||
httpHeaders["X-SecondLife-Object-Key"] = m_itemID.ToString();
|
||||
httpHeaders["X-SecondLife-Region"] = World.RegionInfo.RegionName;
|
||||
httpHeaders["X-SecondLife-Local-Position"] = m_host.AbsolutePosition.ToString();
|
||||
httpHeaders["X-SecondLife-Local-Velocity"] = m_host.Velocity.ToString();
|
||||
httpHeaders["X-SecondLife-Local-Rotation"] = m_host.RotationOffset.ToString();
|
||||
|
||||
ScenePresence scenePresence = World.GetScenePresence(m_host.ObjectOwner);
|
||||
httpHeaders["X-SecondLife-Owner-Name"] = scenePresence == null ? string.Empty : scenePresence.Name;
|
||||
|
||||
httpHeaders["X-SecondLife-Owner-Key"] = m_host.ObjectOwner.ToString();
|
||||
|
||||
LLUUID reqID = httpScriptMod.
|
||||
StartHttpRequest(m_localID, m_itemID, url, param, body);
|
||||
StartHttpRequest(m_localID, m_itemID, url, param, httpHeaders, body);
|
||||
|
||||
if (reqID != LLUUID.Zero)
|
||||
return reqID.ToString();
|
||||
|
|
Loading…
Reference in New Issue