diff options
author | Diva Canto | 2011-05-06 09:09:13 -0700 |
---|---|---|
committer | Diva Canto | 2011-05-06 09:09:13 -0700 |
commit | 50c0069f7d3f3fa90fcdb8f52ae02cf6f3680efe (patch) | |
tree | 546d13e4f4925b82dc8a0fa037eeb0928d188132 /OpenSim | |
parent | Bug fix: iars under Library weren't being loaded. (diff) | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC_OLD-50c0069f7d3f3fa90fcdb8f52ae02cf6f3680efe.zip opensim-SC_OLD-50c0069f7d3f3fa90fcdb8f52ae02cf6f3680efe.tar.gz opensim-SC_OLD-50c0069f7d3f3fa90fcdb8f52ae02cf6f3680efe.tar.bz2 opensim-SC_OLD-50c0069f7d3f3fa90fcdb8f52ae02cf6f3680efe.tar.xz |
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Framework/MainServer.cs | 5 | ||||
-rw-r--r-- | OpenSim/Framework/NetworkServersInfo.cs | 15 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 14 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/RegionApplicationBase.cs | 16 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs | 61 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/World/Region/RestartModule.cs | 19 | ||||
-rw-r--r-- | OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs | 3 | ||||
-rw-r--r-- | OpenSim/Server/Base/HttpServerBase.cs | 77 | ||||
-rw-r--r-- | OpenSim/Services/AssetService/AssetService.cs | 42 |
9 files changed, 237 insertions, 15 deletions
diff --git a/OpenSim/Framework/MainServer.cs b/OpenSim/Framework/MainServer.cs index 0515b16..a3e0a26 100644 --- a/OpenSim/Framework/MainServer.cs +++ b/OpenSim/Framework/MainServer.cs | |||
@@ -52,6 +52,11 @@ namespace OpenSim.Framework | |||
52 | return GetHttpServer(port,null); | 52 | return GetHttpServer(port,null); |
53 | } | 53 | } |
54 | 54 | ||
55 | public static void AddHttpServer(BaseHttpServer server) | ||
56 | { | ||
57 | m_Servers.Add(server.Port, server); | ||
58 | } | ||
59 | |||
55 | public static IHttpServer GetHttpServer(uint port, IPAddress ipaddr) | 60 | public static IHttpServer GetHttpServer(uint port, IPAddress ipaddr) |
56 | { | 61 | { |
57 | if (port == 0) | 62 | if (port == 0) |
diff --git a/OpenSim/Framework/NetworkServersInfo.cs b/OpenSim/Framework/NetworkServersInfo.cs index b25f8b9..5bb4111 100644 --- a/OpenSim/Framework/NetworkServersInfo.cs +++ b/OpenSim/Framework/NetworkServersInfo.cs | |||
@@ -49,6 +49,12 @@ namespace OpenSim.Framework | |||
49 | public string HttpSSLCN = ""; | 49 | public string HttpSSLCN = ""; |
50 | public uint httpSSLPort = 9001; | 50 | public uint httpSSLPort = 9001; |
51 | 51 | ||
52 | // "Out of band" managemnt https | ||
53 | public bool ssl_listener = false; | ||
54 | public uint https_port = 0; | ||
55 | public string cert_path = String.Empty; | ||
56 | public string cert_pass = String.Empty; | ||
57 | |||
52 | public string MessagingURL = String.Empty; | 58 | public string MessagingURL = String.Empty; |
53 | 59 | ||
54 | public NetworkServersInfo() | 60 | public NetworkServersInfo() |
@@ -86,6 +92,15 @@ namespace OpenSim.Framework | |||
86 | secureInventoryServer = config.Configs["Network"].GetBoolean("secure_inventory_server", true); | 92 | secureInventoryServer = config.Configs["Network"].GetBoolean("secure_inventory_server", true); |
87 | 93 | ||
88 | MessagingURL = config.Configs["Network"].GetString("messaging_server_url", string.Empty); | 94 | MessagingURL = config.Configs["Network"].GetString("messaging_server_url", string.Empty); |
95 | |||
96 | // "Out of band management https" | ||
97 | ssl_listener = config.Configs["Network"].GetBoolean("https_listener",false); | ||
98 | if( ssl_listener) | ||
99 | { | ||
100 | cert_path = config.Configs["Network"].GetString("cert_path",String.Empty); | ||
101 | cert_pass = config.Configs["Network"].GetString("cert_pass",String.Empty); | ||
102 | https_port = (uint)config.Configs["Network"].GetInt("https_port", 0); | ||
103 | } | ||
89 | } | 104 | } |
90 | } | 105 | } |
91 | } | 106 | } |
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index ba89e21..598e5d1 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | |||
@@ -32,6 +32,7 @@ using System.Collections.Specialized; | |||
32 | using System.IO; | 32 | using System.IO; |
33 | using System.Net; | 33 | using System.Net; |
34 | using System.Net.Sockets; | 34 | using System.Net.Sockets; |
35 | using System.Security.Cryptography.X509Certificates; | ||
35 | using System.Reflection; | 36 | using System.Reflection; |
36 | using System.Globalization; | 37 | using System.Globalization; |
37 | using System.Text; | 38 | using System.Text; |
@@ -72,6 +73,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
72 | protected uint m_port; | 73 | protected uint m_port; |
73 | protected uint m_sslport; | 74 | protected uint m_sslport; |
74 | protected bool m_ssl; | 75 | protected bool m_ssl; |
76 | private X509Certificate2 m_cert; | ||
75 | protected bool m_firstcaps = true; | 77 | protected bool m_firstcaps = true; |
76 | protected string m_SSLCommonName = ""; | 78 | protected string m_SSLCommonName = ""; |
77 | 79 | ||
@@ -123,6 +125,14 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
123 | } | 125 | } |
124 | } | 126 | } |
125 | 127 | ||
128 | public BaseHttpServer(uint port, bool ssl, string CPath, string CPass) : this (port, ssl) | ||
129 | { | ||
130 | if (m_ssl) | ||
131 | { | ||
132 | m_cert = new X509Certificate2(CPath, CPass); | ||
133 | } | ||
134 | } | ||
135 | |||
126 | /// <summary> | 136 | /// <summary> |
127 | /// Add a stream handler to the http server. If the handler already exists, then nothing happens. | 137 | /// Add a stream handler to the http server. If the handler already exists, then nothing happens. |
128 | /// </summary> | 138 | /// </summary> |
@@ -1683,6 +1693,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1683 | try | 1693 | try |
1684 | { | 1694 | { |
1685 | //m_httpListener = new HttpListener(); | 1695 | //m_httpListener = new HttpListener(); |
1696 | |||
1686 | NotSocketErrors = 0; | 1697 | NotSocketErrors = 0; |
1687 | if (!m_ssl) | 1698 | if (!m_ssl) |
1688 | { | 1699 | { |
@@ -1702,6 +1713,9 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1702 | { | 1713 | { |
1703 | //m_httpListener.Prefixes.Add("https://+:" + (m_sslport) + "/"); | 1714 | //m_httpListener.Prefixes.Add("https://+:" + (m_sslport) + "/"); |
1704 | //m_httpListener.Prefixes.Add("http://+:" + m_port + "/"); | 1715 | //m_httpListener.Prefixes.Add("http://+:" + m_port + "/"); |
1716 | m_httpListener2 = CoolHTTPListener.Create(IPAddress.Any, (int)m_port, m_cert); | ||
1717 | m_httpListener2.ExceptionThrown += httpServerException; | ||
1718 | m_httpListener2.LogWriter = httpserverlog; | ||
1705 | } | 1719 | } |
1706 | 1720 | ||
1707 | m_httpListener2.RequestReceived += OnRequest; | 1721 | m_httpListener2.RequestReceived += OnRequest; |
diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs index ea1317a..6e3a58e 100644 --- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs +++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs | |||
@@ -96,6 +96,22 @@ namespace OpenSim.Region.ClientStack | |||
96 | 96 | ||
97 | MainServer.Instance = m_httpServer; | 97 | MainServer.Instance = m_httpServer; |
98 | 98 | ||
99 | // "OOB" Server | ||
100 | if (m_networkServersInfo.ssl_listener) | ||
101 | { | ||
102 | BaseHttpServer server = null; | ||
103 | server = new BaseHttpServer( | ||
104 | m_networkServersInfo.https_port, m_networkServersInfo.ssl_listener, m_networkServersInfo.cert_path, | ||
105 | m_networkServersInfo.cert_pass); | ||
106 | // Add the server to m_Servers | ||
107 | if(server != null) | ||
108 | { | ||
109 | m_log.InfoFormat("[REGION SERVER]: Starting HTTPS server on port {0}", server.Port); | ||
110 | MainServer.AddHttpServer(server); | ||
111 | server.Start(); | ||
112 | } | ||
113 | } | ||
114 | |||
99 | base.StartupSpecific(); | 115 | base.StartupSpecific(); |
100 | } | 116 | } |
101 | 117 | ||
diff --git a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs index 9b565ed..a552a28 100644 --- a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs | |||
@@ -78,7 +78,9 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
78 | 78 | ||
79 | private int m_TotalUrls = 100; | 79 | private int m_TotalUrls = 100; |
80 | 80 | ||
81 | private uint https_port = 0; | ||
81 | private IHttpServer m_HttpServer = null; | 82 | private IHttpServer m_HttpServer = null; |
83 | private IHttpServer m_HttpsServer = null; | ||
82 | 84 | ||
83 | private string m_ExternalHostNameForLSL = ""; | 85 | private string m_ExternalHostNameForLSL = ""; |
84 | 86 | ||
@@ -100,6 +102,11 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
100 | public void Initialise(IConfigSource config) | 102 | public void Initialise(IConfigSource config) |
101 | { | 103 | { |
102 | m_ExternalHostNameForLSL = config.Configs["Network"].GetString("ExternalHostNameForLSL", System.Environment.MachineName); | 104 | m_ExternalHostNameForLSL = config.Configs["Network"].GetString("ExternalHostNameForLSL", System.Environment.MachineName); |
105 | bool ssl_enabled = config.Configs["Network"].GetBoolean("https_listener",false); | ||
106 | if (ssl_enabled) | ||
107 | { | ||
108 | https_port = (uint) config.Configs["Network"].GetInt("https_port",0); | ||
109 | } | ||
103 | } | 110 | } |
104 | 111 | ||
105 | public void PostInitialise() | 112 | public void PostInitialise() |
@@ -113,6 +120,12 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
113 | // There can only be one | 120 | // There can only be one |
114 | // | 121 | // |
115 | m_HttpServer = MainServer.Instance; | 122 | m_HttpServer = MainServer.Instance; |
123 | // | ||
124 | // We can use the https if it is enabled | ||
125 | if (https_port > 0) | ||
126 | { | ||
127 | m_HttpsServer = MainServer.GetHttpServer(https_port); | ||
128 | } | ||
116 | } | 129 | } |
117 | 130 | ||
118 | scene.RegisterModuleInterface<IUrlModule>(this); | 131 | scene.RegisterModuleInterface<IUrlModule>(this); |
@@ -171,7 +184,40 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
171 | { | 184 | { |
172 | UUID urlcode = UUID.Random(); | 185 | UUID urlcode = UUID.Random(); |
173 | 186 | ||
174 | engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" }); | 187 | if (m_HttpsServer == null) |
188 | { | ||
189 | engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" }); | ||
190 | return urlcode; | ||
191 | } | ||
192 | |||
193 | lock (m_UrlMap) | ||
194 | { | ||
195 | if (m_UrlMap.Count >= m_TotalUrls) | ||
196 | { | ||
197 | engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" }); | ||
198 | return urlcode; | ||
199 | } | ||
200 | string url = "https://" + m_ExternalHostNameForLSL + ":" + m_HttpsServer.Port.ToString() + "/lslhttps/" + urlcode.ToString() + "/"; | ||
201 | |||
202 | UrlData urlData = new UrlData(); | ||
203 | urlData.hostID = host.UUID; | ||
204 | urlData.itemID = itemID; | ||
205 | urlData.engine = engine; | ||
206 | urlData.url = url; | ||
207 | urlData.urlcode = urlcode; | ||
208 | urlData.requests = new Dictionary<UUID, RequestData>(); | ||
209 | |||
210 | |||
211 | m_UrlMap[url] = urlData; | ||
212 | |||
213 | string uri = "/lslhttps/" + urlcode.ToString() + "/"; | ||
214 | |||
215 | m_HttpsServer.AddPollServiceHTTPHandler(uri,HandleHttpPoll, | ||
216 | new PollServiceEventArgs(HttpRequestHandler,HasEvents, GetEvents, NoEvents, | ||
217 | urlcode)); | ||
218 | |||
219 | engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_GRANTED", url }); | ||
220 | } | ||
175 | 221 | ||
176 | return urlcode; | 222 | return urlcode; |
177 | } | 223 | } |
@@ -345,7 +391,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
345 | } | 391 | } |
346 | private Hashtable GetEvents(UUID requestID, UUID sessionID, string request) | 392 | private Hashtable GetEvents(UUID requestID, UUID sessionID, string request) |
347 | { | 393 | { |
348 | UrlData url = null; | 394 | UrlData url = null; |
349 | RequestData requestData = null; | 395 | RequestData requestData = null; |
350 | 396 | ||
351 | lock (m_RequestMap) | 397 | lock (m_RequestMap) |
@@ -391,11 +437,12 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
391 | lock (request) | 437 | lock (request) |
392 | { | 438 | { |
393 | string uri = request["uri"].ToString(); | 439 | string uri = request["uri"].ToString(); |
394 | 440 | bool is_ssl = uri.Contains("lslhttps"); | |
441 | |||
395 | try | 442 | try |
396 | { | 443 | { |
397 | Hashtable headers = (Hashtable)request["headers"]; | 444 | Hashtable headers = (Hashtable)request["headers"]; |
398 | 445 | ||
399 | // string uri_full = "http://" + m_ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + uri;// "/lslhttp/" + urlcode.ToString() + "/"; | 446 | // string uri_full = "http://" + m_ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + uri;// "/lslhttp/" + urlcode.ToString() + "/"; |
400 | 447 | ||
401 | int pos1 = uri.IndexOf("/");// /lslhttp | 448 | int pos1 = uri.IndexOf("/");// /lslhttp |
@@ -409,7 +456,11 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
409 | 456 | ||
410 | pathInfo = uri.Substring(pos3); | 457 | pathInfo = uri.Substring(pos3); |
411 | 458 | ||
412 | UrlData url = m_UrlMap["http://" + m_ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + uri_tmp]; | 459 | UrlData url = null; |
460 | if (!is_ssl) | ||
461 | url = m_UrlMap["http://" + m_ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + uri_tmp]; | ||
462 | else | ||
463 | url = m_UrlMap["https://" + m_ExternalHostNameForLSL + ":" + m_HttpsServer.Port.ToString() + uri_tmp]; | ||
413 | 464 | ||
414 | //for llGetHttpHeader support we need to store original URI here | 465 | //for llGetHttpHeader support we need to store original URI here |
415 | //to make x-path-info / x-query-string / x-script-url / x-remote-ip headers | 466 | //to make x-path-info / x-query-string / x-script-url / x-remote-ip headers |
diff --git a/OpenSim/Region/CoreModules/World/Region/RestartModule.cs b/OpenSim/Region/CoreModules/World/Region/RestartModule.cs index ab6a598..e983239 100644 --- a/OpenSim/Region/CoreModules/World/Region/RestartModule.cs +++ b/OpenSim/Region/CoreModules/World/Region/RestartModule.cs | |||
@@ -64,19 +64,26 @@ namespace OpenSim.Region.CoreModules.World.Region | |||
64 | public void AddRegion(Scene scene) | 64 | public void AddRegion(Scene scene) |
65 | { | 65 | { |
66 | m_Scene = scene; | 66 | m_Scene = scene; |
67 | |||
67 | scene.RegisterModuleInterface<IRestartModule>(this); | 68 | scene.RegisterModuleInterface<IRestartModule>(this); |
68 | MainConsole.Instance.Commands.AddCommand("RestartModule", | 69 | MainConsole.Instance.Commands.AddCommand("RestartModule", |
69 | false, "region restart bluebox", | 70 | false, "region restart bluebox", |
70 | "region restart bluebox <message> <time> ...", | 71 | "region restart bluebox <message> <delta seconds>+", |
71 | "Restart the region", HandleRegionRestart); | 72 | "Schedule a region restart", |
73 | "Schedule a region restart after a given number of seconds. If one delta is given then the region is restarted in delta seconds time. A time to restart is sent to users in the region as a transient notice. If multiple deltas are given then a notice is sent when we reach each delta.", | ||
74 | HandleRegionRestart); | ||
75 | |||
72 | MainConsole.Instance.Commands.AddCommand("RestartModule", | 76 | MainConsole.Instance.Commands.AddCommand("RestartModule", |
73 | false, "region restart notice", | 77 | false, "region restart notice", |
74 | "region restart notice <message> <time> ...", | 78 | "region restart notice <message> <delta seconds>+", |
75 | "Restart the region", HandleRegionRestart); | 79 | "Schedule a region restart", |
80 | "Schedule a region restart after a given number of seconds. If one delta is given then the region is restarted in delta seconds time. A time to restart is sent to users in the region as a dismissable bluebox notice. If multiple deltas are given then a notice is sent when we reach each delta.", | ||
81 | HandleRegionRestart); | ||
82 | |||
76 | MainConsole.Instance.Commands.AddCommand("RestartModule", | 83 | MainConsole.Instance.Commands.AddCommand("RestartModule", |
77 | false, "region restart abort", | 84 | false, "region restart abort", |
78 | "region restart abort [<message>]", | 85 | "region restart abort [<message>]", |
79 | "Restart the region", HandleRegionRestart); | 86 | "Abort a region restart", HandleRegionRestart); |
80 | } | 87 | } |
81 | 88 | ||
82 | public void RegionLoaded(Scene scene) | 89 | public void RegionLoaded(Scene scene) |
@@ -245,7 +252,7 @@ namespace OpenSim.Region.CoreModules.World.Region | |||
245 | } | 252 | } |
246 | } | 253 | } |
247 | 254 | ||
248 | MainConsole.Instance.Output("Error: restart region <mode> <name> <time> ..."); | 255 | MainConsole.Instance.Output("Error: restart region <mode> <name> <delta seconds>+"); |
249 | return; | 256 | return; |
250 | } | 257 | } |
251 | 258 | ||
diff --git a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs index db17d8f..62e6fae 100644 --- a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs +++ b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs | |||
@@ -107,11 +107,10 @@ namespace OpenSim.Region.CoreModules.UDP.Linden | |||
107 | 107 | ||
108 | scene.AddCommand( | 108 | scene.AddCommand( |
109 | this, "emergency-monitoring", | 109 | this, "emergency-monitoring", |
110 | "Go on/off emergency monitoring mode", | 110 | "emergency-monitoring", |
111 | "Go on/off emergency monitoring mode", | 111 | "Go on/off emergency monitoring mode", |
112 | "Go on/off emergency monitoring mode", | 112 | "Go on/off emergency monitoring mode", |
113 | EmergencyMonitoring); | 113 | EmergencyMonitoring); |
114 | |||
115 | } | 114 | } |
116 | 115 | ||
117 | public void RemoveRegion(Scene scene) | 116 | public void RemoveRegion(Scene scene) |
diff --git a/OpenSim/Server/Base/HttpServerBase.cs b/OpenSim/Server/Base/HttpServerBase.cs index 9e4593e..bb5ce96 100644 --- a/OpenSim/Server/Base/HttpServerBase.cs +++ b/OpenSim/Server/Base/HttpServerBase.cs | |||
@@ -97,16 +97,76 @@ namespace OpenSim.Server.Base | |||
97 | 97 | ||
98 | if (port == 0) | 98 | if (port == 0) |
99 | { | 99 | { |
100 | System.Console.WriteLine("Port number not specified or 0, server can't start"); | 100 | |
101 | Thread.CurrentThread.Abort(); | 101 | Thread.CurrentThread.Abort(); |
102 | } | 102 | } |
103 | // | ||
104 | bool ssl_main = networkConfig.GetBoolean("https_main",false); | ||
105 | bool ssl_listener = networkConfig.GetBoolean("https_listener",false); | ||
103 | 106 | ||
104 | m_consolePort = (uint)networkConfig.GetInt("ConsolePort", 0); | 107 | m_consolePort = (uint)networkConfig.GetInt("ConsolePort", 0); |
105 | m_Port = port; | 108 | m_Port = port; |
109 | // | ||
110 | // This is where to make the servers: | ||
111 | // | ||
112 | // | ||
113 | // Make the base server according to the port, etc. | ||
114 | // ADD: Possibility to make main server ssl | ||
115 | // Then, check for https settings and ADD a server to | ||
116 | // m_Servers | ||
117 | // | ||
118 | if ( !ssl_main ) | ||
119 | { | ||
120 | m_HttpServer = new BaseHttpServer(port); | ||
106 | 121 | ||
107 | m_HttpServer = new BaseHttpServer(port); | 122 | } |
123 | else | ||
124 | { | ||
125 | string cert_path = networkConfig.GetString("cert_path",String.Empty); | ||
126 | if ( cert_path == String.Empty ) | ||
127 | { | ||
128 | System.Console.WriteLine("Path to X509 certificate is missing, server can't start."); | ||
129 | Thread.CurrentThread.Abort(); | ||
130 | } | ||
131 | string cert_pass = networkConfig.GetString("cert_pass",String.Empty); | ||
132 | if ( cert_pass == String.Empty ) | ||
133 | { | ||
134 | System.Console.WriteLine("Password for X509 certificate is missing, server can't start."); | ||
135 | Thread.CurrentThread.Abort(); | ||
136 | } | ||
137 | m_HttpServer = new BaseHttpServer(port, ssl_main, cert_path, cert_pass); | ||
138 | } | ||
108 | 139 | ||
109 | MainServer.Instance = m_HttpServer; | 140 | MainServer.Instance = m_HttpServer; |
141 | |||
142 | // If https_listener = true, then add an ssl listener on the https_port... | ||
143 | if ( ssl_listener == true ) { | ||
144 | |||
145 | uint https_port = (uint)networkConfig.GetInt("https_port", 0); | ||
146 | |||
147 | string cert_path = networkConfig.GetString("cert_path",String.Empty); | ||
148 | if ( cert_path == String.Empty ) | ||
149 | { | ||
150 | System.Console.WriteLine("Path to X509 certificate is missing, server can't start."); | ||
151 | Thread.CurrentThread.Abort(); | ||
152 | } | ||
153 | string cert_pass = networkConfig.GetString("cert_pass",String.Empty); | ||
154 | if ( cert_pass == String.Empty ) | ||
155 | { | ||
156 | System.Console.WriteLine("Password for X509 certificate is missing, server can't start."); | ||
157 | Thread.CurrentThread.Abort(); | ||
158 | } | ||
159 | // Add our https_server | ||
160 | BaseHttpServer server = null; | ||
161 | server = new BaseHttpServer(https_port, ssl_listener, cert_path, cert_pass); | ||
162 | if (server != null) | ||
163 | { | ||
164 | m_Log.InfoFormat("[SERVER]: Starting HTTPS server on port {0}", https_port); | ||
165 | m_Servers.Add(https_port,server); | ||
166 | } | ||
167 | else | ||
168 | System.Console.WriteLine(String.Format("Failed to start HTTPS server on port {0}",https_port)); | ||
169 | } | ||
110 | } | 170 | } |
111 | 171 | ||
112 | protected override void Initialise() | 172 | protected override void Initialise() |
@@ -114,6 +174,19 @@ namespace OpenSim.Server.Base | |||
114 | m_Log.InfoFormat("[SERVER]: Starting HTTP server on port {0}", m_HttpServer.Port); | 174 | m_Log.InfoFormat("[SERVER]: Starting HTTP server on port {0}", m_HttpServer.Port); |
115 | m_HttpServer.Start(); | 175 | m_HttpServer.Start(); |
116 | 176 | ||
177 | if (m_Servers.Count > 0) | ||
178 | { | ||
179 | foreach (BaseHttpServer s in m_Servers.Values) | ||
180 | { | ||
181 | if (!s.UseSSL) | ||
182 | m_Log.InfoFormat("[SERVER]: Starting HTTP server on port {0}", s.Port); | ||
183 | else | ||
184 | m_Log.InfoFormat("[SERVER]: Starting HTTPS server on port {0}", s.Port); | ||
185 | |||
186 | s.Start(); | ||
187 | } | ||
188 | } | ||
189 | |||
117 | if (MainConsole.Instance is RemoteConsole) | 190 | if (MainConsole.Instance is RemoteConsole) |
118 | { | 191 | { |
119 | if (m_consolePort == 0) | 192 | if (m_consolePort == 0) |
diff --git a/OpenSim/Services/AssetService/AssetService.cs b/OpenSim/Services/AssetService/AssetService.cs index e1f90b6..80d58e1 100644 --- a/OpenSim/Services/AssetService/AssetService.cs +++ b/OpenSim/Services/AssetService/AssetService.cs | |||
@@ -26,6 +26,8 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | ||
30 | using System.IO; | ||
29 | using System.Reflection; | 31 | using System.Reflection; |
30 | using Nini.Config; | 32 | using Nini.Config; |
31 | using log4net; | 33 | using log4net; |
@@ -60,6 +62,13 @@ namespace OpenSim.Services.AssetService | |||
60 | "delete asset", | 62 | "delete asset", |
61 | "delete asset <ID>", | 63 | "delete asset <ID>", |
62 | "Delete asset from database", HandleDeleteAsset); | 64 | "Delete asset from database", HandleDeleteAsset); |
65 | |||
66 | MainConsole.Instance.Commands.AddCommand("kfs", false, | ||
67 | "dump asset", | ||
68 | "dump asset <ID>", | ||
69 | "Dump asset to a file", | ||
70 | "The filename is the same as the ID given.", | ||
71 | HandleDumpAsset); | ||
63 | 72 | ||
64 | if (m_AssetLoader != null) | 73 | if (m_AssetLoader != null) |
65 | { | 74 | { |
@@ -189,6 +198,39 @@ namespace OpenSim.Services.AssetService | |||
189 | 198 | ||
190 | return false; | 199 | return false; |
191 | } | 200 | } |
201 | |||
202 | void HandleDumpAsset(string module, string[] args) | ||
203 | { | ||
204 | if (args.Length < 3) | ||
205 | { | ||
206 | MainConsole.Instance.Output("Usage is dump asset <ID>"); | ||
207 | return; | ||
208 | } | ||
209 | |||
210 | string rawAssetId = args[2]; | ||
211 | UUID assetId; | ||
212 | |||
213 | if (!UUID.TryParse(rawAssetId, out assetId)) | ||
214 | { | ||
215 | MainConsole.Instance.OutputFormat("ERROR: {0} is not a valid ID format", rawAssetId); | ||
216 | return; | ||
217 | } | ||
218 | |||
219 | AssetBase asset = m_Database.GetAsset(assetId); | ||
220 | if (asset == null) | ||
221 | { | ||
222 | MainConsole.Instance.OutputFormat("ERROR: No asset found with ID {0}", assetId); | ||
223 | return; | ||
224 | } | ||
225 | |||
226 | using (FileStream fs = new FileStream(rawAssetId, FileMode.CreateNew)) | ||
227 | { | ||
228 | using (BinaryWriter bw = new BinaryWriter(fs)) | ||
229 | { | ||
230 | bw.Write(asset.Data); | ||
231 | } | ||
232 | } | ||
233 | } | ||
192 | 234 | ||
193 | void HandleShowDigest(string module, string[] args) | 235 | void HandleShowDigest(string module, string[] args) |
194 | { | 236 | { |