aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs')
-rw-r--r--OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs51
1 files changed, 50 insertions, 1 deletions
diff --git a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
index f2922d6..2a4d440 100644
--- a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
@@ -51,6 +51,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
51 public UUID urlcode; 51 public UUID urlcode;
52 public Dictionary<UUID, RequestData> requests; 52 public Dictionary<UUID, RequestData> requests;
53 public bool isSsl; 53 public bool isSsl;
54 public Scene scene;
54 } 55 }
55 56
56 public class RequestData 57 public class RequestData
@@ -66,6 +67,9 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
66 public int startTime; 67 public int startTime;
67 public bool responseSent; 68 public bool responseSent;
68 public string uri; 69 public string uri;
70 public bool allowResponseType = false;
71 public UUID hostID;
72 public Scene scene;
69 } 73 }
70 74
71 /// <summary> 75 /// <summary>
@@ -171,6 +175,17 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
171 175
172 public void RemoveRegion(Scene scene) 176 public void RemoveRegion(Scene scene)
173 { 177 {
178 // Drop references to that scene
179 foreach (KeyValuePair<string, UrlData> kvp in m_UrlMap)
180 {
181 if (kvp.Value.scene == scene)
182 kvp.Value.scene = null;
183 }
184 foreach (KeyValuePair<UUID, UrlData> kvp in m_RequestMap)
185 {
186 if (kvp.Value.scene == scene)
187 kvp.Value.scene = null;
188 }
174 } 189 }
175 190
176 public void Close() 191 public void Close()
@@ -198,6 +213,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
198 urlData.urlcode = urlcode; 213 urlData.urlcode = urlcode;
199 urlData.isSsl = false; 214 urlData.isSsl = false;
200 urlData.requests = new Dictionary<UUID, RequestData>(); 215 urlData.requests = new Dictionary<UUID, RequestData>();
216 urlData.scene = host.ParentGroup.Scene;
201 217
202 m_UrlMap[url] = urlData; 218 m_UrlMap[url] = urlData;
203 219
@@ -316,6 +332,11 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
316 if (!urlData.requests[request].responseSent) 332 if (!urlData.requests[request].responseSent)
317 { 333 {
318 string responseBody = body; 334 string responseBody = body;
335
336 // If we have no OpenID from built-in browser, disable this
337 if (!urlData.requests[request].allowResponseType)
338 urlData.requests[request].responseType = "text/plain";
339
319 if (urlData.requests[request].responseType.Equals("text/plain")) 340 if (urlData.requests[request].responseType.Equals("text/plain"))
320 { 341 {
321 string value; 342 string value;
@@ -532,7 +553,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
532 //put response 553 //put response
533 response["int_response_code"] = requestData.responseCode; 554 response["int_response_code"] = requestData.responseCode;
534 response["str_response_string"] = requestData.responseBody; 555 response["str_response_string"] = requestData.responseBody;
535 response["content_type"] = "text/plain"; 556 response["content_type"] = requestData.responseType;
536 response["keepalive"] = false; 557 response["keepalive"] = false;
537 response["reusecontext"] = false; 558 response["reusecontext"] = false;
538 559
@@ -600,6 +621,8 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
600 requestData.requestDone = false; 621 requestData.requestDone = false;
601 requestData.startTime = System.Environment.TickCount; 622 requestData.startTime = System.Environment.TickCount;
602 requestData.uri = uri; 623 requestData.uri = uri;
624 requestData.hostID = url.hostID;
625 requestData.scene = url.scene;
603 if (requestData.headers == null) 626 if (requestData.headers == null)
604 requestData.headers = new Dictionary<string, string>(); 627 requestData.headers = new Dictionary<string, string>();
605 628
@@ -608,6 +631,32 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
608 string key = (string)header.Key; 631 string key = (string)header.Key;
609 string value = (string)header.Value; 632 string value = (string)header.Value;
610 requestData.headers.Add(key, value); 633 requestData.headers.Add(key, value);
634 if (key == "cookie")
635 {
636 string[] parts = value.Split(new char[] {'='});
637 if (parts[0] == "agni_sl_session_id" && parts.Length > 1)
638 {
639 string cookie = Uri.UnescapeDataString(parts[1]);
640 string[] crumbs = cookie.Split(new char[] {':'});
641 UUID owner;
642 if (crumbs.Length == 2 && UUID.TryParse(crumbs[0], out owner))
643 {
644 if (crumbs[1].Length == 32)
645 {
646 Scene scene = requestData.scene;
647 if (scene != null)
648 {
649 SceneObjectPart host = scene.GetSceneObjectPart(requestData.hostID);
650 if (host != null)
651 {
652 if (host.OwnerID == owner)
653 requestData.allowResponseType = true;
654 }
655 }
656 }
657 }
658 }
659 }
611 } 660 }
612 foreach (DictionaryEntry de in request) 661 foreach (DictionaryEntry de in request)
613 { 662 {