Fix out of process websocket check (#819)

This commit is contained in:
Justin Kotalik 2018-05-07 13:49:27 -07:00 committed by GitHub
parent 2b38e09bef
commit dc9db57389
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 31 deletions

View File

@ -178,7 +178,6 @@ ASPNETCORE_CONFIG::Populate(
IAppHostElement *pWindowsAuthenticationElement = NULL; IAppHostElement *pWindowsAuthenticationElement = NULL;
IAppHostElement *pBasicAuthenticationElement = NULL; IAppHostElement *pBasicAuthenticationElement = NULL;
IAppHostElement *pAnonymousAuthenticationElement = NULL; IAppHostElement *pAnonymousAuthenticationElement = NULL;
IAppHostElement *pWebSocketElement = NULL;
IAppHostElement *pEnvVarList = NULL; IAppHostElement *pEnvVarList = NULL;
IAppHostElement *pEnvVar = NULL; IAppHostElement *pEnvVar = NULL;
IAppHostElementCollection *pEnvVarCollection = NULL; IAppHostElementCollection *pEnvVarCollection = NULL;
@ -192,7 +191,6 @@ ASPNETCORE_CONFIG::Populate(
BSTR bstrBasicAuthSection = NULL; BSTR bstrBasicAuthSection = NULL;
BSTR bstrAnonymousAuthSection = NULL; BSTR bstrAnonymousAuthSection = NULL;
BSTR bstrAspNetCoreSection = NULL; BSTR bstrAspNetCoreSection = NULL;
BSTR bstrWebsocketSection = NULL;
m_pEnvironmentVariables = new ENVIRONMENT_VAR_HASH(); m_pEnvironmentVariables = new ENVIRONMENT_VAR_HASH();
if (m_pEnvironmentVariables == NULL) if (m_pEnvironmentVariables == NULL)
@ -322,29 +320,18 @@ ASPNETCORE_CONFIG::Populate(
} }
} }
bstrWebsocketSection = SysAllocString(CS_WEBSOCKET_SECTION); // Even though the applicationhost.config file contains the websocket element,
if (bstrWebsocketSection == NULL) // the websocket module may still not be enabled. Check if the
{ PCWSTR pszVariableValue;
hr = E_OUTOFMEMORY; DWORD cbLength;
goto Finished; hr = pHttpContext->GetServerVariable("WEBSOCKET_VERSION", &pszVariableValue, &cbLength);
}
hr = pAdminManager->GetAdminSection(bstrWebsocketSection,
m_struConfigPath.QueryStr(),
&pWebSocketElement);
if (FAILED(hr)) if (FAILED(hr))
{ {
m_fWebSocketEnabled = FALSE; m_fWebSocketEnabled = FALSE;
} }
else else
{ {
hr = GetElementBoolProperty(pWebSocketElement, m_fWebSocketEnabled = TRUE;
CS_ENABLED,
&m_fWebSocketEnabled);
if (FAILED(hr))
{
goto Finished;
}
} }
bstrAspNetCoreSection = SysAllocString(CS_ASPNETCORE_SECTION); bstrAspNetCoreSection = SysAllocString(CS_ASPNETCORE_SECTION);
@ -557,12 +544,6 @@ Finished:
pAspNetCoreElement = NULL; pAspNetCoreElement = NULL;
} }
if (pWebSocketElement != NULL)
{
pWebSocketElement->Release();
pWebSocketElement = NULL;
}
if (pWindowsAuthenticationElement != NULL) if (pWindowsAuthenticationElement != NULL)
{ {
pWindowsAuthenticationElement->Release(); pWindowsAuthenticationElement->Release();

View File

@ -362,7 +362,6 @@ public:
return hr; return hr;
} }
static static
HRESULT HRESULT
AddWebsocketEnabledToEnvironmentVariables AddWebsocketEnabledToEnvironmentVariables

View File

@ -23,7 +23,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
} }
[Fact] [Fact]
public Task UpgradeFeatureDetectionEnabled_InProcess_IISExpress_CoreClr_x64_Portable() public Task UpgradeFeatureDetectionDisabled_InProcess_IISExpress_CoreClr_x64_Portable()
{ {
return UpgradeFeatureDetectionDeployer(RuntimeFlavor.CoreClr, return UpgradeFeatureDetectionDeployer(RuntimeFlavor.CoreClr,
ApplicationType.Portable, ApplicationType.Portable,
@ -33,7 +33,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
} }
[Fact] [Fact]
public Task UpgradeFeatureDetectionDisabled_InProcess_IISExpress_CoreClr_x64_Portable() public Task UpgradeFeatureDetectionEnabled_InProcess_IISExpress_CoreClr_x64_Portable()
{ {
return UpgradeFeatureDetectionDeployer(RuntimeFlavor.CoreClr, return UpgradeFeatureDetectionDeployer(RuntimeFlavor.CoreClr,
ApplicationType.Portable, ApplicationType.Portable,
@ -43,7 +43,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
} }
[Fact] [Fact]
public Task UpgradeFeatureDetectionEnabled_OutOfProcess_IISExpress_CoreClr_x64_Portable() public Task UpgradeFeatureDetectionDisabled_OutOfProcess_IISExpress_CoreClr_x64_Portable()
{ {
return UpgradeFeatureDetectionDeployer(RuntimeFlavor.CoreClr, return UpgradeFeatureDetectionDeployer(RuntimeFlavor.CoreClr,
ApplicationType.Portable, ApplicationType.Portable,
@ -52,8 +52,9 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
"Disabled"); "Disabled");
} }
// This test is failing on win7 and win2008
[Fact] [Fact]
public Task UpgradeFeatureDetectionDisabled_OutOfProcess_IISExpress_CoreClr_x64_Portable() public Task UpgradeFeatureDetectionEnabled_OutOfProcess_IISExpress_CoreClr_x64_Portable()
{ {
return UpgradeFeatureDetectionDeployer(RuntimeFlavor.CoreClr, return UpgradeFeatureDetectionDeployer(RuntimeFlavor.CoreClr,
ApplicationType.Portable, ApplicationType.Portable,
@ -89,7 +90,6 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
{ {
var deploymentResult = await deployer.DeployAsync(); var deploymentResult = await deployer.DeployAsync();
deploymentResult.HttpClient.Timeout = TimeSpan.FromSeconds(5); deploymentResult.HttpClient.Timeout = TimeSpan.FromSeconds(5);
// Request to base address and check if various parts of the body are rendered & measure the cold startup time. // Request to base address and check if various parts of the body are rendered & measure the cold startup time.
var response = await RetryHelper.RetryRequest(() => var response = await RetryHelper.RetryRequest(() =>
{ {