本文整理汇总了C#中OpenSim.Framework.Servers.HttpServer.BaseHttpServer.SetSecureParams方法的典型用法代码示例。如果您正苦于以下问题:C# BaseHttpServer.SetSecureParams方法的具体用法?C# BaseHttpServer.SetSecureParams怎么用?C# BaseHttpServer.SetSecureParams使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenSim.Framework.Servers.HttpServer.BaseHttpServer
的用法示例。
在下文中一共展示了BaseHttpServer.SetSecureParams方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetHttpServer
public IHttpServer GetHttpServer (uint port, bool secure, string certPath, string certPass, SslProtocols sslProtocol)
{
if ((port == m_Port || port == 0) && HttpServer != null)
return HttpServer;
BaseHttpServer server;
if(m_Servers.TryGetValue(port, out server) && server.Secure == secure)
return server;
string hostName =
m_config.Configs["Network"].GetString("HostName", "http" + (secure ? "s" : "") + "://" + Utilities.GetExternalIp());
//Clean it up a bit
if (hostName.StartsWith("http://") || hostName.StartsWith("https://"))
hostName = hostName.Replace("https://", "").Replace("http://", "");
if (hostName.EndsWith ("/"))
hostName = hostName.Remove (hostName.Length - 1, 1);
server = new BaseHttpServer(port, hostName, secure);
try
{
if(secure)//Set these params now
server.SetSecureParams(certPath, certPass, sslProtocol);
server.Start();
}
catch(Exception)
{
//Remove the server from the list
m_Servers.Remove (port);
//Then pass the exception upwards
throw;
}
return (m_Servers[port] = server);
}
示例2: StartupSpecific
protected override void StartupSpecific()
{
m_storageManager = CreateStorageManager();
m_clientStackManager = CreateClientStackManager();
Initialize();
// Main HTTP server first
m_httpServer = new BaseHttpServer(m_httpServerPort, null);
m_httpServer.HostName = m_networkServersInfo.HostName;
MainServer.AddHttpServer(m_httpServer);
m_log.InfoFormat("[REGION]: Starting HTTP server on {0}:{1}", m_httpServer.HostName, m_httpServerPort);
m_httpServer.Start();
// If specified configure an ssl server for use as well
// you need a Cert Request/Signed pair installed in the MY store with the CN specified
if (m_networkServersInfo.HttpUsesSSL)
{
if (m_networkServersInfo.HttpListenerPort == m_networkServersInfo.httpSSLPort)
{
m_log.Error("[HTTP]: HTTP Server config failed. HTTP Server and HTTPS server must be on different ports");
}
else
{
/// XXX Should also support specifying an IP Address
BaseHttpServer secureServer = new BaseHttpServer(m_networkServersInfo.httpSSLPort, null);
secureServer.HostName = m_networkServersInfo.HostName;
if (m_networkServersInfo.HttpSSLCN != null)
secureServer.SetSecureParams(m_networkServersInfo.HttpSSLCN, m_networkServersInfo.sslProtocol);
else
secureServer.SetSecureParams(m_networkServersInfo.HttpSSLCert, m_networkServersInfo.HttpSSLPassword, m_networkServersInfo.sslProtocol);
MainServer.AddHttpServer(secureServer);
m_log.Info("[REGION]: Starting HTTPS server");
secureServer.Start();
}
}
base.StartupSpecific();
}