aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Scripting
diff options
context:
space:
mode:
authorMelanie Thielker2009-05-13 20:32:14 +0000
committerMelanie Thielker2009-05-13 20:32:14 +0000
commitfb3d5770dd7c7293652705f662f0a1a5bb1011ab (patch)
treea7f18c7d5493c24d69436f215fcbf9b8970a8386 /OpenSim/Region/CoreModules/Scripting
parent* Ignored some gens (diff)
downloadopensim-SC-fb3d5770dd7c7293652705f662f0a1a5bb1011ab.zip
opensim-SC-fb3d5770dd7c7293652705f662f0a1a5bb1011ab.tar.gz
opensim-SC-fb3d5770dd7c7293652705f662f0a1a5bb1011ab.tar.bz2
opensim-SC-fb3d5770dd7c7293652705f662f0a1a5bb1011ab.tar.xz
Make the LSL HTTP server create and give out URLs to scripts
Diffstat (limited to 'OpenSim/Region/CoreModules/Scripting')
-rw-r--r--OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs15
1 files changed, 14 insertions, 1 deletions
diff --git a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
index 1fff71e..eb0e801 100644
--- a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
@@ -59,6 +59,10 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
59 59
60 public class UrlModule : ISharedRegionModule, IUrlModule 60 public class UrlModule : ISharedRegionModule, IUrlModule
61 { 61 {
62 private static readonly ILog m_log =
63 LogManager.GetLogger(
64 MethodBase.GetCurrentMethod().DeclaringType);
65
62 private Dictionary<UUID, UrlData> m_RequestMap = 66 private Dictionary<UUID, UrlData> m_RequestMap =
63 new Dictionary<UUID, UrlData>(); 67 new Dictionary<UUID, UrlData>();
64 68
@@ -90,6 +94,8 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
90 // 94 //
91 m_HttpServer = scene.CommsManager.HttpServer; 95 m_HttpServer = scene.CommsManager.HttpServer;
92 } 96 }
97
98 scene.RegisterModuleInterface<IUrlModule>(this);
93 } 99 }
94 100
95 public void RegionLoaded(Scene scene) 101 public void RegionLoaded(Scene scene)
@@ -115,7 +121,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
115 engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" }); 121 engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" });
116 return urlcode; 122 return urlcode;
117 } 123 }
118 string url = "http://"+System.Environment.MachineName+"/"+urlcode.ToString(); 124 string url = "http://"+System.Environment.MachineName+"/lslhttp/"+urlcode.ToString();
119 125
120 UrlData urlData = new UrlData(); 126 UrlData urlData = new UrlData();
121 urlData.hostID = host.UUID; 127 urlData.hostID = host.UUID;
@@ -129,9 +135,12 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
129 135
130 m_HttpServer.AddHTTPHandler("/lslhttp/"+urlcode.ToString(), HttpRequestHandler); 136 m_HttpServer.AddHTTPHandler("/lslhttp/"+urlcode.ToString(), HttpRequestHandler);
131 137
138 m_log.DebugFormat("Posting event http_request to script with url {0}", url);
132 engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_GRANTED", url }); 139 engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_GRANTED", url });
133 } 140 }
134 141
142 m_log.DebugFormat("Returning {0} to LSL", urlcode.ToString());
143
135 return urlcode; 144 return urlcode;
136 } 145 }
137 146
@@ -226,6 +235,10 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
226 235
227 private Hashtable HttpRequestHandler(Hashtable request) 236 private Hashtable HttpRequestHandler(Hashtable request)
228 { 237 {
238 foreach (KeyValuePair<string, Object> kvp in request)
239 {
240 m_log.DebugFormat("{0} = {1}", kvp.Key, kvp.Value.ToString());
241 }
229 Hashtable response = new Hashtable(); 242 Hashtable response = new Hashtable();
230 response["int_response_code"] = 404; 243 response["int_response_code"] = 404;
231 244