diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Client/VWoHTTP/VWoHTTPModule.cs | 43 |
1 files changed, 40 insertions, 3 deletions
diff --git a/OpenSim/Client/VWoHTTP/VWoHTTPModule.cs b/OpenSim/Client/VWoHTTP/VWoHTTPModule.cs index 451bf1e..c5b5c09 100644 --- a/OpenSim/Client/VWoHTTP/VWoHTTPModule.cs +++ b/OpenSim/Client/VWoHTTP/VWoHTTPModule.cs | |||
@@ -13,17 +13,21 @@ namespace OpenSim.Client.VWoHTTP | |||
13 | { | 13 | { |
14 | class VWoHTTPModule : IRegionModule, IHttpAgentHandler | 14 | class VWoHTTPModule : IRegionModule, IHttpAgentHandler |
15 | { | 15 | { |
16 | private bool m_disabled = true; | ||
16 | 17 | ||
17 | private IHttpServer m_httpd; | 18 | private IHttpServer m_httpd; |
18 | 19 | ||
19 | private readonly List<Scene> m_scenes = new List<Scene>(); | 20 | private readonly List<Scene> m_scenes = new List<Scene>(); |
20 | 21 | ||
21 | //private Dictionary<UUID, VWHClientView> m_clients = new Dictionary<UUID, VWHClientView>(); | 22 | private Dictionary<UUID, VWHClientView> m_clients = new Dictionary<UUID, VWHClientView>(); |
22 | 23 | ||
23 | #region Implementation of IRegionModule | 24 | #region Implementation of IRegionModule |
24 | 25 | ||
25 | public void Initialise(Scene scene, IConfigSource source) | 26 | public void Initialise(Scene scene, IConfigSource source) |
26 | { | 27 | { |
28 | if(m_disabled) | ||
29 | return; | ||
30 | |||
27 | m_scenes.Add(scene); | 31 | m_scenes.Add(scene); |
28 | 32 | ||
29 | m_httpd = scene.CommsManager.HttpServer; | 33 | m_httpd = scene.CommsManager.HttpServer; |
@@ -31,11 +35,17 @@ namespace OpenSim.Client.VWoHTTP | |||
31 | 35 | ||
32 | public void PostInitialise() | 36 | public void PostInitialise() |
33 | { | 37 | { |
38 | if (m_disabled) | ||
39 | return; | ||
40 | |||
34 | m_httpd.AddAgentHandler("vwohttp", this); | 41 | m_httpd.AddAgentHandler("vwohttp", this); |
35 | } | 42 | } |
36 | 43 | ||
37 | public void Close() | 44 | public void Close() |
38 | { | 45 | { |
46 | if (m_disabled) | ||
47 | return; | ||
48 | |||
39 | m_httpd.RemoveAgentHandler("vwohttp", this); | 49 | m_httpd.RemoveAgentHandler("vwohttp", this); |
40 | } | 50 | } |
41 | 51 | ||
@@ -55,8 +65,35 @@ namespace OpenSim.Client.VWoHTTP | |||
55 | 65 | ||
56 | public bool Handle(OSHttpRequest req, OSHttpResponse resp) | 66 | public bool Handle(OSHttpRequest req, OSHttpResponse resp) |
57 | { | 67 | { |
58 | 68 | string[] urlparts = req.Url.AbsolutePath.Split(new char[] {'/'}, StringSplitOptions.RemoveEmptyEntries); | |
59 | return false; | 69 | |
70 | if (urlparts.Length < 2) | ||
71 | return false; | ||
72 | |||
73 | if (urlparts[1] == "connect") | ||
74 | { | ||
75 | UUID sessID = UUID.Random(); | ||
76 | |||
77 | VWHClientView client = new VWHClientView(sessID, UUID.Random(), "VWoHTTPClient", m_scenes[0]); | ||
78 | |||
79 | m_clients.Add(sessID, client); | ||
80 | |||
81 | return true; | ||
82 | } | ||
83 | else | ||
84 | { | ||
85 | if (urlparts.Length < 3) | ||
86 | return false; | ||
87 | |||
88 | UUID sessionID; | ||
89 | if (!UUID.TryParse(urlparts[1], out sessionID)) | ||
90 | return false; | ||
91 | |||
92 | if (!m_clients.ContainsKey(sessionID)) | ||
93 | return false; | ||
94 | |||
95 | return m_clients[sessionID].ProcessInMsg(req, resp); | ||
96 | } | ||
60 | } | 97 | } |
61 | 98 | ||
62 | public bool Match(OSHttpRequest req, OSHttpResponse resp) | 99 | public bool Match(OSHttpRequest req, OSHttpResponse resp) |