websocket enabled check (#612)
This commit is contained in:
parent
792b72e71a
commit
71b90a31a9
|
|
@ -148,6 +148,7 @@ ASPNETCORE_CONFIG::Populate(
|
|||
IAppHostElement *pWindowsAuthenticationElement = NULL;
|
||||
IAppHostElement *pBasicAuthenticationElement = NULL;
|
||||
IAppHostElement *pAnonymousAuthenticationElement = NULL;
|
||||
IAppHostElement *pWebSocketElement = NULL;
|
||||
IAppHostElement *pEnvVarList = NULL;
|
||||
IAppHostElement *pEnvVar = NULL;
|
||||
IAppHostElementCollection *pEnvVarCollection = NULL;
|
||||
|
|
@ -161,6 +162,7 @@ ASPNETCORE_CONFIG::Populate(
|
|||
BSTR bstrBasicAuthSection = NULL;
|
||||
BSTR bstrAnonymousAuthSection = NULL;
|
||||
BSTR bstrAspNetCoreSection = NULL;
|
||||
BSTR bstrWebsocketSection = NULL;
|
||||
|
||||
m_pEnvironmentVariables = new ENVIRONMENT_VAR_HASH();
|
||||
if (m_pEnvironmentVariables == NULL)
|
||||
|
|
@ -235,7 +237,7 @@ ASPNETCORE_CONFIG::Populate(
|
|||
else
|
||||
{
|
||||
hr = GetElementBoolProperty(pWindowsAuthenticationElement,
|
||||
CS_AUTHENTICATION_ENABLED,
|
||||
CS_ENABLED,
|
||||
&m_fWindowsAuthEnabled);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
|
|
@ -259,7 +261,7 @@ ASPNETCORE_CONFIG::Populate(
|
|||
else
|
||||
{
|
||||
hr = GetElementBoolProperty(pBasicAuthenticationElement,
|
||||
CS_AUTHENTICATION_ENABLED,
|
||||
CS_ENABLED,
|
||||
&m_fBasicAuthEnabled);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
|
|
@ -282,7 +284,7 @@ ASPNETCORE_CONFIG::Populate(
|
|||
else
|
||||
{
|
||||
hr = GetElementBoolProperty(pAnonymousAuthenticationElement,
|
||||
CS_AUTHENTICATION_ENABLED,
|
||||
CS_ENABLED,
|
||||
&m_fAnonymousAuthEnabled);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
|
|
@ -290,6 +292,31 @@ ASPNETCORE_CONFIG::Populate(
|
|||
}
|
||||
}
|
||||
|
||||
bstrWebsocketSection = SysAllocString(CS_WEBSOCKET_SECTION);
|
||||
if (bstrWebsocketSection == NULL)
|
||||
{
|
||||
hr = E_OUTOFMEMORY;
|
||||
goto Finished;
|
||||
}
|
||||
|
||||
hr = pAdminManager->GetAdminSection(bstrWebsocketSection,
|
||||
m_struConfigPath.QueryStr(),
|
||||
&pWebSocketElement);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
m_fWebSocketEnabled = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
hr = GetElementBoolProperty(pWebSocketElement,
|
||||
CS_ENABLED,
|
||||
&m_fWebSocketEnabled);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
goto Finished;
|
||||
}
|
||||
}
|
||||
|
||||
bstrAspNetCoreSection = SysAllocString(CS_ASPNETCORE_SECTION);
|
||||
if (bstrAspNetCoreSection == NULL)
|
||||
{
|
||||
|
|
@ -500,6 +527,30 @@ Finished:
|
|||
pAspNetCoreElement = NULL;
|
||||
}
|
||||
|
||||
if (pWebSocketElement != NULL)
|
||||
{
|
||||
pWebSocketElement->Release();
|
||||
pWebSocketElement = NULL;
|
||||
}
|
||||
|
||||
if (pWindowsAuthenticationElement != NULL)
|
||||
{
|
||||
pWindowsAuthenticationElement->Release();
|
||||
pWindowsAuthenticationElement = NULL;
|
||||
}
|
||||
|
||||
if (pAnonymousAuthenticationElement!= NULL)
|
||||
{
|
||||
pAnonymousAuthenticationElement->Release();
|
||||
pAnonymousAuthenticationElement = NULL;
|
||||
}
|
||||
|
||||
if (pBasicAuthenticationElement != NULL)
|
||||
{
|
||||
pBasicAuthenticationElement->Release();
|
||||
pBasicAuthenticationElement = NULL;
|
||||
}
|
||||
|
||||
if (pEnvVarList != NULL)
|
||||
{
|
||||
pEnvVarList->Release();
|
||||
|
|
|
|||
|
|
@ -8,7 +8,8 @@
|
|||
#define CS_WINDOWS_AUTHENTICATION_SECTION L"system.webServer/security/authentication/windowsAuthentication"
|
||||
#define CS_BASIC_AUTHENTICATION_SECTION L"system.webServer/security/authentication/basicAuthentication"
|
||||
#define CS_ANONYMOUS_AUTHENTICATION_SECTION L"system.webServer/security/authentication/anonymousAuthentication"
|
||||
#define CS_AUTHENTICATION_ENABLED L"enabled"
|
||||
#define CS_WEBSOCKET_SECTION L"system.webServer/webSocket"
|
||||
#define CS_ENABLED L"enabled"
|
||||
#define CS_ASPNETCORE_PROCESS_EXE_PATH L"processPath"
|
||||
#define CS_ASPNETCORE_PROCESS_ARGUMENTS L"arguments"
|
||||
#define CS_ASPNETCORE_PROCESS_STARTUP_TIME_LIMIT L"startupTimeLimit"
|
||||
|
|
@ -154,7 +155,7 @@ public:
|
|||
STRU*
|
||||
QueryProcessPath(
|
||||
VOID
|
||||
)
|
||||
)
|
||||
{
|
||||
return &m_struProcessPath;
|
||||
}
|
||||
|
|
@ -168,11 +169,17 @@ public:
|
|||
}
|
||||
|
||||
BOOL
|
||||
QueryStdoutLogEnabled()
|
||||
QueryStdoutLogEnabled()
|
||||
{
|
||||
return m_fStdoutLogEnabled;
|
||||
}
|
||||
|
||||
BOOL
|
||||
QueryWebSocketEnabled()
|
||||
{
|
||||
return m_fWebSocketEnabled;
|
||||
}
|
||||
|
||||
BOOL
|
||||
QueryForwardWindowsAuthToken()
|
||||
{
|
||||
|
|
@ -315,7 +322,7 @@ private:
|
|||
BOOL m_fWindowsAuthEnabled;
|
||||
BOOL m_fBasicAuthEnabled;
|
||||
BOOL m_fAnonymousAuthEnabled;
|
||||
BOOL m_fIsStandAloneApplication;
|
||||
BOOL m_fWebSocketEnabled;
|
||||
APP_HOSTING_MODEL m_hostingModel;
|
||||
ENVIRONMENT_VAR_HASH* m_pEnvironmentVariables;
|
||||
STRU m_struHostFxrLocation;
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ FORWARDING_HANDLER::OnExecuteRequestHandler()
|
|||
//
|
||||
// Mark request as websocket if upgrade header is present.
|
||||
//
|
||||
if (g_fWebSocketSupported)
|
||||
if (pApplication->QueryConfig()->QueryWebSocketEnabled())
|
||||
{
|
||||
USHORT cchHeader = 0;
|
||||
PCSTR pszWebSocketHeader = pRequest->GetHeader("Upgrade", &cchHeader);
|
||||
|
|
|
|||
Loading…
Reference in New Issue