aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Server/Base/HttpServerBase.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Server/Base/HttpServerBase.cs')
-rw-r--r--OpenSim/Server/Base/HttpServerBase.cs77
1 files changed, 75 insertions, 2 deletions
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)