aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorCharles Krinke2008-07-14 13:51:54 +0000
committerCharles Krinke2008-07-14 13:51:54 +0000
commit00791594ad4ed6d78bd6edbb2e02eaaf5c30c8ce (patch)
tree17bf6ae0214a3b83835874bdd9723e6e285cfdfa /OpenSim/Region
parentfixing warning in IRCBridgeModule and logging the exception cause now. (diff)
downloadopensim-SC_OLD-00791594ad4ed6d78bd6edbb2e02eaaf5c30c8ce.zip
opensim-SC_OLD-00791594ad4ed6d78bd6edbb2e02eaaf5c30c8ce.tar.gz
opensim-SC_OLD-00791594ad4ed6d78bd6edbb2e02eaaf5c30c8ce.tar.bz2
opensim-SC_OLD-00791594ad4ed6d78bd6edbb2e02eaaf5c30c8ce.tar.xz
Mantis#1739. Thank you kindly, Grumly57 for a patch that:
Implements X-SecondLife-* HTTP Headers for llHTTPRequest
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Environment/Interfaces/IHttpRequests.cs2
-rw-r--r--OpenSim/Region/Environment/Modules/Scripting/HttpRequest/ScriptsHttpRequests.cs8
-rw-r--r--OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs18
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs18
4 files changed, 42 insertions, 4 deletions
diff --git a/OpenSim/Region/Environment/Interfaces/IHttpRequests.cs b/OpenSim/Region/Environment/Interfaces/IHttpRequests.cs
index 46ba9b2..3a635de 100644
--- a/OpenSim/Region/Environment/Interfaces/IHttpRequests.cs
+++ b/OpenSim/Region/Environment/Interfaces/IHttpRequests.cs
@@ -34,7 +34,7 @@ namespace OpenSim.Region.Environment.Interfaces
34 public interface IHttpRequests 34 public interface IHttpRequests
35 { 35 {
36 LLUUID MakeHttpRequest(string url, string parameters, string body); 36 LLUUID MakeHttpRequest(string url, string parameters, string body);
37 LLUUID StartHttpRequest(uint localID, LLUUID itemID, string url, List<string> parameters, string body); 37 LLUUID StartHttpRequest(uint localID, LLUUID itemID, string url, List<string> parameters, Dictionary<string, string> headers, string body);
38 void StopHttpRequest(uint m_localID, LLUUID m_itemID); 38 void StopHttpRequest(uint m_localID, LLUUID m_itemID);
39 HttpRequestClass GetNextCompletedRequest(); 39 HttpRequestClass GetNextCompletedRequest();
40 void RemoveCompletedRequest(LLUUID id); 40 void RemoveCompletedRequest(LLUUID id);
diff --git a/OpenSim/Region/Environment/Modules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/OpenSim/Region/Environment/Modules/Scripting/HttpRequest/ScriptsHttpRequests.cs
index 6e32362..c670ad7 100644
--- a/OpenSim/Region/Environment/Modules/Scripting/HttpRequest/ScriptsHttpRequests.cs
+++ b/OpenSim/Region/Environment/Modules/Scripting/HttpRequest/ScriptsHttpRequests.cs
@@ -37,6 +37,7 @@ using OpenSim.Framework;
37using OpenSim.Framework.Servers; 37using OpenSim.Framework.Servers;
38using OpenSim.Region.Environment.Interfaces; 38using OpenSim.Region.Environment.Interfaces;
39using OpenSim.Region.Environment.Scenes; 39using OpenSim.Region.Environment.Scenes;
40using System.Collections;
40 41
41/***************************************************** 42/*****************************************************
42 * 43 *
@@ -105,7 +106,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.HttpRequest
105 return LLUUID.Zero; 106 return LLUUID.Zero;
106 } 107 }
107 108
108 public LLUUID StartHttpRequest(uint localID, LLUUID itemID, string url, List<string> parameters, string body) 109 public LLUUID StartHttpRequest(uint localID, LLUUID itemID, string url, List<string> parameters, Dictionary<string, string> headers, string body)
109 { 110 {
110 LLUUID reqID = LLUUID.Random(); 111 LLUUID reqID = LLUUID.Random();
111 HttpRequestClass htc = new HttpRequestClass(); 112 HttpRequestClass htc = new HttpRequestClass();
@@ -150,6 +151,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.HttpRequest
150 htc.reqID = reqID; 151 htc.reqID = reqID;
151 htc.httpTimeout = httpTimeout; 152 htc.httpTimeout = httpTimeout;
152 htc.outbound_body = body; 153 htc.outbound_body = body;
154 htc.response_headers = headers;
153 155
154 lock (HttpListLock) 156 lock (HttpListLock)
155 { 157 {
@@ -280,6 +282,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.HttpRequest
280 public HttpWebRequest request; 282 public HttpWebRequest request;
281 public string response_body; 283 public string response_body;
282 public List<string> response_metadata; 284 public List<string> response_metadata;
285 public Dictionary<string, string> response_headers;
283 public int status; 286 public int status;
284 public string url; 287 public string url;
285 288
@@ -314,6 +317,9 @@ namespace OpenSim.Region.Environment.Modules.Scripting.HttpRequest
314 request.Method = httpMethod; 317 request.Method = httpMethod;
315 request.ContentType = httpMIMEType; 318 request.ContentType = httpMIMEType;
316 319
320 foreach (KeyValuePair<string, string> entry in response_headers)
321 request.Headers[entry.Key] = entry.Value;
322
317 // Encode outbound data 323 // Encode outbound data
318 if (outbound_body.Length > 0) { 324 if (outbound_body.Length > 0) {
319 byte[] data = Encoding.UTF8.GetBytes(outbound_body); 325 byte[] data = Encoding.UTF8.GetBytes(outbound_body);
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
index 4106fbb..6eb8749 100644
--- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
+++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
@@ -6868,8 +6868,24 @@ namespace OpenSim.Region.ScriptEngine.Common
6868 { 6868 {
6869 param.Add(o.ToString()); 6869 param.Add(o.ToString());
6870 } 6870 }
6871
6872 Dictionary<string, string> httpHeaders = new Dictionary<string, string>();
6873
6874 httpHeaders["X-SecondLife-Shard"] = "OpenSim";
6875 httpHeaders["X-SecondLife-Object-Name"] = m_host.Name;
6876 httpHeaders["X-SecondLife-Object-Key"] = m_itemID.ToString();
6877 httpHeaders["X-SecondLife-Region"] = World.RegionInfo.RegionName;
6878 httpHeaders["X-SecondLife-Local-Position"] = m_host.AbsolutePosition.ToString();
6879 httpHeaders["X-SecondLife-Local-Velocity"] = m_host.Velocity.ToString();
6880 httpHeaders["X-SecondLife-Local-Rotation"] = m_host.RotationOffset.ToString();
6881
6882 ScenePresence scenePresence = World.GetScenePresence(m_host.ObjectOwner);
6883 httpHeaders["X-SecondLife-Owner-Name"] = scenePresence == null ? string.Empty : scenePresence.Name;
6884
6885 httpHeaders["X-SecondLife-Owner-Key"] = m_host.ObjectOwner.ToString();
6886
6871 LLUUID reqID = httpScriptMod. 6887 LLUUID reqID = httpScriptMod.
6872 StartHttpRequest(m_localID, m_itemID, url, param, body); 6888 StartHttpRequest(m_localID, m_itemID, url, param, httpHeaders, body);
6873 6889
6874 if (reqID != LLUUID.Zero) 6890 if (reqID != LLUUID.Zero)
6875 return reqID.ToString(); 6891 return reqID.ToString();
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 06a6086..507a132 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -6648,8 +6648,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6648 { 6648 {
6649 param.Add(o.ToString()); 6649 param.Add(o.ToString());
6650 } 6650 }
6651
6652 Dictionary<string, string> httpHeaders = new Dictionary<string, string>();
6653
6654 httpHeaders["X-SecondLife-Shard"] = "OpenSim";
6655 httpHeaders["X-SecondLife-Object-Name"] = m_host.Name;
6656 httpHeaders["X-SecondLife-Object-Key"] = m_itemID.ToString();
6657 httpHeaders["X-SecondLife-Region"] = World.RegionInfo.RegionName;
6658 httpHeaders["X-SecondLife-Local-Position"] = m_host.AbsolutePosition.ToString();
6659 httpHeaders["X-SecondLife-Local-Velocity"] = m_host.Velocity.ToString();
6660 httpHeaders["X-SecondLife-Local-Rotation"] = m_host.RotationOffset.ToString();
6661
6662 ScenePresence scenePresence = World.GetScenePresence(m_host.ObjectOwner);
6663 httpHeaders["X-SecondLife-Owner-Name"] = scenePresence == null ? string.Empty : scenePresence.Name;
6664
6665 httpHeaders["X-SecondLife-Owner-Key"] = m_host.ObjectOwner.ToString();
6666
6651 LLUUID reqID = httpScriptMod. 6667 LLUUID reqID = httpScriptMod.
6652 StartHttpRequest(m_localID, m_itemID, url, param, body); 6668 StartHttpRequest(m_localID, m_itemID, url, param, httpHeaders, body);
6653 6669
6654 if (reqID != LLUUID.Zero) 6670 if (reqID != LLUUID.Zero)
6655 return reqID.ToString(); 6671 return reqID.ToString();