diff options
Diffstat (limited to '')
4 files changed, 66 insertions, 36 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index af292c6..bd8b681 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | |||
@@ -111,7 +111,6 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
111 | protected uint m_sslport; | 111 | protected uint m_sslport; |
112 | protected bool m_ssl; | 112 | protected bool m_ssl; |
113 | private X509Certificate2 m_cert; | 113 | private X509Certificate2 m_cert; |
114 | protected bool m_firstcaps = true; | ||
115 | protected string m_SSLCommonName = ""; | 114 | protected string m_SSLCommonName = ""; |
116 | protected List<string> m_certNames = new List<string>(); | 115 | protected List<string> m_certNames = new List<string>(); |
117 | protected List<string> m_certIPs = new List<string>(); | 116 | protected List<string> m_certIPs = new List<string>(); |
@@ -152,11 +151,6 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
152 | m_port = port; | 151 | m_port = port; |
153 | } | 152 | } |
154 | 153 | ||
155 | public BaseHttpServer(uint port, bool ssl) : this (port) | ||
156 | { | ||
157 | m_ssl = ssl; | ||
158 | } | ||
159 | |||
160 | private void load_cert(string CPath, string CPass) | 154 | private void load_cert(string CPath, string CPass) |
161 | { | 155 | { |
162 | try | 156 | try |
@@ -216,21 +210,24 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
216 | 210 | ||
217 | if(m_cert.Issuer == m_cert.Subject ) | 211 | if(m_cert.Issuer == m_cert.Subject ) |
218 | m_log.Warn("Self signed certificate. Clients need to allow this (some viewers debug option NoVerifySSLcert must be set to true"); | 212 | m_log.Warn("Self signed certificate. Clients need to allow this (some viewers debug option NoVerifySSLcert must be set to true"); |
219 | |||
220 | |||
221 | } | 213 | } |
222 | else | 214 | else |
223 | m_ssl = false; | 215 | m_ssl = false; |
224 | } | 216 | } |
225 | 217 | ||
226 | public BaseHttpServer(uint port, bool ssl, string CPath, string CPass) : this (port, ssl) | 218 | public BaseHttpServer(uint port, bool ssl, string CPath, string CPass) |
227 | { | 219 | { |
228 | if (m_ssl) | 220 | m_port = port; |
221 | if (ssl) | ||
229 | { | 222 | { |
230 | load_cert(CPath, CPass); | 223 | load_cert(CPath, CPass); |
231 | if(m_cert.Issuer == m_cert.Subject ) | 224 | if(m_cert.Issuer == m_cert.Subject ) |
232 | m_log.Warn("Self signed certificate. Http clients need to allow this"); | 225 | m_log.Warn("Self signed certificate. Http clients need to allow this"); |
226 | m_ssl = true; | ||
227 | m_sslport = port; | ||
233 | } | 228 | } |
229 | else | ||
230 | m_ssl = false; | ||
234 | } | 231 | } |
235 | 232 | ||
236 | static bool MatchDNS (string hostname, string dns) | 233 | static bool MatchDNS (string hostname, string dns) |
@@ -2038,7 +2035,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
2038 | 2035 | ||
2039 | public void Start() | 2036 | public void Start() |
2040 | { | 2037 | { |
2041 | Start(true); | 2038 | Start(true,true); |
2042 | } | 2039 | } |
2043 | 2040 | ||
2044 | /// <summary> | 2041 | /// <summary> |
@@ -2048,7 +2045,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
2048 | /// If true then poll responses are performed asynchronsly. | 2045 | /// If true then poll responses are performed asynchronsly. |
2049 | /// Option exists to allow regression tests to perform processing synchronously. | 2046 | /// Option exists to allow regression tests to perform processing synchronously. |
2050 | /// </param> | 2047 | /// </param> |
2051 | public void Start(bool performPollResponsesAsync) | 2048 | public void Start(bool performPollResponsesAsync, bool runPool) |
2052 | { | 2049 | { |
2053 | m_log.InfoFormat( | 2050 | m_log.InfoFormat( |
2054 | "[BASE HTTP SERVER]: Starting {0} server on port {1}", UseSSL ? "HTTPS" : "HTTP", Port); | 2051 | "[BASE HTTP SERVER]: Starting {0} server on port {1}", UseSSL ? "HTTPS" : "HTTP", Port); |
@@ -2086,9 +2083,11 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
2086 | m_httpListener2.Start(64); | 2083 | m_httpListener2.Start(64); |
2087 | 2084 | ||
2088 | // Long Poll Service Manager with 3 worker threads a 25 second timeout for no events | 2085 | // Long Poll Service Manager with 3 worker threads a 25 second timeout for no events |
2089 | 2086 | if(runPool) | |
2090 | PollServiceRequestManager = new PollServiceRequestManager(this, performPollResponsesAsync, 2, 25000); | 2087 | { |
2091 | PollServiceRequestManager.Start(); | 2088 | PollServiceRequestManager = new PollServiceRequestManager(this, performPollResponsesAsync, 2, 25000); |
2089 | PollServiceRequestManager.Start(); | ||
2090 | } | ||
2092 | 2091 | ||
2093 | HTTPDRunning = true; | 2092 | HTTPDRunning = true; |
2094 | 2093 | ||
diff --git a/OpenSim/Framework/Servers/MainServer.cs b/OpenSim/Framework/Servers/MainServer.cs index 57931d4..e9c284c 100644 --- a/OpenSim/Framework/Servers/MainServer.cs +++ b/OpenSim/Framework/Servers/MainServer.cs | |||
@@ -42,6 +42,7 @@ namespace OpenSim.Framework.Servers | |||
42 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 42 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
43 | 43 | ||
44 | private static BaseHttpServer instance = null; | 44 | private static BaseHttpServer instance = null; |
45 | private static BaseHttpServer unsecureinstance = null; | ||
45 | private static Dictionary<uint, BaseHttpServer> m_Servers = new Dictionary<uint, BaseHttpServer>(); | 46 | private static Dictionary<uint, BaseHttpServer> m_Servers = new Dictionary<uint, BaseHttpServer>(); |
46 | 47 | ||
47 | /// <summary> | 48 | /// <summary> |
@@ -93,6 +94,21 @@ namespace OpenSim.Framework.Servers | |||
93 | } | 94 | } |
94 | } | 95 | } |
95 | 96 | ||
97 | |||
98 | public static BaseHttpServer ÚnSecureInstance | ||
99 | { | ||
100 | get { return unsecureinstance; } | ||
101 | |||
102 | set | ||
103 | { | ||
104 | lock (m_Servers) | ||
105 | if (!m_Servers.ContainsValue(value)) | ||
106 | throw new Exception("HTTP server must already have been registered to be set as the main instance"); | ||
107 | |||
108 | unsecureinstance = value; | ||
109 | } | ||
110 | } | ||
111 | |||
96 | /// <summary> | 112 | /// <summary> |
97 | /// Get all the registered servers. | 113 | /// Get all the registered servers. |
98 | /// </summary> | 114 | /// </summary> |
diff --git a/OpenSim/Region/Application/RegionApplicationBase.cs b/OpenSim/Region/Application/RegionApplicationBase.cs index 603f139..77b0138 100644 --- a/OpenSim/Region/Application/RegionApplicationBase.cs +++ b/OpenSim/Region/Application/RegionApplicationBase.cs | |||
@@ -69,23 +69,38 @@ namespace OpenSim | |||
69 | 69 | ||
70 | Initialize(); | 70 | Initialize(); |
71 | 71 | ||
72 | m_httpServer | 72 | uint mainport = m_networkServersInfo.HttpListenerPort; |
73 | = new BaseHttpServer( | 73 | uint mainSSLport =m_networkServersInfo.httpSSLPort; |
74 | m_httpServerPort, m_networkServersInfo.HttpUsesSSL, | ||
75 | m_networkServersInfo.httpSSLPort, m_networkServersInfo.HttpSSLCN, | ||
76 | m_networkServersInfo.HttpSSLCertPath, m_networkServersInfo.HttpSSLCNCertPass); | ||
77 | 74 | ||
78 | /* why this? we only run one | 75 | if (m_networkServersInfo.HttpUsesSSL && (mainport == mainSSLport)) |
79 | if (m_networkServersInfo.HttpUsesSSL && (m_networkServersInfo.HttpListenerPort == m_networkServersInfo.httpSSLPort)) | ||
80 | { | 76 | { |
81 | m_log.Error("[REGION SERVER]: HTTP Server config failed. HTTP Server and HTTPS server must be on different ports"); | 77 | m_log.Error("[REGION SERVER]: HTTP Server config failed. HTTP Server and HTTPS server must be on different ports"); |
82 | } | 78 | } |
83 | */ | ||
84 | m_log.InfoFormat("[REGION SERVER]: Starting HTTP{0} server on port {1}", | ||
85 | m_networkServersInfo.HttpUsesSSL ? "S" : "", m_httpServerPort); | ||
86 | m_httpServer.Start(); | ||
87 | 79 | ||
88 | MainServer.AddHttpServer(m_httpServer); | 80 | if(m_networkServersInfo.HttpUsesSSL) |
81 | { | ||
82 | m_httpServer = new BaseHttpServer( | ||
83 | mainSSLport, m_networkServersInfo.HttpUsesSSL, | ||
84 | mainSSLport, m_networkServersInfo.HttpSSLCN, | ||
85 | m_networkServersInfo.HttpSSLCertPath, m_networkServersInfo.HttpSSLCNCertPass); | ||
86 | m_httpServer.Start(true,true); | ||
87 | MainServer.AddHttpServer(m_httpServer); | ||
88 | |||
89 | } | ||
90 | |||
91 | // unsecure main server | ||
92 | BaseHttpServer server = new BaseHttpServer(mainport); | ||
93 | if(!m_networkServersInfo.HttpUsesSSL) | ||
94 | { | ||
95 | m_httpServer = server; | ||
96 | server.Start(true, true); | ||
97 | } | ||
98 | else | ||
99 | server.Start(false, false); | ||
100 | |||
101 | MainServer.AddHttpServer(server); | ||
102 | MainServer.ÚnSecureInstance = server; | ||
103 | |||
89 | MainServer.Instance = m_httpServer; | 104 | MainServer.Instance = m_httpServer; |
90 | 105 | ||
91 | // "OOB" Server | 106 | // "OOB" Server |
@@ -93,22 +108,22 @@ namespace OpenSim | |||
93 | { | 108 | { |
94 | if (!m_networkServersInfo.ssl_external) | 109 | if (!m_networkServersInfo.ssl_external) |
95 | { | 110 | { |
96 | BaseHttpServer server = new BaseHttpServer( | 111 | server = new BaseHttpServer( |
97 | m_networkServersInfo.https_port, m_networkServersInfo.ssl_listener, m_networkServersInfo.cert_path, | 112 | m_networkServersInfo.https_port, m_networkServersInfo.ssl_listener, |
113 | m_networkServersInfo.cert_path, | ||
98 | m_networkServersInfo.cert_pass); | 114 | m_networkServersInfo.cert_pass); |
99 | 115 | ||
100 | m_log.InfoFormat("[REGION SERVER]: Starting HTTPS server on port {0}", server.Port); | 116 | m_log.InfoFormat("[REGION SERVER]: Starting OOB HTTPS server on port {0}", server.SSLPort); |
117 | server.Start(false, false); | ||
101 | MainServer.AddHttpServer(server); | 118 | MainServer.AddHttpServer(server); |
102 | server.Start(); | ||
103 | } | 119 | } |
104 | else | 120 | else |
105 | { | 121 | { |
106 | BaseHttpServer server = new BaseHttpServer( | 122 | server = new BaseHttpServer(m_networkServersInfo.https_port); |
107 | m_networkServersInfo.https_port); | ||
108 | 123 | ||
109 | m_log.InfoFormat("[REGION SERVER]: Starting HTTP server on port {0} for external HTTPS", server.Port); | 124 | m_log.InfoFormat("[REGION SERVER]: Starting HTTP server on port {0} for external HTTPS", server.Port); |
125 | server.Start(false, false); | ||
110 | MainServer.AddHttpServer(server); | 126 | MainServer.AddHttpServer(server); |
111 | server.Start(); | ||
112 | } | 127 | } |
113 | } | 128 | } |
114 | 129 | ||
diff --git a/OpenSim/Region/OptionalModules/DataSnapshot/DataRequestHandler.cs b/OpenSim/Region/OptionalModules/DataSnapshot/DataRequestHandler.cs index 50276ae..9273b20 100644 --- a/OpenSim/Region/OptionalModules/DataSnapshot/DataRequestHandler.cs +++ b/OpenSim/Region/OptionalModules/DataSnapshot/DataRequestHandler.cs | |||
@@ -52,12 +52,12 @@ namespace OpenSim.Region.DataSnapshot | |||
52 | m_externalData = externalData; | 52 | m_externalData = externalData; |
53 | 53 | ||
54 | //Register HTTP handler | 54 | //Register HTTP handler |
55 | if (MainServer.Instance.AddHTTPHandler("collector", OnGetSnapshot)) | 55 | if (MainServer.ÚnSecureInstance.AddHTTPHandler("collector", OnGetSnapshot)) |
56 | { | 56 | { |
57 | m_log.Info("[DATASNAPSHOT]: Set up snapshot service"); | 57 | m_log.Info("[DATASNAPSHOT]: Set up snapshot service"); |
58 | } | 58 | } |
59 | // Register validation callback handler | 59 | // Register validation callback handler |
60 | MainServer.Instance.AddHTTPHandler("validate", OnValidate); | 60 | MainServer.ÚnSecureInstance.AddHTTPHandler("validate", OnValidate); |
61 | 61 | ||
62 | } | 62 | } |
63 | 63 | ||