Merge pull request #768 from aspnet/jkotalik/ancmCurrent
Port ANCM current to github.
This commit is contained in:
commit
589a672521
|
|
@ -37,10 +37,10 @@ project.lock.json
|
||||||
*.CppClean.log
|
*.CppClean.log
|
||||||
*msbuild.log
|
*msbuild.log
|
||||||
|
|
||||||
src/*/Debug/
|
src/*/*/Debug/
|
||||||
src/*/x64/Debug/
|
src/*/*/x64/Debug/
|
||||||
src/*/Release/
|
src/*/*/Release/
|
||||||
src/*/x64/Release/
|
src/*/*/x64/Release/
|
||||||
x64/
|
x64/
|
||||||
|
|
||||||
*vcxproj.filters
|
*vcxproj.filters
|
||||||
|
|
@ -49,12 +49,13 @@ x64/
|
||||||
*.lib
|
*.lib
|
||||||
*.idb
|
*.idb
|
||||||
|
|
||||||
src/AspNetCore/aspnetcore_msg.h
|
src/*/AspNetCore/aspnetcoremodule.h
|
||||||
src/AspNetCore/aspnetcore_msg.rc
|
src/*/AspNetCore/aspnetcore_msg.h
|
||||||
src/AspNetCore/version.h
|
src/*/AspNetCore/aspnetcore_msg.rc
|
||||||
src/RequestHandler/version.h
|
src/*/*/version.h
|
||||||
src/CommonLib/aspnetcore_msg.h
|
src/*/RequestHandler/version.h
|
||||||
src/CommonLib/aspnetcore_msg.rc
|
src/*/CommonLib/aspnetcore_msg.h
|
||||||
|
src/*/CommonLib/aspnetcore_msg.rc
|
||||||
test/*/Debug
|
test/*/Debug
|
||||||
test/*/Release
|
test/*/Release
|
||||||
test/gtest-1.8.0/msvc/Debug
|
test/gtest-1.8.0/msvc/Debug
|
||||||
|
|
|
||||||
|
|
@ -60,14 +60,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InProcessWebSite", "test\We
|
||||||
{439824F9-1455-4CC4-BD79-B44FA0A16552} = {439824F9-1455-4CC4-BD79-B44FA0A16552}
|
{439824F9-1455-4CC4-BD79-B44FA0A16552} = {439824F9-1455-4CC4-BD79-B44FA0A16552}
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AspNetCore", "src\AspNetCore\AspNetCore.vcxproj", "{439824F9-1455-4CC4-BD79-B44FA0A16552}"
|
|
||||||
EndProject
|
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IISLib", "src\IISLib\IISLib.vcxproj", "{4787A64F-9A3E-4867-A55A-70CB4B2B2FFE}"
|
|
||||||
EndProject
|
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CommonLib", "src\CommonLib\CommonLib.vcxproj", "{55494E58-E061-4C4C-A0A8-837008E72F85}"
|
|
||||||
EndProject
|
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RequestHandler", "src\RequestHandler\RequestHandler.vcxproj", "{D57EA297-6DC2-4BC0-8C91-334863327863}"
|
|
||||||
EndProject
|
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Server.IIS", "src\Microsoft.AspNetCore.Server.IIS\Microsoft.AspNetCore.Server.IIS.csproj", "{46A8612B-418B-4D70-B3A7-A21DD0627473}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Server.IIS", "src\Microsoft.AspNetCore.Server.IIS\Microsoft.AspNetCore.Server.IIS.csproj", "{46A8612B-418B-4D70-B3A7-A21DD0627473}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StressTestWebSite", "test\WebSites\StressTestWebSite\StressTestWebSite.csproj", "{13FD8F12-FFBE-4D01-B4AC-444F2994B04F}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StressTestWebSite", "test\WebSites\StressTestWebSite\StressTestWebSite.csproj", "{13FD8F12-FFBE-4D01-B4AC-444F2994B04F}"
|
||||||
|
|
@ -86,6 +78,22 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CommonLibTests", "test\Comm
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtest", "test\gtest-1.8.0\msvc\gtest.vcxproj", "{2AF210A9-5BDC-45E8-95DD-07B5A2616493}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtest", "test\gtest-1.8.0\msvc\gtest.vcxproj", "{2AF210A9-5BDC-45E8-95DD-07B5A2616493}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AspNetCoreModuleV1", "AspNetCoreModuleV1", "{16E521CE-77F1-4B1C-A183-520A41C4F372}"
|
||||||
|
EndProject
|
||||||
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AspNetCoreModuleV2", "AspNetCoreModuleV2", "{06CA2C2B-83B0-4D83-905A-E0C74790009E}"
|
||||||
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IISLib", "src\AspNetCoreModuleV1\IISLib\IISLib.vcxproj", "{4787A64F-9A3E-4867-A55A-70CB4B2B2FFE}"
|
||||||
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AspNetCore", "src\AspNetCoreModuleV1\AspNetCore\AspNetCore.vcxproj", "{439824F9-1455-4CC4-BD79-B44FA0A16552}"
|
||||||
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AspNetCore", "src\AspNetCoreModuleV2\AspNetCore\AspNetCore.vcxproj", "{EC82302F-D2F0-4727-99D1-EABC0DD9DC3B}"
|
||||||
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CommonLib", "src\AspNetCoreModuleV2\CommonLib\CommonLib.vcxproj", "{55494E58-E061-4C4C-A0A8-837008E72F85}"
|
||||||
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IISLib", "src\AspNetCoreModuleV2\IISLib\IISLib.vcxproj", "{09D9D1D6-2951-4E14-BC35-76A23CF9391A}"
|
||||||
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RequestHandler", "src\AspNetCoreModuleV2\RequestHandler\RequestHandler.vcxproj", "{D57EA297-6DC2-4BC0-8C91-334863327863}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
|
@ -176,46 +184,6 @@ Global
|
||||||
{679FA2A2-898B-4320-884E-C2D294A97CE1}.Release|x64.Build.0 = Release|x64
|
{679FA2A2-898B-4320-884E-C2D294A97CE1}.Release|x64.Build.0 = Release|x64
|
||||||
{679FA2A2-898B-4320-884E-C2D294A97CE1}.Release|x86.ActiveCfg = Release|x86
|
{679FA2A2-898B-4320-884E-C2D294A97CE1}.Release|x86.ActiveCfg = Release|x86
|
||||||
{679FA2A2-898B-4320-884E-C2D294A97CE1}.Release|x86.Build.0 = Release|x86
|
{679FA2A2-898B-4320-884E-C2D294A97CE1}.Release|x86.Build.0 = Release|x86
|
||||||
{439824F9-1455-4CC4-BD79-B44FA0A16552}.Debug|Any CPU.ActiveCfg = Debug|x64
|
|
||||||
{439824F9-1455-4CC4-BD79-B44FA0A16552}.Debug|x64.ActiveCfg = Debug|x64
|
|
||||||
{439824F9-1455-4CC4-BD79-B44FA0A16552}.Debug|x64.Build.0 = Debug|x64
|
|
||||||
{439824F9-1455-4CC4-BD79-B44FA0A16552}.Debug|x86.ActiveCfg = Debug|Win32
|
|
||||||
{439824F9-1455-4CC4-BD79-B44FA0A16552}.Debug|x86.Build.0 = Debug|Win32
|
|
||||||
{439824F9-1455-4CC4-BD79-B44FA0A16552}.Release|Any CPU.ActiveCfg = Release|x64
|
|
||||||
{439824F9-1455-4CC4-BD79-B44FA0A16552}.Release|x64.ActiveCfg = Release|x64
|
|
||||||
{439824F9-1455-4CC4-BD79-B44FA0A16552}.Release|x64.Build.0 = Release|x64
|
|
||||||
{439824F9-1455-4CC4-BD79-B44FA0A16552}.Release|x86.ActiveCfg = Release|Win32
|
|
||||||
{439824F9-1455-4CC4-BD79-B44FA0A16552}.Release|x86.Build.0 = Release|Win32
|
|
||||||
{4787A64F-9A3E-4867-A55A-70CB4B2B2FFE}.Debug|Any CPU.ActiveCfg = Debug|x64
|
|
||||||
{4787A64F-9A3E-4867-A55A-70CB4B2B2FFE}.Debug|x64.ActiveCfg = Debug|x64
|
|
||||||
{4787A64F-9A3E-4867-A55A-70CB4B2B2FFE}.Debug|x64.Build.0 = Debug|x64
|
|
||||||
{4787A64F-9A3E-4867-A55A-70CB4B2B2FFE}.Debug|x86.ActiveCfg = Debug|Win32
|
|
||||||
{4787A64F-9A3E-4867-A55A-70CB4B2B2FFE}.Debug|x86.Build.0 = Debug|Win32
|
|
||||||
{4787A64F-9A3E-4867-A55A-70CB4B2B2FFE}.Release|Any CPU.ActiveCfg = Release|x64
|
|
||||||
{4787A64F-9A3E-4867-A55A-70CB4B2B2FFE}.Release|x64.ActiveCfg = Release|x64
|
|
||||||
{4787A64F-9A3E-4867-A55A-70CB4B2B2FFE}.Release|x64.Build.0 = Release|x64
|
|
||||||
{4787A64F-9A3E-4867-A55A-70CB4B2B2FFE}.Release|x86.ActiveCfg = Release|Win32
|
|
||||||
{4787A64F-9A3E-4867-A55A-70CB4B2B2FFE}.Release|x86.Build.0 = Release|Win32
|
|
||||||
{55494E58-E061-4C4C-A0A8-837008E72F85}.Debug|Any CPU.ActiveCfg = Debug|x64
|
|
||||||
{55494E58-E061-4C4C-A0A8-837008E72F85}.Debug|x64.ActiveCfg = Debug|x64
|
|
||||||
{55494E58-E061-4C4C-A0A8-837008E72F85}.Debug|x64.Build.0 = Debug|x64
|
|
||||||
{55494E58-E061-4C4C-A0A8-837008E72F85}.Debug|x86.ActiveCfg = Debug|Win32
|
|
||||||
{55494E58-E061-4C4C-A0A8-837008E72F85}.Debug|x86.Build.0 = Debug|Win32
|
|
||||||
{55494E58-E061-4C4C-A0A8-837008E72F85}.Release|Any CPU.ActiveCfg = Release|x64
|
|
||||||
{55494E58-E061-4C4C-A0A8-837008E72F85}.Release|x64.ActiveCfg = Release|x64
|
|
||||||
{55494E58-E061-4C4C-A0A8-837008E72F85}.Release|x64.Build.0 = Release|x64
|
|
||||||
{55494E58-E061-4C4C-A0A8-837008E72F85}.Release|x86.ActiveCfg = Release|Win32
|
|
||||||
{55494E58-E061-4C4C-A0A8-837008E72F85}.Release|x86.Build.0 = Release|Win32
|
|
||||||
{D57EA297-6DC2-4BC0-8C91-334863327863}.Debug|Any CPU.ActiveCfg = Debug|Win32
|
|
||||||
{D57EA297-6DC2-4BC0-8C91-334863327863}.Debug|x64.ActiveCfg = Debug|x64
|
|
||||||
{D57EA297-6DC2-4BC0-8C91-334863327863}.Debug|x64.Build.0 = Debug|x64
|
|
||||||
{D57EA297-6DC2-4BC0-8C91-334863327863}.Debug|x86.ActiveCfg = Debug|Win32
|
|
||||||
{D57EA297-6DC2-4BC0-8C91-334863327863}.Debug|x86.Build.0 = Debug|Win32
|
|
||||||
{D57EA297-6DC2-4BC0-8C91-334863327863}.Release|Any CPU.ActiveCfg = Release|Win32
|
|
||||||
{D57EA297-6DC2-4BC0-8C91-334863327863}.Release|x64.ActiveCfg = Release|x64
|
|
||||||
{D57EA297-6DC2-4BC0-8C91-334863327863}.Release|x64.Build.0 = Release|x64
|
|
||||||
{D57EA297-6DC2-4BC0-8C91-334863327863}.Release|x86.ActiveCfg = Release|Win32
|
|
||||||
{D57EA297-6DC2-4BC0-8C91-334863327863}.Release|x86.Build.0 = Release|Win32
|
|
||||||
{46A8612B-418B-4D70-B3A7-A21DD0627473}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{46A8612B-418B-4D70-B3A7-A21DD0627473}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{46A8612B-418B-4D70-B3A7-A21DD0627473}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{46A8612B-418B-4D70-B3A7-A21DD0627473}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{46A8612B-418B-4D70-B3A7-A21DD0627473}.Debug|x64.ActiveCfg = Debug|Any CPU
|
{46A8612B-418B-4D70-B3A7-A21DD0627473}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
|
@ -260,6 +228,86 @@ Global
|
||||||
{FC2A97F8-A749-4C04-97D1-97500066A820}.Release|x64.Build.0 = Release|x64
|
{FC2A97F8-A749-4C04-97D1-97500066A820}.Release|x64.Build.0 = Release|x64
|
||||||
{FC2A97F8-A749-4C04-97D1-97500066A820}.Release|x86.ActiveCfg = Release|x86
|
{FC2A97F8-A749-4C04-97D1-97500066A820}.Release|x86.ActiveCfg = Release|x86
|
||||||
{FC2A97F8-A749-4C04-97D1-97500066A820}.Release|x86.Build.0 = Release|x86
|
{FC2A97F8-A749-4C04-97D1-97500066A820}.Release|x86.Build.0 = Release|x86
|
||||||
|
{1EAC8125-1765-4E2D-8CBE-56DC98A1C8C1}.Debug|Any CPU.ActiveCfg = Debug|Win32
|
||||||
|
{1EAC8125-1765-4E2D-8CBE-56DC98A1C8C1}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{1EAC8125-1765-4E2D-8CBE-56DC98A1C8C1}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{1EAC8125-1765-4E2D-8CBE-56DC98A1C8C1}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
|
{1EAC8125-1765-4E2D-8CBE-56DC98A1C8C1}.Debug|x86.Build.0 = Debug|Win32
|
||||||
|
{1EAC8125-1765-4E2D-8CBE-56DC98A1C8C1}.Release|Any CPU.ActiveCfg = Release|Win32
|
||||||
|
{1EAC8125-1765-4E2D-8CBE-56DC98A1C8C1}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{1EAC8125-1765-4E2D-8CBE-56DC98A1C8C1}.Release|x64.Build.0 = Release|x64
|
||||||
|
{1EAC8125-1765-4E2D-8CBE-56DC98A1C8C1}.Release|x86.ActiveCfg = Release|Win32
|
||||||
|
{1EAC8125-1765-4E2D-8CBE-56DC98A1C8C1}.Release|x86.Build.0 = Release|Win32
|
||||||
|
{2AF210A9-5BDC-45E8-95DD-07B5A2616493}.Debug|Any CPU.ActiveCfg = Debug|Win32
|
||||||
|
{2AF210A9-5BDC-45E8-95DD-07B5A2616493}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{2AF210A9-5BDC-45E8-95DD-07B5A2616493}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{2AF210A9-5BDC-45E8-95DD-07B5A2616493}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
|
{2AF210A9-5BDC-45E8-95DD-07B5A2616493}.Debug|x86.Build.0 = Debug|Win32
|
||||||
|
{2AF210A9-5BDC-45E8-95DD-07B5A2616493}.Release|Any CPU.ActiveCfg = Release|Win32
|
||||||
|
{2AF210A9-5BDC-45E8-95DD-07B5A2616493}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{2AF210A9-5BDC-45E8-95DD-07B5A2616493}.Release|x64.Build.0 = Release|x64
|
||||||
|
{2AF210A9-5BDC-45E8-95DD-07B5A2616493}.Release|x86.ActiveCfg = Release|Win32
|
||||||
|
{2AF210A9-5BDC-45E8-95DD-07B5A2616493}.Release|x86.Build.0 = Release|Win32
|
||||||
|
{4787A64F-9A3E-4867-A55A-70CB4B2B2FFE}.Debug|Any CPU.ActiveCfg = Debug|Win32
|
||||||
|
{4787A64F-9A3E-4867-A55A-70CB4B2B2FFE}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{4787A64F-9A3E-4867-A55A-70CB4B2B2FFE}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{4787A64F-9A3E-4867-A55A-70CB4B2B2FFE}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
|
{4787A64F-9A3E-4867-A55A-70CB4B2B2FFE}.Debug|x86.Build.0 = Debug|Win32
|
||||||
|
{4787A64F-9A3E-4867-A55A-70CB4B2B2FFE}.Release|Any CPU.ActiveCfg = Release|Win32
|
||||||
|
{4787A64F-9A3E-4867-A55A-70CB4B2B2FFE}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{4787A64F-9A3E-4867-A55A-70CB4B2B2FFE}.Release|x64.Build.0 = Release|x64
|
||||||
|
{4787A64F-9A3E-4867-A55A-70CB4B2B2FFE}.Release|x86.ActiveCfg = Release|Win32
|
||||||
|
{4787A64F-9A3E-4867-A55A-70CB4B2B2FFE}.Release|x86.Build.0 = Release|Win32
|
||||||
|
{439824F9-1455-4CC4-BD79-B44FA0A16552}.Debug|Any CPU.ActiveCfg = Debug|Win32
|
||||||
|
{439824F9-1455-4CC4-BD79-B44FA0A16552}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{439824F9-1455-4CC4-BD79-B44FA0A16552}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{439824F9-1455-4CC4-BD79-B44FA0A16552}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
|
{439824F9-1455-4CC4-BD79-B44FA0A16552}.Debug|x86.Build.0 = Debug|Win32
|
||||||
|
{439824F9-1455-4CC4-BD79-B44FA0A16552}.Release|Any CPU.ActiveCfg = Release|Win32
|
||||||
|
{439824F9-1455-4CC4-BD79-B44FA0A16552}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{439824F9-1455-4CC4-BD79-B44FA0A16552}.Release|x64.Build.0 = Release|x64
|
||||||
|
{439824F9-1455-4CC4-BD79-B44FA0A16552}.Release|x86.ActiveCfg = Release|Win32
|
||||||
|
{439824F9-1455-4CC4-BD79-B44FA0A16552}.Release|x86.Build.0 = Release|Win32
|
||||||
|
{EC82302F-D2F0-4727-99D1-EABC0DD9DC3B}.Debug|Any CPU.ActiveCfg = Debug|Win32
|
||||||
|
{EC82302F-D2F0-4727-99D1-EABC0DD9DC3B}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{EC82302F-D2F0-4727-99D1-EABC0DD9DC3B}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{EC82302F-D2F0-4727-99D1-EABC0DD9DC3B}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
|
{EC82302F-D2F0-4727-99D1-EABC0DD9DC3B}.Debug|x86.Build.0 = Debug|Win32
|
||||||
|
{EC82302F-D2F0-4727-99D1-EABC0DD9DC3B}.Release|Any CPU.ActiveCfg = Release|Win32
|
||||||
|
{EC82302F-D2F0-4727-99D1-EABC0DD9DC3B}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{EC82302F-D2F0-4727-99D1-EABC0DD9DC3B}.Release|x64.Build.0 = Release|x64
|
||||||
|
{EC82302F-D2F0-4727-99D1-EABC0DD9DC3B}.Release|x86.ActiveCfg = Release|Win32
|
||||||
|
{EC82302F-D2F0-4727-99D1-EABC0DD9DC3B}.Release|x86.Build.0 = Release|Win32
|
||||||
|
{55494E58-E061-4C4C-A0A8-837008E72F85}.Debug|Any CPU.ActiveCfg = Debug|Win32
|
||||||
|
{55494E58-E061-4C4C-A0A8-837008E72F85}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{55494E58-E061-4C4C-A0A8-837008E72F85}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{55494E58-E061-4C4C-A0A8-837008E72F85}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
|
{55494E58-E061-4C4C-A0A8-837008E72F85}.Debug|x86.Build.0 = Debug|Win32
|
||||||
|
{55494E58-E061-4C4C-A0A8-837008E72F85}.Release|Any CPU.ActiveCfg = Release|Win32
|
||||||
|
{55494E58-E061-4C4C-A0A8-837008E72F85}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{55494E58-E061-4C4C-A0A8-837008E72F85}.Release|x64.Build.0 = Release|x64
|
||||||
|
{55494E58-E061-4C4C-A0A8-837008E72F85}.Release|x86.ActiveCfg = Release|Win32
|
||||||
|
{55494E58-E061-4C4C-A0A8-837008E72F85}.Release|x86.Build.0 = Release|Win32
|
||||||
|
{09D9D1D6-2951-4E14-BC35-76A23CF9391A}.Debug|Any CPU.ActiveCfg = Debug|Win32
|
||||||
|
{09D9D1D6-2951-4E14-BC35-76A23CF9391A}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{09D9D1D6-2951-4E14-BC35-76A23CF9391A}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{09D9D1D6-2951-4E14-BC35-76A23CF9391A}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
|
{09D9D1D6-2951-4E14-BC35-76A23CF9391A}.Debug|x86.Build.0 = Debug|Win32
|
||||||
|
{09D9D1D6-2951-4E14-BC35-76A23CF9391A}.Release|Any CPU.ActiveCfg = Release|Win32
|
||||||
|
{09D9D1D6-2951-4E14-BC35-76A23CF9391A}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{09D9D1D6-2951-4E14-BC35-76A23CF9391A}.Release|x64.Build.0 = Release|x64
|
||||||
|
{09D9D1D6-2951-4E14-BC35-76A23CF9391A}.Release|x86.ActiveCfg = Release|Win32
|
||||||
|
{09D9D1D6-2951-4E14-BC35-76A23CF9391A}.Release|x86.Build.0 = Release|Win32
|
||||||
|
{D57EA297-6DC2-4BC0-8C91-334863327863}.Debug|Any CPU.ActiveCfg = Debug|Win32
|
||||||
|
{D57EA297-6DC2-4BC0-8C91-334863327863}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{D57EA297-6DC2-4BC0-8C91-334863327863}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{D57EA297-6DC2-4BC0-8C91-334863327863}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
|
{D57EA297-6DC2-4BC0-8C91-334863327863}.Debug|x86.Build.0 = Debug|Win32
|
||||||
|
{D57EA297-6DC2-4BC0-8C91-334863327863}.Release|Any CPU.ActiveCfg = Release|Win32
|
||||||
|
{D57EA297-6DC2-4BC0-8C91-334863327863}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{D57EA297-6DC2-4BC0-8C91-334863327863}.Release|x64.Build.0 = Release|x64
|
||||||
|
{D57EA297-6DC2-4BC0-8C91-334863327863}.Release|x86.ActiveCfg = Release|Win32
|
||||||
|
{D57EA297-6DC2-4BC0-8C91-334863327863}.Release|x86.Build.0 = Release|Win32
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|
@ -272,15 +320,21 @@ Global
|
||||||
{4E3E1F5C-CD52-4CC0-A35F-D1FA1685D2FA} = {EF30B533-D715-421A-92B7-92FEF460AC9C}
|
{4E3E1F5C-CD52-4CC0-A35F-D1FA1685D2FA} = {EF30B533-D715-421A-92B7-92FEF460AC9C}
|
||||||
{9BC4AFCB-325D-4C81-8228-8CF301CE2F97} = {C74B8F36-FD2F-45C9-9B8A-00E7CF0126A9}
|
{9BC4AFCB-325D-4C81-8228-8CF301CE2F97} = {C74B8F36-FD2F-45C9-9B8A-00E7CF0126A9}
|
||||||
{679FA2A2-898B-4320-884E-C2D294A97CE1} = {744ACDC6-F6A0-4FF9-9421-F25C5F2DC520}
|
{679FA2A2-898B-4320-884E-C2D294A97CE1} = {744ACDC6-F6A0-4FF9-9421-F25C5F2DC520}
|
||||||
{439824F9-1455-4CC4-BD79-B44FA0A16552} = {04B1EDB6-E967-4D25-89B9-E6F8304038CD}
|
|
||||||
{4787A64F-9A3E-4867-A55A-70CB4B2B2FFE} = {04B1EDB6-E967-4D25-89B9-E6F8304038CD}
|
|
||||||
{55494E58-E061-4C4C-A0A8-837008E72F85} = {04B1EDB6-E967-4D25-89B9-E6F8304038CD}
|
|
||||||
{D57EA297-6DC2-4BC0-8C91-334863327863} = {04B1EDB6-E967-4D25-89B9-E6F8304038CD}
|
|
||||||
{46A8612B-418B-4D70-B3A7-A21DD0627473} = {04B1EDB6-E967-4D25-89B9-E6F8304038CD}
|
{46A8612B-418B-4D70-B3A7-A21DD0627473} = {04B1EDB6-E967-4D25-89B9-E6F8304038CD}
|
||||||
{13FD8F12-FFBE-4D01-B4AC-444F2994B04F} = {744ACDC6-F6A0-4FF9-9421-F25C5F2DC520}
|
{13FD8F12-FFBE-4D01-B4AC-444F2994B04F} = {744ACDC6-F6A0-4FF9-9421-F25C5F2DC520}
|
||||||
{064D860B-4D7C-4B1D-918F-E020F1B99E2A} = {EF30B533-D715-421A-92B7-92FEF460AC9C}
|
{064D860B-4D7C-4B1D-918F-E020F1B99E2A} = {EF30B533-D715-421A-92B7-92FEF460AC9C}
|
||||||
{744ACDC6-F6A0-4FF9-9421-F25C5F2DC520} = {EF30B533-D715-421A-92B7-92FEF460AC9C}
|
{744ACDC6-F6A0-4FF9-9421-F25C5F2DC520} = {EF30B533-D715-421A-92B7-92FEF460AC9C}
|
||||||
{FC2A97F8-A749-4C04-97D1-97500066A820} = {744ACDC6-F6A0-4FF9-9421-F25C5F2DC520}
|
{FC2A97F8-A749-4C04-97D1-97500066A820} = {744ACDC6-F6A0-4FF9-9421-F25C5F2DC520}
|
||||||
|
{1EAC8125-1765-4E2D-8CBE-56DC98A1C8C1} = {EF30B533-D715-421A-92B7-92FEF460AC9C}
|
||||||
|
{2AF210A9-5BDC-45E8-95DD-07B5A2616493} = {EF30B533-D715-421A-92B7-92FEF460AC9C}
|
||||||
|
{16E521CE-77F1-4B1C-A183-520A41C4F372} = {04B1EDB6-E967-4D25-89B9-E6F8304038CD}
|
||||||
|
{06CA2C2B-83B0-4D83-905A-E0C74790009E} = {04B1EDB6-E967-4D25-89B9-E6F8304038CD}
|
||||||
|
{4787A64F-9A3E-4867-A55A-70CB4B2B2FFE} = {16E521CE-77F1-4B1C-A183-520A41C4F372}
|
||||||
|
{439824F9-1455-4CC4-BD79-B44FA0A16552} = {16E521CE-77F1-4B1C-A183-520A41C4F372}
|
||||||
|
{EC82302F-D2F0-4727-99D1-EABC0DD9DC3B} = {06CA2C2B-83B0-4D83-905A-E0C74790009E}
|
||||||
|
{55494E58-E061-4C4C-A0A8-837008E72F85} = {06CA2C2B-83B0-4D83-905A-E0C74790009E}
|
||||||
|
{09D9D1D6-2951-4E14-BC35-76A23CF9391A} = {06CA2C2B-83B0-4D83-905A-E0C74790009E}
|
||||||
|
{D57EA297-6DC2-4BC0-8C91-334863327863} = {06CA2C2B-83B0-4D83-905A-E0C74790009E}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
SolutionGuid = {DB4F868D-E1AE-4FD7-9333-69FA15B268C5}
|
SolutionGuid = {DB4F868D-E1AE-4FD7-9333-69FA15B268C5}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,8 @@
|
||||||
"adx-nonshipping": {
|
"adx-nonshipping": {
|
||||||
"rules": [],
|
"rules": [],
|
||||||
"packages": {
|
"packages": {
|
||||||
"Microsoft.AspNetCore.AspNetCoreModule": {}
|
"Microsoft.AspNetCore.AspNetCoreModule": {},
|
||||||
|
"Microsoft.AspNetCore.AspNetCoreModuleV1": {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Default": {
|
"Default": {
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,9 @@
|
||||||
<Project ToolsVersion="12.0" DefaultTargets="Test" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="12.0" DefaultTargets="Test" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<Import Project="$(MSBuildThisFileDirectory)\Build.Settings" />
|
<Import Project="$(MSBuildThisFileDirectory)\Build.Settings" />
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Projects Include="$(SolutionDir)\src\AspNetCore\AspNetCore.vcxproj" />
|
<Projects Include="$(SolutionDir)\src\AspNetCoreModuleV1\AspNetCore\AspNetCore.vcxproj" />
|
||||||
<Projects Include="$(SolutionDir)\src\RequestHandler\RequestHandler.vcxproj" />
|
<Projects Include="$(SolutionDir)\src\AspNetCoreModuleV2\AspNetCore\AspNetCore.vcxproj" />
|
||||||
|
<Projects Include="$(SolutionDir)\src\AspNetCoreModuleV2\RequestHandler\RequestHandler.vcxproj" />
|
||||||
<Projects Include="$(SolutionDir)\test\CommonLibTests\CommonLibTests.vcxproj">
|
<Projects Include="$(SolutionDir)\test\CommonLibTests\CommonLibTests.vcxproj">
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,9 +20,11 @@
|
||||||
Text="Could not find an installation of Visual Studio with the C++ development tools."
|
Text="Could not find an installation of Visual Studio with the C++ development tools."
|
||||||
Condition="'$(VisualStudioMSBuildx86Path)' == ''" />
|
Condition="'$(VisualStudioMSBuildx86Path)' == ''" />
|
||||||
|
|
||||||
<Exec Command=""$(VisualStudioMSBuildx86Path)" "$(RepositoryRoot)src\AspNetCore\AspNetCore.vcxproj" $(BuildArgs) -p:Platform=%(Platforms.Identity) -bl:$(LogOutputDir)native.%(Platforms.Identity).binlog"
|
<Exec Command=""$(VisualStudioMSBuildx86Path)" "$(RepositoryRoot)src\AspNetCoreModuleV1\AspNetCore\AspNetCore.vcxproj" $(BuildArgs) -p:Platform=%(Platforms.Identity) -bl:$(LogOutputDir)native.%(Platforms.Identity).binlog"
|
||||||
Condition="'$(VisualStudioMSBuildx86Path)' != ''" />
|
Condition="'$(VisualStudioMSBuildx86Path)' != ''" />
|
||||||
<Exec Command=""$(VisualStudioMSBuildx86Path)" "$(RepositoryRoot)src\RequestHandler\RequestHandler.vcxproj" $(BuildArgs) -p:Platform=%(Platforms.Identity) -bl:$(LogOutputDir)native.%(Platforms.Identity).binlog"
|
<Exec Command=""$(VisualStudioMSBuildx86Path)" "$(RepositoryRoot)src\AspNetCoreModuleV2\AspNetCore\AspNetCore.vcxproj" $(BuildArgs) -p:Platform=%(Platforms.Identity) -bl:$(LogOutputDir)native.%(Platforms.Identity).binlog"
|
||||||
|
Condition="'$(VisualStudioMSBuildx86Path)' != ''" />
|
||||||
|
<Exec Command=""$(VisualStudioMSBuildx86Path)" "$(RepositoryRoot)src\AspNetCoreModuleV2\RequestHandler\RequestHandler.vcxproj" $(BuildArgs) -p:Platform=%(Platforms.Identity) -bl:$(LogOutputDir)native.%(Platforms.Identity).binlog"
|
||||||
Condition="'$(VisualStudioMSBuildx86Path)' != ''" />
|
Condition="'$(VisualStudioMSBuildx86Path)' != ''" />
|
||||||
<Exec Command=""$(VisualStudioMSBuildx86Path)" "$(RepositoryRoot)test\CommonLibTests\CommonLibTests.vcxproj" $(BuildArgs) -p:Platform=%(Platforms.Identity) -bl:$(LogOutputDir)native.%(Platforms.Identity).binlog"
|
<Exec Command=""$(VisualStudioMSBuildx86Path)" "$(RepositoryRoot)test\CommonLibTests\CommonLibTests.vcxproj" $(BuildArgs) -p:Platform=%(Platforms.Identity) -bl:$(LogOutputDir)native.%(Platforms.Identity).binlog"
|
||||||
Condition="'$(VisualStudioMSBuildx86Path)' != ''" />
|
Condition="'$(VisualStudioMSBuildx86Path)' != ''" />
|
||||||
|
|
@ -37,6 +39,14 @@
|
||||||
</ArtifactInfo>
|
</ArtifactInfo>
|
||||||
<FilesToExcludeFromSigning Include="$(BuildDir)Microsoft.AspNetCore.AspNetCoreModule.$(PackageVersion).nupkg" />
|
<FilesToExcludeFromSigning Include="$(BuildDir)Microsoft.AspNetCore.AspNetCoreModule.$(PackageVersion).nupkg" />
|
||||||
|
|
||||||
|
<ArtifactInfo Include="$(BuildDir)Microsoft.AspNetCore.AspNetCoreModuleV1.$(PackageVersion).nupkg">
|
||||||
|
<ArtifactType>NuGetPackage</ArtifactType>
|
||||||
|
<PackageId>Microsoft.AspNetCore.AspNetCoreModuleV1</PackageId>
|
||||||
|
<Version>$(PackageVersion)</Version>
|
||||||
|
<RepositoryRoot>$(RepositoryRoot)</RepositoryRoot>
|
||||||
|
</ArtifactInfo>
|
||||||
|
<FilesToExcludeFromSigning Include="$(BuildDir)Microsoft.AspNetCore.AspNetCoreModuleV1.$(PackageVersion).nupkg" />
|
||||||
|
|
||||||
<ArtifactInfo Include="$(AncmZipOutputPath)">
|
<ArtifactInfo Include="$(AncmZipOutputPath)">
|
||||||
<ArtifactType>ZipArchive</ArtifactType>
|
<ArtifactType>ZipArchive</ArtifactType>
|
||||||
<RepositoryRoot>$(RepositoryRoot)</RepositoryRoot>
|
<RepositoryRoot>$(RepositoryRoot)</RepositoryRoot>
|
||||||
|
|
@ -44,14 +54,22 @@
|
||||||
</ArtifactInfo>
|
</ArtifactInfo>
|
||||||
|
|
||||||
<FilesToSign Include="$(AncmZipOutputPath)" IsContainer="true" />
|
<FilesToSign Include="$(AncmZipOutputPath)" IsContainer="true" />
|
||||||
<FilesToSign Include="x64/aspnetcore.dll" Container="$(AncmZipOutputPath)" Certificate="$(AssemblySigningCertName)" />
|
<FilesToSign Include="AspNetCoreModuleV1/x64/aspnetcore.dll" Container="$(AncmZipOutputPath)" Certificate="$(AssemblySigningCertName)" />
|
||||||
<FilesToSign Include="x86/aspnetcore.dll" Container="$(AncmZipOutputPath)" Certificate="$(AssemblySigningCertName)" />
|
<FilesToSign Include="AspNetCoreModuleV1/x86/aspnetcore.dll" Container="$(AncmZipOutputPath)" Certificate="$(AssemblySigningCertName)" />
|
||||||
<FilesToSign Include="x64/aspnetcorerh.dll" Container="$(AncmZipOutputPath)" Certificate="$(AssemblySigningCertName)" />
|
<FilesToSign Include="AspNetCoreModuleV2/x64/aspnetcore.dll" Container="$(AncmZipOutputPath)" Certificate="$(AssemblySigningCertName)" />
|
||||||
<FilesToSign Include="x86/aspnetcorerh.dll" Container="$(AncmZipOutputPath)" Certificate="$(AssemblySigningCertName)" />
|
<FilesToSign Include="AspNetCoreModuleV2/x86/aspnetcore.dll" Container="$(AncmZipOutputPath)" Certificate="$(AssemblySigningCertName)" />
|
||||||
|
<FilesToSign Include="AspNetCoreModuleV2/x64/aspnetcorerh.dll" Container="$(AncmZipOutputPath)" Certificate="$(AssemblySigningCertName)" />
|
||||||
|
<FilesToSign Include="AspNetCoreModuleV2/x86/aspnetcorerh.dll" Container="$(AncmZipOutputPath)" Certificate="$(AssemblySigningCertName)" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<Target Name="PackageNativeProjects">
|
<Target Name="PackageNativeProjects">
|
||||||
<PackNuspec NuspecPath="$(MSBuildThisFileDirectory)..\nuget\AspNetCore.nuspec"
|
<PackNuspec NuspecPath="$(MSBuildThisFileDirectory)..\nuget\AspNetCoreV1.nuspec"
|
||||||
|
DestinationFolder="$(BuildDir)"
|
||||||
|
Properties="version=$(PackageVersion);Configuration=$(Configuration)"
|
||||||
|
Overwrite="true"
|
||||||
|
BasePath="$(RepositoryRoot)" />
|
||||||
|
|
||||||
|
<PackNuspec NuspecPath="$(MSBuildThisFileDirectory)..\nuget\AspNetCoreV2.nuspec"
|
||||||
DestinationFolder="$(BuildDir)"
|
DestinationFolder="$(BuildDir)"
|
||||||
Properties="version=$(PackageVersion);Configuration=$(Configuration)"
|
Properties="version=$(PackageVersion);Configuration=$(Configuration)"
|
||||||
Overwrite="true"
|
Overwrite="true"
|
||||||
|
|
@ -59,18 +77,23 @@
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<!-- x64 -->
|
<!-- x64 -->
|
||||||
<AncmFiles Include="$(RepositoryRoot)src\AspNetCore\bin\$(Configuration)\x64\aspnetcore.dll" Link="x64\aspnetcore.dll" />
|
<AncmFiles Include="$(RepositoryRoot)src\AspNetCoreModuleV1\AspNetCore\bin\$(Configuration)\x64\aspnetcore.dll" Link="AspNetCoreModuleV1\x64\aspnetcore.dll" />
|
||||||
<AncmFiles Include="$(RepositoryRoot)src\AspNetCore\bin\$(Configuration)\x64\aspnetcore.pdb" Link="x64\aspnetcore.pdb" />
|
<AncmFiles Include="$(RepositoryRoot)src\AspNetCoreModuleV1\AspNetCore\bin\$(Configuration)\x64\aspnetcore.pdb" Link="AspNetCoreModuleV1\x64\aspnetcore.pdb" />
|
||||||
<AncmFiles Include="$(RepositoryRoot)src\RequestHandler\bin\$(Configuration)\x64\aspnetcorerh.dll" Link="x64\aspnetcorerh.dll" />
|
<AncmFiles Include="$(RepositoryRoot)src\AspNetCoreModuleV2\AspNetCore\bin\$(Configuration)\x64\aspnetcore.dll" Link="AspNetCoreModuleV2\x64\aspnetcore.dll" />
|
||||||
<AncmFiles Include="$(RepositoryRoot)src\RequestHandler\bin\$(Configuration)\x64\aspnetcorerh.pdb" Link="x64\aspnetcorerh.pdb" />
|
<AncmFiles Include="$(RepositoryRoot)src\AspNetCoreModuleV2\AspNetCore\bin\$(Configuration)\x64\aspnetcore.pdb" Link="AspNetCoreModuleV2\x64\aspnetcore.pdb" />
|
||||||
|
<AncmFiles Include="$(RepositoryRoot)src\AspNetCoreModuleV2\RequestHandler\bin\$(Configuration)\x64\aspnetcorerh.dll" Link="AspNetCoreModuleV2\x64\aspnetcorerh.dll" />
|
||||||
|
<AncmFiles Include="$(RepositoryRoot)src\AspNetCoreModuleV2\RequestHandler\bin\$(Configuration)\x64\aspnetcorerh.pdb" Link="x64\aspnetcorerh.pdb" />
|
||||||
<!-- x86 -->
|
<!-- x86 -->
|
||||||
<AncmFiles Include="$(RepositoryRoot)src\AspNetCore\bin\$(Configuration)\Win32\aspnetcore.dll" Link="x86\aspnetcore.dll" />
|
<AncmFiles Include="$(RepositoryRoot)src\AspNetCoreModuleV1\AspNetCore\bin\$(Configuration)\Win32\aspnetcore.dll" Link="AspNetCoreModuleV1\x86\aspnetcore.dll" />
|
||||||
<AncmFiles Include="$(RepositoryRoot)src\AspNetCore\bin\$(Configuration)\Win32\aspnetcore.pdb" Link="x86\aspnetcore.pdb" />
|
<AncmFiles Include="$(RepositoryRoot)src\AspNetCoreModuleV1\AspNetCore\bin\$(Configuration)\Win32\aspnetcore.pdb" Link="AspNetCoreModuleV1\x86\aspnetcore.pdb" />
|
||||||
<AncmFiles Include="$(RepositoryRoot)src\RequestHandler\bin\$(Configuration)\Win32\aspnetcorerh.dll" Link="x86\aspnetcorerh.dll" />
|
<AncmFiles Include="$(RepositoryRoot)src\AspNetCoreModuleV2\AspNetCore\bin\$(Configuration)\Win32\aspnetcore.dll" Link="AspNetCoreModuleV2\x86\aspnetcore.dll" />
|
||||||
<AncmFiles Include="$(RepositoryRoot)src\RequestHandler\bin\$(Configuration)\Win32\aspnetcorerh.pdb" Link="x86\aspnetcorerh.pdb" />
|
<AncmFiles Include="$(RepositoryRoot)src\AspNetCoreModuleV2\AspNetCore\bin\$(Configuration)\Win32\aspnetcore.pdb" Link="AspNetCoreModuleV2\x86\aspnetcore.pdb" />
|
||||||
|
<AncmFiles Include="$(RepositoryRoot)src\AspNetCoreModuleV2\RequestHandler\bin\$(Configuration)\Win32\aspnetcorerh.dll" Link="AspNetCoreModuleV2\x86\aspnetcorerh.dll" />
|
||||||
|
<AncmFiles Include="$(RepositoryRoot)src\AspNetCoreModuleV2\RequestHandler\bin\$(Configuration)\Win32\aspnetcorerh.pdb" Link="AspNetCoreModuleV2\x86\aspnetcorerh.pdb" />
|
||||||
<!-- Schema-->
|
<!-- Schema-->
|
||||||
<AncmFiles Include="$(RepositoryRoot)src\AspNetCore\bin\$(Configuration)\x64\aspnetcore_schema.xml" Link="aspnetcore_schema.xml" />
|
<AncmFiles Include="$(RepositoryRoot)src\AspNetCoreModuleV1\AspNetCore\bin\$(Configuration)\x64\aspnetcore_schema.xml" Link="AspNetCoreModuleV1\aspnetcore_schema.xml" />
|
||||||
<AncmFiles Include="$(RepositoryRoot)src\AspNetCore\bin\$(Configuration)\x64\ancm.mof" Link="ancm.mof" />
|
<AncmFiles Include="$(RepositoryRoot)src\AspNetCoreModuleV2\AspNetCore\bin\$(Configuration)\x64\aspnetcore_schema.xml" Link="AspNetCoreModuleV2\aspnetcore_schema.xml" />
|
||||||
|
<AncmFiles Include="$(RepositoryRoot)src\AspNetCoreModuleV2\AspNetCore\bin\$(Configuration)\x64\ancm.mof" Link="AspNetCoreModuleV2\ancm.mof" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ZipArchive File="$(AncmZipOutputPath)"
|
<ZipArchive File="$(AncmZipOutputPath)"
|
||||||
|
|
|
||||||
|
|
@ -26,12 +26,17 @@
|
||||||
Set the base path to the request handler
|
Set the base path to the request handler
|
||||||
-->
|
-->
|
||||||
<BasePathForRequestHandler Condition="'$(RuntimeIdentifier)' == ''">$(NativePlatform)\</BasePathForRequestHandler>
|
<BasePathForRequestHandler Condition="'$(RuntimeIdentifier)' == ''">$(NativePlatform)\</BasePathForRequestHandler>
|
||||||
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup Condition="'$(OS)' == 'Windows_NT'">
|
<ItemGroup Condition="'$(OS)' == 'Windows_NT' AND ('$(ANCMVersion)' == 'V2' Or '$(ANCMVersion)' == '')">
|
||||||
<None Include="$(MSBuildThisFileDirectory)..\src\RequestHandler\bin\$(Configuration)\$(NativeFolder)\aspnetcorerh.dll" CopyToOutputDirectory="PreserveNewest" Visible="true" Link="$(BasePathForRequestHandler)%(FileName)%(Extension)" />
|
<None Include="$(MSBuildThisFileDirectory)..\src\AspNetCoreModuleV2\RequestHandler\bin\$(Configuration)\$(NativeFolder)\aspnetcorerh.dll" CopyToOutputDirectory="PreserveNewest" Visible="true" Link="$(BasePathForRequestHandler)%(FileName)%(Extension)" />
|
||||||
<None Include="$(MSBuildThisFileDirectory)..\src\RequestHandler\bin\$(Configuration)\$(NativeFolder)\aspnetcorerh.pdb" CopyToOutputDirectory="PreserveNewest" Visible="true" Link="$(BasePathForRequestHandler)%(FileName)%(Extension)" />
|
<None Include="$(MSBuildThisFileDirectory)..\src\AspNetCoreModuleV2\RequestHandler\bin\$(Configuration)\$(NativeFolder)\aspnetcorerh.pdb" CopyToOutputDirectory="PreserveNewest" Visible="true" Link="$(BasePathForRequestHandler)%(FileName)%(Extension)" />
|
||||||
<None Include="$(MSBuildThisFileDirectory)..\src\AspNetCore\bin\$(Configuration)\$(NativeFolder)\aspnetcore.dll" CopyToOutputDirectory="PreserveNewest" Visible="true" Link="$(NativePlatform)\%(FileName)%(Extension)" />
|
<None Include="$(MSBuildThisFileDirectory)..\src\AspNetCoreModuleV2\AspNetCore\bin\$(Configuration)\$(NativeFolder)\aspnetcore.dll" CopyToOutputDirectory="PreserveNewest" Visible="true" Link="$(NativePlatform)\%(FileName)%(Extension)" />
|
||||||
<None Include="$(MSBuildThisFileDirectory)..\src\AspNetCore\bin\$(Configuration)\$(NativeFolder)\aspnetcore.pdb" CopyToOutputDirectory="PreserveNewest" Visible="true" Link="$(NativePlatform)\%(FileName)%(Extension)" />
|
<None Include="$(MSBuildThisFileDirectory)..\src\AspNetCoreModuleV2\AspNetCore\bin\$(Configuration)\$(NativeFolder)\aspnetcore.pdb" CopyToOutputDirectory="PreserveNewest" Visible="true" Link="$(NativePlatform)\%(FileName)%(Extension)" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup Condition="'$(OS)' == 'Windows_NT' AND '$(ANCMVersion)' == 'V1'">
|
||||||
|
<None Include="$(MSBuildThisFileDirectory)..\src\AspNetCoreModuleV1\AspNetCore\bin\$(Configuration)\$(NativeFolder)\aspnetcore.dll" CopyToOutputDirectory="PreserveNewest" Visible="true" Link="$(NativePlatform)\%(FileName)%(Extension)" />
|
||||||
|
<None Include="$(MSBuildThisFileDirectory)..\src\AspNetCoreModuleV1\AspNetCore\bin\$(Configuration)\$(NativeFolder)\aspnetcore.pdb" CopyToOutputDirectory="PreserveNewest" Visible="true" Link="$(NativePlatform)\%(FileName)%(Extension)" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
|
|
@ -56,7 +61,7 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
||||||
<Target Name="PrepareInjectionApp">
|
<Target Name="PrepareInjectionApp" Condition="'$(ANCMVersion)' == 'V2' Or '$(ANCMVersion)' == ''">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<InjectDepsAssembly>$(MSBuildThisFileDirectory)..\test\TestTasks\bin\$(Configuration)\$(TargetFramework)\TestTasks</InjectDepsAssembly>
|
<InjectDepsAssembly>$(MSBuildThisFileDirectory)..\test\TestTasks\bin\$(Configuration)\$(TargetFramework)\TestTasks</InjectDepsAssembly>
|
||||||
|
|
||||||
|
|
@ -76,11 +81,11 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Target>
|
</Target>
|
||||||
|
|
||||||
<Target Name="InjectRequestHandler" AfterTargets="GenerateBuildDependencyFile" DependsOnTargets="PrepareInjectionApp">
|
<Target Name="InjectRequestHandler" AfterTargets="GenerateBuildDependencyFile" DependsOnTargets="PrepareInjectionApp" Condition="'$(ANCMVersion)' == 'V2' Or '$(ANCMVersion)' == ''">
|
||||||
<Exec Command="$(InjectDepsApp) $(InjectDepsArguments) "$(ProjectDepsFilePath)"" />
|
<Exec Command="$(InjectDepsApp) $(InjectDepsArguments) "$(ProjectDepsFilePath)"" />
|
||||||
</Target>
|
</Target>
|
||||||
|
|
||||||
<Target Name="InjectRequestHandlerOnPublish" AfterTargets="GeneratePublishDependencyFile" DependsOnTargets="PrepareInjectionApp">
|
<Target Name="InjectRequestHandlerOnPublish" AfterTargets="GeneratePublishDependencyFile" DependsOnTargets="PrepareInjectionApp" Condition="'$(ANCMVersion)' == 'V2' Or '$(ANCMVersion)' == ''">
|
||||||
<Exec Command="$(InjectDepsApp) $(InjectDepsArguments) "$(PublishDepsFilePath)"" />
|
<Exec Command="$(InjectDepsApp) $(InjectDepsArguments) "$(PublishDepsFilePath)"" />
|
||||||
</Target>
|
</Target>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
|
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
|
||||||
<metadata>
|
<metadata>
|
||||||
<id>Microsoft.AspNetCore.AspNetCoreModule</id>
|
<id>Microsoft.AspNetCore.AspNetCoreModuleV1</id>
|
||||||
<title>Microsoft ASP.NET Core Module</title>
|
<title>Microsoft ASP.NET Core Module</title>
|
||||||
<version>$VERSION$</version>
|
<version>$VERSION$</version>
|
||||||
<authors>Microsoft</authors>
|
<authors>Microsoft</authors>
|
||||||
|
|
@ -13,17 +13,15 @@
|
||||||
<requireLicenseAcceptance>true</requireLicenseAcceptance>
|
<requireLicenseAcceptance>true</requireLicenseAcceptance>
|
||||||
<description>ASP.NET Core Module</description>
|
<description>ASP.NET Core Module</description>
|
||||||
<language>en-US</language>
|
<language>en-US</language>
|
||||||
<tags>Microsoft.AspNetCore.AspNetCoreModule</tags>
|
<tags>Microsoft.AspNetCore.AspNetCoreModuleV1</tags>
|
||||||
<contentFiles>
|
<contentFiles>
|
||||||
<files include="any/any/*/*.dll" buildAction="None" copyToOutput="true" flatten="false" />
|
<files include="any/any/*/*.dll" buildAction="None" copyToOutput="true" flatten="false" />
|
||||||
</contentFiles>
|
</contentFiles>
|
||||||
</metadata>
|
</metadata>
|
||||||
<files>
|
<files>
|
||||||
<file src="src\AspNetCore\bin\$Configuration$\Win32\aspnetcore.dll" target="contentFiles\any\any\x86\aspnetcore.dll" />
|
<file src="src\AspNetCoreModuleV1\AspNetCore\bin\$Configuration$\Win32\aspnetcore.dll" target="contentFiles\any\any\x86\aspnetcore.dll" />
|
||||||
<file src="src\AspNetCore\bin\$Configuration$\x64\aspnetcore.dll" target="contentFiles\any\any\x64\aspnetcore.dll" />
|
<file src="src\AspNetCoreModuleV1\AspNetCore\bin\$Configuration$\x64\aspnetcore.dll" target="contentFiles\any\any\x64\aspnetcore.dll" />
|
||||||
<file src="src\RequestHandler\bin\$Configuration$\Win32\aspnetcorerh.dll" target="contentFiles\any\any\x86\aspnetcorerh.dll" />
|
<file src="src\AspNetCoreModuleV1\AspNetCore\bin\$Configuration$\x64\*.xml"/>
|
||||||
<file src="src\RequestHandler\bin\$Configuration$\x64\aspnetcorerh.dll" target="contentFiles\any\any\x64\aspnetcorerh.dll" />
|
|
||||||
<file src="src\AspNetCore\bin\$Configuration$\x64\*.xml"/>
|
|
||||||
<file src="tools\installancm.ps1"/>
|
<file src="tools\installancm.ps1"/>
|
||||||
<file src="LICENSE.txt"/>
|
<file src="LICENSE.txt"/>
|
||||||
<file src="nuget\Microsoft.AspNetCore.AspNetCoreModule.props" target="build\" />
|
<file src="nuget\Microsoft.AspNetCore.AspNetCoreModule.props" target="build\" />
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
|
||||||
|
<metadata>
|
||||||
|
<id>Microsoft.AspNetCore.AspNetCoreModule</id> <!--TODO make this package version V2 when possible -->
|
||||||
|
<title>Microsoft ASP.NET Core Module</title>
|
||||||
|
<version>$VERSION$</version>
|
||||||
|
<authors>Microsoft</authors>
|
||||||
|
<owners>Microsoft</owners>
|
||||||
|
<licenseUrl>https://www.microsoft.com/web/webpi/eula/net_library_eula_ENU.htm</licenseUrl>
|
||||||
|
<copyright>© .NET Foundation. All rights reserved.</copyright>
|
||||||
|
<projectUrl>https://www.asp.net/</projectUrl>
|
||||||
|
<iconUrl>https://go.microsoft.com/fwlink/?LinkID=288859</iconUrl>
|
||||||
|
<requireLicenseAcceptance>true</requireLicenseAcceptance>
|
||||||
|
<description>ASP.NET Core Module</description>
|
||||||
|
<language>en-US</language>
|
||||||
|
<tags>Microsoft.AspNetCore.AspNetCoreModule</tags>
|
||||||
|
<contentFiles>
|
||||||
|
<files include="any/any/*/*.dll" buildAction="None" copyToOutput="true" flatten="false" />
|
||||||
|
</contentFiles>
|
||||||
|
</metadata>
|
||||||
|
<files>
|
||||||
|
<file src="src\AspNetCoreModuleV2\AspNetCore\bin\$Configuration$\Win32\aspnetcore.dll" target="contentFiles\any\any\x86\aspnetcore.dll" />
|
||||||
|
<file src="src\AspNetCoreModuleV2\AspNetCore\bin\$Configuration$\x64\aspnetcore.dll" target="contentFiles\any\any\x64\aspnetcore.dll" />
|
||||||
|
<file src="src\AspNetCoreModuleV2\RequestHandler\bin\$Configuration$\Win32\aspnetcorerh.dll" target="contentFiles\any\any\x86\aspnetcorerh.dll" />
|
||||||
|
<file src="src\AspNetCoreModuleV2\RequestHandler\bin\$Configuration$\x64\aspnetcorerh.dll" target="contentFiles\any\any\x64\aspnetcorerh.dll" />
|
||||||
|
<file src="src\AspNetCoreModuleV2\AspNetCore\bin\$Configuration$\x64\*.xml"/>
|
||||||
|
<file src="tools\installancm.ps1"/>
|
||||||
|
<file src="LICENSE.txt"/>
|
||||||
|
<file src="nuget\Microsoft.AspNetCore.AspNetCoreModule.props" target="build\" />
|
||||||
|
</files>
|
||||||
|
</package>
|
||||||
|
|
@ -0,0 +1,284 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="..\..\..\Build\Build.Settings" />
|
||||||
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug|x64">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|x64">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<ProjectGuid>{439824F9-1455-4CC4-BD79-B44FA0A16552}</ProjectGuid>
|
||||||
|
<Keyword>Win32Proj</Keyword>
|
||||||
|
<RootNamespace>AspNetCoreModule</RootNamespace>
|
||||||
|
<ProjectName>AspNetCore</ProjectName>
|
||||||
|
<TargetName>aspnetcore</TargetName>
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
<WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutDir>$(MSBuildProjectDirectory)\bin\$(Configuration)\$(Platform)\</OutDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level4</WarningLevel>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;ASPNETCOREMODULE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<PrecompiledHeaderFile>precomp.hxx</PrecompiledHeaderFile>
|
||||||
|
<PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
|
||||||
|
<AdditionalIncludeDirectories>..\IISLib;inc\</AdditionalIncludeDirectories>
|
||||||
|
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||||
|
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||||
|
<TreatWarningAsError>true</TreatWarningAsError>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<PreprocessKeepComments>false</PreprocessKeepComments>
|
||||||
|
<ExceptionHandling>SyncCThrow</ExceptionHandling>
|
||||||
|
<StructMemberAlignment>8Bytes</StructMemberAlignment>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
||||||
|
<OmitDefaultLibName>true</OmitDefaultLibName>
|
||||||
|
<CompileAs>CompileAsCpp</CompileAs>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<AdditionalDependencies>kernel32.lib;user32.lib;advapi32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;ahadmin.lib;rpcrt4.lib;winhttp.lib;pdh.lib;ws2_32.lib;wbemuuid.lib;iphlpapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
<ModuleDefinitionFile>Source.def</ModuleDefinitionFile>
|
||||||
|
</Link>
|
||||||
|
<ResourceCompile>
|
||||||
|
<AdditionalIncludeDirectories>..\Commonlib</AdditionalIncludeDirectories>
|
||||||
|
</ResourceCompile>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level4</WarningLevel>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;ASPNETCOREMODULE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<PrecompiledHeaderFile>precomp.hxx</PrecompiledHeaderFile>
|
||||||
|
<PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
|
||||||
|
<AdditionalIncludeDirectories>..\IISLib;inc\</AdditionalIncludeDirectories>
|
||||||
|
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||||
|
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||||
|
<TreatWarningAsError>true</TreatWarningAsError>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<PreprocessKeepComments>false</PreprocessKeepComments>
|
||||||
|
<ExceptionHandling>SyncCThrow</ExceptionHandling>
|
||||||
|
<StructMemberAlignment>8Bytes</StructMemberAlignment>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
||||||
|
<OmitDefaultLibName>true</OmitDefaultLibName>
|
||||||
|
<CompileAs>CompileAsCpp</CompileAs>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<AdditionalDependencies>kernel32.lib;user32.lib;advapi32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;ahadmin.lib;rpcrt4.lib;winhttp.lib;pdh.lib;ws2_32.lib;wbemuuid.lib;iphlpapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
<ModuleDefinitionFile>Source.def</ModuleDefinitionFile>
|
||||||
|
</Link>
|
||||||
|
<ResourceCompile>
|
||||||
|
<AdditionalIncludeDirectories>..\Commonlib</AdditionalIncludeDirectories>
|
||||||
|
</ResourceCompile>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level4</WarningLevel>
|
||||||
|
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;ASPNETCOREMODULE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<AdditionalIncludeDirectories>..\IISLib;inc\</AdditionalIncludeDirectories>
|
||||||
|
<PrecompiledHeaderFile>precomp.hxx</PrecompiledHeaderFile>
|
||||||
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
|
<TreatWarningAsError>true</TreatWarningAsError>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<PreprocessKeepComments>false</PreprocessKeepComments>
|
||||||
|
<ExceptionHandling>SyncCThrow</ExceptionHandling>
|
||||||
|
<StructMemberAlignment>8Bytes</StructMemberAlignment>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
||||||
|
<OmitDefaultLibName>true</OmitDefaultLibName>
|
||||||
|
<CompileAs>CompileAsCpp</CompileAs>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<ModuleDefinitionFile>Source.def</ModuleDefinitionFile>
|
||||||
|
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;ahadmin.lib;winhttp.lib;odbc32.lib;ws2_32.lib;odbccp32.lib;wbemuuid.lib;iphlpapi.lib;pdh.lib;rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
</Link>
|
||||||
|
<ResourceCompile>
|
||||||
|
<AdditionalIncludeDirectories>..\Commonlib</AdditionalIncludeDirectories>
|
||||||
|
</ResourceCompile>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level4</WarningLevel>
|
||||||
|
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;ASPNETCOREMODULE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<PrecompiledHeaderFile>precomp.hxx</PrecompiledHeaderFile>
|
||||||
|
<AdditionalIncludeDirectories>..\IISLib;inc\</AdditionalIncludeDirectories>
|
||||||
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
|
<TreatWarningAsError>true</TreatWarningAsError>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<PreprocessKeepComments>false</PreprocessKeepComments>
|
||||||
|
<ExceptionHandling>SyncCThrow</ExceptionHandling>
|
||||||
|
<StructMemberAlignment>8Bytes</StructMemberAlignment>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
||||||
|
<OmitDefaultLibName>true</OmitDefaultLibName>
|
||||||
|
<CompileAs>CompileAsCpp</CompileAs>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<ModuleDefinitionFile>Source.def</ModuleDefinitionFile>
|
||||||
|
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;ahadmin.lib;rpcrt4.lib;winhttp.lib;pdh.lib;ws2_32.lib;wbemuuid.lib;iphlpapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
</Link>
|
||||||
|
<ResourceCompile>
|
||||||
|
<AdditionalIncludeDirectories>..\Commonlib</AdditionalIncludeDirectories>
|
||||||
|
</ResourceCompile>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="Source.def" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Include="aspnetcore_schema.xml">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Xml Include="aspnetcore_schema.xml" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="src\application.cxx" />
|
||||||
|
<ClCompile Include="src\applicationmanager.cxx" />
|
||||||
|
<ClCompile Include="src\aspnetcoreconfig.cxx" />
|
||||||
|
<ClCompile Include="src\filewatcher.cxx" />
|
||||||
|
<ClCompile Include="src\forwarderconnection.cxx" />
|
||||||
|
<ClCompile Include="src\forwardinghandler.cxx" />
|
||||||
|
<ClCompile Include="src\main.cxx" />
|
||||||
|
<ClCompile Include="src\path.cxx" />
|
||||||
|
<ClCompile Include="src\processmanager.cxx" />
|
||||||
|
<ClCompile Include="src\protocolconfig.cxx" />
|
||||||
|
<ClCompile Include="src\proxymodule.cxx" />
|
||||||
|
<ClCompile Include="src\responseheaderhash.cxx" />
|
||||||
|
<ClCompile Include="src\serverprocess.cxx" />
|
||||||
|
<ClCompile Include="src\websockethandler.cxx" />
|
||||||
|
<ClCompile Include="src\winhttphelper.cxx" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="Inc\application.h" />
|
||||||
|
<ClInclude Include="Inc\applicationmanager.h" />
|
||||||
|
<ClInclude Include="Inc\aspnetcoreconfig.h" />
|
||||||
|
<ClInclude Include="Inc\debugutil.h" />
|
||||||
|
<ClInclude Include="Inc\environmentvariablehash.h" />
|
||||||
|
<ClInclude Include="Inc\filewatcher.h" />
|
||||||
|
<ClInclude Include="Inc\forwarderconnection.h" />
|
||||||
|
<ClInclude Include="Inc\forwardinghandler.h" />
|
||||||
|
<ClInclude Include="Inc\path.h" />
|
||||||
|
<ClInclude Include="Inc\processmanager.h" />
|
||||||
|
<ClInclude Include="Inc\protocolconfig.h" />
|
||||||
|
<ClInclude Include="Inc\proxymodule.h" />
|
||||||
|
<ClInclude Include="Inc\resource.h" />
|
||||||
|
<ClInclude Include="Inc\responseheaderhash.h" />
|
||||||
|
<ClInclude Include="Inc\serverprocess.h" />
|
||||||
|
<ClInclude Include="Inc\sttimer.h" />
|
||||||
|
<ClInclude Include="Inc\websockethandler.h" />
|
||||||
|
<ClInclude Include="Inc\winhttphelper.h" />
|
||||||
|
<ClInclude Include="resource.h" />
|
||||||
|
<ClInclude Include="src\precomp.hxx" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ResourceCompile Include="aspnetcoremodule.rc" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\IISLib\IISLib.vcxproj">
|
||||||
|
<Project>{4787a64f-9a3e-4867-a55a-70cb4b2b2ffe}</Project>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="..\..\..\build\native.targets" />
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<CustomBuild Include="aspnetcore_msg.mc">
|
||||||
|
<FileType>Document</FileType>
|
||||||
|
<Command>mc %(FullPath)</Command>
|
||||||
|
<Message>Compiling Event Messages ...</Message>
|
||||||
|
<Outputs>%(Filename).rc;%(Filename).h;MSG0409.bin</Outputs>
|
||||||
|
</CustomBuild>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
|
|
@ -0,0 +1,293 @@
|
||||||
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
//
|
||||||
|
// The key used for hash-table lookups, consists of the port on which the http process is created.
|
||||||
|
//
|
||||||
|
class APPLICATION_KEY
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
APPLICATION_KEY(
|
||||||
|
VOID
|
||||||
|
) : INLINE_STRU_INIT(m_struKey)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
Initialize(
|
||||||
|
_In_ LPCWSTR pszKey
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return m_struKey.Copy(pszKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
GetIsEqual(
|
||||||
|
const APPLICATION_KEY * key2
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return m_struKey.Equals(key2->m_struKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD CalcKeyHash() const
|
||||||
|
{
|
||||||
|
return Hash(m_struKey.QueryStr());
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
INLINE_STRU(m_struKey, 1024);
|
||||||
|
};
|
||||||
|
|
||||||
|
class APP_OFFLINE_HTM
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
APP_OFFLINE_HTM(LPCWSTR pszPath) : m_cRefs(1)
|
||||||
|
{
|
||||||
|
m_Path.Copy( pszPath );
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
ReferenceAppOfflineHtm() const
|
||||||
|
{
|
||||||
|
InterlockedIncrement(&m_cRefs);
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
DereferenceAppOfflineHtm() const
|
||||||
|
{
|
||||||
|
if (InterlockedDecrement(&m_cRefs) == 0)
|
||||||
|
{
|
||||||
|
delete this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
Load(
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
BOOL fResult = TRUE;
|
||||||
|
LARGE_INTEGER li = {0};
|
||||||
|
CHAR *pszBuff = NULL;
|
||||||
|
HANDLE handle = INVALID_HANDLE_VALUE;
|
||||||
|
|
||||||
|
handle = CreateFile( m_Path.QueryStr(),
|
||||||
|
GENERIC_READ,
|
||||||
|
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
|
||||||
|
NULL,
|
||||||
|
OPEN_EXISTING,
|
||||||
|
FILE_ATTRIBUTE_NORMAL,
|
||||||
|
NULL );
|
||||||
|
|
||||||
|
if( handle == INVALID_HANDLE_VALUE )
|
||||||
|
{
|
||||||
|
if ( GetLastError() == ERROR_FILE_NOT_FOUND )
|
||||||
|
{
|
||||||
|
fResult = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// This Load() member function is supposed be called only when the change notification event of file creation or file modification happens.
|
||||||
|
// If file is currenlty locked exclusively by other processes, we might get INVALID_HANDLE_VALUE even though the file exists. In that case, we should return TRUE here.
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!GetFileSizeEx( handle, &li ))
|
||||||
|
{
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( li.HighPart != 0 )
|
||||||
|
{
|
||||||
|
// > 4gb file size not supported
|
||||||
|
// todo: log a warning at event log
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD bytesRead = 0;
|
||||||
|
|
||||||
|
if(li.LowPart > 0)
|
||||||
|
{
|
||||||
|
pszBuff = new CHAR[ li.LowPart + 1 ];
|
||||||
|
|
||||||
|
if( ReadFile( handle, pszBuff, li.LowPart, &bytesRead, NULL ) )
|
||||||
|
{
|
||||||
|
m_Contents.Copy( pszBuff, bytesRead );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Finished:
|
||||||
|
if( handle != INVALID_HANDLE_VALUE )
|
||||||
|
{
|
||||||
|
CloseHandle(handle);
|
||||||
|
handle = INVALID_HANDLE_VALUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( pszBuff != NULL )
|
||||||
|
{
|
||||||
|
delete[] pszBuff;
|
||||||
|
pszBuff = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return fResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
mutable LONG m_cRefs;
|
||||||
|
STRA m_Contents;
|
||||||
|
STRU m_Path;
|
||||||
|
};
|
||||||
|
|
||||||
|
class APPLICATION_MANAGER;
|
||||||
|
|
||||||
|
class APPLICATION
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
APPLICATION() : m_pProcessManager(NULL), m_pApplicationManager(NULL), m_cRefs(1),
|
||||||
|
m_fAppOfflineFound(FALSE), m_pAppOfflineHtm(NULL), m_pFileWatcherEntry(NULL)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
APPLICATION_KEY *
|
||||||
|
QueryApplicationKey()
|
||||||
|
{
|
||||||
|
return &m_applicationKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
SetAppOfflineFound(
|
||||||
|
BOOL found
|
||||||
|
)
|
||||||
|
{
|
||||||
|
m_fAppOfflineFound = found;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
AppOfflineFound()
|
||||||
|
{
|
||||||
|
return m_fAppOfflineFound;
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
GetProcess(
|
||||||
|
_In_ IHttpContext *context,
|
||||||
|
_In_ ASPNETCORE_CONFIG *pConfig,
|
||||||
|
_Out_ SERVER_PROCESS **ppServerProcess
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return m_pProcessManager->GetProcess( context, pConfig, ppServerProcess );
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
Recycle()
|
||||||
|
{
|
||||||
|
HRESULT hr = S_OK;
|
||||||
|
m_pProcessManager->ShutdownAllProcesses();
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
ReferenceApplication() const
|
||||||
|
{
|
||||||
|
InterlockedIncrement(&m_cRefs);
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
DereferenceApplication() const
|
||||||
|
{
|
||||||
|
if (InterlockedDecrement(&m_cRefs) == 0)
|
||||||
|
{
|
||||||
|
delete this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
APP_OFFLINE_HTM* QueryAppOfflineHtm()
|
||||||
|
{
|
||||||
|
return m_pAppOfflineHtm;
|
||||||
|
}
|
||||||
|
|
||||||
|
~APPLICATION();
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
Initialize(
|
||||||
|
_In_ APPLICATION_MANAGER *pApplicationManager,
|
||||||
|
_In_ LPCWSTR pszApplication,
|
||||||
|
_In_ LPCWSTR pszPhysicalPath
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
UpdateAppOfflineFileHandle();
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
StartMonitoringAppOffline();
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
STRU m_strAppPhysicalPath;
|
||||||
|
mutable LONG m_cRefs;
|
||||||
|
APPLICATION_KEY m_applicationKey;
|
||||||
|
PROCESS_MANAGER* m_pProcessManager;
|
||||||
|
APPLICATION_MANAGER *m_pApplicationManager;
|
||||||
|
BOOL m_fAppOfflineFound;
|
||||||
|
APP_OFFLINE_HTM *m_pAppOfflineHtm;
|
||||||
|
FILE_WATCHER_ENTRY *m_pFileWatcherEntry;
|
||||||
|
};
|
||||||
|
|
||||||
|
class APPLICATION_HASH :
|
||||||
|
public HASH_TABLE<APPLICATION, APPLICATION_KEY *>
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
APPLICATION_HASH()
|
||||||
|
{}
|
||||||
|
|
||||||
|
APPLICATION_KEY *
|
||||||
|
ExtractKey(
|
||||||
|
APPLICATION *pApplication
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return pApplication->QueryApplicationKey();
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD
|
||||||
|
CalcKeyHash(
|
||||||
|
APPLICATION_KEY *key
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return key->CalcKeyHash();
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
EqualKeys(
|
||||||
|
APPLICATION_KEY *key1,
|
||||||
|
APPLICATION_KEY *key2
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return key1->GetIsEqual(key2);
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
ReferenceRecord(
|
||||||
|
APPLICATION *pApplication
|
||||||
|
)
|
||||||
|
{
|
||||||
|
pApplication->ReferenceApplication();
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
DereferenceRecord(
|
||||||
|
APPLICATION *pApplication
|
||||||
|
)
|
||||||
|
{
|
||||||
|
pApplication->DereferenceApplication();
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
APPLICATION_HASH(const APPLICATION_HASH &);
|
||||||
|
void operator=(const APPLICATION_HASH &);
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,158 @@
|
||||||
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#define DEFAULT_HASH_BUCKETS 293
|
||||||
|
|
||||||
|
class APPLICATION_MANAGER
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
static
|
||||||
|
APPLICATION_MANAGER*
|
||||||
|
GetInstance(
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if( sm_pApplicationManager == NULL )
|
||||||
|
{
|
||||||
|
sm_pApplicationManager = new APPLICATION_MANAGER();
|
||||||
|
}
|
||||||
|
|
||||||
|
return sm_pApplicationManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
VOID
|
||||||
|
Cleanup(
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if(sm_pApplicationManager != NULL)
|
||||||
|
{
|
||||||
|
delete sm_pApplicationManager;
|
||||||
|
sm_pApplicationManager = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
GetApplication(
|
||||||
|
_In_ IHttpContext* pContext,
|
||||||
|
_Out_ APPLICATION ** ppApplication
|
||||||
|
);
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
RecycleApplication(
|
||||||
|
_In_ LPCWSTR pszApplication
|
||||||
|
);
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
Get502ErrorPage(
|
||||||
|
_Out_ HTTP_DATA_CHUNK** ppErrorPage
|
||||||
|
);
|
||||||
|
|
||||||
|
~APPLICATION_MANAGER()
|
||||||
|
{
|
||||||
|
if(m_pApplicationHash != NULL)
|
||||||
|
{
|
||||||
|
m_pApplicationHash->Clear();
|
||||||
|
delete m_pApplicationHash;
|
||||||
|
m_pApplicationHash = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( m_pFileWatcher!= NULL )
|
||||||
|
{
|
||||||
|
delete m_pFileWatcher;
|
||||||
|
m_pFileWatcher = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(m_pHttp502ErrorPage != NULL)
|
||||||
|
{
|
||||||
|
delete m_pHttp502ErrorPage;
|
||||||
|
m_pHttp502ErrorPage = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
FILE_WATCHER*
|
||||||
|
GetFileWatcher()
|
||||||
|
{
|
||||||
|
return m_pFileWatcher;
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT Initialize()
|
||||||
|
{
|
||||||
|
HRESULT hr = S_OK;
|
||||||
|
|
||||||
|
if(m_pApplicationHash == NULL)
|
||||||
|
{
|
||||||
|
m_pApplicationHash = new APPLICATION_HASH();
|
||||||
|
if(m_pApplicationHash == NULL)
|
||||||
|
{
|
||||||
|
hr = E_OUTOFMEMORY;
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = m_pApplicationHash->Initialize(DEFAULT_HASH_BUCKETS);
|
||||||
|
if(FAILED(hr))
|
||||||
|
{
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( m_pFileWatcher == NULL )
|
||||||
|
{
|
||||||
|
m_pFileWatcher = new FILE_WATCHER;
|
||||||
|
if(m_pFileWatcher == NULL)
|
||||||
|
{
|
||||||
|
hr = HRESULT_FROM_WIN32( ERROR_NOT_ENOUGH_MEMORY );
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_pFileWatcher->Create();
|
||||||
|
}
|
||||||
|
|
||||||
|
Finished:
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
//
|
||||||
|
// we currently limit the size of m_pstrErrorInfo to 5000, be careful if you want to change its payload
|
||||||
|
//
|
||||||
|
APPLICATION_MANAGER() : m_pApplicationHash(NULL), m_pFileWatcher(NULL), m_pHttp502ErrorPage(NULL), m_pstrErrorInfo(
|
||||||
|
"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\"> \
|
||||||
|
<html xmlns=\"http://www.w3.org/1999/xhtml\"> \
|
||||||
|
<head> \
|
||||||
|
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\" /> \
|
||||||
|
<title> IIS 502.5 Error </title><style type=\"text/css\"></style></head> \
|
||||||
|
<body> <div id = \"content\"> \
|
||||||
|
<div class = \"content-container\"><h3> HTTP Error 502.5 - Process Failure </h3></div> \
|
||||||
|
<div class = \"content-container\"> \
|
||||||
|
<fieldset> <h4> Common causes of this issue: </h4> \
|
||||||
|
<ul><li> The application process failed to start </li> \
|
||||||
|
<li> The application process started but then stopped </li> \
|
||||||
|
<li> The application process started but failed to listen on the configured port </li></ul></fieldset> \
|
||||||
|
</div> \
|
||||||
|
<div class = \"content-container\"> \
|
||||||
|
<fieldset><h4> Troubleshooting steps: </h4> \
|
||||||
|
<ul><li> Check the system event log for error messages </li> \
|
||||||
|
<li> Enable logging the application process' stdout messages </li> \
|
||||||
|
<li> Attach a debugger to the application process and inspect </li></ul></fieldset> \
|
||||||
|
<fieldset><h4> For more information visit: \
|
||||||
|
<a href=\"https://go.microsoft.com/fwlink/?linkid=808681\"> <cite> https://go.microsoft.com/fwlink/?LinkID=808681 </cite></a></h4> \
|
||||||
|
</fieldset> \
|
||||||
|
</div> \
|
||||||
|
</div></body></html>")
|
||||||
|
{
|
||||||
|
InitializeSRWLock(&m_srwLock);
|
||||||
|
}
|
||||||
|
|
||||||
|
FILE_WATCHER *m_pFileWatcher;
|
||||||
|
APPLICATION_HASH *m_pApplicationHash;
|
||||||
|
static APPLICATION_MANAGER *sm_pApplicationManager;
|
||||||
|
SRWLOCK m_srwLock;
|
||||||
|
HTTP_DATA_CHUNK *m_pHttp502ErrorPage;
|
||||||
|
LPSTR m_pstrErrorInfo;
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,207 @@
|
||||||
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#define CS_ROOTWEB_CONFIG L"MACHINE/WEBROOT/APPHOST/"
|
||||||
|
#define CS_ROOTWEB_CONFIG_LEN _countof(CS_ROOTWEB_CONFIG)-1
|
||||||
|
#define CS_ASPNETCORE_SECTION L"system.webServer/aspNetCore"
|
||||||
|
#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_ASPNETCORE_PROCESS_EXE_PATH L"processPath"
|
||||||
|
#define CS_ASPNETCORE_PROCESS_ARGUMENTS L"arguments"
|
||||||
|
#define CS_ASPNETCORE_PROCESS_STARTUP_TIME_LIMIT L"startupTimeLimit"
|
||||||
|
#define CS_ASPNETCORE_PROCESS_SHUTDOWN_TIME_LIMIT L"shutdownTimeLimit"
|
||||||
|
#define CS_ASPNETCORE_WINHTTP_REQUEST_TIMEOUT L"requestTimeout"
|
||||||
|
#define CS_ASPNETCORE_RAPID_FAILS_PER_MINUTE L"rapidFailsPerMinute"
|
||||||
|
#define CS_ASPNETCORE_STDOUT_LOG_ENABLED L"stdoutLogEnabled"
|
||||||
|
#define CS_ASPNETCORE_STDOUT_LOG_FILE L"stdoutLogFile"
|
||||||
|
#define CS_ASPNETCORE_ENVIRONMENT_VARIABLES L"environmentVariables"
|
||||||
|
#define CS_ASPNETCORE_ENVIRONMENT_VARIABLE L"environmentVariable"
|
||||||
|
#define CS_ASPNETCORE_ENVIRONMENT_VARIABLE_NAME L"name"
|
||||||
|
#define CS_ASPNETCORE_ENVIRONMENT_VARIABLE_VALUE L"value"
|
||||||
|
#define CS_ASPNETCORE_PROCESSES_PER_APPLICATION L"processesPerApplication"
|
||||||
|
#define CS_ASPNETCORE_FORWARD_WINDOWS_AUTH_TOKEN L"forwardWindowsAuthToken"
|
||||||
|
#define CS_ASPNETCORE_DISABLE_START_UP_ERROR_PAGE L"disableStartUpErrorPage"
|
||||||
|
#define CS_ASPNETCORE_RECYCLE_ON_FILE_CHANGE L"recycleOnFileChange"
|
||||||
|
#define CS_ASPNETCORE_RECYCLE_ON_FILE_CHANGE_FILE L"file"
|
||||||
|
#define CS_ASPNETCORE_RECYCLE_ON_FILE_CHANGE_FILE_PATH L"path"
|
||||||
|
|
||||||
|
#define MAX_RAPID_FAILS_PER_MINUTE 100
|
||||||
|
#define MILLISECONDS_IN_ONE_SECOND 1000
|
||||||
|
#define MIN_PORT 1025
|
||||||
|
#define MAX_PORT 48000
|
||||||
|
|
||||||
|
#define HEX_TO_ASCII(c) ((CHAR)(((c) < 10) ? ((c) + '0') : ((c) + 'a' - 10)))
|
||||||
|
|
||||||
|
extern HTTP_MODULE_ID g_pModuleId;
|
||||||
|
extern IHttpServer * g_pHttpServer;
|
||||||
|
|
||||||
|
class ASPNETCORE_CONFIG : IHttpStoredContext
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
virtual
|
||||||
|
~ASPNETCORE_CONFIG();
|
||||||
|
|
||||||
|
VOID
|
||||||
|
CleanupStoredContext()
|
||||||
|
{
|
||||||
|
delete this;
|
||||||
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
HRESULT
|
||||||
|
GetConfig(
|
||||||
|
_In_ IHttpContext *pHttpContext,
|
||||||
|
_Out_ ASPNETCORE_CONFIG **ppAspNetCoreConfig
|
||||||
|
);
|
||||||
|
|
||||||
|
ENVIRONMENT_VAR_HASH*
|
||||||
|
QueryEnvironmentVariables(
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return m_pEnvironmentVariables;
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD
|
||||||
|
QueryRapidFailsPerMinute(
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return m_dwRapidFailsPerMinute;
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD
|
||||||
|
QueryStartupTimeLimitInMS(
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return m_dwStartupTimeLimitInMS;
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD
|
||||||
|
QueryShutdownTimeLimitInMS(
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return m_dwShutdownTimeLimitInMS;
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD
|
||||||
|
QueryProcessesPerApplication(
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return m_dwProcessesPerApplication;
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD
|
||||||
|
QueryRequestTimeoutInMS(
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return m_dwRequestTimeoutInMS;
|
||||||
|
}
|
||||||
|
|
||||||
|
STRU*
|
||||||
|
QueryArguments(
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return &m_struArguments;
|
||||||
|
}
|
||||||
|
|
||||||
|
STRU*
|
||||||
|
QueryApplicationPath(
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return &m_struApplication;
|
||||||
|
}
|
||||||
|
|
||||||
|
STRU*
|
||||||
|
QueryProcessPath(
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return &m_struProcessPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
QueryStdoutLogEnabled()
|
||||||
|
{
|
||||||
|
return m_fStdoutLogEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
QueryForwardWindowsAuthToken()
|
||||||
|
{
|
||||||
|
return m_fForwardWindowsAuthToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
QueryWindowsAuthEnabled()
|
||||||
|
{
|
||||||
|
return m_fWindowsAuthEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
QueryBasicAuthEnabled()
|
||||||
|
{
|
||||||
|
return m_fBasicAuthEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
QueryAnonymousAuthEnabled()
|
||||||
|
{
|
||||||
|
return m_fAnonymousAuthEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
QueryDisableStartUpErrorPage()
|
||||||
|
{
|
||||||
|
return m_fDisableStartUpErrorPage;
|
||||||
|
}
|
||||||
|
|
||||||
|
STRU*
|
||||||
|
QueryStdoutLogFile()
|
||||||
|
{
|
||||||
|
return &m_struStdoutLogFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
//
|
||||||
|
// private constructor
|
||||||
|
//
|
||||||
|
ASPNETCORE_CONFIG():
|
||||||
|
m_fStdoutLogEnabled( FALSE ),
|
||||||
|
m_pEnvironmentVariables( NULL )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
Populate(
|
||||||
|
IHttpContext *pHttpContext
|
||||||
|
);
|
||||||
|
|
||||||
|
DWORD m_dwRequestTimeoutInMS;
|
||||||
|
DWORD m_dwStartupTimeLimitInMS;
|
||||||
|
DWORD m_dwShutdownTimeLimitInMS;
|
||||||
|
DWORD m_dwRapidFailsPerMinute;
|
||||||
|
DWORD m_dwProcessesPerApplication;
|
||||||
|
STRU m_struApplication;
|
||||||
|
STRU m_struArguments;
|
||||||
|
STRU m_struProcessPath;
|
||||||
|
STRU m_struStdoutLogFile;
|
||||||
|
BOOL m_fStdoutLogEnabled;
|
||||||
|
BOOL m_fForwardWindowsAuthToken;
|
||||||
|
BOOL m_fDisableStartUpErrorPage;
|
||||||
|
BOOL m_fWindowsAuthEnabled;
|
||||||
|
BOOL m_fBasicAuthEnabled;
|
||||||
|
BOOL m_fAnonymousAuthEnabled;
|
||||||
|
ENVIRONMENT_VAR_HASH* m_pEnvironmentVariables;
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,82 @@
|
||||||
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#define ASPNETCORE_DEBUG_FLAG_INFO 0x00000001
|
||||||
|
#define ASPNETCORE_DEBUG_FLAG_WARNING 0x00000002
|
||||||
|
#define ASPNETCORE_DEBUG_FLAG_ERROR 0x00000004
|
||||||
|
|
||||||
|
extern DWORD g_dwAspNetCoreDebugFlags;
|
||||||
|
|
||||||
|
static
|
||||||
|
BOOL
|
||||||
|
IfDebug(
|
||||||
|
DWORD dwFlag
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return ( dwFlag & g_dwAspNetCoreDebugFlags );
|
||||||
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
VOID
|
||||||
|
DebugPrint(
|
||||||
|
DWORD dwFlag,
|
||||||
|
LPCSTR szString
|
||||||
|
)
|
||||||
|
{
|
||||||
|
STACK_STRA (strOutput, 256);
|
||||||
|
HRESULT hr = S_OK;
|
||||||
|
|
||||||
|
if ( IfDebug( dwFlag ) )
|
||||||
|
{
|
||||||
|
hr = strOutput.SafeSnprintf(
|
||||||
|
"[aspnetcore.dll] %s\r\n",
|
||||||
|
szString );
|
||||||
|
|
||||||
|
if (FAILED (hr))
|
||||||
|
{
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
OutputDebugStringA( strOutput.QueryStr() );
|
||||||
|
}
|
||||||
|
|
||||||
|
Finished:
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
VOID
|
||||||
|
DebugPrintf(
|
||||||
|
DWORD dwFlag,
|
||||||
|
LPCSTR szFormat,
|
||||||
|
...
|
||||||
|
)
|
||||||
|
{
|
||||||
|
STACK_STRA (strCooked,256);
|
||||||
|
|
||||||
|
va_list args;
|
||||||
|
HRESULT hr = S_OK;
|
||||||
|
|
||||||
|
if ( IfDebug( dwFlag ) )
|
||||||
|
{
|
||||||
|
va_start( args, szFormat );
|
||||||
|
|
||||||
|
hr = strCooked.SafeVsnprintf(szFormat, args );
|
||||||
|
|
||||||
|
va_end( args );
|
||||||
|
|
||||||
|
if (FAILED (hr))
|
||||||
|
{
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
DebugPrint( dwFlag, strCooked.QueryStr() );
|
||||||
|
}
|
||||||
|
|
||||||
|
Finished:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,155 @@
|
||||||
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
//
|
||||||
|
// The key used for hash-table lookups, consists of the port on which the http process is created.
|
||||||
|
//
|
||||||
|
|
||||||
|
class ENVIRONMENT_VAR_ENTRY
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ENVIRONMENT_VAR_ENTRY():
|
||||||
|
_cRefs(1)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
Initialize(
|
||||||
|
PCWSTR pszName,
|
||||||
|
PCWSTR pszValue
|
||||||
|
)
|
||||||
|
{
|
||||||
|
HRESULT hr = S_OK;
|
||||||
|
if (FAILED(hr = _strName.Copy(pszName)) ||
|
||||||
|
FAILED(hr = _strValue.Copy(pszValue)))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
Reference() const
|
||||||
|
{
|
||||||
|
InterlockedIncrement(&_cRefs);
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
Dereference() const
|
||||||
|
{
|
||||||
|
if (InterlockedDecrement(&_cRefs) == 0)
|
||||||
|
{
|
||||||
|
delete this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
PWSTR const
|
||||||
|
QueryName()
|
||||||
|
{
|
||||||
|
return _strName.QueryStr();
|
||||||
|
}
|
||||||
|
|
||||||
|
PWSTR const
|
||||||
|
QueryValue()
|
||||||
|
{
|
||||||
|
return _strValue.QueryStr();
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
~ENVIRONMENT_VAR_ENTRY()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
STRU _strName;
|
||||||
|
STRU _strValue;
|
||||||
|
mutable LONG _cRefs;
|
||||||
|
};
|
||||||
|
|
||||||
|
class ENVIRONMENT_VAR_HASH : public HASH_TABLE<ENVIRONMENT_VAR_ENTRY, PWSTR>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ENVIRONMENT_VAR_HASH()
|
||||||
|
{}
|
||||||
|
|
||||||
|
PWSTR
|
||||||
|
ExtractKey(
|
||||||
|
ENVIRONMENT_VAR_ENTRY * pEntry
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return pEntry->QueryName();
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD
|
||||||
|
CalcKeyHash(
|
||||||
|
PWSTR pszName
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return HashStringNoCase(pszName);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
EqualKeys(
|
||||||
|
PWSTR pszName1,
|
||||||
|
PWSTR pszName2
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return (_wcsicmp(pszName1, pszName2) == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
ReferenceRecord(
|
||||||
|
ENVIRONMENT_VAR_ENTRY * pEntry
|
||||||
|
)
|
||||||
|
{
|
||||||
|
pEntry->Reference();
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
DereferenceRecord(
|
||||||
|
ENVIRONMENT_VAR_ENTRY * pEntry
|
||||||
|
)
|
||||||
|
{
|
||||||
|
pEntry->Dereference();
|
||||||
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
VOID
|
||||||
|
CopyToMultiSz(
|
||||||
|
ENVIRONMENT_VAR_ENTRY * pEntry,
|
||||||
|
PVOID pvData
|
||||||
|
)
|
||||||
|
{
|
||||||
|
STRU strTemp;
|
||||||
|
MULTISZ *pMultiSz = static_cast<MULTISZ *>(pvData);
|
||||||
|
DBG_ASSERT(pMultiSz);
|
||||||
|
DBG_ASSERT(pEntry);
|
||||||
|
strTemp.Copy(pEntry->QueryName());
|
||||||
|
strTemp.Append(pEntry->QueryValue());
|
||||||
|
pMultiSz->Append(strTemp.QueryStr());
|
||||||
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
VOID
|
||||||
|
CopyToTable(
|
||||||
|
ENVIRONMENT_VAR_ENTRY * pEntry,
|
||||||
|
PVOID pvData
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// best effort copy, ignore the failure
|
||||||
|
ENVIRONMENT_VAR_ENTRY * pNewEntry = new ENVIRONMENT_VAR_ENTRY();
|
||||||
|
if (pNewEntry != NULL)
|
||||||
|
{
|
||||||
|
pNewEntry->Initialize(pEntry->QueryName(), pEntry->QueryValue());
|
||||||
|
ENVIRONMENT_VAR_HASH *pHash = static_cast<ENVIRONMENT_VAR_HASH *>(pvData);
|
||||||
|
DBG_ASSERT(pHash);
|
||||||
|
pHash->InsertRecord(pNewEntry);
|
||||||
|
// Need to dereference as InsertRecord references it now
|
||||||
|
pNewEntry->Dereference();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
ENVIRONMENT_VAR_HASH(const ENVIRONMENT_VAR_HASH &);
|
||||||
|
void operator=(const ENVIRONMENT_VAR_HASH &);
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,126 @@
|
||||||
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#define FILE_WATCHER_SHUTDOWN_KEY (ULONG_PTR)(-1)
|
||||||
|
#define FILE_WATCHER_ENTRY_BUFFER_SIZE 4096
|
||||||
|
#ifndef CONTAINING_RECORD
|
||||||
|
//
|
||||||
|
// Calculate the address of the base of the structure given its type, and an
|
||||||
|
// address of a field within the structure.
|
||||||
|
//
|
||||||
|
|
||||||
|
#define CONTAINING_RECORD(address, type, field) \
|
||||||
|
((type *)((PCHAR)(address)-(ULONG_PTR)(&((type *)0)->field)))
|
||||||
|
|
||||||
|
#endif // !CONTAINING_RECORD
|
||||||
|
#define FILE_NOTIFY_VALID_MASK 0x00000fff
|
||||||
|
#define FILE_WATCHER_ENTRY_SIGNATURE ((DWORD) 'FWES')
|
||||||
|
#define FILE_WATCHER_ENTRY_SIGNATURE_FREE ((DWORD) 'sewf')
|
||||||
|
|
||||||
|
class APPLICATION;
|
||||||
|
|
||||||
|
class FILE_WATCHER{
|
||||||
|
public:
|
||||||
|
|
||||||
|
FILE_WATCHER();
|
||||||
|
|
||||||
|
~FILE_WATCHER();
|
||||||
|
|
||||||
|
HRESULT Create();
|
||||||
|
|
||||||
|
HANDLE
|
||||||
|
QueryCompletionPort(
|
||||||
|
VOID
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return m_hCompletionPort;
|
||||||
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
DWORD
|
||||||
|
WINAPI ChangeNotificationThread(LPVOID);
|
||||||
|
|
||||||
|
static
|
||||||
|
void
|
||||||
|
WINAPI FileWatcherCompletionRoutine
|
||||||
|
(
|
||||||
|
DWORD dwCompletionStatus,
|
||||||
|
DWORD cbCompletion,
|
||||||
|
OVERLAPPED * pOverlapped
|
||||||
|
);
|
||||||
|
|
||||||
|
private:
|
||||||
|
HANDLE m_hCompletionPort;
|
||||||
|
HANDLE m_hChangeNotificationThread;
|
||||||
|
};
|
||||||
|
|
||||||
|
class FILE_WATCHER_ENTRY
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
FILE_WATCHER_ENTRY(FILE_WATCHER * pFileMonitor);
|
||||||
|
|
||||||
|
OVERLAPPED _overlapped;
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
Create(
|
||||||
|
_In_ PCWSTR pszDirectoryToMonitor,
|
||||||
|
_In_ PCWSTR pszFileNameToMonitor,
|
||||||
|
_In_ APPLICATION* pApplication,
|
||||||
|
_In_ HANDLE hImpersonationToken
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
ReferenceFileWatcherEntry() const
|
||||||
|
{
|
||||||
|
InterlockedIncrement(&_cRefs);
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
DereferenceFileWatcherEntry() const
|
||||||
|
{
|
||||||
|
if (InterlockedDecrement(&_cRefs) == 0)
|
||||||
|
{
|
||||||
|
delete this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
QueryIsValid() const
|
||||||
|
{
|
||||||
|
return _fIsValid;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
MarkEntryInValid()
|
||||||
|
{
|
||||||
|
_fIsValid = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT Monitor();
|
||||||
|
|
||||||
|
VOID StopMonitor();
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
HandleChangeCompletion(
|
||||||
|
_In_ DWORD dwCompletionStatus,
|
||||||
|
_In_ DWORD cbCompletion
|
||||||
|
);
|
||||||
|
|
||||||
|
private:
|
||||||
|
virtual ~FILE_WATCHER_ENTRY();
|
||||||
|
|
||||||
|
DWORD _dwSignature;
|
||||||
|
BUFFER _buffDirectoryChanges;
|
||||||
|
HANDLE _hImpersonationToken;
|
||||||
|
HANDLE _hDirectory;
|
||||||
|
FILE_WATCHER* _pFileMonitor;
|
||||||
|
APPLICATION* _pApplication;
|
||||||
|
STRU _strFileName;
|
||||||
|
STRU _strDirectoryName;
|
||||||
|
LONG _lStopMonitorCalled;
|
||||||
|
mutable LONG _cRefs;
|
||||||
|
BOOL _fIsValid;
|
||||||
|
SRWLOCK _srwLock;
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,157 @@
|
||||||
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
//
|
||||||
|
// The key used for hash-table lookups, consists of the port on which the http process is created.
|
||||||
|
//
|
||||||
|
class FORWARDER_CONNECTION_KEY
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
FORWARDER_CONNECTION_KEY(
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
Initialize(
|
||||||
|
_In_ DWORD dwPort
|
||||||
|
)
|
||||||
|
{
|
||||||
|
m_dwPort = dwPort;
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
GetIsEqual(
|
||||||
|
const FORWARDER_CONNECTION_KEY * key2
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return m_dwPort == key2->m_dwPort;
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD CalcKeyHash() const
|
||||||
|
{
|
||||||
|
// TODO: Review hash distribution.
|
||||||
|
return Hash(m_dwPort);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
DWORD m_dwPort;
|
||||||
|
};
|
||||||
|
|
||||||
|
class FORWARDER_CONNECTION
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
FORWARDER_CONNECTION(
|
||||||
|
VOID
|
||||||
|
);
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
Initialize(
|
||||||
|
DWORD dwPort
|
||||||
|
);
|
||||||
|
|
||||||
|
HINTERNET
|
||||||
|
QueryHandle() const
|
||||||
|
{
|
||||||
|
return m_hConnection;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
ReferenceForwarderConnection() const
|
||||||
|
{
|
||||||
|
InterlockedIncrement(&m_cRefs);
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
DereferenceForwarderConnection() const
|
||||||
|
{
|
||||||
|
if (InterlockedDecrement(&m_cRefs) == 0)
|
||||||
|
{
|
||||||
|
delete this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FORWARDER_CONNECTION_KEY *
|
||||||
|
QueryConnectionKey()
|
||||||
|
{
|
||||||
|
return &m_ConnectionKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
~FORWARDER_CONNECTION()
|
||||||
|
{
|
||||||
|
if (m_hConnection != NULL)
|
||||||
|
{
|
||||||
|
WinHttpCloseHandle(m_hConnection);
|
||||||
|
m_hConnection = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mutable LONG m_cRefs;
|
||||||
|
FORWARDER_CONNECTION_KEY m_ConnectionKey;
|
||||||
|
HINTERNET m_hConnection;
|
||||||
|
};
|
||||||
|
|
||||||
|
class FORWARDER_CONNECTION_HASH :
|
||||||
|
public HASH_TABLE<FORWARDER_CONNECTION, FORWARDER_CONNECTION_KEY *>
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
FORWARDER_CONNECTION_HASH()
|
||||||
|
{}
|
||||||
|
|
||||||
|
FORWARDER_CONNECTION_KEY *
|
||||||
|
ExtractKey(
|
||||||
|
FORWARDER_CONNECTION *pConnection
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return pConnection->QueryConnectionKey();
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD
|
||||||
|
CalcKeyHash(
|
||||||
|
FORWARDER_CONNECTION_KEY *key
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return key->CalcKeyHash();
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
EqualKeys(
|
||||||
|
FORWARDER_CONNECTION_KEY *key1,
|
||||||
|
FORWARDER_CONNECTION_KEY *key2
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return key1->GetIsEqual(key2);
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
ReferenceRecord(
|
||||||
|
FORWARDER_CONNECTION *pConnection
|
||||||
|
)
|
||||||
|
{
|
||||||
|
pConnection->ReferenceForwarderConnection();
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
DereferenceRecord(
|
||||||
|
FORWARDER_CONNECTION *pConnection
|
||||||
|
)
|
||||||
|
{
|
||||||
|
pConnection->DereferenceForwarderConnection();
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
FORWARDER_CONNECTION_HASH(const FORWARDER_CONNECTION_HASH &);
|
||||||
|
void operator=(const FORWARDER_CONNECTION_HASH &);
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,468 @@
|
||||||
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "forwarderconnection.h"
|
||||||
|
#include "protocolconfig.h"
|
||||||
|
#include "serverprocess.h"
|
||||||
|
#include "application.h"
|
||||||
|
#include "tracelog.h"
|
||||||
|
#include "websockethandler.h"
|
||||||
|
|
||||||
|
#define ASPNETCORE_DEBUG_STRU_BUFFER_SIZE 100
|
||||||
|
#define ASPNETCORE_DEBUG_STRU_ARRAY_SIZE 100
|
||||||
|
|
||||||
|
enum FORWARDING_REQUEST_STATUS
|
||||||
|
{
|
||||||
|
FORWARDER_START,
|
||||||
|
FORWARDER_SENDING_REQUEST,
|
||||||
|
FORWARDER_RECEIVING_RESPONSE,
|
||||||
|
FORWARDER_RECEIVED_WEBSOCKET_RESPONSE,
|
||||||
|
FORWARDER_RESET_CONNECTION,
|
||||||
|
FORWARDER_DONE
|
||||||
|
};
|
||||||
|
|
||||||
|
extern HTTP_MODULE_ID g_pModuleId;
|
||||||
|
extern IHttpServer * g_pHttpServer;
|
||||||
|
extern BOOL g_fAsyncDisconnectAvailable;
|
||||||
|
extern PCWSTR g_pszModuleName;
|
||||||
|
extern HMODULE g_hModule;
|
||||||
|
extern HMODULE g_hWinHttpModule;
|
||||||
|
extern DWORD g_dwTlsIndex;
|
||||||
|
extern DWORD g_OptionalWinHttpFlags;
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
extern STRA g_strLogs[ASPNETCORE_DEBUG_STRU_ARRAY_SIZE];
|
||||||
|
extern DWORD g_dwLogCounter;
|
||||||
|
#endif // DEBUG
|
||||||
|
|
||||||
|
enum MULTI_PART_POSITION
|
||||||
|
{
|
||||||
|
MULTI_PART_IN_BOUNDARY,
|
||||||
|
MULTI_PART_IN_HEADER,
|
||||||
|
MULTI_PART_IN_CHUNK,
|
||||||
|
MULTI_PART_IN_CHUNK_END
|
||||||
|
};
|
||||||
|
|
||||||
|
class ASYNC_DISCONNECT_CONTEXT;
|
||||||
|
|
||||||
|
#define FORWARDING_HANDLER_SIGNATURE ((DWORD)'FHLR')
|
||||||
|
#define FORWARDING_HANDLER_SIGNATURE_FREE ((DWORD)'fhlr')
|
||||||
|
|
||||||
|
class FORWARDING_HANDLER
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
FORWARDING_HANDLER(
|
||||||
|
__in IHttpContext * pW3Context
|
||||||
|
);
|
||||||
|
|
||||||
|
static void * operator new(size_t size);
|
||||||
|
|
||||||
|
static void operator delete(void * pMemory);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
ReferenceForwardingHandler(
|
||||||
|
VOID
|
||||||
|
) const;
|
||||||
|
|
||||||
|
VOID
|
||||||
|
DereferenceForwardingHandler(
|
||||||
|
VOID
|
||||||
|
) const;
|
||||||
|
|
||||||
|
REQUEST_NOTIFICATION_STATUS
|
||||||
|
OnExecuteRequestHandler();
|
||||||
|
|
||||||
|
REQUEST_NOTIFICATION_STATUS
|
||||||
|
OnAsyncCompletion(
|
||||||
|
DWORD cbCompletion,
|
||||||
|
HRESULT hrCompletionStatus
|
||||||
|
);
|
||||||
|
|
||||||
|
IHttpTraceContext *
|
||||||
|
QueryTraceContext()
|
||||||
|
{
|
||||||
|
return m_pW3Context->GetTraceContext();
|
||||||
|
}
|
||||||
|
|
||||||
|
IHttpContext *
|
||||||
|
QueryHttpContext(
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return m_pW3Context;
|
||||||
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
VOID
|
||||||
|
CALLBACK
|
||||||
|
OnWinHttpCompletion(
|
||||||
|
HINTERNET hRequest,
|
||||||
|
DWORD_PTR dwContext,
|
||||||
|
DWORD dwInternetStatus,
|
||||||
|
LPVOID lpvStatusInformation,
|
||||||
|
DWORD dwStatusInformationLength
|
||||||
|
)
|
||||||
|
{
|
||||||
|
|
||||||
|
FORWARDING_HANDLER * pThis = static_cast<FORWARDING_HANDLER *>(reinterpret_cast<PVOID>(dwContext));
|
||||||
|
if (pThis == NULL)
|
||||||
|
{
|
||||||
|
//error happened, nothing can be done here
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
DBG_ASSERT(pThis->m_Signature == FORWARDING_HANDLER_SIGNATURE);
|
||||||
|
pThis->OnWinHttpCompletionInternal(hRequest,
|
||||||
|
dwInternetStatus,
|
||||||
|
lpvStatusInformation,
|
||||||
|
dwStatusInformationLength);
|
||||||
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
HRESULT
|
||||||
|
StaticInitialize(
|
||||||
|
BOOL fEnableReferenceCountTracing
|
||||||
|
);
|
||||||
|
|
||||||
|
static
|
||||||
|
VOID
|
||||||
|
StaticTerminate();
|
||||||
|
|
||||||
|
static
|
||||||
|
PCWSTR
|
||||||
|
QueryErrorFormat()
|
||||||
|
{
|
||||||
|
return sm_strErrorFormat.QueryStr();
|
||||||
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
HANDLE
|
||||||
|
QueryEventLog()
|
||||||
|
{
|
||||||
|
return sm_hEventLog;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
TerminateRequest(
|
||||||
|
BOOL fClientInitiated
|
||||||
|
);
|
||||||
|
|
||||||
|
static HINTERNET sm_hSession;
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
SetStatusAndHeaders(
|
||||||
|
PCSTR pszHeaders,
|
||||||
|
DWORD cchHeaders
|
||||||
|
);
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
OnSharedRequestEntity(
|
||||||
|
ULONGLONG ulOffset,
|
||||||
|
LPCBYTE pvBuffer,
|
||||||
|
DWORD cbBuffer
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
SetStatus(
|
||||||
|
FORWARDING_REQUEST_STATUS status
|
||||||
|
)
|
||||||
|
{
|
||||||
|
m_RequestStatus = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual
|
||||||
|
~FORWARDING_HANDLER(
|
||||||
|
VOID
|
||||||
|
);
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
//
|
||||||
|
// Begin OnMapRequestHandler phases.
|
||||||
|
//
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
CreateWinHttpRequest(
|
||||||
|
__in const IHttpRequest * pRequest,
|
||||||
|
__in const PROTOCOL_CONFIG * pProtocol,
|
||||||
|
__in HINTERNET hConnect,
|
||||||
|
__inout STRU * pstrUrl,
|
||||||
|
ASPNETCORE_CONFIG* pAspNetCoreConfig,
|
||||||
|
SERVER_PROCESS* pServerProcess
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// End OnMapRequestHandler phases.
|
||||||
|
//
|
||||||
|
|
||||||
|
VOID
|
||||||
|
RemoveRequest();
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
GetHeaders(
|
||||||
|
const PROTOCOL_CONFIG * pProtocol,
|
||||||
|
PCWSTR * ppszHeaders,
|
||||||
|
DWORD * pcchHeaders,
|
||||||
|
ASPNETCORE_CONFIG* pAspNetCoreConfig,
|
||||||
|
SERVER_PROCESS* pServerProcess
|
||||||
|
);
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
DoReverseRewrite(
|
||||||
|
__in IHttpResponse *pResponse
|
||||||
|
);
|
||||||
|
|
||||||
|
BYTE *
|
||||||
|
GetNewResponseBuffer(
|
||||||
|
DWORD dwBufferSize
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
FreeResponseBuffers();
|
||||||
|
|
||||||
|
VOID
|
||||||
|
OnWinHttpCompletionInternal(
|
||||||
|
HINTERNET hRequest,
|
||||||
|
DWORD dwInternetStatus,
|
||||||
|
LPVOID lpvStatusInformation,
|
||||||
|
DWORD dwStatusInformationLength
|
||||||
|
);
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
OnWinHttpCompletionSendRequestOrWriteComplete(
|
||||||
|
HINTERNET hRequest,
|
||||||
|
DWORD dwInternetStatus,
|
||||||
|
__out BOOL * pfClientError,
|
||||||
|
__out BOOL * pfAnotherCompletionExpected
|
||||||
|
);
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
OnWinHttpCompletionStatusHeadersAvailable(
|
||||||
|
HINTERNET hRequest,
|
||||||
|
__out BOOL * pfAnotherCompletionExpected
|
||||||
|
);
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
OnWinHttpCompletionStatusDataAvailable(
|
||||||
|
HINTERNET hRequest,
|
||||||
|
DWORD dwBytes,
|
||||||
|
__out BOOL * pfAnotherCompletionExpected
|
||||||
|
);
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
OnWinHttpCompletionStatusReadComplete(
|
||||||
|
__in IHttpResponse * pResponse,
|
||||||
|
DWORD dwStatusInformationLength,
|
||||||
|
__out BOOL * pfAnotherCompletionExpected
|
||||||
|
);
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
OnSendingRequest(
|
||||||
|
DWORD cbCompletion,
|
||||||
|
HRESULT hrCompletionStatus,
|
||||||
|
__out BOOL * pfClientError
|
||||||
|
);
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
OnReceivingResponse();
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
OnWebSocketWinHttpSendComplete(
|
||||||
|
HINTERNET hRequest,
|
||||||
|
LPVOID pvStatus,
|
||||||
|
DWORD hrCompletion,
|
||||||
|
DWORD cbCompletion,
|
||||||
|
BOOL * pfAnotherCompletionExpected
|
||||||
|
);
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
OnWebSocketWinHttpReceiveComplete(
|
||||||
|
HINTERNET hRequest,
|
||||||
|
LPVOID pvStatus,
|
||||||
|
DWORD hrCompletion,
|
||||||
|
DWORD cbCompletion,
|
||||||
|
BOOL * pfAnotherCompletionExpected
|
||||||
|
);
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
OnWebSocketIisSendComplete(
|
||||||
|
DWORD hrCompletion,
|
||||||
|
DWORD cbCompletion
|
||||||
|
);
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
OnWebSocketIisReceiveComplete(
|
||||||
|
DWORD hrCompletion,
|
||||||
|
DWORD cbCompletion
|
||||||
|
);
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
DoIisWebSocketReceive(
|
||||||
|
VOID
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
TerminateWebsocket(
|
||||||
|
VOID
|
||||||
|
);
|
||||||
|
|
||||||
|
DWORD m_Signature;
|
||||||
|
mutable LONG m_cRefs;
|
||||||
|
|
||||||
|
IHttpContext * m_pW3Context;
|
||||||
|
|
||||||
|
//
|
||||||
|
// WinHTTP request handle is protected using a read-write lock.
|
||||||
|
//
|
||||||
|
SRWLOCK m_RequestLock;
|
||||||
|
HINTERNET m_hRequest;
|
||||||
|
|
||||||
|
APP_OFFLINE_HTM *m_pAppOfflineHtm;
|
||||||
|
APPLICATION *m_pApplication;
|
||||||
|
|
||||||
|
BOOL m_fResponseHeadersReceivedAndSet;
|
||||||
|
volatile BOOL m_fClientDisconnected;
|
||||||
|
//
|
||||||
|
// A safety guard flag indicating no more IIS PostCompletion is allowed
|
||||||
|
//
|
||||||
|
volatile BOOL m_fFinishRequest;
|
||||||
|
//
|
||||||
|
// A safety guard flag to prevent from unexpect callback which may signal IIS pipeline
|
||||||
|
// more than once with non-pending status
|
||||||
|
//
|
||||||
|
volatile BOOL m_fDoneAsyncCompletion;
|
||||||
|
volatile BOOL m_fHasError;
|
||||||
|
//
|
||||||
|
// WinHttp may hit AV under race if handle got closed more than once simultaneously
|
||||||
|
// Use two bool variables to guard
|
||||||
|
//
|
||||||
|
volatile BOOL m_fHttpHandleInClose;
|
||||||
|
volatile BOOL m_fWebSocketHandleInClose;
|
||||||
|
//
|
||||||
|
// Record the number of winhttp handles in use
|
||||||
|
// release IIS pipeline only after all handles got closed
|
||||||
|
//
|
||||||
|
volatile LONG m_dwHandlers;
|
||||||
|
|
||||||
|
BOOL m_fDoReverseRewriteHeaders;
|
||||||
|
BOOL m_fServerResetConn;
|
||||||
|
DWORD m_msStartTime;
|
||||||
|
DWORD m_BytesToReceive;
|
||||||
|
DWORD m_BytesToSend;
|
||||||
|
|
||||||
|
BYTE * m_pEntityBuffer;
|
||||||
|
DWORD m_cchLastSend;
|
||||||
|
|
||||||
|
static const SIZE_T INLINE_ENTITY_BUFFERS = 8;
|
||||||
|
DWORD m_cEntityBuffers;
|
||||||
|
BUFFER_T<BYTE*,INLINE_ENTITY_BUFFERS> m_buffEntityBuffers;
|
||||||
|
|
||||||
|
DWORD m_cBytesBuffered;
|
||||||
|
DWORD m_cMinBufferLimit;
|
||||||
|
|
||||||
|
PCSTR m_pszOriginalHostHeader;
|
||||||
|
|
||||||
|
volatile FORWARDING_REQUEST_STATUS m_RequestStatus;
|
||||||
|
|
||||||
|
ASYNC_DISCONNECT_CONTEXT * m_pDisconnect;
|
||||||
|
|
||||||
|
PCWSTR m_pszHeaders;
|
||||||
|
DWORD m_cchHeaders;
|
||||||
|
|
||||||
|
BOOL m_fWebSocketEnabled;
|
||||||
|
|
||||||
|
STRU m_strFullUri;
|
||||||
|
|
||||||
|
ULONGLONG m_cContentLength;
|
||||||
|
|
||||||
|
WEBSOCKET_HANDLER * m_pWebSocket;
|
||||||
|
|
||||||
|
static PROTOCOL_CONFIG sm_ProtocolConfig;
|
||||||
|
|
||||||
|
static STRU sm_strErrorFormat;
|
||||||
|
|
||||||
|
static HANDLE sm_hEventLog;
|
||||||
|
|
||||||
|
static ALLOC_CACHE_HANDLER * sm_pAlloc;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Reference cout tracing for debugging purposes.
|
||||||
|
//
|
||||||
|
static TRACE_LOG * sm_pTraceLog;
|
||||||
|
};
|
||||||
|
|
||||||
|
class ASYNC_DISCONNECT_CONTEXT : public IHttpConnectionStoredContext
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ASYNC_DISCONNECT_CONTEXT()
|
||||||
|
{
|
||||||
|
m_pHandler = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
CleanupStoredContext()
|
||||||
|
{
|
||||||
|
DBG_ASSERT(m_pHandler == NULL);
|
||||||
|
delete this;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
NotifyDisconnect()
|
||||||
|
{
|
||||||
|
FORWARDING_HANDLER *pInitialValue = (FORWARDING_HANDLER*)
|
||||||
|
InterlockedExchangePointer((PVOID*) &m_pHandler, NULL);
|
||||||
|
|
||||||
|
if (pInitialValue != NULL)
|
||||||
|
{
|
||||||
|
pInitialValue->TerminateRequest(TRUE);
|
||||||
|
pInitialValue->DereferenceForwardingHandler();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
SetHandler(
|
||||||
|
FORWARDING_HANDLER *pHandler
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Take a reference on the forwarding handler.
|
||||||
|
// This reference will be released on either of two conditions:
|
||||||
|
//
|
||||||
|
// 1. When the request processing ends, in which case a ResetHandler()
|
||||||
|
// is called.
|
||||||
|
//
|
||||||
|
// 2. When a disconnect notification arrives.
|
||||||
|
//
|
||||||
|
// We need to make sure that only one of them ends up dereferencing
|
||||||
|
// the object.
|
||||||
|
//
|
||||||
|
|
||||||
|
DBG_ASSERT (pHandler != NULL);
|
||||||
|
DBG_ASSERT (m_pHandler == NULL);
|
||||||
|
|
||||||
|
pHandler->ReferenceForwardingHandler();
|
||||||
|
InterlockedExchangePointer((PVOID*)&m_pHandler, pHandler);
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
ResetHandler(
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
FORWARDING_HANDLER *pInitialValue = (FORWARDING_HANDLER*)
|
||||||
|
InterlockedExchangePointer( (PVOID*)&m_pHandler, NULL);
|
||||||
|
|
||||||
|
if (pInitialValue != NULL)
|
||||||
|
{
|
||||||
|
pInitialValue->DereferenceForwardingHandler();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
~ASYNC_DISCONNECT_CONTEXT()
|
||||||
|
{}
|
||||||
|
|
||||||
|
FORWARDING_HANDLER * m_pHandler;
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,95 @@
|
||||||
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
class PATH
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
static
|
||||||
|
HRESULT
|
||||||
|
SplitUrl(
|
||||||
|
PCWSTR pszDestinationUrl,
|
||||||
|
BOOL *pfSecure,
|
||||||
|
STRU *pstrDestination,
|
||||||
|
STRU *pstrUrl
|
||||||
|
);
|
||||||
|
|
||||||
|
static
|
||||||
|
HRESULT
|
||||||
|
UnEscapeUrl(
|
||||||
|
PCWSTR pszUrl,
|
||||||
|
DWORD cchUrl,
|
||||||
|
bool fCopyQuery,
|
||||||
|
STRA * pstrResult
|
||||||
|
);
|
||||||
|
|
||||||
|
static
|
||||||
|
HRESULT
|
||||||
|
UnEscapeUrl(
|
||||||
|
PCWSTR pszUrl,
|
||||||
|
DWORD cchUrl,
|
||||||
|
STRU * pstrResult
|
||||||
|
);
|
||||||
|
|
||||||
|
static HRESULT
|
||||||
|
EscapeAbsPath(
|
||||||
|
IHttpRequest * pRequest,
|
||||||
|
STRU * strEscapedUrl
|
||||||
|
);
|
||||||
|
|
||||||
|
static
|
||||||
|
bool
|
||||||
|
IsValidAttributeNameChar(
|
||||||
|
WCHAR ch
|
||||||
|
);
|
||||||
|
|
||||||
|
static
|
||||||
|
bool
|
||||||
|
IsValidQueryStringName(
|
||||||
|
PCWSTR pszName
|
||||||
|
);
|
||||||
|
|
||||||
|
static
|
||||||
|
bool
|
||||||
|
IsValidHeaderName(
|
||||||
|
PCWSTR pszName
|
||||||
|
);
|
||||||
|
|
||||||
|
static
|
||||||
|
bool
|
||||||
|
FindInMultiString(
|
||||||
|
PCWSTR pszMultiString,
|
||||||
|
PCWSTR pszStringToFind
|
||||||
|
);
|
||||||
|
|
||||||
|
static
|
||||||
|
HRESULT
|
||||||
|
IsPathUnc(
|
||||||
|
__in LPCWSTR pszPath,
|
||||||
|
__out BOOL * pfIsUnc
|
||||||
|
);
|
||||||
|
|
||||||
|
static
|
||||||
|
HRESULT
|
||||||
|
ConvertPathToFullPath(
|
||||||
|
_In_ LPCWSTR pszPath,
|
||||||
|
_In_ LPCWSTR pszRootPath,
|
||||||
|
_Out_ STRU* pStrFullPath
|
||||||
|
);
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
PATH() {}
|
||||||
|
~PATH() {}
|
||||||
|
|
||||||
|
static
|
||||||
|
CHAR
|
||||||
|
ToHexDigit(
|
||||||
|
UINT nDigit
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return static_cast<CHAR>(nDigit > 9 ? nDigit - 10 + 'A' : nDigit + '0');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,193 @@
|
||||||
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#define ONE_MINUTE_IN_MILLISECONDS 60000
|
||||||
|
|
||||||
|
class PROCESS_MANAGER
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
virtual
|
||||||
|
~PROCESS_MANAGER();
|
||||||
|
|
||||||
|
VOID
|
||||||
|
ReferenceProcessManager() const
|
||||||
|
{
|
||||||
|
InterlockedIncrement(&m_cRefs);
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
DereferenceProcessManager() const
|
||||||
|
{
|
||||||
|
if (InterlockedDecrement(&m_cRefs) == 0)
|
||||||
|
{
|
||||||
|
delete this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
GetProcess(
|
||||||
|
_In_ IHttpContext *context,
|
||||||
|
_In_ ASPNETCORE_CONFIG *pConfig,
|
||||||
|
_Out_ SERVER_PROCESS **ppServerProcess
|
||||||
|
);
|
||||||
|
|
||||||
|
HANDLE
|
||||||
|
QueryNULHandle()
|
||||||
|
{
|
||||||
|
return m_hNULHandle;
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
Initialize(
|
||||||
|
VOID
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
SendShutdownSignal()
|
||||||
|
{
|
||||||
|
AcquireSRWLockExclusive( &m_srwLock );
|
||||||
|
|
||||||
|
for(DWORD i = 0; i < m_dwProcessesPerApplication; ++i )
|
||||||
|
{
|
||||||
|
if( m_ppServerProcessList != NULL &&
|
||||||
|
m_ppServerProcessList[i] != NULL )
|
||||||
|
{
|
||||||
|
m_ppServerProcessList[i]->SendSignal();
|
||||||
|
m_ppServerProcessList[i]->DereferenceServerProcess();
|
||||||
|
m_ppServerProcessList[i] = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ReleaseSRWLockExclusive( &m_srwLock );
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
ShutdownProcess(
|
||||||
|
SERVER_PROCESS* pServerProcess
|
||||||
|
)
|
||||||
|
{
|
||||||
|
AcquireSRWLockExclusive( &m_srwLock );
|
||||||
|
|
||||||
|
ShutdownProcessNoLock( pServerProcess );
|
||||||
|
|
||||||
|
ReleaseSRWLockExclusive( &m_srwLock );
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
ShutdownAllProcesses(
|
||||||
|
)
|
||||||
|
{
|
||||||
|
AcquireSRWLockExclusive( &m_srwLock );
|
||||||
|
|
||||||
|
ShutdownAllProcessesNoLock();
|
||||||
|
|
||||||
|
ReleaseSRWLockExclusive( &m_srwLock );
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
IncrementRapidFailCount(
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
InterlockedIncrement(&m_cRapidFailCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
PROCESS_MANAGER() :
|
||||||
|
m_ppServerProcessList( NULL ),
|
||||||
|
m_hNULHandle( NULL ),
|
||||||
|
m_cRapidFailCount( 0 ),
|
||||||
|
m_dwProcessesPerApplication( 1 ),
|
||||||
|
m_dwRouteToProcessIndex( 0 ),
|
||||||
|
m_fServerProcessListReady(FALSE),
|
||||||
|
m_cRefs( 1 )
|
||||||
|
{
|
||||||
|
InitializeSRWLock( &m_srwLock );
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
RapidFailsPerMinuteExceeded(
|
||||||
|
LONG dwRapidFailsPerMinute
|
||||||
|
)
|
||||||
|
{
|
||||||
|
DWORD dwCurrentTickCount = GetTickCount();
|
||||||
|
|
||||||
|
if( (dwCurrentTickCount - m_dwRapidFailTickStart)
|
||||||
|
>= ONE_MINUTE_IN_MILLISECONDS )
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// reset counters every minute.
|
||||||
|
//
|
||||||
|
|
||||||
|
InterlockedExchange(&m_cRapidFailCount, 0);
|
||||||
|
m_dwRapidFailTickStart = dwCurrentTickCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
return m_cRapidFailCount > dwRapidFailsPerMinute;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
ShutdownProcessNoLock(
|
||||||
|
SERVER_PROCESS* pServerProcess
|
||||||
|
)
|
||||||
|
{
|
||||||
|
for(DWORD i = 0; i < m_dwProcessesPerApplication; ++i )
|
||||||
|
{
|
||||||
|
if( m_ppServerProcessList != NULL &&
|
||||||
|
m_ppServerProcessList[i] != NULL &&
|
||||||
|
m_ppServerProcessList[i]->GetPort() == pServerProcess->GetPort() )
|
||||||
|
{
|
||||||
|
// shutdown pServerProcess if not already shutdown.
|
||||||
|
m_ppServerProcessList[i]->StopProcess();
|
||||||
|
m_ppServerProcessList[i]->DereferenceServerProcess();
|
||||||
|
m_ppServerProcessList[i] = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
ShutdownAllProcessesNoLock(
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
for(DWORD i = 0; i < m_dwProcessesPerApplication; ++i )
|
||||||
|
{
|
||||||
|
if( m_ppServerProcessList != NULL &&
|
||||||
|
m_ppServerProcessList[i] != NULL )
|
||||||
|
{
|
||||||
|
// shutdown pServerProcess if not already shutdown.
|
||||||
|
m_ppServerProcessList[i]->SendSignal();
|
||||||
|
m_ppServerProcessList[i]->DereferenceServerProcess();
|
||||||
|
m_ppServerProcessList[i] = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
volatile LONG m_cRapidFailCount;
|
||||||
|
DWORD m_dwRapidFailTickStart;
|
||||||
|
DWORD m_dwProcessesPerApplication;
|
||||||
|
volatile DWORD m_dwRouteToProcessIndex;
|
||||||
|
|
||||||
|
SRWLOCK m_srwLock;
|
||||||
|
SERVER_PROCESS **m_ppServerProcessList;
|
||||||
|
|
||||||
|
//
|
||||||
|
// m_hNULHandle is used to redirect stdout/stderr to NUL.
|
||||||
|
// If Createprocess is called to launch a batch file for example,
|
||||||
|
// it tries to write to the console buffer by default. It fails to
|
||||||
|
// start if the console buffer is owned by the parent process i.e
|
||||||
|
// in our case w3wp.exe. So we have to redirect the stdout/stderr
|
||||||
|
// of the child process to NUL or to a file (anything other than
|
||||||
|
// the console buffer of the parent process).
|
||||||
|
//
|
||||||
|
|
||||||
|
HANDLE m_hNULHandle;
|
||||||
|
mutable LONG m_cRefs;
|
||||||
|
|
||||||
|
volatile static BOOL sm_fWSAStartupDone;
|
||||||
|
volatile BOOL m_fServerProcessListReady;
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,105 @@
|
||||||
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "aspnetcoreconfig.h"
|
||||||
|
|
||||||
|
class PROTOCOL_CONFIG
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
PROTOCOL_CONFIG()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
Initialize();
|
||||||
|
|
||||||
|
VOID
|
||||||
|
OverrideConfig(
|
||||||
|
ASPNETCORE_CONFIG *pAspNetCoreConfig
|
||||||
|
);
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
QueryDoKeepAlive() const
|
||||||
|
{
|
||||||
|
return m_fKeepAlive;
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD
|
||||||
|
QueryTimeout() const
|
||||||
|
{
|
||||||
|
return m_msTimeout;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
QueryPreserveHostHeader() const
|
||||||
|
{
|
||||||
|
return m_fPreserveHostHeader;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
QueryReverseRewriteHeaders() const
|
||||||
|
{
|
||||||
|
return m_fReverseRewriteHeaders;
|
||||||
|
}
|
||||||
|
|
||||||
|
const STRA *
|
||||||
|
QueryXForwardedForName() const
|
||||||
|
{
|
||||||
|
return &m_strXForwardedForName;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
QueryIncludePortInXForwardedFor() const
|
||||||
|
{
|
||||||
|
return m_fIncludePortInXForwardedFor;
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD
|
||||||
|
QueryMinResponseBuffer() const
|
||||||
|
{
|
||||||
|
return m_dwMinResponseBuffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD
|
||||||
|
QueryResponseBufferLimit() const
|
||||||
|
{
|
||||||
|
return m_dwResponseBufferLimit;
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD
|
||||||
|
QueryMaxResponseHeaderSize() const
|
||||||
|
{
|
||||||
|
return m_dwMaxResponseHeaderSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
const STRA*
|
||||||
|
QuerySslHeaderName() const
|
||||||
|
{
|
||||||
|
return &m_strSslHeaderName;
|
||||||
|
}
|
||||||
|
|
||||||
|
const STRA *
|
||||||
|
QueryClientCertName() const
|
||||||
|
{
|
||||||
|
return &m_strClientCertName;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
BOOL m_fKeepAlive;
|
||||||
|
BOOL m_fPreserveHostHeader;
|
||||||
|
BOOL m_fReverseRewriteHeaders;
|
||||||
|
BOOL m_fIncludePortInXForwardedFor;
|
||||||
|
|
||||||
|
DWORD m_msTimeout;
|
||||||
|
DWORD m_dwMinResponseBuffer;
|
||||||
|
DWORD m_dwResponseBufferLimit;
|
||||||
|
DWORD m_dwMaxResponseHeaderSize;
|
||||||
|
|
||||||
|
STRA m_strXForwardedForName;
|
||||||
|
STRA m_strSslHeaderName;
|
||||||
|
STRA m_strClientCertName;
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,61 @@
|
||||||
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "forwardinghandler.h"
|
||||||
|
|
||||||
|
class CProxyModule : public CHttpModule
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
CProxyModule();
|
||||||
|
|
||||||
|
~CProxyModule();
|
||||||
|
|
||||||
|
void * operator new(size_t size, IModuleAllocator * pPlacement)
|
||||||
|
{
|
||||||
|
return pPlacement->AllocateMemory(static_cast<DWORD>(size));
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
operator delete(
|
||||||
|
void *
|
||||||
|
)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
__override
|
||||||
|
REQUEST_NOTIFICATION_STATUS
|
||||||
|
OnExecuteRequestHandler(
|
||||||
|
IHttpContext * pHttpContext,
|
||||||
|
IHttpEventProvider * pProvider
|
||||||
|
);
|
||||||
|
|
||||||
|
__override
|
||||||
|
REQUEST_NOTIFICATION_STATUS
|
||||||
|
OnAsyncCompletion(
|
||||||
|
IHttpContext * pHttpContext,
|
||||||
|
DWORD dwNotification,
|
||||||
|
BOOL fPostNotification,
|
||||||
|
IHttpEventProvider * pProvider,
|
||||||
|
IHttpCompletionInfo * pCompletionInfo
|
||||||
|
);
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
FORWARDING_HANDLER * m_pHandler;
|
||||||
|
};
|
||||||
|
|
||||||
|
class CProxyModuleFactory : public IHttpModuleFactory
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
HRESULT
|
||||||
|
GetHttpModule(
|
||||||
|
CHttpModule ** ppModule,
|
||||||
|
IModuleAllocator * pAllocator
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
Terminate();
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#define IDS_INVALID_PROPERTY 1000
|
||||||
|
#define IDS_SERVER_ERROR 1001
|
||||||
|
|
||||||
|
#define ASPNETCORE_EVENT_MSG_BUFFER_SIZE 256
|
||||||
|
#define ASPNETCORE_EVENT_PROCESS_START_SUCCESS_MSG L"Application '%s' started process '%d' successfully and is listening on port '%d'."
|
||||||
|
#define ASPNETCORE_EVENT_RAPID_FAIL_COUNT_EXCEEDED_MSG L"Maximum rapid fail count per minute of '%d' exceeded."
|
||||||
|
#define ASPNETCORE_EVENT_PROCESS_START_INTERNAL_ERROR_MSG L"Application '%s' failed to parse processPath and arguments due to internal error, ErrorCode = '0x%x'."
|
||||||
|
#define ASPNETCORE_EVENT_PROCESS_START_POSTCREATE_ERROR_MSG L"Application '%s' with physical root '%s' created process with commandline '%s'but failed to get its status, ErrorCode = '0x%x'."
|
||||||
|
#define ASPNETCORE_EVENT_PROCESS_START_ERROR_MSG L"Application '%s' with physical root '%s' failed to start process with commandline '%s', ErrorCode = '0x%x : %x."
|
||||||
|
#define ASPNETCORE_EVENT_PROCESS_START_WRONGPORT_ERROR_MSG L"Application '%s' with physical root '%s' created process with commandline '%s' but failed to listen on the given port '%d'"
|
||||||
|
#define ASPNETCORE_EVENT_PROCESS_START_NOTREADY_ERROR_MSG L"Application '%s' with physical root '%s' created process with commandline '%s' but either crashed or did not reponse or did not listen on the given port '%d', ErrorCode = '0x%x'"
|
||||||
|
#define ASPNETCORE_EVENT_INVALID_STDOUT_LOG_FILE_MSG L"Warning: Could not create stdoutLogFile %s, ErrorCode = %d."
|
||||||
|
#define ASPNETCORE_EVENT_GRACEFUL_SHUTDOWN_FAILURE_MSG L"Failed to gracefully shutdown process '%d'."
|
||||||
|
#define ASPNETCORE_EVENT_SENT_SHUTDOWN_HTTP_REQUEST_MSG L"Sent shutdown HTTP message to process '%d' and received http status '%d'."
|
||||||
|
#define ASPNETCORE_EVENT_RECYCLE_APPOFFLINE_MSG L"App_offline file '%s' was detected."
|
||||||
|
|
@ -0,0 +1,110 @@
|
||||||
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
//
|
||||||
|
// *_HEADER_HASH maps strings to UlHeader* values
|
||||||
|
//
|
||||||
|
|
||||||
|
#define UNKNOWN_INDEX (0xFFFFFFFF)
|
||||||
|
|
||||||
|
struct HEADER_RECORD
|
||||||
|
{
|
||||||
|
PCSTR _pszName;
|
||||||
|
ULONG _ulHeaderIndex;
|
||||||
|
};
|
||||||
|
|
||||||
|
class RESPONSE_HEADER_HASH: public HASH_TABLE<HEADER_RECORD, PCSTR>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
RESPONSE_HEADER_HASH()
|
||||||
|
{}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
ReferenceRecord(
|
||||||
|
HEADER_RECORD *
|
||||||
|
)
|
||||||
|
{}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
DereferenceRecord(
|
||||||
|
HEADER_RECORD *
|
||||||
|
)
|
||||||
|
{}
|
||||||
|
|
||||||
|
PCSTR
|
||||||
|
ExtractKey(
|
||||||
|
HEADER_RECORD * pRecord
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return pRecord->_pszName;
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD
|
||||||
|
CalcKeyHash(
|
||||||
|
PCSTR key
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return HashStringNoCase(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
EqualKeys(
|
||||||
|
PCSTR key1,
|
||||||
|
PCSTR key2
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return (_stricmp(key1, key2) == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
Initialize(
|
||||||
|
VOID
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
Terminate(
|
||||||
|
VOID
|
||||||
|
);
|
||||||
|
|
||||||
|
DWORD
|
||||||
|
GetIndex(
|
||||||
|
PCSTR pszName
|
||||||
|
)
|
||||||
|
{
|
||||||
|
HEADER_RECORD * pRecord = NULL;
|
||||||
|
|
||||||
|
FindKey(pszName, &pRecord);
|
||||||
|
if (pRecord != NULL)
|
||||||
|
{
|
||||||
|
return pRecord->_ulHeaderIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
return UNKNOWN_INDEX;
|
||||||
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
PCSTR
|
||||||
|
GetString(
|
||||||
|
ULONG ulIndex
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (ulIndex < HttpHeaderResponseMaximum)
|
||||||
|
{
|
||||||
|
DBG_ASSERT(sm_rgHeaders[ulIndex]._ulHeaderIndex == ulIndex);
|
||||||
|
return sm_rgHeaders[ulIndex]._pszName;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
static HEADER_RECORD sm_rgHeaders[];
|
||||||
|
|
||||||
|
RESPONSE_HEADER_HASH(const RESPONSE_HEADER_HASH &);
|
||||||
|
void operator=(const RESPONSE_HEADER_HASH &);
|
||||||
|
};
|
||||||
|
|
||||||
|
extern RESPONSE_HEADER_HASH * g_pResponseHeaderHash;
|
||||||
|
|
@ -0,0 +1,325 @@
|
||||||
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#define MIN_PORT 1025
|
||||||
|
#define MAX_PORT 48000
|
||||||
|
#define MAX_RETRY 10
|
||||||
|
#define MAX_ACTIVE_CHILD_PROCESSES 16
|
||||||
|
#define LOCALHOST "127.0.0.1"
|
||||||
|
#define ASPNETCORE_PORT_STR L"ASPNETCORE_PORT"
|
||||||
|
#define ASPNETCORE_PORT_ENV_STR L"ASPNETCORE_PORT="
|
||||||
|
#define ASPNETCORE_APP_PATH_ENV_STR L"ASPNETCORE_APPL_PATH="
|
||||||
|
#define ASPNETCORE_APP_TOKEN_ENV_STR L"ASPNETCORE_TOKEN="
|
||||||
|
#define ASPNETCORE_APP_PATH_ENV_STR L"ASPNETCORE_APPL_PATH="
|
||||||
|
#define HOSTING_STARTUP_ASSEMBLIES_ENV_STR L"ASPNETCORE_HOSTINGSTARTUPASSEMBLIES"
|
||||||
|
#define HOSTING_STARTUP_ASSEMBLIES_NAME L"ASPNETCORE_HOSTINGSTARTUPASSEMBLIES="
|
||||||
|
#define HOSTING_STARTUP_ASSEMBLIES_VALUE L"Microsoft.AspNetCore.Server.IISIntegration"
|
||||||
|
#define ASPNETCORE_IIS_AUTH_ENV_STR L"ASPNETCORE_IIS_HTTPAUTH="
|
||||||
|
#define ASPNETCORE_IIS_AUTH_WINDOWS L"windows;"
|
||||||
|
#define ASPNETCORE_IIS_AUTH_BASIC L"basic;"
|
||||||
|
#define ASPNETCORE_IIS_AUTH_ANONYMOUS L"anonymous;"
|
||||||
|
#define ASPNETCORE_IIS_AUTH_NONE L"none"
|
||||||
|
|
||||||
|
class PROCESS_MANAGER;
|
||||||
|
class FORWARDER_CONNECTION;
|
||||||
|
|
||||||
|
class SERVER_PROCESS
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
SERVER_PROCESS();
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
Initialize(
|
||||||
|
_In_ PROCESS_MANAGER *pProcessManager,
|
||||||
|
_In_ STRU *pszProcessExePath,
|
||||||
|
_In_ STRU *pszArguments,
|
||||||
|
_In_ DWORD dwStartupTimeLimitInMS,
|
||||||
|
_In_ DWORD dwShtudownTimeLimitInMS,
|
||||||
|
_In_ BOOL fWindowsAuthEnabled,
|
||||||
|
_In_ BOOL fBasicAuthEnabled,
|
||||||
|
_In_ BOOL fAnonymousAuthEnabled,
|
||||||
|
_In_ ENVIRONMENT_VAR_HASH* pEnvironmentVariables,
|
||||||
|
_In_ BOOL fStdoutLogEnabled,
|
||||||
|
_In_ STRU *pstruStdoutLogFile
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
StartProcess(
|
||||||
|
_In_ IHttpContext *context
|
||||||
|
);
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
SetWindowsAuthToken(
|
||||||
|
_In_ HANDLE hToken,
|
||||||
|
_Out_ LPHANDLE pTargeTokenHandle
|
||||||
|
);
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
IsReady(
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return m_fReady;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
StopProcess(
|
||||||
|
VOID
|
||||||
|
);
|
||||||
|
|
||||||
|
DWORD
|
||||||
|
GetPort()
|
||||||
|
{
|
||||||
|
return m_dwPort;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
ReferenceServerProcess(
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
InterlockedIncrement(&m_cRefs);
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
DereferenceServerProcess(
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
_ASSERT(m_cRefs != 0 );
|
||||||
|
|
||||||
|
if (InterlockedDecrement(&m_cRefs) == 0)
|
||||||
|
{
|
||||||
|
delete this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual
|
||||||
|
~SERVER_PROCESS();
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
HandleProcessExit(
|
||||||
|
VOID
|
||||||
|
);
|
||||||
|
|
||||||
|
FORWARDER_CONNECTION*
|
||||||
|
QueryWinHttpConnection(
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return m_pForwarderConnection;
|
||||||
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
VOID
|
||||||
|
CALLBACK
|
||||||
|
TimerCallback(
|
||||||
|
_In_ PTP_CALLBACK_INSTANCE Instance,
|
||||||
|
_In_ PVOID Context,
|
||||||
|
_In_ PTP_TIMER Timer
|
||||||
|
);
|
||||||
|
|
||||||
|
LPCWSTR
|
||||||
|
QueryPortStr()
|
||||||
|
{
|
||||||
|
return m_struPort.QueryStr();
|
||||||
|
}
|
||||||
|
|
||||||
|
LPCWSTR
|
||||||
|
QueryFullLogPath()
|
||||||
|
{
|
||||||
|
return m_struFullLogFile.QueryStr();
|
||||||
|
}
|
||||||
|
|
||||||
|
LPCSTR
|
||||||
|
QueryGuid()
|
||||||
|
{
|
||||||
|
return m_straGuid.QueryStr();
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD
|
||||||
|
QueryProcessGroupId()
|
||||||
|
{
|
||||||
|
return m_dwProcessId;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
SendSignal(
|
||||||
|
VOID
|
||||||
|
);
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
IsDebuggerIsAttached(
|
||||||
|
VOID
|
||||||
|
);
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
StopAllProcessesInJobObject(
|
||||||
|
VOID
|
||||||
|
);
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
SetupStdHandles(
|
||||||
|
_In_ IHttpContext *context,
|
||||||
|
_In_ LPSTARTUPINFOW pStartupInfo
|
||||||
|
);
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
CheckIfServerIsUp(
|
||||||
|
_In_ DWORD dwPort,
|
||||||
|
_Out_ DWORD * pdwProcessId,
|
||||||
|
_Out_ BOOL * pfReady
|
||||||
|
);
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
RegisterProcessWait(
|
||||||
|
_In_ PHANDLE phWaitHandle,
|
||||||
|
_In_ HANDLE hProcessToWaitOn
|
||||||
|
);
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
GetChildProcessHandles(
|
||||||
|
);
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
SetupListenPort(
|
||||||
|
ENVIRONMENT_VAR_HASH *pEnvironmentVarTable
|
||||||
|
);
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
SetupAppPath(
|
||||||
|
IHttpContext* pContext,
|
||||||
|
ENVIRONMENT_VAR_HASH* pEnvironmentVarTable
|
||||||
|
);
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
SetupAppToken(
|
||||||
|
ENVIRONMENT_VAR_HASH* pEnvironmentVarTable
|
||||||
|
);
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
InitEnvironmentVariablesTable(
|
||||||
|
ENVIRONMENT_VAR_HASH** pEnvironmentVarTable
|
||||||
|
);
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
OutputEnvironmentVariables(
|
||||||
|
MULTISZ* pmszOutput,
|
||||||
|
ENVIRONMENT_VAR_HASH* pEnvironmentVarTable
|
||||||
|
);
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
SetupCommandLine(
|
||||||
|
STRU* pstrCommandLine
|
||||||
|
);
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
PostStartCheck(
|
||||||
|
const STRU* const pStruCommandline,
|
||||||
|
STRU* pStruErrorMessage
|
||||||
|
);
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
GetRandomPort(
|
||||||
|
DWORD* pdwPickedPort,
|
||||||
|
DWORD dwExcludedPort
|
||||||
|
);
|
||||||
|
|
||||||
|
DWORD
|
||||||
|
GetNumberOfDigits(
|
||||||
|
_In_ DWORD dwNumber
|
||||||
|
)
|
||||||
|
{
|
||||||
|
DWORD digits = 0;
|
||||||
|
|
||||||
|
if( dwNumber == 0 )
|
||||||
|
{
|
||||||
|
digits = 1;
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
while( dwNumber > 0)
|
||||||
|
{
|
||||||
|
dwNumber = dwNumber / 10;
|
||||||
|
digits ++;
|
||||||
|
}
|
||||||
|
Finished:
|
||||||
|
return digits;
|
||||||
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
VOID
|
||||||
|
SendShutDownSignal(
|
||||||
|
LPVOID lpParam
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
SendShutDownSignalInternal(
|
||||||
|
VOID
|
||||||
|
);
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
SendShutdownHttpMessage(
|
||||||
|
VOID
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
TerminateBackendProcess(
|
||||||
|
VOID
|
||||||
|
);
|
||||||
|
|
||||||
|
FORWARDER_CONNECTION *m_pForwarderConnection;
|
||||||
|
BOOL m_fStdoutLogEnabled;
|
||||||
|
BOOL m_fWindowsAuthEnabled;
|
||||||
|
BOOL m_fBasicAuthEnabled;
|
||||||
|
BOOL m_fAnonymousAuthEnabled;
|
||||||
|
|
||||||
|
STTIMER m_Timer;
|
||||||
|
SOCKET m_socket;
|
||||||
|
|
||||||
|
STRU m_struLogFile;
|
||||||
|
STRU m_struFullLogFile;
|
||||||
|
STRU m_ProcessPath;
|
||||||
|
STRU m_Arguments;
|
||||||
|
STRU m_struAppPath;
|
||||||
|
STRU m_struAppFullPath;
|
||||||
|
STRU m_struPort;
|
||||||
|
STRU m_pszRootApplicationPath;
|
||||||
|
volatile LONG m_lStopping;
|
||||||
|
volatile BOOL m_fReady;
|
||||||
|
mutable LONG m_cRefs;
|
||||||
|
|
||||||
|
DWORD m_dwPort;
|
||||||
|
DWORD m_dwStartupTimeLimitInMS;
|
||||||
|
DWORD m_dwShutdownTimeLimitInMS;
|
||||||
|
DWORD m_cChildProcess;
|
||||||
|
DWORD m_dwChildProcessIds[MAX_ACTIVE_CHILD_PROCESSES];
|
||||||
|
DWORD m_dwProcessId;
|
||||||
|
DWORD m_dwListeningProcessId;
|
||||||
|
|
||||||
|
STRA m_straGuid;
|
||||||
|
|
||||||
|
HANDLE m_hJobObject;
|
||||||
|
HANDLE m_hStdoutHandle;
|
||||||
|
//
|
||||||
|
// m_hProcessHandle is the handle to process this object creates.
|
||||||
|
//
|
||||||
|
HANDLE m_hProcessHandle;
|
||||||
|
HANDLE m_hListeningProcessHandle;
|
||||||
|
HANDLE m_hProcessWaitHandle;
|
||||||
|
HANDLE m_hShutdownHandle;
|
||||||
|
//
|
||||||
|
// m_hChildProcessHandle is the handle to process created by
|
||||||
|
// m_hProcessHandle process if it does.
|
||||||
|
//
|
||||||
|
HANDLE m_hChildProcessHandles[MAX_ACTIVE_CHILD_PROCESSES];
|
||||||
|
HANDLE m_hChildProcessWaitHandles[MAX_ACTIVE_CHILD_PROCESSES];
|
||||||
|
|
||||||
|
PROCESS_MANAGER *m_pProcessManager;
|
||||||
|
ENVIRONMENT_VAR_HASH *m_pEnvironmentVarTable ;
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,221 @@
|
||||||
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
class FORWARDING_HANDLER;
|
||||||
|
|
||||||
|
class WEBSOCKET_HANDLER
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
WEBSOCKET_HANDLER();
|
||||||
|
|
||||||
|
virtual
|
||||||
|
~WEBSOCKET_HANDLER();
|
||||||
|
|
||||||
|
static
|
||||||
|
HRESULT
|
||||||
|
StaticInitialize(
|
||||||
|
BOOL fEnableReferenceTraceLogging
|
||||||
|
);
|
||||||
|
|
||||||
|
static
|
||||||
|
VOID
|
||||||
|
StaticTerminate(
|
||||||
|
VOID
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
Terminate(
|
||||||
|
VOID
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
TerminateRequest(
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
Cleanup(ServerStateUnavailable);
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
ProcessRequest(
|
||||||
|
FORWARDING_HANDLER *pHandler,
|
||||||
|
IHttpContext * pHttpContext,
|
||||||
|
HINTERNET hRequest,
|
||||||
|
BOOL* fHandleCreated
|
||||||
|
);
|
||||||
|
|
||||||
|
REQUEST_NOTIFICATION_STATUS
|
||||||
|
OnAsyncCompletion(
|
||||||
|
VOID
|
||||||
|
);
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
OnWinHttpSendComplete(
|
||||||
|
WINHTTP_WEB_SOCKET_STATUS * pCompletionStatus
|
||||||
|
);
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
OnWinHttpShutdownComplete(
|
||||||
|
VOID
|
||||||
|
);
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
OnWinHttpReceiveComplete(
|
||||||
|
WINHTTP_WEB_SOCKET_STATUS * pCompletionStatus
|
||||||
|
);
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
OnWinHttpIoError(
|
||||||
|
WINHTTP_WEB_SOCKET_ASYNC_RESULT *pCompletionStatus
|
||||||
|
);
|
||||||
|
|
||||||
|
private:
|
||||||
|
enum CleanupReason
|
||||||
|
{
|
||||||
|
CleanupReasonUnknown = 0,
|
||||||
|
IdleTimeout = 1,
|
||||||
|
ConnectFailed = 2,
|
||||||
|
ClientDisconnect = 3,
|
||||||
|
ServerDisconnect = 4,
|
||||||
|
ServerStateUnavailable = 5
|
||||||
|
};
|
||||||
|
|
||||||
|
WEBSOCKET_HANDLER(const WEBSOCKET_HANDLER &);
|
||||||
|
void operator=(const WEBSOCKET_HANDLER &);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
InsertRequest(
|
||||||
|
VOID
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
RemoveRequest(
|
||||||
|
VOID
|
||||||
|
);
|
||||||
|
|
||||||
|
static
|
||||||
|
VOID
|
||||||
|
WINAPI
|
||||||
|
OnReadIoCompletion(
|
||||||
|
HRESULT hrError,
|
||||||
|
VOID * pvCompletionContext,
|
||||||
|
DWORD cbIO,
|
||||||
|
BOOL fUTF8Encoded,
|
||||||
|
BOOL fFinalFragment,
|
||||||
|
BOOL fClose
|
||||||
|
);
|
||||||
|
|
||||||
|
static
|
||||||
|
VOID
|
||||||
|
WINAPI
|
||||||
|
OnWriteIoCompletion(
|
||||||
|
HRESULT hrError,
|
||||||
|
VOID * pvCompletionContext,
|
||||||
|
DWORD cbIO,
|
||||||
|
BOOL fUTF8Encoded,
|
||||||
|
BOOL fFinalFragment,
|
||||||
|
BOOL fClose
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
Cleanup(
|
||||||
|
CleanupReason reason
|
||||||
|
);
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
DoIisWebSocketReceive(
|
||||||
|
VOID
|
||||||
|
);
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
DoWinHttpWebSocketReceive(
|
||||||
|
VOID
|
||||||
|
);
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
DoIisWebSocketSend(
|
||||||
|
DWORD cbData,
|
||||||
|
WINHTTP_WEB_SOCKET_BUFFER_TYPE eBufferType
|
||||||
|
);
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
DoWinHttpWebSocketSend(
|
||||||
|
DWORD cbData,
|
||||||
|
WINHTTP_WEB_SOCKET_BUFFER_TYPE eBufferType
|
||||||
|
);
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
OnIisSendComplete(
|
||||||
|
HRESULT hrError,
|
||||||
|
DWORD cbIO
|
||||||
|
);
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
OnIisReceiveComplete(
|
||||||
|
HRESULT hrError,
|
||||||
|
DWORD cbIO,
|
||||||
|
BOOL fUTF8Encoded,
|
||||||
|
BOOL fFinalFragment,
|
||||||
|
BOOL fClose
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
IncrementOutstandingIo(
|
||||||
|
VOID
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
DecrementOutstandingIo(
|
||||||
|
VOID
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
IndicateCompletionToIIS(
|
||||||
|
VOID
|
||||||
|
);
|
||||||
|
|
||||||
|
private:
|
||||||
|
static const
|
||||||
|
DWORD RECEIVE_BUFFER_SIZE = 4*1024;
|
||||||
|
|
||||||
|
LIST_ENTRY _listEntry;
|
||||||
|
|
||||||
|
IHttpContext3 * _pHttpContext;
|
||||||
|
|
||||||
|
IWebSocketContext * _pWebSocketContext;
|
||||||
|
|
||||||
|
FORWARDING_HANDLER *_pHandler;
|
||||||
|
|
||||||
|
HINTERNET _hWebSocketRequest;
|
||||||
|
|
||||||
|
BYTE _WinHttpReceiveBuffer[RECEIVE_BUFFER_SIZE];
|
||||||
|
|
||||||
|
BYTE _IisReceiveBuffer[RECEIVE_BUFFER_SIZE];
|
||||||
|
|
||||||
|
CRITICAL_SECTION _RequestLock;
|
||||||
|
|
||||||
|
LONG _dwOutstandingIo;
|
||||||
|
|
||||||
|
volatile
|
||||||
|
BOOL _fHandleClosed;
|
||||||
|
|
||||||
|
volatile
|
||||||
|
BOOL _fCleanupInProgress;
|
||||||
|
|
||||||
|
volatile
|
||||||
|
BOOL _fIndicateCompletionToIis;
|
||||||
|
|
||||||
|
volatile
|
||||||
|
BOOL _fReceivedCloseMsg;
|
||||||
|
|
||||||
|
static
|
||||||
|
LIST_ENTRY sm_RequestsListHead;
|
||||||
|
|
||||||
|
static
|
||||||
|
SRWLOCK sm_RequestsListLock;
|
||||||
|
|
||||||
|
static
|
||||||
|
TRACE_LOG * sm_pTraceLog;
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,91 @@
|
||||||
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
typedef
|
||||||
|
HINTERNET
|
||||||
|
(WINAPI * PFN_WINHTTP_WEBSOCKET_COMPLETE_UPGRADE)(
|
||||||
|
_In_ HINTERNET hRequest,
|
||||||
|
_In_opt_ DWORD_PTR pContext
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
typedef
|
||||||
|
DWORD
|
||||||
|
(WINAPI * PFN_WINHTTP_WEBSOCKET_SEND)(
|
||||||
|
_In_ HINTERNET hWebSocket,
|
||||||
|
_In_ WINHTTP_WEB_SOCKET_BUFFER_TYPE eBufferType,
|
||||||
|
_In_reads_opt_(dwBufferLength) PVOID pvBuffer,
|
||||||
|
_In_ DWORD dwBufferLength
|
||||||
|
);
|
||||||
|
|
||||||
|
typedef
|
||||||
|
DWORD
|
||||||
|
(WINAPI * PFN_WINHTTP_WEBSOCKET_RECEIVE)(
|
||||||
|
_In_ HINTERNET hWebSocket,
|
||||||
|
_Out_writes_bytes_to_(dwBufferLength, *pdwBytesRead) PVOID pvBuffer,
|
||||||
|
_In_ DWORD dwBufferLength,
|
||||||
|
_Out_range_(0, dwBufferLength) DWORD *pdwBytesRead,
|
||||||
|
_Out_ WINHTTP_WEB_SOCKET_BUFFER_TYPE *peBufferType
|
||||||
|
);
|
||||||
|
|
||||||
|
typedef
|
||||||
|
DWORD
|
||||||
|
(WINAPI * PFN_WINHTTP_WEBSOCKET_SHUTDOWN)(
|
||||||
|
_In_ HINTERNET hWebSocket,
|
||||||
|
_In_ USHORT usStatus,
|
||||||
|
_In_reads_bytes_opt_(dwReasonLength) PVOID pvReason,
|
||||||
|
_In_range_(0, WINHTTP_WEB_SOCKET_MAX_CLOSE_REASON_LENGTH) DWORD dwReasonLength
|
||||||
|
);
|
||||||
|
|
||||||
|
typedef
|
||||||
|
DWORD
|
||||||
|
(WINAPI * PFN_WINHTTP_WEBSOCKET_QUERY_CLOSE_STATUS)(
|
||||||
|
_In_ HINTERNET hWebSocket,
|
||||||
|
_Out_ USHORT *pusStatus,
|
||||||
|
_Out_writes_bytes_to_opt_(dwReasonLength, *pdwReasonLengthConsumed) PVOID pvReason,
|
||||||
|
_In_range_(0, WINHTTP_WEB_SOCKET_MAX_CLOSE_REASON_LENGTH) DWORD dwReasonLength,
|
||||||
|
_Out_range_(0, WINHTTP_WEB_SOCKET_MAX_CLOSE_REASON_LENGTH) DWORD *pdwReasonLengthConsumed
|
||||||
|
);
|
||||||
|
|
||||||
|
class WINHTTP_HELPER
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static
|
||||||
|
HRESULT
|
||||||
|
StaticInitialize();
|
||||||
|
|
||||||
|
static
|
||||||
|
VOID
|
||||||
|
GetFlagsFromBufferType(
|
||||||
|
__in WINHTTP_WEB_SOCKET_BUFFER_TYPE BufferType,
|
||||||
|
__out BOOL * pfUtf8Encoded,
|
||||||
|
__out BOOL * pfFinalFragment,
|
||||||
|
__out BOOL * pfClose
|
||||||
|
);
|
||||||
|
|
||||||
|
static
|
||||||
|
VOID
|
||||||
|
GetBufferTypeFromFlags(
|
||||||
|
__in BOOL fUtf8Encoded,
|
||||||
|
__in BOOL fFinalFragment,
|
||||||
|
__in BOOL fClose,
|
||||||
|
__out WINHTTP_WEB_SOCKET_BUFFER_TYPE* pBufferType
|
||||||
|
);
|
||||||
|
|
||||||
|
static
|
||||||
|
PFN_WINHTTP_WEBSOCKET_COMPLETE_UPGRADE sm_pfnWinHttpWebSocketCompleteUpgrade;
|
||||||
|
|
||||||
|
static
|
||||||
|
PFN_WINHTTP_WEBSOCKET_SEND sm_pfnWinHttpWebSocketSend;
|
||||||
|
|
||||||
|
static
|
||||||
|
PFN_WINHTTP_WEBSOCKET_RECEIVE sm_pfnWinHttpWebSocketReceive;
|
||||||
|
|
||||||
|
static
|
||||||
|
PFN_WINHTTP_WEBSOCKET_SHUTDOWN sm_pfnWinHttpWebSocketShutdown;
|
||||||
|
|
||||||
|
static
|
||||||
|
PFN_WINHTTP_WEBSOCKET_QUERY_CLOSE_STATUS sm_pfnWinHttpWebSocketQueryCloseStatus;
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,78 @@
|
||||||
|
;/*++
|
||||||
|
;
|
||||||
|
;Copyright (c) 2014 Microsoft Corporation
|
||||||
|
;
|
||||||
|
;Module Name:
|
||||||
|
;
|
||||||
|
; aspnetcore_msg.mc
|
||||||
|
;
|
||||||
|
;Abstract:
|
||||||
|
;
|
||||||
|
; Asp.Net Core Module localizable messages.
|
||||||
|
;
|
||||||
|
;--*/
|
||||||
|
;
|
||||||
|
;
|
||||||
|
;#ifndef _ASPNETCORE_MSG_H_
|
||||||
|
;#define _ASPNETCORE_MSG_H_
|
||||||
|
;
|
||||||
|
|
||||||
|
SeverityNames=(Success=0x0
|
||||||
|
Informational=0x1
|
||||||
|
Warning=0x2
|
||||||
|
Error=0x3
|
||||||
|
)
|
||||||
|
|
||||||
|
MessageIdTypedef=DWORD
|
||||||
|
|
||||||
|
Messageid=1000
|
||||||
|
SymbolicName=ASPNETCORE_EVENT_PROCESS_START_ERROR
|
||||||
|
Language=English
|
||||||
|
%1
|
||||||
|
.
|
||||||
|
|
||||||
|
Messageid=1001
|
||||||
|
SymbolicName=ASPNETCORE_EVENT_PROCESS_START_SUCCESS
|
||||||
|
Language=English
|
||||||
|
%1
|
||||||
|
.
|
||||||
|
|
||||||
|
Messageid=1002
|
||||||
|
SymbolicName=ASPNETCORE_EVENT_PROCESS_CRASH
|
||||||
|
Language=English
|
||||||
|
%1
|
||||||
|
.
|
||||||
|
|
||||||
|
Messageid=1003
|
||||||
|
SymbolicName=ASPNETCORE_EVENT_RAPID_FAIL_COUNT_EXCEEDED
|
||||||
|
Language=English
|
||||||
|
%1
|
||||||
|
.
|
||||||
|
|
||||||
|
Messageid=1004
|
||||||
|
SymbolicName=ASPNETCORE_EVENT_CONFIG_ERROR
|
||||||
|
Language=English
|
||||||
|
%1
|
||||||
|
.
|
||||||
|
|
||||||
|
Messageid=1005
|
||||||
|
SymbolicName=ASPNETCORE_EVENT_GRACEFUL_SHUTDOWN_FAILURE
|
||||||
|
Language=English
|
||||||
|
%1
|
||||||
|
.
|
||||||
|
|
||||||
|
Messageid=1006
|
||||||
|
SymbolicName=ASPNETCORE_EVENT_SENT_SHUTDOWN_HTTP_REQUEST
|
||||||
|
Language=English
|
||||||
|
%1
|
||||||
|
.
|
||||||
|
|
||||||
|
Messageid=1012
|
||||||
|
SymbolicName=ASPNETCORE_EVENT_RECYCLE_APPOFFLINE
|
||||||
|
Language=English
|
||||||
|
%1
|
||||||
|
.
|
||||||
|
|
||||||
|
;
|
||||||
|
;#endif // _ASPNETCORE_MODULE_MSG_H_
|
||||||
|
;
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
<!--
|
||||||
|
|
||||||
|
IIS Asp.Net Core Extension Schema
|
||||||
|
|
||||||
|
** Please DO NOT edit this file yourself. **
|
||||||
|
|
||||||
|
If you want to add configuration sections to the schema, you may place
|
||||||
|
them in .xml files similar to this one, in this directory. They will be
|
||||||
|
picked up automatically on startup.
|
||||||
|
|
||||||
|
-->
|
||||||
|
|
||||||
|
<configSchema>
|
||||||
|
<sectionSchema name="system.webServer/aspNetCore">
|
||||||
|
<attribute name="processPath" type="string" expanded="true"/>
|
||||||
|
<attribute name="arguments" type="string" expanded="true" defaultValue=""/>
|
||||||
|
<attribute name="startupTimeLimit" type="uint" defaultValue="120" validationType="integerRange" validationParameter="0,3600"/> <!-- in seconds -->
|
||||||
|
<attribute name="shutdownTimeLimit" type="uint" defaultValue="10" validationType="integerRange" validationParameter="0,600"/> <!-- in seconds -->
|
||||||
|
<attribute name="rapidFailsPerMinute" type="uint" defaultValue="10" validationType="integerRange" validationParameter="0,100"/>
|
||||||
|
<attribute name="requestTimeout" type="timeSpan" defaultValue="00:02:00" validationType="timeSpanRange" validationParameter="0,1296000,60"/>
|
||||||
|
<attribute name="stdoutLogEnabled" type="bool" defaultValue="false" />
|
||||||
|
<attribute name="stdoutLogFile" type="string" defaultValue=".\aspnetcore-stdout" expanded="true"/>
|
||||||
|
<attribute name="processesPerApplication" type="uint" defaultValue="1" validationType="integerRange" validationParameter="1,100"/>
|
||||||
|
<attribute name="forwardWindowsAuthToken" type="bool" defaultValue="true" />
|
||||||
|
<attribute name="disableStartUpErrorPage" type="bool" defaultValue="false" />
|
||||||
|
<attribute name="hostingModel" type="string" />
|
||||||
|
<element name="recycleOnFileChange">
|
||||||
|
<collection addElement="file" clearElement="clear">
|
||||||
|
<attribute name="path" type="string" required="true" validationType="nonEmptyString" expanded="true"/>
|
||||||
|
</collection>
|
||||||
|
</element>
|
||||||
|
<element name="environmentVariables">
|
||||||
|
<collection addElement="environmentVariable" clearElement="clear" >
|
||||||
|
<attribute name="name" type="string" required="true" validationType="nonEmptyString"/>
|
||||||
|
<attribute name="value" type="string" required="true"/>
|
||||||
|
</collection>
|
||||||
|
</element>
|
||||||
|
</sectionSchema>
|
||||||
|
</configSchema>
|
||||||
|
|
@ -0,0 +1,117 @@
|
||||||
|
// Microsoft Visual C++ generated resource script.
|
||||||
|
//
|
||||||
|
#include <windows.h>
|
||||||
|
#include "version.h"
|
||||||
|
#include "resource.h"
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// English (United States) resources
|
||||||
|
|
||||||
|
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||||
|
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// 11
|
||||||
|
//
|
||||||
|
|
||||||
|
//1 11
|
||||||
|
//BEGIN
|
||||||
|
// 0x0001, 0x0000, 0x03e8, 0x0000, 0x03ed, 0x0000, 0x0010, 0x0000, 0x0010,
|
||||||
|
// 0x0001, 0x0025, 0x0031, 0x000d, 0x000a, 0x0000, 0x0000, 0x0010, 0x0001,
|
||||||
|
// 0x0025, 0x0031, 0x000d, 0x000a, 0x0000, 0x0000, 0x0010, 0x0001, 0x0025,
|
||||||
|
// 0x0031, 0x000d, 0x000a, 0x0000, 0x0000, 0x0010, 0x0001, 0x0025, 0x0031,
|
||||||
|
// 0x000d, 0x000a, 0x0000, 0x0000, 0x0010, 0x0001, 0x0025, 0x0031, 0x000d,
|
||||||
|
// 0x000a, 0x0000, 0x0000, 0x0010, 0x0001, 0x0025, 0x0031, 0x000d, 0x000a,
|
||||||
|
// 0x0000, 0x0000
|
||||||
|
//END
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef APSTUDIO_INVOKED
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// TEXTINCLUDE
|
||||||
|
//
|
||||||
|
|
||||||
|
1 TEXTINCLUDE
|
||||||
|
BEGIN
|
||||||
|
"resource.h\0"
|
||||||
|
END
|
||||||
|
|
||||||
|
2 TEXTINCLUDE
|
||||||
|
BEGIN
|
||||||
|
"\0"
|
||||||
|
END
|
||||||
|
|
||||||
|
3 TEXTINCLUDE
|
||||||
|
BEGIN
|
||||||
|
"\r\n"
|
||||||
|
"\0"
|
||||||
|
END
|
||||||
|
|
||||||
|
#endif // APSTUDIO_INVOKED
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Version
|
||||||
|
//
|
||||||
|
|
||||||
|
VS_VERSION_INFO VERSIONINFO
|
||||||
|
FILEVERSION FileVersion
|
||||||
|
PRODUCTVERSION ProductVersion
|
||||||
|
FILEFLAGSMASK 0x3fL
|
||||||
|
#ifdef _DEBUG
|
||||||
|
FILEFLAGS 0x1L
|
||||||
|
#else
|
||||||
|
FILEFLAGS 0x0L
|
||||||
|
#endif
|
||||||
|
FILEOS 0x40004L
|
||||||
|
FILETYPE 0x2L
|
||||||
|
FILESUBTYPE 0x0L
|
||||||
|
BEGIN
|
||||||
|
BLOCK "StringFileInfo"
|
||||||
|
BEGIN
|
||||||
|
BLOCK "040904b0"
|
||||||
|
BEGIN
|
||||||
|
VALUE "CompanyName", "Microsoft"
|
||||||
|
VALUE "FileDescription", "IIS ASP.NET Core Module"
|
||||||
|
VALUE "FileVersion", FileVersionStr
|
||||||
|
VALUE "InternalName", "aspnetcore.dll"
|
||||||
|
VALUE "LegalCopyright", "Copyright (C) 2016"
|
||||||
|
VALUE "OriginalFilename", "aspnetcore.dll"
|
||||||
|
VALUE "ProductName", "ASP.NET Core Module"
|
||||||
|
VALUE "ProductVersion", ProductVersionStr
|
||||||
|
END
|
||||||
|
END
|
||||||
|
BLOCK "VarFileInfo"
|
||||||
|
BEGIN
|
||||||
|
VALUE "Translation", 0x409, 1200
|
||||||
|
END
|
||||||
|
END
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// String Table
|
||||||
|
//
|
||||||
|
|
||||||
|
STRINGTABLE
|
||||||
|
BEGIN
|
||||||
|
IDS_INVALID_PROPERTY "Property name '%s' in system.webServer/aspNetCore section has invalid value '%s' which does not conform to the prescribed format"
|
||||||
|
IDS_SERVER_ERROR "There was a connection error while trying to route the request."
|
||||||
|
END
|
||||||
|
|
||||||
|
#endif // English (United States) resources
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef APSTUDIO_INVOKED
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Generated from the TEXTINCLUDE 3 resource.
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
#endif // not APSTUDIO_INVOKED
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
//{{NO_DEPENDENCIES}}
|
||||||
|
// Microsoft Visual C++ generated include file.
|
||||||
|
// Used by aspnetcoremodule.rc
|
||||||
|
//
|
||||||
|
#define ASPNETCORE_EVENT_MSG_BUFFER_SIZE 256
|
||||||
|
#define IDS_INVALID_PROPERTY 1000
|
||||||
|
#define IDS_SERVER_ERROR 1001
|
||||||
|
|
||||||
|
// Next default values for new objects
|
||||||
|
//
|
||||||
|
#ifdef APSTUDIO_INVOKED
|
||||||
|
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||||
|
#define _APS_NEXT_RESOURCE_VALUE 101
|
||||||
|
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||||
|
#define _APS_NEXT_CONTROL_VALUE 1000
|
||||||
|
#define _APS_NEXT_SYMED_VALUE 101
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,164 @@
|
||||||
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
#include "precomp.hxx"
|
||||||
|
|
||||||
|
APPLICATION::~APPLICATION()
|
||||||
|
{
|
||||||
|
if (m_pAppOfflineHtm != NULL)
|
||||||
|
{
|
||||||
|
m_pAppOfflineHtm->DereferenceAppOfflineHtm();
|
||||||
|
m_pAppOfflineHtm = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_pFileWatcherEntry != NULL)
|
||||||
|
{
|
||||||
|
// Mark the entry as invalid,
|
||||||
|
// StopMonitor will close the file handle and trigger a FCN
|
||||||
|
// the entry will delete itself when processing this FCN
|
||||||
|
m_pFileWatcherEntry->MarkEntryInValid();
|
||||||
|
m_pFileWatcherEntry->StopMonitor();
|
||||||
|
m_pFileWatcherEntry = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_pProcessManager != NULL)
|
||||||
|
{
|
||||||
|
m_pProcessManager->ShutdownAllProcesses();
|
||||||
|
m_pProcessManager->DereferenceProcessManager();
|
||||||
|
m_pProcessManager = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
APPLICATION::Initialize(
|
||||||
|
_In_ APPLICATION_MANAGER* pApplicationManager,
|
||||||
|
_In_ LPCWSTR pszApplication,
|
||||||
|
_In_ LPCWSTR pszPhysicalPath
|
||||||
|
)
|
||||||
|
{
|
||||||
|
HRESULT hr = S_OK;
|
||||||
|
|
||||||
|
DBG_ASSERT(pszPhysicalPath != NULL);
|
||||||
|
DBG_ASSERT(pApplicationManager != NULL);
|
||||||
|
DBG_ASSERT(pszPhysicalPath != NULL);
|
||||||
|
m_strAppPhysicalPath.Copy(pszPhysicalPath);
|
||||||
|
|
||||||
|
m_pApplicationManager = pApplicationManager;
|
||||||
|
|
||||||
|
hr = m_applicationKey.Initialize(pszApplication);
|
||||||
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_pProcessManager == NULL)
|
||||||
|
{
|
||||||
|
m_pProcessManager = new PROCESS_MANAGER;
|
||||||
|
if (m_pProcessManager == NULL)
|
||||||
|
{
|
||||||
|
hr = E_OUTOFMEMORY;
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = m_pProcessManager->Initialize();
|
||||||
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_pFileWatcherEntry == NULL)
|
||||||
|
{
|
||||||
|
m_pFileWatcherEntry = new FILE_WATCHER_ENTRY(pApplicationManager->GetFileWatcher());
|
||||||
|
if (m_pFileWatcherEntry == NULL)
|
||||||
|
{
|
||||||
|
hr = E_OUTOFMEMORY;
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
UpdateAppOfflineFileHandle();
|
||||||
|
|
||||||
|
Finished:
|
||||||
|
|
||||||
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
if (m_pFileWatcherEntry != NULL)
|
||||||
|
{
|
||||||
|
m_pFileWatcherEntry->DereferenceFileWatcherEntry();
|
||||||
|
m_pFileWatcherEntry = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_pProcessManager != NULL)
|
||||||
|
{
|
||||||
|
m_pProcessManager->DereferenceProcessManager();
|
||||||
|
m_pProcessManager = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
APPLICATION::StartMonitoringAppOffline()
|
||||||
|
{
|
||||||
|
HRESULT hr = S_OK;
|
||||||
|
|
||||||
|
hr = m_pFileWatcherEntry->Create(m_strAppPhysicalPath.QueryStr(), L"app_offline.htm", this, NULL);
|
||||||
|
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
APPLICATION::UpdateAppOfflineFileHandle()
|
||||||
|
{
|
||||||
|
STRU strFilePath;
|
||||||
|
PATH::ConvertPathToFullPath(L".\\app_offline.htm", m_strAppPhysicalPath.QueryStr(), &strFilePath);
|
||||||
|
APP_OFFLINE_HTM *pOldAppOfflineHtm = NULL;
|
||||||
|
APP_OFFLINE_HTM *pNewAppOfflineHtm = NULL;
|
||||||
|
|
||||||
|
if (INVALID_FILE_ATTRIBUTES == GetFileAttributes(strFilePath.QueryStr()) && GetLastError() == ERROR_FILE_NOT_FOUND)
|
||||||
|
{
|
||||||
|
m_fAppOfflineFound = FALSE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_fAppOfflineFound = TRUE;
|
||||||
|
|
||||||
|
//
|
||||||
|
// send shutdown signal
|
||||||
|
//
|
||||||
|
|
||||||
|
// The reason why we send the shutdown signal before loading the new app_offline file is because we want to make some delay
|
||||||
|
// before reading the appoffline.htm so that the file change can be done on time.
|
||||||
|
if (m_pProcessManager != NULL)
|
||||||
|
{
|
||||||
|
m_pProcessManager->SendShutdownSignal();
|
||||||
|
}
|
||||||
|
|
||||||
|
pNewAppOfflineHtm = new APP_OFFLINE_HTM(strFilePath.QueryStr());
|
||||||
|
|
||||||
|
if ( pNewAppOfflineHtm != NULL )
|
||||||
|
{
|
||||||
|
if (pNewAppOfflineHtm->Load())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// loaded the new app_offline.htm
|
||||||
|
//
|
||||||
|
pOldAppOfflineHtm = (APP_OFFLINE_HTM *)InterlockedExchangePointer((VOID**)&m_pAppOfflineHtm, pNewAppOfflineHtm);
|
||||||
|
|
||||||
|
if (pOldAppOfflineHtm != NULL)
|
||||||
|
{
|
||||||
|
pOldAppOfflineHtm->DereferenceAppOfflineHtm();
|
||||||
|
pOldAppOfflineHtm = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// ignored the new app_offline file because the file does not exist.
|
||||||
|
pNewAppOfflineHtm->DereferenceAppOfflineHtm();
|
||||||
|
pNewAppOfflineHtm = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,178 @@
|
||||||
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
#include "precomp.hxx"
|
||||||
|
|
||||||
|
APPLICATION_MANAGER* APPLICATION_MANAGER::sm_pApplicationManager = NULL;
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
APPLICATION_MANAGER::GetApplication(
|
||||||
|
_In_ IHttpContext* pContext,
|
||||||
|
_Out_ APPLICATION ** ppApplication
|
||||||
|
)
|
||||||
|
{
|
||||||
|
HRESULT hr = S_OK;
|
||||||
|
APPLICATION *pApplication = NULL;
|
||||||
|
APPLICATION_KEY key;
|
||||||
|
BOOL fExclusiveLock = FALSE;
|
||||||
|
PCWSTR pszApplicationId = NULL;
|
||||||
|
|
||||||
|
*ppApplication = NULL;
|
||||||
|
|
||||||
|
DBG_ASSERT(pContext != NULL);
|
||||||
|
DBG_ASSERT(pContext->GetApplication() != NULL);
|
||||||
|
pszApplicationId = pContext->GetApplication()->GetApplicationId();
|
||||||
|
|
||||||
|
hr = key.Initialize(pszApplicationId);
|
||||||
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_pApplicationHash->FindKey(&key, ppApplication);
|
||||||
|
|
||||||
|
if (*ppApplication == NULL)
|
||||||
|
{
|
||||||
|
|
||||||
|
pApplication = new APPLICATION();
|
||||||
|
if (pApplication == NULL)
|
||||||
|
{
|
||||||
|
hr = E_OUTOFMEMORY;
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
AcquireSRWLockExclusive(&m_srwLock);
|
||||||
|
fExclusiveLock = TRUE;
|
||||||
|
m_pApplicationHash->FindKey(&key, ppApplication);
|
||||||
|
|
||||||
|
if (*ppApplication != NULL)
|
||||||
|
{
|
||||||
|
// someone else created the application
|
||||||
|
delete pApplication;
|
||||||
|
pApplication = NULL;
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = pApplication->Initialize(this, pszApplicationId, pContext->GetApplication()->GetApplicationPhysicalPath());
|
||||||
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = m_pApplicationHash->InsertRecord( pApplication );
|
||||||
|
|
||||||
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
ReleaseSRWLockExclusive(&m_srwLock);
|
||||||
|
fExclusiveLock = FALSE;
|
||||||
|
|
||||||
|
pApplication->StartMonitoringAppOffline();
|
||||||
|
|
||||||
|
*ppApplication = pApplication;
|
||||||
|
pApplication = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
Finished:
|
||||||
|
|
||||||
|
if (fExclusiveLock == TRUE)
|
||||||
|
ReleaseSRWLockExclusive(&m_srwLock);
|
||||||
|
|
||||||
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
if (pApplication != NULL)
|
||||||
|
{
|
||||||
|
pApplication->DereferenceApplication();
|
||||||
|
pApplication = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
APPLICATION_MANAGER::RecycleApplication(
|
||||||
|
_In_ LPCWSTR pszApplication
|
||||||
|
)
|
||||||
|
{
|
||||||
|
HRESULT hr = S_OK;
|
||||||
|
APPLICATION_KEY key;
|
||||||
|
|
||||||
|
hr = key.Initialize(pszApplication);
|
||||||
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
AcquireSRWLockExclusive(&m_srwLock);
|
||||||
|
m_pApplicationHash->DeleteKey(&key);
|
||||||
|
ReleaseSRWLockExclusive(&m_srwLock);
|
||||||
|
|
||||||
|
Finished:
|
||||||
|
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
APPLICATION_MANAGER::Get502ErrorPage(
|
||||||
|
_Out_ HTTP_DATA_CHUNK** ppErrorPage
|
||||||
|
)
|
||||||
|
{
|
||||||
|
HRESULT hr = S_OK;
|
||||||
|
BOOL fExclusiveLock = FALSE;
|
||||||
|
HTTP_DATA_CHUNK *pHttp502ErrorPage = NULL;
|
||||||
|
|
||||||
|
DBG_ASSERT(ppErrorPage != NULL);
|
||||||
|
|
||||||
|
//on-demand create the error page
|
||||||
|
if (m_pHttp502ErrorPage != NULL)
|
||||||
|
{
|
||||||
|
*ppErrorPage = m_pHttp502ErrorPage;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AcquireSRWLockExclusive(&m_srwLock);
|
||||||
|
fExclusiveLock = TRUE;
|
||||||
|
if (m_pHttp502ErrorPage != NULL)
|
||||||
|
{
|
||||||
|
*ppErrorPage = m_pHttp502ErrorPage;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
size_t maxsize = 5000;
|
||||||
|
pHttp502ErrorPage = new HTTP_DATA_CHUNK();
|
||||||
|
if (pHttp502ErrorPage == NULL)
|
||||||
|
{
|
||||||
|
hr = HRESULT_FROM_WIN32(ERROR_NOT_ENOUGH_MEMORY);
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
pHttp502ErrorPage->DataChunkType = HttpDataChunkFromMemory;
|
||||||
|
pHttp502ErrorPage->FromMemory.pBuffer = (PVOID)m_pstrErrorInfo;
|
||||||
|
|
||||||
|
pHttp502ErrorPage->FromMemory.BufferLength = (ULONG)strnlen(m_pstrErrorInfo, maxsize); //(ULONG)(wcslen(m_pstrErrorInfo)); // *sizeof(WCHAR);
|
||||||
|
if(m_pHttp502ErrorPage != NULL)
|
||||||
|
{
|
||||||
|
delete m_pHttp502ErrorPage;
|
||||||
|
}
|
||||||
|
m_pHttp502ErrorPage = pHttp502ErrorPage;
|
||||||
|
*ppErrorPage = m_pHttp502ErrorPage;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Finished:
|
||||||
|
if (fExclusiveLock)
|
||||||
|
{
|
||||||
|
ReleaseSRWLockExclusive(&m_srwLock);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
if (pHttp502ErrorPage != NULL)
|
||||||
|
{
|
||||||
|
delete pHttp502ErrorPage;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,416 @@
|
||||||
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
#include "precomp.hxx"
|
||||||
|
|
||||||
|
ASPNETCORE_CONFIG::~ASPNETCORE_CONFIG()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// the destructor will be called once IIS decides to recycle the module context (i.e., application)
|
||||||
|
//
|
||||||
|
if (!m_struApplication.IsEmpty())
|
||||||
|
{
|
||||||
|
APPLICATION_MANAGER::GetInstance()->RecycleApplication(m_struApplication.QueryStr());
|
||||||
|
}
|
||||||
|
if(m_pEnvironmentVariables != NULL)
|
||||||
|
{
|
||||||
|
m_pEnvironmentVariables->Clear();
|
||||||
|
delete m_pEnvironmentVariables;
|
||||||
|
m_pEnvironmentVariables = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
ASPNETCORE_CONFIG::GetConfig(
|
||||||
|
_In_ IHttpContext *pHttpContext,
|
||||||
|
_Out_ ASPNETCORE_CONFIG **ppAspNetCoreConfig
|
||||||
|
)
|
||||||
|
{
|
||||||
|
HRESULT hr = S_OK;
|
||||||
|
IHttpApplication *pHttpApplication = pHttpContext->GetApplication();
|
||||||
|
ASPNETCORE_CONFIG *pAspNetCoreConfig = NULL;
|
||||||
|
|
||||||
|
if (ppAspNetCoreConfig == NULL)
|
||||||
|
{
|
||||||
|
hr = E_INVALIDARG;
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
*ppAspNetCoreConfig = NULL;
|
||||||
|
|
||||||
|
// potential bug if user sepcific config at virtual dir level
|
||||||
|
pAspNetCoreConfig = (ASPNETCORE_CONFIG*)
|
||||||
|
pHttpApplication->GetModuleContextContainer()->GetModuleContext(g_pModuleId);
|
||||||
|
|
||||||
|
if (pAspNetCoreConfig != NULL)
|
||||||
|
{
|
||||||
|
*ppAspNetCoreConfig = pAspNetCoreConfig;
|
||||||
|
pAspNetCoreConfig = NULL;
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
pAspNetCoreConfig = new ASPNETCORE_CONFIG;
|
||||||
|
if (pAspNetCoreConfig == NULL)
|
||||||
|
{
|
||||||
|
hr = E_OUTOFMEMORY;
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = pAspNetCoreConfig->Populate(pHttpContext);
|
||||||
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = pHttpApplication->GetModuleContextContainer()->
|
||||||
|
SetModuleContext(pAspNetCoreConfig, g_pModuleId);
|
||||||
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
if (hr == HRESULT_FROM_WIN32(ERROR_ALREADY_ASSIGNED))
|
||||||
|
{
|
||||||
|
delete pAspNetCoreConfig;
|
||||||
|
|
||||||
|
pAspNetCoreConfig = (ASPNETCORE_CONFIG*)pHttpApplication->
|
||||||
|
GetModuleContextContainer()->
|
||||||
|
GetModuleContext(g_pModuleId);
|
||||||
|
|
||||||
|
_ASSERT(pAspNetCoreConfig != NULL);
|
||||||
|
|
||||||
|
hr = S_OK;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// set appliction info here instead of inside Populate()
|
||||||
|
// as the destructor will delete the backend process
|
||||||
|
hr = pAspNetCoreConfig->QueryApplicationPath()->Copy(pHttpApplication->GetApplicationId());
|
||||||
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*ppAspNetCoreConfig = pAspNetCoreConfig;
|
||||||
|
pAspNetCoreConfig = NULL;
|
||||||
|
|
||||||
|
Finished:
|
||||||
|
|
||||||
|
if (pAspNetCoreConfig != NULL)
|
||||||
|
{
|
||||||
|
delete pAspNetCoreConfig;
|
||||||
|
pAspNetCoreConfig = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
ASPNETCORE_CONFIG::Populate(
|
||||||
|
IHttpContext *pHttpContext
|
||||||
|
)
|
||||||
|
{
|
||||||
|
HRESULT hr = S_OK;
|
||||||
|
STACK_STRU(strSiteConfigPath, 256);
|
||||||
|
STRU strEnvName;
|
||||||
|
STRU strEnvValue;
|
||||||
|
STRU strExpandedEnvValue;
|
||||||
|
IAppHostAdminManager *pAdminManager = NULL;
|
||||||
|
IAppHostElement *pAspNetCoreElement = NULL;
|
||||||
|
IAppHostElement *pWindowsAuthenticationElement = NULL;
|
||||||
|
IAppHostElement *pBasicAuthenticationElement = NULL;
|
||||||
|
IAppHostElement *pAnonymousAuthenticationElement = NULL;
|
||||||
|
IAppHostElement *pEnvVarList = NULL;
|
||||||
|
IAppHostElement *pEnvVar = NULL;
|
||||||
|
IAppHostElementCollection *pEnvVarCollection = NULL;
|
||||||
|
ULONGLONG ullRawTimeSpan = 0;
|
||||||
|
ENUM_INDEX index;
|
||||||
|
ENVIRONMENT_VAR_ENTRY* pEntry = NULL;
|
||||||
|
|
||||||
|
m_pEnvironmentVariables = new ENVIRONMENT_VAR_HASH();
|
||||||
|
if (m_pEnvironmentVariables == NULL)
|
||||||
|
{
|
||||||
|
hr = E_OUTOFMEMORY;
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
if (FAILED(hr = m_pEnvironmentVariables->Initialize(37 /*prime*/)))
|
||||||
|
{
|
||||||
|
delete m_pEnvironmentVariables;
|
||||||
|
m_pEnvironmentVariables = NULL;
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
pAdminManager = g_pHttpServer->GetAdminManager();
|
||||||
|
|
||||||
|
hr = strSiteConfigPath.Copy(pHttpContext->GetApplication()->GetAppConfigPath());
|
||||||
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = pAdminManager->GetAdminSection(CS_WINDOWS_AUTHENTICATION_SECTION,
|
||||||
|
strSiteConfigPath.QueryStr(),
|
||||||
|
&pWindowsAuthenticationElement);
|
||||||
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
// assume the corresponding authen was not enabled
|
||||||
|
// as the section may get deleted by user in some HWC case
|
||||||
|
// ToDo: log a warning to event log
|
||||||
|
m_fWindowsAuthEnabled = FALSE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
hr = GetElementBoolProperty(pWindowsAuthenticationElement,
|
||||||
|
CS_AUTHENTICATION_ENABLED,
|
||||||
|
&m_fWindowsAuthEnabled);
|
||||||
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = pAdminManager->GetAdminSection(CS_BASIC_AUTHENTICATION_SECTION,
|
||||||
|
strSiteConfigPath.QueryStr(),
|
||||||
|
&pBasicAuthenticationElement);
|
||||||
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
m_fBasicAuthEnabled = FALSE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
hr = GetElementBoolProperty(pBasicAuthenticationElement,
|
||||||
|
CS_AUTHENTICATION_ENABLED,
|
||||||
|
&m_fBasicAuthEnabled);
|
||||||
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = pAdminManager->GetAdminSection(CS_ANONYMOUS_AUTHENTICATION_SECTION,
|
||||||
|
strSiteConfigPath.QueryStr(),
|
||||||
|
&pAnonymousAuthenticationElement);
|
||||||
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
m_fAnonymousAuthEnabled = FALSE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
hr = GetElementBoolProperty(pAnonymousAuthenticationElement,
|
||||||
|
CS_AUTHENTICATION_ENABLED,
|
||||||
|
&m_fAnonymousAuthEnabled);
|
||||||
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = pAdminManager->GetAdminSection(CS_ASPNETCORE_SECTION,
|
||||||
|
strSiteConfigPath.QueryStr(),
|
||||||
|
&pAspNetCoreElement);
|
||||||
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = GetElementStringProperty(pAspNetCoreElement,
|
||||||
|
CS_ASPNETCORE_PROCESS_EXE_PATH,
|
||||||
|
&m_struProcessPath);
|
||||||
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = GetElementStringProperty(pAspNetCoreElement,
|
||||||
|
CS_ASPNETCORE_PROCESS_ARGUMENTS,
|
||||||
|
&m_struArguments);
|
||||||
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = GetElementDWORDProperty(pAspNetCoreElement,
|
||||||
|
CS_ASPNETCORE_RAPID_FAILS_PER_MINUTE,
|
||||||
|
&m_dwRapidFailsPerMinute);
|
||||||
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// rapidFailsPerMinute cannot be greater than 100.
|
||||||
|
//
|
||||||
|
if (m_dwRapidFailsPerMinute > MAX_RAPID_FAILS_PER_MINUTE)
|
||||||
|
{
|
||||||
|
m_dwRapidFailsPerMinute = MAX_RAPID_FAILS_PER_MINUTE;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = GetElementDWORDProperty(pAspNetCoreElement,
|
||||||
|
CS_ASPNETCORE_PROCESSES_PER_APPLICATION,
|
||||||
|
&m_dwProcessesPerApplication);
|
||||||
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = GetElementDWORDProperty(
|
||||||
|
pAspNetCoreElement,
|
||||||
|
CS_ASPNETCORE_PROCESS_STARTUP_TIME_LIMIT,
|
||||||
|
&m_dwStartupTimeLimitInMS
|
||||||
|
);
|
||||||
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_dwStartupTimeLimitInMS *= MILLISECONDS_IN_ONE_SECOND;
|
||||||
|
|
||||||
|
hr = GetElementDWORDProperty(
|
||||||
|
pAspNetCoreElement,
|
||||||
|
CS_ASPNETCORE_PROCESS_SHUTDOWN_TIME_LIMIT,
|
||||||
|
&m_dwShutdownTimeLimitInMS
|
||||||
|
);
|
||||||
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
m_dwShutdownTimeLimitInMS *= MILLISECONDS_IN_ONE_SECOND;
|
||||||
|
|
||||||
|
hr = GetElementBoolProperty(pAspNetCoreElement,
|
||||||
|
CS_ASPNETCORE_FORWARD_WINDOWS_AUTH_TOKEN,
|
||||||
|
&m_fForwardWindowsAuthToken);
|
||||||
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = GetElementBoolProperty(pAspNetCoreElement,
|
||||||
|
CS_ASPNETCORE_DISABLE_START_UP_ERROR_PAGE,
|
||||||
|
&m_fDisableStartUpErrorPage);
|
||||||
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = GetElementRawTimeSpanProperty(
|
||||||
|
pAspNetCoreElement,
|
||||||
|
CS_ASPNETCORE_WINHTTP_REQUEST_TIMEOUT,
|
||||||
|
&ullRawTimeSpan
|
||||||
|
);
|
||||||
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_dwRequestTimeoutInMS = (DWORD)TIMESPAN_IN_MILLISECONDS(ullRawTimeSpan);
|
||||||
|
|
||||||
|
hr = GetElementBoolProperty(pAspNetCoreElement,
|
||||||
|
CS_ASPNETCORE_STDOUT_LOG_ENABLED,
|
||||||
|
&m_fStdoutLogEnabled);
|
||||||
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = GetElementStringProperty(pAspNetCoreElement,
|
||||||
|
CS_ASPNETCORE_STDOUT_LOG_FILE,
|
||||||
|
&m_struStdoutLogFile);
|
||||||
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = GetElementChildByName(pAspNetCoreElement,
|
||||||
|
CS_ASPNETCORE_ENVIRONMENT_VARIABLES,
|
||||||
|
&pEnvVarList);
|
||||||
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = pEnvVarList->get_Collection(&pEnvVarCollection);
|
||||||
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (hr = FindFirstElement(pEnvVarCollection, &index, &pEnvVar);
|
||||||
|
SUCCEEDED(hr);
|
||||||
|
hr = FindNextElement(pEnvVarCollection, &index, &pEnvVar))
|
||||||
|
{
|
||||||
|
if (hr == S_FALSE)
|
||||||
|
{
|
||||||
|
hr = S_OK;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (FAILED(hr = GetElementStringProperty(pEnvVar,
|
||||||
|
CS_ASPNETCORE_ENVIRONMENT_VARIABLE_NAME,
|
||||||
|
&strEnvName)) ||
|
||||||
|
FAILED(hr = GetElementStringProperty(pEnvVar,
|
||||||
|
CS_ASPNETCORE_ENVIRONMENT_VARIABLE_VALUE,
|
||||||
|
&strEnvValue)) ||
|
||||||
|
FAILED(hr = strEnvName.Append(L"=")) ||
|
||||||
|
FAILED(hr = STRU::ExpandEnvironmentVariables(strEnvValue.QueryStr(), &strExpandedEnvValue)))
|
||||||
|
{
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
pEntry = new ENVIRONMENT_VAR_ENTRY();
|
||||||
|
if (pEntry == NULL)
|
||||||
|
{
|
||||||
|
hr = E_OUTOFMEMORY;
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (FAILED(hr = pEntry->Initialize(strEnvName.QueryStr(), strExpandedEnvValue.QueryStr())) ||
|
||||||
|
FAILED(hr = m_pEnvironmentVariables->InsertRecord(pEntry)))
|
||||||
|
{
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
strEnvName.Reset();
|
||||||
|
strEnvValue.Reset();
|
||||||
|
strExpandedEnvValue.Reset();
|
||||||
|
pEnvVar->Release();
|
||||||
|
pEnvVar = NULL;
|
||||||
|
pEntry->Dereference();
|
||||||
|
pEntry = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
Finished:
|
||||||
|
|
||||||
|
if (pAspNetCoreElement != NULL)
|
||||||
|
{
|
||||||
|
pAspNetCoreElement->Release();
|
||||||
|
pAspNetCoreElement = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pEnvVarList != NULL)
|
||||||
|
{
|
||||||
|
pEnvVarList->Release();
|
||||||
|
pEnvVarList = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pEnvVar != NULL)
|
||||||
|
{
|
||||||
|
pEnvVar->Release();
|
||||||
|
pEnvVar = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pEnvVarCollection != NULL)
|
||||||
|
{
|
||||||
|
pEnvVarCollection->Release();
|
||||||
|
pEnvVarCollection = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pEntry != NULL)
|
||||||
|
{
|
||||||
|
pEntry->Dereference();
|
||||||
|
pEntry = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,481 @@
|
||||||
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
#include "precomp.hxx"
|
||||||
|
|
||||||
|
FILE_WATCHER::FILE_WATCHER() :
|
||||||
|
m_hCompletionPort(NULL),
|
||||||
|
m_hChangeNotificationThread(NULL)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
FILE_WATCHER::~FILE_WATCHER()
|
||||||
|
{
|
||||||
|
if (m_hChangeNotificationThread != NULL)
|
||||||
|
{
|
||||||
|
CloseHandle(m_hChangeNotificationThread);
|
||||||
|
m_hChangeNotificationThread = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
FILE_WATCHER::Create(
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
HRESULT hr = S_OK;
|
||||||
|
|
||||||
|
m_hCompletionPort = CreateIoCompletionPort(INVALID_HANDLE_VALUE,
|
||||||
|
NULL,
|
||||||
|
0,
|
||||||
|
0);
|
||||||
|
|
||||||
|
if (m_hCompletionPort == NULL)
|
||||||
|
{
|
||||||
|
hr = HRESULT_FROM_WIN32(GetLastError());
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_hChangeNotificationThread = CreateThread(NULL,
|
||||||
|
0,
|
||||||
|
ChangeNotificationThread,
|
||||||
|
this,
|
||||||
|
0,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
if (m_hChangeNotificationThread == NULL)
|
||||||
|
{
|
||||||
|
hr = HRESULT_FROM_WIN32(GetLastError());
|
||||||
|
|
||||||
|
CloseHandle(m_hCompletionPort);
|
||||||
|
m_hCompletionPort = NULL;
|
||||||
|
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
Finished:
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD
|
||||||
|
WINAPI
|
||||||
|
FILE_WATCHER::ChangeNotificationThread(
|
||||||
|
LPVOID pvArg
|
||||||
|
)
|
||||||
|
/*++
|
||||||
|
|
||||||
|
Routine Description:
|
||||||
|
|
||||||
|
IO completion thread
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
|
||||||
|
None
|
||||||
|
|
||||||
|
Return Value:
|
||||||
|
|
||||||
|
Win32 error
|
||||||
|
|
||||||
|
--*/
|
||||||
|
{
|
||||||
|
FILE_WATCHER * pFileMonitor;
|
||||||
|
BOOL fSuccess = FALSE;
|
||||||
|
DWORD cbCompletion = 0;
|
||||||
|
OVERLAPPED * pOverlapped = NULL;
|
||||||
|
DWORD dwErrorStatus;
|
||||||
|
ULONG_PTR completionKey;
|
||||||
|
|
||||||
|
pFileMonitor = (FILE_WATCHER*)pvArg;
|
||||||
|
DBG_ASSERT(pFileMonitor != NULL);
|
||||||
|
|
||||||
|
while (TRUE)
|
||||||
|
{
|
||||||
|
fSuccess = GetQueuedCompletionStatus(
|
||||||
|
pFileMonitor->m_hCompletionPort,
|
||||||
|
&cbCompletion,
|
||||||
|
&completionKey,
|
||||||
|
&pOverlapped,
|
||||||
|
INFINITE);
|
||||||
|
|
||||||
|
DBG_ASSERT(fSuccess);
|
||||||
|
DebugPrint(1, "FILE_WATCHER::ChangeNotificationThread");
|
||||||
|
dwErrorStatus = fSuccess ? ERROR_SUCCESS : GetLastError();
|
||||||
|
|
||||||
|
if (completionKey == FILE_WATCHER_SHUTDOWN_KEY)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
DBG_ASSERT(pOverlapped != NULL);
|
||||||
|
if (pOverlapped != NULL)
|
||||||
|
{
|
||||||
|
FileWatcherCompletionRoutine(
|
||||||
|
dwErrorStatus,
|
||||||
|
cbCompletion,
|
||||||
|
pOverlapped);
|
||||||
|
}
|
||||||
|
pOverlapped = NULL;
|
||||||
|
cbCompletion = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
WINAPI
|
||||||
|
FILE_WATCHER::FileWatcherCompletionRoutine(
|
||||||
|
DWORD dwCompletionStatus,
|
||||||
|
DWORD cbCompletion,
|
||||||
|
OVERLAPPED * pOverlapped
|
||||||
|
)
|
||||||
|
/*++
|
||||||
|
|
||||||
|
Routine Description:
|
||||||
|
|
||||||
|
Called when ReadDirectoryChangesW() completes
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
|
||||||
|
dwCompletionStatus - Error of completion
|
||||||
|
cbCompletion - Bytes of completion
|
||||||
|
pOverlapped - State of completion
|
||||||
|
|
||||||
|
Return Value:
|
||||||
|
|
||||||
|
None
|
||||||
|
|
||||||
|
--*/
|
||||||
|
{
|
||||||
|
FILE_WATCHER_ENTRY * pMonitorEntry;
|
||||||
|
pMonitorEntry = CONTAINING_RECORD(pOverlapped, FILE_WATCHER_ENTRY, _overlapped);
|
||||||
|
pMonitorEntry->DereferenceFileWatcherEntry();
|
||||||
|
DBG_ASSERT(pMonitorEntry != NULL);
|
||||||
|
|
||||||
|
pMonitorEntry->HandleChangeCompletion(dwCompletionStatus, cbCompletion);
|
||||||
|
|
||||||
|
if (pMonitorEntry->QueryIsValid())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Continue monitoring
|
||||||
|
//
|
||||||
|
pMonitorEntry->Monitor();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Marked by application distructor
|
||||||
|
// Deference the entry to delete it
|
||||||
|
//
|
||||||
|
pMonitorEntry->DereferenceFileWatcherEntry();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FILE_WATCHER_ENTRY::FILE_WATCHER_ENTRY(FILE_WATCHER * pFileMonitor) :
|
||||||
|
_pFileMonitor(pFileMonitor),
|
||||||
|
_hDirectory(INVALID_HANDLE_VALUE),
|
||||||
|
_hImpersonationToken(NULL),
|
||||||
|
_pApplication(NULL),
|
||||||
|
_lStopMonitorCalled(0),
|
||||||
|
_cRefs(1),
|
||||||
|
_fIsValid(TRUE)
|
||||||
|
{
|
||||||
|
_dwSignature = FILE_WATCHER_ENTRY_SIGNATURE;
|
||||||
|
InitializeSRWLock(&_srwLock);
|
||||||
|
}
|
||||||
|
|
||||||
|
FILE_WATCHER_ENTRY::~FILE_WATCHER_ENTRY()
|
||||||
|
{
|
||||||
|
_dwSignature = FILE_WATCHER_ENTRY_SIGNATURE_FREE;
|
||||||
|
|
||||||
|
if (_hDirectory != INVALID_HANDLE_VALUE)
|
||||||
|
{
|
||||||
|
CloseHandle(_hDirectory);
|
||||||
|
_hDirectory = INVALID_HANDLE_VALUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_hImpersonationToken != NULL)
|
||||||
|
{
|
||||||
|
CloseHandle(_hImpersonationToken);
|
||||||
|
_hImpersonationToken = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma warning(disable:4100)
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
FILE_WATCHER_ENTRY::HandleChangeCompletion(
|
||||||
|
_In_ DWORD dwCompletionStatus,
|
||||||
|
_In_ DWORD cbCompletion
|
||||||
|
)
|
||||||
|
/*++
|
||||||
|
|
||||||
|
Routine Description:
|
||||||
|
|
||||||
|
Handle change notification (see if any of associated config files
|
||||||
|
need to be flushed)
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
|
||||||
|
dwCompletionStatus - Completion status
|
||||||
|
cbCompletion - Bytes of completion
|
||||||
|
|
||||||
|
Return Value:
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
|
||||||
|
--*/
|
||||||
|
{
|
||||||
|
HRESULT hr = S_OK;
|
||||||
|
FILE_NOTIFY_INFORMATION * pNotificationInfo;
|
||||||
|
BOOL fFileChanged = FALSE;
|
||||||
|
STRU strEventMsg;
|
||||||
|
|
||||||
|
AcquireSRWLockExclusive(&_srwLock);
|
||||||
|
if (!_fIsValid)
|
||||||
|
{
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
// When directory handle is closed then HandleChangeCompletion
|
||||||
|
// happens with cbCompletion = 0 and dwCompletionStatus = 0
|
||||||
|
// From documentation it is not clear if that combination
|
||||||
|
// of return values is specific to closing handles or whether
|
||||||
|
// it could also mean an error condition. Hence we will maintain
|
||||||
|
// explicit flag that will help us determine if entry
|
||||||
|
// is being shutdown (StopMonitor() called)
|
||||||
|
//
|
||||||
|
if (_lStopMonitorCalled)
|
||||||
|
{
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// There could be a FCN overflow
|
||||||
|
// Let assume the file got changed instead of checking files
|
||||||
|
// Othersie we have to cache the file info
|
||||||
|
//
|
||||||
|
if (cbCompletion == 0)
|
||||||
|
{
|
||||||
|
fFileChanged = TRUE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pNotificationInfo = (FILE_NOTIFY_INFORMATION*)_buffDirectoryChanges.QueryPtr();
|
||||||
|
DBG_ASSERT(pNotificationInfo != NULL);
|
||||||
|
|
||||||
|
while (pNotificationInfo != NULL)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// check whether the monitored file got changed
|
||||||
|
//
|
||||||
|
if (_wcsnicmp(pNotificationInfo->FileName,
|
||||||
|
_strFileName.QueryStr(),
|
||||||
|
pNotificationInfo->FileNameLength/sizeof(WCHAR)) == 0)
|
||||||
|
{
|
||||||
|
fFileChanged = TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// Advance to next notification
|
||||||
|
//
|
||||||
|
if (pNotificationInfo->NextEntryOffset == 0)
|
||||||
|
{
|
||||||
|
pNotificationInfo = NULL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pNotificationInfo = (FILE_NOTIFY_INFORMATION*)
|
||||||
|
((PBYTE)pNotificationInfo +
|
||||||
|
pNotificationInfo->NextEntryOffset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fFileChanged)
|
||||||
|
{
|
||||||
|
LPCWSTR apsz[1];
|
||||||
|
if (SUCCEEDED(strEventMsg.SafeSnwprintf(
|
||||||
|
ASPNETCORE_EVENT_RECYCLE_APPOFFLINE_MSG,
|
||||||
|
_strFileName.QueryStr())))
|
||||||
|
{
|
||||||
|
apsz[0] = strEventMsg.QueryStr();
|
||||||
|
|
||||||
|
//
|
||||||
|
// not checking return code because if ReportEvent
|
||||||
|
// fails, we cannot do anything.
|
||||||
|
//
|
||||||
|
if (FORWARDING_HANDLER::QueryEventLog() != NULL)
|
||||||
|
{
|
||||||
|
ReportEventW(FORWARDING_HANDLER::QueryEventLog(),
|
||||||
|
EVENTLOG_INFORMATION_TYPE,
|
||||||
|
0,
|
||||||
|
ASPNETCORE_EVENT_RECYCLE_APPOFFLINE,
|
||||||
|
NULL,
|
||||||
|
1,
|
||||||
|
0,
|
||||||
|
apsz,
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// so far we only monitoring app_offline
|
||||||
|
//
|
||||||
|
_pApplication->UpdateAppOfflineFileHandle();
|
||||||
|
}
|
||||||
|
|
||||||
|
Finished:
|
||||||
|
ReleaseSRWLockExclusive(&_srwLock);
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma warning( error : 4100 )
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
FILE_WATCHER_ENTRY::Monitor(VOID)
|
||||||
|
{
|
||||||
|
HRESULT hr = S_OK;
|
||||||
|
DWORD cbRead;
|
||||||
|
|
||||||
|
AcquireSRWLockExclusive(&_srwLock);
|
||||||
|
ReferenceFileWatcherEntry();
|
||||||
|
ZeroMemory(&_overlapped, sizeof(_overlapped));
|
||||||
|
|
||||||
|
if(!ReadDirectoryChangesW(_hDirectory,
|
||||||
|
_buffDirectoryChanges.QueryPtr(),
|
||||||
|
_buffDirectoryChanges.QuerySize(),
|
||||||
|
FALSE, // Watching sub dirs. Set to False now as only monitoring app_offline
|
||||||
|
FILE_NOTIFY_VALID_MASK & ~FILE_NOTIFY_CHANGE_LAST_ACCESS,
|
||||||
|
&cbRead,
|
||||||
|
&_overlapped,
|
||||||
|
NULL))
|
||||||
|
{
|
||||||
|
hr = HRESULT_FROM_WIN32(GetLastError());
|
||||||
|
}
|
||||||
|
|
||||||
|
ReleaseSRWLockExclusive(&_srwLock);
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
FILE_WATCHER_ENTRY::StopMonitor(VOID)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Flag that monitoring is being stopped so that
|
||||||
|
// we know that HandleChangeCompletion() call
|
||||||
|
// can be ignored
|
||||||
|
//
|
||||||
|
InterlockedExchange(&_lStopMonitorCalled, 1);
|
||||||
|
|
||||||
|
AcquireSRWLockExclusive(&_srwLock);
|
||||||
|
|
||||||
|
if (_hDirectory != INVALID_HANDLE_VALUE)
|
||||||
|
{
|
||||||
|
CloseHandle(_hDirectory);
|
||||||
|
_hDirectory = INVALID_HANDLE_VALUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReleaseSRWLockExclusive(&_srwLock);
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
FILE_WATCHER_ENTRY::Create(
|
||||||
|
_In_ PCWSTR pszDirectoryToMonitor,
|
||||||
|
_In_ PCWSTR pszFileNameToMonitor,
|
||||||
|
_In_ APPLICATION* pApplication,
|
||||||
|
_In_ HANDLE hImpersonationToken
|
||||||
|
)
|
||||||
|
{
|
||||||
|
HRESULT hr = S_OK;
|
||||||
|
BOOL fRet = FALSE;
|
||||||
|
|
||||||
|
if (pszDirectoryToMonitor == NULL ||
|
||||||
|
pszFileNameToMonitor == NULL ||
|
||||||
|
pApplication == NULL)
|
||||||
|
{
|
||||||
|
DBG_ASSERT(FALSE);
|
||||||
|
hr = HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER);
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
//remember the application
|
||||||
|
//
|
||||||
|
_pApplication = pApplication;
|
||||||
|
|
||||||
|
if (FAILED(hr = _strFileName.Copy(pszFileNameToMonitor)))
|
||||||
|
{
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (FAILED(hr = _strDirectoryName.Copy(pszDirectoryToMonitor)))
|
||||||
|
{
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Resize change buffer to something "reasonable"
|
||||||
|
//
|
||||||
|
if (!_buffDirectoryChanges.Resize(FILE_WATCHER_ENTRY_BUFFER_SIZE))
|
||||||
|
{
|
||||||
|
hr = HRESULT_FROM_WIN32(ERROR_NOT_ENOUGH_MEMORY);
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hImpersonationToken != NULL)
|
||||||
|
{
|
||||||
|
fRet = DuplicateHandle(GetCurrentProcess(),
|
||||||
|
hImpersonationToken,
|
||||||
|
GetCurrentProcess(),
|
||||||
|
&_hImpersonationToken,
|
||||||
|
0,
|
||||||
|
FALSE,
|
||||||
|
DUPLICATE_SAME_ACCESS);
|
||||||
|
|
||||||
|
if (!fRet)
|
||||||
|
{
|
||||||
|
hr = HRESULT_FROM_WIN32(GetLastError());
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (_hImpersonationToken != NULL)
|
||||||
|
{
|
||||||
|
CloseHandle(_hImpersonationToken);
|
||||||
|
_hImpersonationToken = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_hDirectory = CreateFileW(
|
||||||
|
_strDirectoryName.QueryStr(),
|
||||||
|
FILE_LIST_DIRECTORY,
|
||||||
|
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
|
||||||
|
NULL,
|
||||||
|
OPEN_EXISTING,
|
||||||
|
FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OVERLAPPED,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
if (_hDirectory == INVALID_HANDLE_VALUE)
|
||||||
|
{
|
||||||
|
hr = HRESULT_FROM_WIN32(GetLastError());
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CreateIoCompletionPort(
|
||||||
|
_hDirectory,
|
||||||
|
_pFileMonitor->QueryCompletionPort(),
|
||||||
|
NULL,
|
||||||
|
0) == NULL)
|
||||||
|
{
|
||||||
|
hr = HRESULT_FROM_WIN32(GetLastError());
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Start monitoring
|
||||||
|
//
|
||||||
|
hr = Monitor();
|
||||||
|
|
||||||
|
Finished:
|
||||||
|
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,52 @@
|
||||||
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
#include "precomp.hxx"
|
||||||
|
|
||||||
|
FORWARDER_CONNECTION::FORWARDER_CONNECTION(
|
||||||
|
VOID
|
||||||
|
) : m_cRefs (1),
|
||||||
|
m_hConnection (NULL)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
FORWARDER_CONNECTION::Initialize(
|
||||||
|
DWORD dwPort
|
||||||
|
)
|
||||||
|
{
|
||||||
|
HRESULT hr = S_OK;
|
||||||
|
|
||||||
|
hr = m_ConnectionKey.Initialize( dwPort );
|
||||||
|
if ( FAILED( hr ) )
|
||||||
|
{
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_hConnection = WinHttpConnect(FORWARDING_HANDLER::sm_hSession,
|
||||||
|
L"127.0.0.1",
|
||||||
|
(USHORT) dwPort,
|
||||||
|
0);
|
||||||
|
if (m_hConnection == NULL)
|
||||||
|
{
|
||||||
|
hr = HRESULT_FROM_WIN32(GetLastError());
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Since WinHttp will not emit WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING
|
||||||
|
// when closing WebSocket handle on Win8. Register callback at Connect level as a workaround
|
||||||
|
//
|
||||||
|
if (WinHttpSetStatusCallback(m_hConnection,
|
||||||
|
FORWARDING_HANDLER::OnWinHttpCompletion,
|
||||||
|
WINHTTP_CALLBACK_FLAG_HANDLES,
|
||||||
|
NULL) == WINHTTP_INVALID_STATUS_CALLBACK)
|
||||||
|
{
|
||||||
|
hr = HRESULT_FROM_WIN32(GetLastError());
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
Finished:
|
||||||
|
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,272 @@
|
||||||
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
#include "precomp.hxx"
|
||||||
|
#include <IPHlpApi.h>
|
||||||
|
|
||||||
|
HTTP_MODULE_ID g_pModuleId = NULL;
|
||||||
|
IHttpServer * g_pHttpServer = NULL;
|
||||||
|
BOOL g_fAsyncDisconnectAvailable = FALSE;
|
||||||
|
BOOL g_fWinHttpNonBlockingCallbackAvailable = FALSE;
|
||||||
|
PCWSTR g_pszModuleName = NULL;
|
||||||
|
HINSTANCE g_hModule;
|
||||||
|
HINSTANCE g_hWinHttpModule;
|
||||||
|
BOOL g_fWebSocketSupported = FALSE;
|
||||||
|
DWORD g_dwTlsIndex = TLS_OUT_OF_INDEXES;
|
||||||
|
BOOL g_fEnableReferenceCountTracing = FALSE;
|
||||||
|
DWORD g_dwAspNetCoreDebugFlags = 0;
|
||||||
|
BOOL g_fNsiApiNotSupported = FALSE;
|
||||||
|
DWORD g_dwActiveServerProcesses = 0;
|
||||||
|
DWORD g_OptionalWinHttpFlags = 0; //specify additional WinHTTP options when using WinHttpOpenRequest API.
|
||||||
|
DWORD g_dwDebugFlags = 0;
|
||||||
|
PCSTR g_szDebugLabel = "ASPNET_CORE_MODULE";
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
STRA g_strLogs[ASPNETCORE_DEBUG_STRU_ARRAY_SIZE];
|
||||||
|
DWORD g_dwLogCounter = 0;
|
||||||
|
#endif // DEBUG
|
||||||
|
|
||||||
|
|
||||||
|
BOOL WINAPI DllMain(
|
||||||
|
HMODULE hModule,
|
||||||
|
DWORD dwReason,
|
||||||
|
LPVOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
switch (dwReason)
|
||||||
|
{
|
||||||
|
case DLL_PROCESS_ATTACH:
|
||||||
|
g_hModule = hModule;
|
||||||
|
DisableThreadLibraryCalls(hModule);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
LoadGlobalConfiguration(
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
HKEY hKey;
|
||||||
|
|
||||||
|
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
|
||||||
|
L"SOFTWARE\\Microsoft\\IIS Extensions\\IIS AspNetCore Module\\Parameters",
|
||||||
|
0,
|
||||||
|
KEY_READ,
|
||||||
|
&hKey) == NO_ERROR)
|
||||||
|
{
|
||||||
|
DWORD dwType;
|
||||||
|
DWORD dwData;
|
||||||
|
DWORD cbData;
|
||||||
|
|
||||||
|
cbData = sizeof(dwData);
|
||||||
|
if ((RegQueryValueEx(hKey,
|
||||||
|
L"OptionalWinHttpFlags",
|
||||||
|
NULL,
|
||||||
|
&dwType,
|
||||||
|
(LPBYTE)&dwData,
|
||||||
|
&cbData) == NO_ERROR) &&
|
||||||
|
(dwType == REG_DWORD))
|
||||||
|
{
|
||||||
|
g_OptionalWinHttpFlags = dwData;
|
||||||
|
}
|
||||||
|
|
||||||
|
cbData = sizeof(dwData);
|
||||||
|
if ((RegQueryValueEx(hKey,
|
||||||
|
L"EnableReferenceCountTracing",
|
||||||
|
NULL,
|
||||||
|
&dwType,
|
||||||
|
(LPBYTE)&dwData,
|
||||||
|
&cbData) == NO_ERROR) &&
|
||||||
|
(dwType == REG_DWORD) && (dwData == 1 || dwData == 0))
|
||||||
|
{
|
||||||
|
g_fEnableReferenceCountTracing = !!dwData;
|
||||||
|
}
|
||||||
|
|
||||||
|
cbData = sizeof(dwData);
|
||||||
|
if ((RegQueryValueEx(hKey,
|
||||||
|
L"DebugFlags",
|
||||||
|
NULL,
|
||||||
|
&dwType,
|
||||||
|
(LPBYTE)&dwData,
|
||||||
|
&cbData) == NO_ERROR) &&
|
||||||
|
(dwType == REG_DWORD))
|
||||||
|
{
|
||||||
|
g_dwAspNetCoreDebugFlags = dwData;
|
||||||
|
}
|
||||||
|
|
||||||
|
RegCloseKey(hKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD dwSize = 0;
|
||||||
|
DWORD dwResult = GetExtendedTcpTable(NULL,
|
||||||
|
&dwSize,
|
||||||
|
FALSE,
|
||||||
|
AF_INET,
|
||||||
|
TCP_TABLE_OWNER_PID_LISTENER,
|
||||||
|
0);
|
||||||
|
if (dwResult != NO_ERROR && dwResult != ERROR_INSUFFICIENT_BUFFER)
|
||||||
|
{
|
||||||
|
g_fNsiApiNotSupported = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
__stdcall
|
||||||
|
RegisterModule(
|
||||||
|
DWORD dwServerVersion,
|
||||||
|
IHttpModuleRegistrationInfo * pModuleInfo,
|
||||||
|
IHttpServer * pHttpServer
|
||||||
|
)
|
||||||
|
/*++
|
||||||
|
|
||||||
|
Routine description:
|
||||||
|
|
||||||
|
Function called by IIS immediately after loading the module, used to let
|
||||||
|
IIS know what notifications the module is interested in
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
|
||||||
|
dwServerVersion - IIS version the module is being loaded on
|
||||||
|
pModuleInfo - info regarding this module
|
||||||
|
pHttpServer - callback functions which can be used by the module at
|
||||||
|
any point
|
||||||
|
|
||||||
|
Return value:
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
|
||||||
|
--*/
|
||||||
|
{
|
||||||
|
HRESULT hr = S_OK;
|
||||||
|
CProxyModuleFactory * pFactory = NULL;
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
CREATE_DEBUG_PRINT_OBJECT("Asp.Net Core Module");
|
||||||
|
g_dwDebugFlags = DEBUG_FLAGS_ANY;
|
||||||
|
#endif // DEBUG
|
||||||
|
|
||||||
|
LoadGlobalConfiguration();
|
||||||
|
|
||||||
|
//
|
||||||
|
// 7.0 is 0,7
|
||||||
|
//
|
||||||
|
if (dwServerVersion > MAKELONG(0, 7))
|
||||||
|
{
|
||||||
|
g_fAsyncDisconnectAvailable = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// 8.0 is 0,8
|
||||||
|
//
|
||||||
|
if (dwServerVersion >= MAKELONG(0, 8))
|
||||||
|
{
|
||||||
|
// IISOOB:36641 Enable back WINHTTP_OPTION_ASSURED_NON_BLOCKING_CALLBACKS for Win8.
|
||||||
|
// g_fWinHttpNonBlockingCallbackAvailable = TRUE;
|
||||||
|
g_fWebSocketSupported = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = WINHTTP_HELPER::StaticInitialize();
|
||||||
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
if (hr == HRESULT_FROM_WIN32(ERROR_PROC_NOT_FOUND))
|
||||||
|
{
|
||||||
|
g_fWebSocketSupported = FALSE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
g_pModuleId = pModuleInfo->GetId();
|
||||||
|
g_pszModuleName = pModuleInfo->GetName();
|
||||||
|
g_pHttpServer = pHttpServer;
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
for (int i = 0; i < ASPNETCORE_DEBUG_STRU_ARRAY_SIZE; i++)
|
||||||
|
{
|
||||||
|
g_strLogs[i].Resize(ASPNETCORE_DEBUG_STRU_BUFFER_SIZE + 1);
|
||||||
|
}
|
||||||
|
#endif // DEBUG
|
||||||
|
//
|
||||||
|
// WinHTTP does not create enough threads, ask it to create more.
|
||||||
|
// Starting in Windows 7, this setting is ignored because WinHTTP
|
||||||
|
// uses a thread pool.
|
||||||
|
//
|
||||||
|
SYSTEM_INFO si;
|
||||||
|
GetSystemInfo(&si);
|
||||||
|
DWORD dwThreadCount = (si.dwNumberOfProcessors * 3 + 1) / 2;
|
||||||
|
WinHttpSetOption(NULL,
|
||||||
|
WINHTTP_OPTION_WORKER_THREAD_COUNT,
|
||||||
|
&dwThreadCount,
|
||||||
|
sizeof(dwThreadCount));
|
||||||
|
|
||||||
|
//
|
||||||
|
// Create the factory before any static initialization.
|
||||||
|
// The CProxyModuleFactory::Terminate method will clean any
|
||||||
|
// static object initialized.
|
||||||
|
//
|
||||||
|
pFactory = new CProxyModuleFactory;
|
||||||
|
if (pFactory == NULL)
|
||||||
|
{
|
||||||
|
hr = E_OUTOFMEMORY;
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = pModuleInfo->SetRequestNotifications(
|
||||||
|
pFactory,
|
||||||
|
RQ_EXECUTE_REQUEST_HANDLER,
|
||||||
|
0);
|
||||||
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
pFactory = NULL;
|
||||||
|
g_pResponseHeaderHash = new RESPONSE_HEADER_HASH;
|
||||||
|
if (g_pResponseHeaderHash == NULL)
|
||||||
|
{
|
||||||
|
hr = E_OUTOFMEMORY;
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = g_pResponseHeaderHash->Initialize();
|
||||||
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = ALLOC_CACHE_HANDLER::StaticInitialize();
|
||||||
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = FORWARDING_HANDLER::StaticInitialize(g_fEnableReferenceCountTracing);
|
||||||
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = WEBSOCKET_HANDLER::StaticInitialize(g_fEnableReferenceCountTracing);
|
||||||
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
Finished:
|
||||||
|
|
||||||
|
if (pFactory != NULL)
|
||||||
|
{
|
||||||
|
pFactory->Terminate();
|
||||||
|
pFactory = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,442 @@
|
||||||
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
#include "precomp.hxx"
|
||||||
|
|
||||||
|
// static
|
||||||
|
HRESULT
|
||||||
|
PATH::SplitUrl(
|
||||||
|
PCWSTR pszDestinationUrl,
|
||||||
|
BOOL *pfSecure,
|
||||||
|
STRU *pstrDestination,
|
||||||
|
STRU *pstrUrl
|
||||||
|
)
|
||||||
|
/*++
|
||||||
|
|
||||||
|
Routine Description:
|
||||||
|
|
||||||
|
Split the URL specified for forwarding into its specific components
|
||||||
|
The format of the URL looks like
|
||||||
|
http[s]://destination[:port]/path
|
||||||
|
when port is omitted, the default port for that specific protocol is used
|
||||||
|
when host is omitted, it gets the same value as the destination
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
|
||||||
|
pszDestinationUrl - the url to be split up
|
||||||
|
pfSecure - SSL to be used in forwarding?
|
||||||
|
pstrDestination - destination
|
||||||
|
pDestinationPort - port
|
||||||
|
pstrUrl - URL
|
||||||
|
|
||||||
|
Return Value:
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
|
||||||
|
--*/
|
||||||
|
{
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
|
//
|
||||||
|
// First determine if the target is secure
|
||||||
|
//
|
||||||
|
if (_wcsnicmp(pszDestinationUrl, L"http://", 7) == 0)
|
||||||
|
{
|
||||||
|
*pfSecure = FALSE;
|
||||||
|
pszDestinationUrl += 7;
|
||||||
|
}
|
||||||
|
else if (_wcsnicmp(pszDestinationUrl, L"https://", 8) == 0)
|
||||||
|
{
|
||||||
|
*pfSecure = TRUE;
|
||||||
|
pszDestinationUrl += 8;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (*pszDestinationUrl == L'\0')
|
||||||
|
{
|
||||||
|
return HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Find the 3rd slash corresponding to the url
|
||||||
|
//
|
||||||
|
LPCWSTR pszSlash = wcschr(pszDestinationUrl, L'/');
|
||||||
|
if (pszSlash == NULL)
|
||||||
|
{
|
||||||
|
if (FAILED(hr = pstrUrl->Copy(L"/", 1)) ||
|
||||||
|
FAILED(hr = pstrDestination->Copy(pszDestinationUrl)))
|
||||||
|
{
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (FAILED(hr = pstrUrl->Copy(pszSlash)) ||
|
||||||
|
FAILED(hr = pstrDestination->Copy(pszDestinationUrl,
|
||||||
|
(DWORD)(pszSlash - pszDestinationUrl))))
|
||||||
|
{
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Change a hexadecimal digit to its numerical equivalent
|
||||||
|
#define TOHEX( ch ) \
|
||||||
|
((ch) > L'9' ? \
|
||||||
|
(ch) >= L'a' ? \
|
||||||
|
(ch) - L'a' + 10 : \
|
||||||
|
(ch) - L'A' + 10 \
|
||||||
|
: (ch) - L'0')
|
||||||
|
|
||||||
|
// static
|
||||||
|
HRESULT
|
||||||
|
PATH::UnEscapeUrl(
|
||||||
|
PCWSTR pszUrl,
|
||||||
|
DWORD cchUrl,
|
||||||
|
bool fCopyQuery,
|
||||||
|
STRA * pstrResult
|
||||||
|
)
|
||||||
|
{
|
||||||
|
HRESULT hr;
|
||||||
|
CHAR pch[2];
|
||||||
|
pch[1] = '\0';
|
||||||
|
DWORD cchStart = 0;
|
||||||
|
DWORD index = 0;
|
||||||
|
|
||||||
|
while (index < cchUrl &&
|
||||||
|
(fCopyQuery || pszUrl[index] != L'?'))
|
||||||
|
{
|
||||||
|
switch (pszUrl[index])
|
||||||
|
{
|
||||||
|
case L'%':
|
||||||
|
if (iswxdigit(pszUrl[index+1]) && iswxdigit(pszUrl[index+2]))
|
||||||
|
{
|
||||||
|
if (index > cchStart &&
|
||||||
|
FAILED(hr = pstrResult->AppendW(pszUrl + cchStart,
|
||||||
|
index - cchStart)))
|
||||||
|
{
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
cchStart = index+3;
|
||||||
|
|
||||||
|
pch[0] = static_cast<CHAR>(TOHEX(pszUrl[index+1]) * 16 +
|
||||||
|
TOHEX(pszUrl[index+2]));
|
||||||
|
if (FAILED(hr = pstrResult->Append(pch, 1)))
|
||||||
|
{
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
index += 3;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
__fallthrough;
|
||||||
|
default:
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (index > cchStart)
|
||||||
|
{
|
||||||
|
return pstrResult->AppendW(pszUrl + cchStart,
|
||||||
|
index - cchStart);
|
||||||
|
}
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
HRESULT
|
||||||
|
PATH::UnEscapeUrl(
|
||||||
|
PCWSTR pszUrl,
|
||||||
|
DWORD cchUrl,
|
||||||
|
STRU * pstrResult
|
||||||
|
)
|
||||||
|
{
|
||||||
|
HRESULT hr;
|
||||||
|
WCHAR pch[2];
|
||||||
|
pch[1] = L'\0';
|
||||||
|
DWORD cchStart = 0;
|
||||||
|
DWORD index = 0;
|
||||||
|
bool fInQuery = FALSE;
|
||||||
|
|
||||||
|
while (index < cchUrl)
|
||||||
|
{
|
||||||
|
switch (pszUrl[index])
|
||||||
|
{
|
||||||
|
case L'%':
|
||||||
|
if (iswxdigit(pszUrl[index+1]) && iswxdigit(pszUrl[index+2]))
|
||||||
|
{
|
||||||
|
if (index > cchStart &&
|
||||||
|
FAILED(hr = pstrResult->Append(pszUrl + cchStart,
|
||||||
|
index - cchStart)))
|
||||||
|
{
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
cchStart = index+3;
|
||||||
|
|
||||||
|
pch[0] = static_cast<WCHAR>(TOHEX(pszUrl[index+1]) * 16 +
|
||||||
|
TOHEX(pszUrl[index+2]));
|
||||||
|
if (FAILED(hr = pstrResult->Append(pch, 1)))
|
||||||
|
{
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
index += 3;
|
||||||
|
if (pch[0] == L'?')
|
||||||
|
{
|
||||||
|
fInQuery = TRUE;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
index++;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case L'/':
|
||||||
|
if (fInQuery)
|
||||||
|
{
|
||||||
|
if (index > cchStart &&
|
||||||
|
FAILED(hr = pstrResult->Append(pszUrl + cchStart,
|
||||||
|
index - cchStart)))
|
||||||
|
{
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
cchStart = index+1;
|
||||||
|
|
||||||
|
if (FAILED(hr = pstrResult->Append(L"\\", 1)))
|
||||||
|
{
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
index += 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
__fallthrough;
|
||||||
|
default:
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (index > cchStart)
|
||||||
|
{
|
||||||
|
return pstrResult->Append(pszUrl + cchStart,
|
||||||
|
index - cchStart);
|
||||||
|
}
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
PATH::EscapeAbsPath(
|
||||||
|
IHttpRequest * pRequest,
|
||||||
|
STRU * strEscapedUrl
|
||||||
|
)
|
||||||
|
{
|
||||||
|
HRESULT hr = S_OK;
|
||||||
|
STRU strAbsPath;
|
||||||
|
LPCWSTR pszAbsPath = NULL;
|
||||||
|
LPCWSTR pszFindStr = NULL;
|
||||||
|
|
||||||
|
hr = strAbsPath.Copy( pRequest->GetRawHttpRequest()->CookedUrl.pAbsPath,
|
||||||
|
pRequest->GetRawHttpRequest()->CookedUrl.AbsPathLength / sizeof(WCHAR) );
|
||||||
|
if(FAILED(hr))
|
||||||
|
{
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
pszAbsPath = strAbsPath.QueryStr();
|
||||||
|
pszFindStr = wcschr(pszAbsPath, L'?');
|
||||||
|
|
||||||
|
while(pszFindStr != NULL)
|
||||||
|
{
|
||||||
|
strEscapedUrl->Append( pszAbsPath, pszFindStr - pszAbsPath);
|
||||||
|
strEscapedUrl->Append(L"%3F");
|
||||||
|
pszAbsPath = pszFindStr + 1;
|
||||||
|
pszFindStr = wcschr(pszAbsPath, L'?');
|
||||||
|
}
|
||||||
|
|
||||||
|
strEscapedUrl->Append(pszAbsPath);
|
||||||
|
strEscapedUrl->Append(pRequest->GetRawHttpRequest()->CookedUrl.pQueryString,
|
||||||
|
pRequest->GetRawHttpRequest()->CookedUrl.QueryStringLength / sizeof(WCHAR));
|
||||||
|
|
||||||
|
Finished:
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
bool
|
||||||
|
PATH::IsValidAttributeNameChar(
|
||||||
|
WCHAR ch
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Values based on ASP.NET rendering for cookie names. RFC 2965 is not clear
|
||||||
|
// what the non-special characters are.
|
||||||
|
//
|
||||||
|
return ch == L'\t' || (ch > 31 && ch < 127);
|
||||||
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
bool
|
||||||
|
PATH::FindInMultiString(
|
||||||
|
PCWSTR pszMultiString,
|
||||||
|
PCWSTR pszStringToFind
|
||||||
|
)
|
||||||
|
{
|
||||||
|
while (*pszMultiString != L'\0')
|
||||||
|
{
|
||||||
|
if (wcscmp(pszMultiString, pszStringToFind) == 0)
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
pszMultiString += wcslen(pszMultiString) + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
bool
|
||||||
|
PATH::IsValidQueryStringName(
|
||||||
|
PCWSTR pszName
|
||||||
|
)
|
||||||
|
{
|
||||||
|
while (*pszName != L'\0')
|
||||||
|
{
|
||||||
|
WCHAR c = *pszName;
|
||||||
|
if (c != L'-' && c != L'_' && c != L'+' &&
|
||||||
|
c != L'.' && c != L'*' && c != L'$' && c != L'%' && c != L',' &&
|
||||||
|
!iswalnum(c))
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
pszName++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
bool
|
||||||
|
PATH::IsValidHeaderName(
|
||||||
|
PCWSTR pszName
|
||||||
|
)
|
||||||
|
{
|
||||||
|
while (*pszName != L'\0')
|
||||||
|
{
|
||||||
|
WCHAR c = *pszName;
|
||||||
|
if (c != L'-' && c != L'_' && c != L'+' &&
|
||||||
|
c != L'.' && c != L'*' && c != L'$' && c != L'%'
|
||||||
|
&& !iswalnum(c))
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
pszName++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
PATH::IsPathUnc(
|
||||||
|
__in LPCWSTR pszPath,
|
||||||
|
__out BOOL * pfIsUnc
|
||||||
|
)
|
||||||
|
{
|
||||||
|
HRESULT hr = S_OK;
|
||||||
|
STRU strTempPath;
|
||||||
|
|
||||||
|
if ( pszPath == NULL || pfIsUnc == NULL )
|
||||||
|
{
|
||||||
|
hr = E_INVALIDARG;
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = MakePathCanonicalizationProof( (LPWSTR) pszPath, &strTempPath );
|
||||||
|
if ( FAILED(hr) )
|
||||||
|
{
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// MakePathCanonicalizationProof will map \\?\UNC, \\.\UNC and \\ to \\?\UNC
|
||||||
|
//
|
||||||
|
(*pfIsUnc) = ( _wcsnicmp( strTempPath.QueryStr(), L"\\\\?\\UNC\\", 8 /* sizeof \\?\UNC\ */) == 0 );
|
||||||
|
|
||||||
|
Finished:
|
||||||
|
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
PATH::ConvertPathToFullPath(
|
||||||
|
_In_ LPCWSTR pszPath,
|
||||||
|
_In_ LPCWSTR pszRootPath,
|
||||||
|
_Out_ STRU* pStruFullPath
|
||||||
|
)
|
||||||
|
{
|
||||||
|
HRESULT hr = S_OK;
|
||||||
|
STRU strFileFullPath;
|
||||||
|
LPWSTR pszFullPath = NULL;
|
||||||
|
|
||||||
|
// if relative path, prefix with root path and then convert to absolute path.
|
||||||
|
if( pszPath[0] == L'.' )
|
||||||
|
{
|
||||||
|
hr = strFileFullPath.Copy(pszRootPath);
|
||||||
|
if(FAILED(hr))
|
||||||
|
{
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!strFileFullPath.EndsWith(L"\\"))
|
||||||
|
{
|
||||||
|
hr = strFileFullPath.Append(L"\\");
|
||||||
|
if(FAILED(hr))
|
||||||
|
{
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = strFileFullPath.Append( pszPath );
|
||||||
|
if(FAILED(hr))
|
||||||
|
{
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
pszFullPath = new WCHAR[ strFileFullPath.QueryCCH() + 1];
|
||||||
|
if( pszFullPath == NULL )
|
||||||
|
{
|
||||||
|
hr = E_OUTOFMEMORY;
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(_wfullpath( pszFullPath,
|
||||||
|
strFileFullPath.QueryStr(),
|
||||||
|
strFileFullPath.QueryCCH() + 1 ) == NULL )
|
||||||
|
{
|
||||||
|
hr = HRESULT_FROM_WIN32( ERROR_INVALID_PARAMETER );
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
// convert to canonical path
|
||||||
|
hr = MakePathCanonicalizationProof( pszFullPath, pStruFullPath );
|
||||||
|
if(FAILED(hr))
|
||||||
|
{
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
Finished:
|
||||||
|
|
||||||
|
if( pszFullPath != NULL )
|
||||||
|
{
|
||||||
|
delete[] pszFullPath;
|
||||||
|
pszFullPath = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,156 @@
|
||||||
|
// Copyright(c).NET Foundation.All rights reserved.
|
||||||
|
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#pragma warning( disable : 4091)
|
||||||
|
|
||||||
|
//
|
||||||
|
// System related headers
|
||||||
|
//
|
||||||
|
#define _WINSOCKAPI_
|
||||||
|
|
||||||
|
#define NTDDI_VERSION 0x06010000
|
||||||
|
#define WINVER 0x0601
|
||||||
|
#define _WIN32_WINNT 0x0601
|
||||||
|
|
||||||
|
#include <windows.h>
|
||||||
|
#include <atlbase.h>
|
||||||
|
#include <pdh.h>
|
||||||
|
|
||||||
|
//#include <ntassert.h>
|
||||||
|
#include <Shlobj.h>
|
||||||
|
#include <httpserv.h>
|
||||||
|
|
||||||
|
// This should remove our issue of compiling for win7 without header files.
|
||||||
|
// We force the Windows 8 version check logic in iiswebsocket.h to succeed even though we're compiling for Windows 7.
|
||||||
|
// Then, we set the version defines back to Windows 7 to for the remainder of the compilation.
|
||||||
|
#undef NTDDI_VERSION
|
||||||
|
#undef WINVER
|
||||||
|
#undef _WIN32_WINNT
|
||||||
|
#define NTDDI_VERSION 0x06020000
|
||||||
|
#define WINVER 0x0602
|
||||||
|
#define _WIN32_WINNT 0x0602
|
||||||
|
#include <iiswebsocket.h>
|
||||||
|
#undef NTDDI_VERSION
|
||||||
|
#undef WINVER
|
||||||
|
#undef _WIN32_WINNT
|
||||||
|
|
||||||
|
#define NTDDI_VERSION 0x06010000
|
||||||
|
#define WINVER 0x0601
|
||||||
|
#define _WIN32_WINNT 0x0601
|
||||||
|
|
||||||
|
#include <httptrace.h>
|
||||||
|
#include <winhttp.h>
|
||||||
|
|
||||||
|
//
|
||||||
|
// Option available starting Windows 8.
|
||||||
|
// 111 is the value in SDK on May 15, 2012.
|
||||||
|
//
|
||||||
|
#ifndef WINHTTP_OPTION_ASSURED_NON_BLOCKING_CALLBACKS
|
||||||
|
#define WINHTTP_OPTION_ASSURED_NON_BLOCKING_CALLBACKS 111
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define ASPNETCORE_EVENT_PROVIDER L"IIS AspNetCore Module"
|
||||||
|
#define ASPNETCORE_IISEXPRESS_EVENT_PROVIDER L"IIS Express AspNetCore Module"
|
||||||
|
|
||||||
|
#define TIMESPAN_IN_MILLISECONDS(x) ((x)/((LONGLONG)(10000)))
|
||||||
|
#define TIMESPAN_IN_SECONDS(x) ((TIMESPAN_IN_MILLISECONDS(x))/((LONGLONG)(1000)))
|
||||||
|
#define TIMESPAN_IN_MINUTES(x) ((TIMESPAN_IN_SECONDS(x))/((LONGLONG)(60)))
|
||||||
|
|
||||||
|
#ifdef max
|
||||||
|
#undef max
|
||||||
|
template<typename T> inline T max(T a, T b)
|
||||||
|
{
|
||||||
|
return a > b ? a : b;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef min
|
||||||
|
#undef min
|
||||||
|
template<typename T> inline T min(T a, T b)
|
||||||
|
{
|
||||||
|
return a < b ? a : b;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
inline bool IsSpace(char ch)
|
||||||
|
{
|
||||||
|
switch(ch)
|
||||||
|
{
|
||||||
|
case 32: // ' '
|
||||||
|
case 9: // '\t'
|
||||||
|
case 10: // '\n'
|
||||||
|
case 13: // '\r'
|
||||||
|
case 11: // '\v'
|
||||||
|
case 12: // '\f'
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#include <hashfn.h>
|
||||||
|
#include <hashtable.h>
|
||||||
|
#include <stringa.h>
|
||||||
|
#include <stringu.h>
|
||||||
|
#include <treehash.h>
|
||||||
|
|
||||||
|
#include <dbgutil.h>
|
||||||
|
#include "ahutil.h"
|
||||||
|
#include "multisz.h"
|
||||||
|
#include "multisza.h"
|
||||||
|
#include "sttimer.h"
|
||||||
|
#include <listentry.h>
|
||||||
|
#include <base64.h>
|
||||||
|
#include <datetime.h>
|
||||||
|
#include <reftrace.h>
|
||||||
|
#include <acache.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
#include "filewatcher.h"
|
||||||
|
#include "environmentvariablehash.h"
|
||||||
|
#include "..\aspnetcore_msg.h"
|
||||||
|
#include "aspnetcoreconfig.h"
|
||||||
|
#include "serverprocess.h"
|
||||||
|
#include "processmanager.h"
|
||||||
|
#include "application.h"
|
||||||
|
#include "applicationmanager.h"
|
||||||
|
#include "resource.h"
|
||||||
|
#include "path.h"
|
||||||
|
#include "debugutil.h"
|
||||||
|
#include "protocolconfig.h"
|
||||||
|
#include "responseheaderhash.h"
|
||||||
|
#include "forwarderconnection.h"
|
||||||
|
#include "winhttphelper.h"
|
||||||
|
#include "websockethandler.h"
|
||||||
|
#include "forwardinghandler.h"
|
||||||
|
#include "proxymodule.h"
|
||||||
|
|
||||||
|
FORCEINLINE
|
||||||
|
DWORD
|
||||||
|
WIN32_FROM_HRESULT(
|
||||||
|
HRESULT hr
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if ((FAILED(hr)) &&
|
||||||
|
(HRESULT_FACILITY(hr) == FACILITY_WIN32))
|
||||||
|
{
|
||||||
|
return HRESULT_CODE(hr);
|
||||||
|
}
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCEINLINE
|
||||||
|
HRESULT
|
||||||
|
HRESULT_FROM_GETLASTERROR()
|
||||||
|
{
|
||||||
|
return ( GetLastError() != NO_ERROR )
|
||||||
|
? HRESULT_FROM_WIN32( GetLastError() )
|
||||||
|
: E_FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
extern BOOL g_fAsyncDisconnectAvailable;
|
||||||
|
extern PVOID g_pModuleId;
|
||||||
|
extern BOOL g_fWebSocketSupported;
|
||||||
|
extern BOOL g_fEnableReferenceCountTracing;
|
||||||
|
extern DWORD g_dwActiveServerProcesses;
|
||||||
|
|
@ -0,0 +1,294 @@
|
||||||
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
#include "precomp.hxx"
|
||||||
|
|
||||||
|
volatile BOOL PROCESS_MANAGER::sm_fWSAStartupDone = FALSE;
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
PROCESS_MANAGER::Initialize(
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
HRESULT hr = S_OK;
|
||||||
|
WSADATA wsaData;
|
||||||
|
int result;
|
||||||
|
BOOL fLocked = FALSE;
|
||||||
|
|
||||||
|
if( !sm_fWSAStartupDone )
|
||||||
|
{
|
||||||
|
AcquireSRWLockExclusive( &m_srwLock );
|
||||||
|
fLocked = TRUE;
|
||||||
|
|
||||||
|
if( !sm_fWSAStartupDone )
|
||||||
|
{
|
||||||
|
if( (result = WSAStartup(MAKEWORD(2, 2), &wsaData)) != 0 )
|
||||||
|
{
|
||||||
|
hr = HRESULT_FROM_WIN32( result );
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
sm_fWSAStartupDone = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReleaseSRWLockExclusive( &m_srwLock );
|
||||||
|
fLocked = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_dwRapidFailTickStart = GetTickCount();
|
||||||
|
|
||||||
|
if( m_hNULHandle == NULL )
|
||||||
|
{
|
||||||
|
SECURITY_ATTRIBUTES saAttr;
|
||||||
|
saAttr.nLength = sizeof(SECURITY_ATTRIBUTES);
|
||||||
|
saAttr.bInheritHandle = TRUE;
|
||||||
|
saAttr.lpSecurityDescriptor = NULL;
|
||||||
|
|
||||||
|
m_hNULHandle = CreateFileW( L"NUL",
|
||||||
|
FILE_WRITE_DATA,
|
||||||
|
FILE_SHARE_READ,
|
||||||
|
&saAttr,
|
||||||
|
CREATE_ALWAYS,
|
||||||
|
FILE_ATTRIBUTE_NORMAL,
|
||||||
|
NULL );
|
||||||
|
if( m_hNULHandle == INVALID_HANDLE_VALUE )
|
||||||
|
{
|
||||||
|
hr = HRESULT_FROM_GETLASTERROR();
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Finished:
|
||||||
|
|
||||||
|
if(fLocked)
|
||||||
|
{
|
||||||
|
ReleaseSRWLockExclusive( &m_srwLock );
|
||||||
|
}
|
||||||
|
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
PROCESS_MANAGER::~PROCESS_MANAGER()
|
||||||
|
{
|
||||||
|
AcquireSRWLockExclusive(&m_srwLock);
|
||||||
|
|
||||||
|
if( m_ppServerProcessList != NULL )
|
||||||
|
{
|
||||||
|
for( DWORD i = 0; i < m_dwProcessesPerApplication; ++i )
|
||||||
|
{
|
||||||
|
if( m_ppServerProcessList[i] != NULL )
|
||||||
|
{
|
||||||
|
m_ppServerProcessList[i]->DereferenceServerProcess();
|
||||||
|
m_ppServerProcessList[i] = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
delete[] m_ppServerProcessList;
|
||||||
|
m_ppServerProcessList = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( m_hNULHandle != NULL )
|
||||||
|
{
|
||||||
|
CloseHandle( m_hNULHandle );
|
||||||
|
m_hNULHandle = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( sm_fWSAStartupDone )
|
||||||
|
{
|
||||||
|
WSACleanup();
|
||||||
|
sm_fWSAStartupDone = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReleaseSRWLockExclusive(&m_srwLock);
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
PROCESS_MANAGER::GetProcess(
|
||||||
|
_In_ IHttpContext *context,
|
||||||
|
_In_ ASPNETCORE_CONFIG *pConfig,
|
||||||
|
_Out_ SERVER_PROCESS **ppServerProcess
|
||||||
|
)
|
||||||
|
{
|
||||||
|
HRESULT hr = S_OK;
|
||||||
|
BOOL fSharedLock = FALSE;
|
||||||
|
BOOL fExclusiveLock = FALSE;
|
||||||
|
PCWSTR apsz[1];
|
||||||
|
STACK_STRU( strEventMsg, 256 );
|
||||||
|
DWORD dwProcessIndex = 0;
|
||||||
|
SERVER_PROCESS **ppSelectedServerProcess = NULL;
|
||||||
|
|
||||||
|
if (!m_fServerProcessListReady)
|
||||||
|
{
|
||||||
|
AcquireSRWLockExclusive( &m_srwLock );
|
||||||
|
fExclusiveLock = TRUE;
|
||||||
|
|
||||||
|
if (!m_fServerProcessListReady)
|
||||||
|
{
|
||||||
|
m_dwProcessesPerApplication = pConfig->QueryProcessesPerApplication();
|
||||||
|
m_ppServerProcessList = new SERVER_PROCESS*[m_dwProcessesPerApplication];
|
||||||
|
if(m_ppServerProcessList == NULL)
|
||||||
|
{
|
||||||
|
hr = E_OUTOFMEMORY;
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(DWORD i=0;i<m_dwProcessesPerApplication;++i)
|
||||||
|
{
|
||||||
|
m_ppServerProcessList[i] = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m_fServerProcessListReady = TRUE;
|
||||||
|
ReleaseSRWLockExclusive( &m_srwLock );
|
||||||
|
fExclusiveLock = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
AcquireSRWLockShared( &m_srwLock );
|
||||||
|
fSharedLock = TRUE;
|
||||||
|
|
||||||
|
//
|
||||||
|
// round robin through to the next available process.
|
||||||
|
//
|
||||||
|
|
||||||
|
dwProcessIndex = (DWORD) InterlockedIncrement64( (LONGLONG*) &m_dwRouteToProcessIndex );
|
||||||
|
dwProcessIndex = dwProcessIndex % m_dwProcessesPerApplication;
|
||||||
|
ppSelectedServerProcess = &m_ppServerProcessList[dwProcessIndex];
|
||||||
|
|
||||||
|
if( *ppSelectedServerProcess != NULL &&
|
||||||
|
m_ppServerProcessList[dwProcessIndex]->IsReady() )
|
||||||
|
{
|
||||||
|
m_ppServerProcessList[dwProcessIndex]->ReferenceServerProcess();
|
||||||
|
*ppServerProcess = m_ppServerProcessList[dwProcessIndex];
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReleaseSRWLockShared( &m_srwLock );
|
||||||
|
fSharedLock = FALSE;
|
||||||
|
// should make the lock per process so that we can start processes simultaneously ?
|
||||||
|
|
||||||
|
if(m_ppServerProcessList[dwProcessIndex] == NULL || !m_ppServerProcessList[dwProcessIndex]->IsReady())
|
||||||
|
{
|
||||||
|
AcquireSRWLockExclusive( &m_srwLock );
|
||||||
|
fExclusiveLock = TRUE;
|
||||||
|
|
||||||
|
if( m_ppServerProcessList[dwProcessIndex] != NULL )
|
||||||
|
{
|
||||||
|
if( !m_ppServerProcessList[dwProcessIndex]->IsReady() )
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// terminate existing process that is not ready
|
||||||
|
// before creating new one.
|
||||||
|
//
|
||||||
|
|
||||||
|
ShutdownProcessNoLock( m_ppServerProcessList[dwProcessIndex] );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// server is already up and ready to serve requests.
|
||||||
|
m_ppServerProcessList[dwProcessIndex]->ReferenceServerProcess();
|
||||||
|
*ppServerProcess = m_ppServerProcessList[dwProcessIndex];
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( RapidFailsPerMinuteExceeded(pConfig->QueryRapidFailsPerMinute()) )
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// rapid fails per minute exceeded, do not create new process.
|
||||||
|
//
|
||||||
|
|
||||||
|
if( SUCCEEDED( strEventMsg.SafeSnwprintf(
|
||||||
|
ASPNETCORE_EVENT_RAPID_FAIL_COUNT_EXCEEDED_MSG,
|
||||||
|
pConfig->QueryRapidFailsPerMinute() ) ) )
|
||||||
|
{
|
||||||
|
apsz[0] = strEventMsg.QueryStr();
|
||||||
|
|
||||||
|
//
|
||||||
|
// not checking return code because if ReportEvent
|
||||||
|
// fails, we cannot do anything.
|
||||||
|
//
|
||||||
|
if (FORWARDING_HANDLER::QueryEventLog() != NULL)
|
||||||
|
{
|
||||||
|
ReportEventW(FORWARDING_HANDLER::QueryEventLog(),
|
||||||
|
EVENTLOG_INFORMATION_TYPE,
|
||||||
|
0,
|
||||||
|
ASPNETCORE_EVENT_RAPID_FAIL_COUNT_EXCEEDED,
|
||||||
|
NULL,
|
||||||
|
1,
|
||||||
|
0,
|
||||||
|
apsz,
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = HRESULT_FROM_WIN32(ERROR_SERVER_DISABLED);
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( m_ppServerProcessList[dwProcessIndex] == NULL )
|
||||||
|
{
|
||||||
|
m_ppServerProcessList[dwProcessIndex] = new SERVER_PROCESS();
|
||||||
|
if( m_ppServerProcessList[dwProcessIndex] == NULL )
|
||||||
|
{
|
||||||
|
hr = E_OUTOFMEMORY;
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = m_ppServerProcessList[dwProcessIndex]->Initialize(
|
||||||
|
this,
|
||||||
|
pConfig->QueryProcessPath(),
|
||||||
|
pConfig->QueryArguments(),
|
||||||
|
pConfig->QueryStartupTimeLimitInMS(),
|
||||||
|
pConfig->QueryShutdownTimeLimitInMS(),
|
||||||
|
pConfig->QueryWindowsAuthEnabled(),
|
||||||
|
pConfig->QueryBasicAuthEnabled(),
|
||||||
|
pConfig->QueryAnonymousAuthEnabled(),
|
||||||
|
pConfig->QueryEnvironmentVariables(),
|
||||||
|
pConfig->QueryStdoutLogEnabled(),
|
||||||
|
pConfig->QueryStdoutLogFile()
|
||||||
|
);
|
||||||
|
if( FAILED( hr ) )
|
||||||
|
{
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = m_ppServerProcessList[dwProcessIndex]->StartProcess(context);
|
||||||
|
if( FAILED( hr ) )
|
||||||
|
{
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !m_ppServerProcessList[dwProcessIndex]->IsReady() )
|
||||||
|
{
|
||||||
|
hr = HRESULT_FROM_WIN32( ERROR_CREATE_FAILED );
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_ppServerProcessList[dwProcessIndex]->ReferenceServerProcess();
|
||||||
|
*ppServerProcess = m_ppServerProcessList[dwProcessIndex];
|
||||||
|
}
|
||||||
|
|
||||||
|
Finished:
|
||||||
|
|
||||||
|
if( FAILED(hr) )
|
||||||
|
{
|
||||||
|
if(m_ppServerProcessList[dwProcessIndex] != NULL )
|
||||||
|
{
|
||||||
|
m_ppServerProcessList[dwProcessIndex]->DereferenceServerProcess();
|
||||||
|
m_ppServerProcessList[dwProcessIndex] = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( fSharedLock )
|
||||||
|
{
|
||||||
|
ReleaseSRWLockShared( &m_srwLock );
|
||||||
|
fSharedLock = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( fExclusiveLock )
|
||||||
|
{
|
||||||
|
ReleaseSRWLockExclusive( &m_srwLock );
|
||||||
|
fExclusiveLock = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,48 @@
|
||||||
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
#include "precomp.hxx"
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
PROTOCOL_CONFIG::Initialize()
|
||||||
|
{
|
||||||
|
HRESULT hr;
|
||||||
|
STRU strTemp;
|
||||||
|
|
||||||
|
m_fKeepAlive = TRUE;
|
||||||
|
m_msTimeout = 120000;
|
||||||
|
m_fPreserveHostHeader = TRUE;
|
||||||
|
m_fReverseRewriteHeaders = FALSE;
|
||||||
|
|
||||||
|
if (FAILED(hr = m_strXForwardedForName.CopyW(L"X-Forwarded-For")))
|
||||||
|
{
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (FAILED(hr = m_strSslHeaderName.CopyW(L"X-Forwarded-Proto")))
|
||||||
|
{
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (FAILED(hr = m_strClientCertName.CopyW(L"MS-ASPNETCORE-CLIENTCERT")))
|
||||||
|
{
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_fIncludePortInXForwardedFor = TRUE;
|
||||||
|
m_dwMinResponseBuffer = 0; // no response buffering
|
||||||
|
m_dwResponseBufferLimit = 4096*1024;
|
||||||
|
m_dwMaxResponseHeaderSize = 65536;
|
||||||
|
|
||||||
|
Finished:
|
||||||
|
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
PROTOCOL_CONFIG::OverrideConfig(
|
||||||
|
ASPNETCORE_CONFIG *pAspNetCoreConfig
|
||||||
|
)
|
||||||
|
{
|
||||||
|
m_msTimeout = pAspNetCoreConfig->QueryRequestTimeoutInMS();
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,114 @@
|
||||||
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
#include "precomp.hxx"
|
||||||
|
|
||||||
|
|
||||||
|
__override
|
||||||
|
HRESULT
|
||||||
|
CProxyModuleFactory::GetHttpModule(
|
||||||
|
CHttpModule ** ppModule,
|
||||||
|
IModuleAllocator * pAllocator
|
||||||
|
)
|
||||||
|
{
|
||||||
|
CProxyModule *pModule = new (pAllocator) CProxyModule();
|
||||||
|
if (pModule == NULL)
|
||||||
|
{
|
||||||
|
return E_OUTOFMEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
|
*ppModule = pModule;
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
__override
|
||||||
|
VOID
|
||||||
|
CProxyModuleFactory::Terminate(
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
/*++
|
||||||
|
|
||||||
|
Routine description:
|
||||||
|
|
||||||
|
Function called by IIS for global (non-request-specific) notifications
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
|
||||||
|
None.
|
||||||
|
|
||||||
|
Return value:
|
||||||
|
|
||||||
|
None
|
||||||
|
|
||||||
|
--*/
|
||||||
|
{
|
||||||
|
FORWARDING_HANDLER::StaticTerminate();
|
||||||
|
|
||||||
|
WEBSOCKET_HANDLER::StaticTerminate();
|
||||||
|
|
||||||
|
if (g_pResponseHeaderHash != NULL)
|
||||||
|
{
|
||||||
|
g_pResponseHeaderHash->Clear();
|
||||||
|
delete g_pResponseHeaderHash;
|
||||||
|
g_pResponseHeaderHash = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
ALLOC_CACHE_HANDLER::StaticTerminate();
|
||||||
|
|
||||||
|
delete this;
|
||||||
|
}
|
||||||
|
|
||||||
|
CProxyModule::CProxyModule(
|
||||||
|
) : m_pHandler(NULL)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
CProxyModule::~CProxyModule()
|
||||||
|
{
|
||||||
|
if (m_pHandler != NULL)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// This will be called when the main notification is cleaned up
|
||||||
|
// i.e., the request is done with IIS pipeline
|
||||||
|
//
|
||||||
|
m_pHandler->DereferenceForwardingHandler();
|
||||||
|
m_pHandler = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
__override
|
||||||
|
REQUEST_NOTIFICATION_STATUS
|
||||||
|
CProxyModule::OnExecuteRequestHandler(
|
||||||
|
IHttpContext * pHttpContext,
|
||||||
|
IHttpEventProvider *
|
||||||
|
)
|
||||||
|
{
|
||||||
|
m_pHandler = new FORWARDING_HANDLER(pHttpContext);
|
||||||
|
if (m_pHandler == NULL)
|
||||||
|
{
|
||||||
|
pHttpContext->GetResponse()->SetStatus(500, "Internal Server Error", 0, E_OUTOFMEMORY);
|
||||||
|
return RQ_NOTIFICATION_FINISH_REQUEST;
|
||||||
|
}
|
||||||
|
|
||||||
|
return m_pHandler->OnExecuteRequestHandler();
|
||||||
|
}
|
||||||
|
|
||||||
|
__override
|
||||||
|
REQUEST_NOTIFICATION_STATUS
|
||||||
|
CProxyModule::OnAsyncCompletion(
|
||||||
|
IHttpContext *,
|
||||||
|
DWORD dwNotification,
|
||||||
|
BOOL fPostNotification,
|
||||||
|
IHttpEventProvider *,
|
||||||
|
IHttpCompletionInfo * pCompletionInfo
|
||||||
|
)
|
||||||
|
{
|
||||||
|
UNREFERENCED_PARAMETER(dwNotification);
|
||||||
|
UNREFERENCED_PARAMETER(fPostNotification);
|
||||||
|
DBG_ASSERT(dwNotification == RQ_EXECUTE_REQUEST_HANDLER);
|
||||||
|
DBG_ASSERT(fPostNotification == FALSE);
|
||||||
|
|
||||||
|
return m_pHandler->OnAsyncCompletion(
|
||||||
|
pCompletionInfo->GetCompletionBytes(),
|
||||||
|
pCompletionInfo->GetCompletionStatus());
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,100 @@
|
||||||
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
#include "precomp.hxx"
|
||||||
|
|
||||||
|
RESPONSE_HEADER_HASH * g_pResponseHeaderHash = NULL;
|
||||||
|
|
||||||
|
HEADER_RECORD RESPONSE_HEADER_HASH::sm_rgHeaders[] =
|
||||||
|
{
|
||||||
|
{ "Cache-Control", HttpHeaderCacheControl },
|
||||||
|
{ "Connection", HttpHeaderConnection },
|
||||||
|
{ "Date", HttpHeaderDate },
|
||||||
|
{ "Keep-Alive", HttpHeaderKeepAlive },
|
||||||
|
{ "Pragma", HttpHeaderPragma },
|
||||||
|
{ "Trailer", HttpHeaderTrailer },
|
||||||
|
{ "Transfer-Encoding", HttpHeaderTransferEncoding },
|
||||||
|
{ "Upgrade", HttpHeaderUpgrade },
|
||||||
|
{ "Via", HttpHeaderVia },
|
||||||
|
{ "Warning", HttpHeaderWarning },
|
||||||
|
{ "Allow", HttpHeaderAllow },
|
||||||
|
{ "Content-Length", HttpHeaderContentLength },
|
||||||
|
{ "Content-Type", HttpHeaderContentType },
|
||||||
|
{ "Content-Encoding", HttpHeaderContentEncoding },
|
||||||
|
{ "Content-Language", HttpHeaderContentLanguage },
|
||||||
|
{ "Content-Location", HttpHeaderContentLocation },
|
||||||
|
{ "Content-MD5", HttpHeaderContentMd5 },
|
||||||
|
{ "Content-Range", HttpHeaderContentRange },
|
||||||
|
{ "Expires", HttpHeaderExpires },
|
||||||
|
{ "Last-Modified", HttpHeaderLastModified },
|
||||||
|
{ "Accept-Ranges", HttpHeaderAcceptRanges },
|
||||||
|
{ "Age", HttpHeaderAge },
|
||||||
|
{ "ETag", HttpHeaderEtag },
|
||||||
|
{ "Location", HttpHeaderLocation },
|
||||||
|
{ "Proxy-Authenticate", HttpHeaderProxyAuthenticate },
|
||||||
|
{ "Retry-After", HttpHeaderRetryAfter },
|
||||||
|
{ "Server", HttpHeaderServer },
|
||||||
|
// Set it to something which cannot be a header name, in effect
|
||||||
|
// making Server an unknown header. w:w is used to avoid collision with Keep-Alive.
|
||||||
|
{ "w:w\r\n", HttpHeaderServer },
|
||||||
|
// Set it to something which cannot be a header name, in effect
|
||||||
|
// making Set-Cookie an unknown header
|
||||||
|
{ "y:y\r\n", HttpHeaderSetCookie },
|
||||||
|
{ "Vary", HttpHeaderVary },
|
||||||
|
// Set it to something which cannot be a header name, in effect
|
||||||
|
// making WWW-Authenticate an unknown header
|
||||||
|
{ "z:z\r\n", HttpHeaderWwwAuthenticate }
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
RESPONSE_HEADER_HASH::Initialize(
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
/*++
|
||||||
|
|
||||||
|
Routine Description:
|
||||||
|
|
||||||
|
Initialize global header hash table
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
|
||||||
|
None
|
||||||
|
|
||||||
|
Return Value:
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
|
||||||
|
--*/
|
||||||
|
{
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
|
//
|
||||||
|
// 31 response headers.
|
||||||
|
// Make sure to update the number of buckets it new headers
|
||||||
|
// are added. Test it to avoid collisions.
|
||||||
|
//
|
||||||
|
C_ASSERT(_countof(sm_rgHeaders) == 31);
|
||||||
|
|
||||||
|
//
|
||||||
|
// 79 buckets will have less collisions for the 31 response headers.
|
||||||
|
// Known collisions are "Age" colliding with "Expire" and "Location"
|
||||||
|
// colliding with both "Expire" and "Age".
|
||||||
|
//
|
||||||
|
hr = HASH_TABLE::Initialize(79);
|
||||||
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
for ( DWORD Index = 0; Index < _countof(sm_rgHeaders); ++Index )
|
||||||
|
{
|
||||||
|
if (FAILED(hr = InsertRecord(&sm_rgHeaders[Index])))
|
||||||
|
{
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,176 @@
|
||||||
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
#include "precomp.hxx"
|
||||||
|
|
||||||
|
PFN_WINHTTP_WEBSOCKET_COMPLETE_UPGRADE
|
||||||
|
WINHTTP_HELPER::sm_pfnWinHttpWebSocketCompleteUpgrade;
|
||||||
|
|
||||||
|
PFN_WINHTTP_WEBSOCKET_SEND
|
||||||
|
WINHTTP_HELPER::sm_pfnWinHttpWebSocketSend;
|
||||||
|
|
||||||
|
PFN_WINHTTP_WEBSOCKET_RECEIVE
|
||||||
|
WINHTTP_HELPER::sm_pfnWinHttpWebSocketReceive;
|
||||||
|
|
||||||
|
PFN_WINHTTP_WEBSOCKET_SHUTDOWN
|
||||||
|
WINHTTP_HELPER::sm_pfnWinHttpWebSocketShutdown;
|
||||||
|
|
||||||
|
PFN_WINHTTP_WEBSOCKET_QUERY_CLOSE_STATUS
|
||||||
|
WINHTTP_HELPER::sm_pfnWinHttpWebSocketQueryCloseStatus;
|
||||||
|
|
||||||
|
//static
|
||||||
|
HRESULT
|
||||||
|
WINHTTP_HELPER::StaticInitialize(
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
HRESULT hr = S_OK;
|
||||||
|
|
||||||
|
if (!g_fWebSocketSupported)
|
||||||
|
{
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Initialize the function pointers for WinHttp Websocket API's.
|
||||||
|
//
|
||||||
|
|
||||||
|
HMODULE hWinHttp = GetModuleHandleA("winhttp.dll");
|
||||||
|
if (hWinHttp == NULL)
|
||||||
|
{
|
||||||
|
hr = HRESULT_FROM_WIN32(GetLastError());
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
sm_pfnWinHttpWebSocketCompleteUpgrade = (PFN_WINHTTP_WEBSOCKET_COMPLETE_UPGRADE)
|
||||||
|
GetProcAddress(hWinHttp, "WinHttpWebSocketCompleteUpgrade");
|
||||||
|
if (sm_pfnWinHttpWebSocketCompleteUpgrade == NULL)
|
||||||
|
{
|
||||||
|
hr = HRESULT_FROM_WIN32(GetLastError());
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
sm_pfnWinHttpWebSocketQueryCloseStatus = (PFN_WINHTTP_WEBSOCKET_QUERY_CLOSE_STATUS)
|
||||||
|
GetProcAddress(hWinHttp, "WinHttpWebSocketQueryCloseStatus");
|
||||||
|
if (sm_pfnWinHttpWebSocketQueryCloseStatus == NULL)
|
||||||
|
{
|
||||||
|
hr = HRESULT_FROM_WIN32(GetLastError());
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
sm_pfnWinHttpWebSocketReceive = (PFN_WINHTTP_WEBSOCKET_RECEIVE)
|
||||||
|
GetProcAddress(hWinHttp, "WinHttpWebSocketReceive");
|
||||||
|
if (sm_pfnWinHttpWebSocketReceive == NULL)
|
||||||
|
{
|
||||||
|
hr = HRESULT_FROM_WIN32(GetLastError());
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
sm_pfnWinHttpWebSocketSend = (PFN_WINHTTP_WEBSOCKET_SEND)
|
||||||
|
GetProcAddress(hWinHttp, "WinHttpWebSocketSend");
|
||||||
|
if (sm_pfnWinHttpWebSocketSend == NULL)
|
||||||
|
{
|
||||||
|
hr = HRESULT_FROM_WIN32(GetLastError());
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
sm_pfnWinHttpWebSocketShutdown = (PFN_WINHTTP_WEBSOCKET_SHUTDOWN)
|
||||||
|
GetProcAddress(hWinHttp, "WinHttpWebSocketShutdown");
|
||||||
|
if (sm_pfnWinHttpWebSocketShutdown == NULL)
|
||||||
|
{
|
||||||
|
hr = HRESULT_FROM_WIN32(GetLastError());
|
||||||
|
goto Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
Finished:
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//static
|
||||||
|
VOID
|
||||||
|
WINHTTP_HELPER::GetFlagsFromBufferType(
|
||||||
|
__in WINHTTP_WEB_SOCKET_BUFFER_TYPE BufferType,
|
||||||
|
__out BOOL * pfUtf8Encoded,
|
||||||
|
__out BOOL * pfFinalFragment,
|
||||||
|
__out BOOL * pfClose
|
||||||
|
)
|
||||||
|
{
|
||||||
|
switch (BufferType)
|
||||||
|
{
|
||||||
|
case WINHTTP_WEB_SOCKET_BINARY_MESSAGE_BUFFER_TYPE:
|
||||||
|
*pfUtf8Encoded = FALSE;
|
||||||
|
*pfFinalFragment = TRUE;
|
||||||
|
*pfClose = FALSE;
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WINHTTP_WEB_SOCKET_BINARY_FRAGMENT_BUFFER_TYPE:
|
||||||
|
*pfUtf8Encoded = FALSE;
|
||||||
|
*pfFinalFragment = FALSE;
|
||||||
|
*pfClose = FALSE;
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WINHTTP_WEB_SOCKET_UTF8_MESSAGE_BUFFER_TYPE:
|
||||||
|
*pfUtf8Encoded = TRUE;
|
||||||
|
*pfFinalFragment = TRUE;
|
||||||
|
*pfClose = FALSE;
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WINHTTP_WEB_SOCKET_UTF8_FRAGMENT_BUFFER_TYPE:
|
||||||
|
*pfUtf8Encoded = TRUE;
|
||||||
|
*pfFinalFragment = FALSE;
|
||||||
|
*pfClose = FALSE;
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WINHTTP_WEB_SOCKET_CLOSE_BUFFER_TYPE:
|
||||||
|
*pfUtf8Encoded = FALSE;
|
||||||
|
*pfFinalFragment = FALSE;
|
||||||
|
*pfClose = TRUE;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//static
|
||||||
|
VOID
|
||||||
|
WINHTTP_HELPER::GetBufferTypeFromFlags(
|
||||||
|
__in BOOL fUtf8Encoded,
|
||||||
|
__in BOOL fFinalFragment,
|
||||||
|
__in BOOL fClose,
|
||||||
|
__out WINHTTP_WEB_SOCKET_BUFFER_TYPE* pBufferType
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (fClose)
|
||||||
|
{
|
||||||
|
*pBufferType = WINHTTP_WEB_SOCKET_CLOSE_BUFFER_TYPE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (fUtf8Encoded)
|
||||||
|
{
|
||||||
|
if (fFinalFragment)
|
||||||
|
{
|
||||||
|
*pBufferType = WINHTTP_WEB_SOCKET_UTF8_MESSAGE_BUFFER_TYPE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*pBufferType = WINHTTP_WEB_SOCKET_UTF8_FRAGMENT_BUFFER_TYPE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (fFinalFragment)
|
||||||
|
{
|
||||||
|
*pBufferType = WINHTTP_WEB_SOCKET_BINARY_MESSAGE_BUFFER_TYPE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*pBufferType = WINHTTP_WEB_SOCKET_BINARY_FRAGMENT_BUFFER_TYPE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
<Keyword>Win32Proj</Keyword>
|
<Keyword>Win32Proj</Keyword>
|
||||||
<RootNamespace>IISLib</RootNamespace>
|
<RootNamespace>IISLib</RootNamespace>
|
||||||
<ProjectName>IISLib</ProjectName>
|
<ProjectName>IISLib</ProjectName>
|
||||||
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
|
<WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
|
@ -68,7 +68,18 @@
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<PropertyGroup Label="UserMacros" />
|
<PropertyGroup Label="UserMacros" />
|
||||||
<PropertyGroup />
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<OutDir>$(MSBuildProjectDirectory)\bin\$(Configuration)\$(Platform)\</OutDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<OutDir>$(MSBuildProjectDirectory)\bin\$(Configuration)\$(Platform)\</OutDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<OutDir>$(MSBuildProjectDirectory)\bin\$(Configuration)\$(Platform)\</OutDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<OutDir>$(MSBuildProjectDirectory)\bin\$(Configuration)\$(Platform)\</OutDir>
|
||||||
|
</PropertyGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<PrecompiledHeader>
|
<PrecompiledHeader>
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<Import Project="..\..\Build\Build.Settings" />
|
<Import Project="..\..\..\Build\Build.Settings" />
|
||||||
<ItemGroup Label="ProjectConfigurations">
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
<ProjectConfiguration Include="Debug|Win32">
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
<Configuration>Debug</Configuration>
|
<Configuration>Debug</Configuration>
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<PropertyGroup Label="Globals">
|
<PropertyGroup Label="Globals">
|
||||||
<ProjectGuid>{439824F9-1455-4CC4-BD79-B44FA0A16552}</ProjectGuid>
|
<ProjectGuid>{EC82302F-D2F0-4727-99D1-EABC0DD9DC3B}</ProjectGuid>
|
||||||
<Keyword>Win32Proj</Keyword>
|
<Keyword>Win32Proj</Keyword>
|
||||||
<RootNamespace>AspNetCoreModule</RootNamespace>
|
<RootNamespace>AspNetCoreModule</RootNamespace>
|
||||||
<ProjectName>AspNetCore</ProjectName>
|
<ProjectName>AspNetCore</ProjectName>
|
||||||
|
|
@ -232,8 +232,7 @@
|
||||||
<Project>{55494e58-e061-4c4c-a0a8-837008e72f85}</Project>
|
<Project>{55494e58-e061-4c4c-a0a8-837008e72f85}</Project>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\IISLib\IISLib.vcxproj">
|
<ProjectReference Include="..\IISLib\IISLib.vcxproj">
|
||||||
<Project>{4787a64f-9a3e-4867-a55a-70cb4b2b2ffe}</Project>
|
<Project>{09d9d1d6-2951-4e14-bc35-76a23cf9391a}</Project>
|
||||||
<LinkLibraryDependencies>false</LinkLibraryDependencies>
|
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
@ -254,7 +253,7 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Xml Include="aspnetcore_schema.xml" />
|
<Xml Include="aspnetcore_schema.xml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="..\..\build\native.targets" />
|
<Import Project="..\..\..\build\native.targets" />
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<ImportGroup Label="ExtensionTargets">
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
LIBRARY aspnetcore
|
||||||
|
|
||||||
|
EXPORTS
|
||||||
|
RegisterModule
|
||||||
|
|
@ -112,10 +112,15 @@ APPLICATION_INFO::UpdateAppOfflineFileHandle()
|
||||||
// if it was, log that app_offline has been dropped.
|
// if it was, log that app_offline has been dropped.
|
||||||
if (m_fAppOfflineFound)
|
if (m_fAppOfflineFound)
|
||||||
{
|
{
|
||||||
UTILITY::LogEvent(g_hEventLog,
|
STACK_STRU(strEventMsg, 256);
|
||||||
EVENTLOG_INFORMATION_TYPE,
|
if (SUCCEEDED(strEventMsg.SafeSnwprintf(
|
||||||
ASPNETCORE_EVENT_RECYCLE_APPOFFLINE_REMOVED,
|
ASPNETCORE_EVENT_RECYCLE_APPOFFLINE_REMOVED_MSG)))
|
||||||
ASPNETCORE_EVENT_RECYCLE_APPOFFLINE_REMOVED_MSG);
|
{
|
||||||
|
UTILITY::LogEvent(g_hEventLog,
|
||||||
|
EVENTLOG_INFORMATION_TYPE,
|
||||||
|
ASPNETCORE_EVENT_RECYCLE_APPOFFLINE_REMOVED,
|
||||||
|
strEventMsg.QueryStr());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_fAppOfflineFound = FALSE;
|
m_fAppOfflineFound = FALSE;
|
||||||
|
|
@ -152,11 +157,16 @@ APPLICATION_INFO::UpdateAppOfflineFileHandle()
|
||||||
// recycle the application
|
// recycle the application
|
||||||
if (m_pApplication != NULL)
|
if (m_pApplication != NULL)
|
||||||
{
|
{
|
||||||
UTILITY::LogEventF(g_hEventLog,
|
STACK_STRU(strEventMsg, 256);
|
||||||
EVENTLOG_INFORMATION_TYPE,
|
if (SUCCEEDED(strEventMsg.SafeSnwprintf(
|
||||||
ASPNETCORE_EVENT_RECYCLE_APPOFFLINE,
|
|
||||||
ASPNETCORE_EVENT_RECYCLE_APPOFFLINE_MSG,
|
ASPNETCORE_EVENT_RECYCLE_APPOFFLINE_MSG,
|
||||||
m_pApplication->QueryConfig()->QueryApplicationPath()->QueryStr());
|
m_pApplication->QueryConfig()->QueryApplicationPath()->QueryStr())))
|
||||||
|
{
|
||||||
|
UTILITY::LogEvent(g_hEventLog,
|
||||||
|
EVENTLOG_INFORMATION_TYPE,
|
||||||
|
ASPNETCORE_EVENT_RECYCLE_APPOFFLINE,
|
||||||
|
strEventMsg.QueryStr());
|
||||||
|
}
|
||||||
|
|
||||||
RecycleApplication();
|
RecycleApplication();
|
||||||
}
|
}
|
||||||
|
|
@ -258,20 +268,32 @@ APPLICATION_INFO::FindRequestHandlerAssembly()
|
||||||
{
|
{
|
||||||
if (FAILED(hr = FindNativeAssemblyFromHostfxr(&struFileName)))
|
if (FAILED(hr = FindNativeAssemblyFromHostfxr(&struFileName)))
|
||||||
{
|
{
|
||||||
UTILITY::LogEvent(g_hEventLog,
|
STACK_STRU(strEventMsg, 256);
|
||||||
|
if (SUCCEEDED(strEventMsg.SafeSnwprintf(
|
||||||
|
ASPNETCORE_EVENT_INPROCESS_RH_MISSING_MSG)))
|
||||||
|
{
|
||||||
|
UTILITY::LogEvent(g_hEventLog,
|
||||||
EVENTLOG_INFORMATION_TYPE,
|
EVENTLOG_INFORMATION_TYPE,
|
||||||
ASPNETCORE_EVENT_INPROCESS_RH_MISSING,
|
ASPNETCORE_EVENT_INPROCESS_RH_MISSING,
|
||||||
ASPNETCORE_EVENT_INPROCESS_RH_MISSING_MSG);
|
strEventMsg.QueryStr());
|
||||||
|
}
|
||||||
|
|
||||||
|
goto Finished;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (FAILED(hr = FindNativeAssemblyFromGlobalLocation(&struFileName)))
|
if (FAILED(hr = FindNativeAssemblyFromGlobalLocation(&struFileName)))
|
||||||
{
|
{
|
||||||
UTILITY::LogEvent(g_hEventLog,
|
STACK_STRU(strEventMsg, 256);
|
||||||
EVENTLOG_INFORMATION_TYPE,
|
if (SUCCEEDED(strEventMsg.SafeSnwprintf(
|
||||||
ASPNETCORE_EVENT_OUT_OF_PROCESS_RH_MISSING,
|
ASPNETCORE_EVENT_OUT_OF_PROCESS_RH_MISSING_MSG)))
|
||||||
ASPNETCORE_EVENT_OUT_OF_PROCESS_RH_MISSING_MSG);
|
{
|
||||||
|
UTILITY::LogEvent(g_hEventLog,
|
||||||
|
EVENTLOG_INFORMATION_TYPE,
|
||||||
|
ASPNETCORE_EVENT_OUT_OF_PROCESS_RH_MISSING,
|
||||||
|
strEventMsg.QueryStr());
|
||||||
|
}
|
||||||
|
|
||||||
goto Finished;
|
goto Finished;
|
||||||
}
|
}
|
||||||
|
|
@ -24,6 +24,7 @@ APPLICATION_MANAGER::GetOrCreateApplicationInfo(
|
||||||
BOOL fMixedHostingModelError = FALSE;
|
BOOL fMixedHostingModelError = FALSE;
|
||||||
BOOL fDuplicatedInProcessApp = FALSE;
|
BOOL fDuplicatedInProcessApp = FALSE;
|
||||||
PCWSTR pszApplicationId = NULL;
|
PCWSTR pszApplicationId = NULL;
|
||||||
|
STACK_STRU ( strEventMsg, 256 );
|
||||||
|
|
||||||
DBG_ASSERT(pServer);
|
DBG_ASSERT(pServer);
|
||||||
DBG_ASSERT(pConfig);
|
DBG_ASSERT(pConfig);
|
||||||
|
|
@ -159,29 +160,41 @@ Finished:
|
||||||
{
|
{
|
||||||
if (fDuplicatedInProcessApp)
|
if (fDuplicatedInProcessApp)
|
||||||
{
|
{
|
||||||
UTILITY::LogEventF(g_hEventLog,
|
if (SUCCEEDED(strEventMsg.SafeSnwprintf(
|
||||||
EVENTLOG_ERROR_TYPE,
|
|
||||||
ASPNETCORE_EVENT_DUPLICATED_INPROCESS_APP,
|
|
||||||
ASPNETCORE_EVENT_DUPLICATED_INPROCESS_APP_MSG,
|
ASPNETCORE_EVENT_DUPLICATED_INPROCESS_APP_MSG,
|
||||||
pszApplicationId);
|
pszApplicationId)))
|
||||||
|
{
|
||||||
|
UTILITY::LogEvent(g_hEventLog,
|
||||||
|
EVENTLOG_ERROR_TYPE,
|
||||||
|
ASPNETCORE_EVENT_DUPLICATED_INPROCESS_APP,
|
||||||
|
strEventMsg.QueryStr());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (fMixedHostingModelError)
|
else if (fMixedHostingModelError)
|
||||||
{
|
{
|
||||||
UTILITY::LogEventF(g_hEventLog,
|
if (SUCCEEDED(strEventMsg.SafeSnwprintf(
|
||||||
EVENTLOG_ERROR_TYPE,
|
|
||||||
ASPNETCORE_EVENT_MIXED_HOSTING_MODEL_ERROR,
|
|
||||||
ASPNETCORE_EVENT_MIXED_HOSTING_MODEL_ERROR_MSG,
|
ASPNETCORE_EVENT_MIXED_HOSTING_MODEL_ERROR_MSG,
|
||||||
pszApplicationId,
|
pszApplicationId,
|
||||||
pConfig->QueryHostingModel());
|
pConfig->QueryHostingModel())))
|
||||||
|
{
|
||||||
|
UTILITY::LogEvent(g_hEventLog,
|
||||||
|
EVENTLOG_ERROR_TYPE,
|
||||||
|
ASPNETCORE_EVENT_MIXED_HOSTING_MODEL_ERROR,
|
||||||
|
strEventMsg.QueryStr());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UTILITY::LogEventF(g_hEventLog,
|
if (SUCCEEDED(strEventMsg.SafeSnwprintf(
|
||||||
EVENTLOG_ERROR_TYPE,
|
|
||||||
ASPNETCORE_EVENT_ADD_APPLICATION_ERROR,
|
|
||||||
ASPNETCORE_EVENT_ADD_APPLICATION_ERROR_MSG,
|
ASPNETCORE_EVENT_ADD_APPLICATION_ERROR_MSG,
|
||||||
pszApplicationId,
|
pszApplicationId,
|
||||||
hr);
|
hr)))
|
||||||
|
{
|
||||||
|
UTILITY::LogEvent(g_hEventLog,
|
||||||
|
EVENTLOG_ERROR_TYPE,
|
||||||
|
ASPNETCORE_EVENT_ADD_APPLICATION_ERROR,
|
||||||
|
strEventMsg.QueryStr());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -336,11 +349,16 @@ APPLICATION_MANAGER::RecycleApplicationFromManager(
|
||||||
APPLICATION_INFO* pRecord;
|
APPLICATION_INFO* pRecord;
|
||||||
|
|
||||||
// Application got recycled. Log an event
|
// Application got recycled. Log an event
|
||||||
UTILITY::LogEventF(g_hEventLog,
|
STACK_STRU(strEventMsg, 256);
|
||||||
EVENTLOG_INFORMATION_TYPE,
|
if (SUCCEEDED(strEventMsg.SafeSnwprintf(
|
||||||
ASPNETCORE_EVENT_RECYCLE_CONFIGURATION,
|
|
||||||
ASPNETCORE_EVENT_RECYCLE_CONFIGURATION_MSG,
|
ASPNETCORE_EVENT_RECYCLE_CONFIGURATION_MSG,
|
||||||
path);
|
path)))
|
||||||
|
{
|
||||||
|
UTILITY::LogEvent(g_hEventLog,
|
||||||
|
EVENTLOG_INFORMATION_TYPE,
|
||||||
|
ASPNETCORE_EVENT_RECYCLE_CONFIGURATION,
|
||||||
|
strEventMsg.QueryStr());
|
||||||
|
}
|
||||||
|
|
||||||
hr = key.Initialize(path);
|
hr = key.Initialize(path);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
|
|
@ -368,11 +386,16 @@ Finished:
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
// Failed to recycle an application. Log an event
|
// Failed to recycle an application. Log an event
|
||||||
UTILITY::LogEventF(g_hEventLog,
|
STACK_STRU(strEventMsg, 256);
|
||||||
EVENTLOG_ERROR_TYPE,
|
if (SUCCEEDED(strEventMsg.SafeSnwprintf(
|
||||||
ASPNETCORE_EVENT_RECYCLE_APP_FAILURE,
|
ASPNETCORE_EVENT_RECYCLE_FAILURE_CONFIGURATION_MSG,
|
||||||
ASPNETCORE_EVENT_RECYCLE_FAILURE_CONFIGURATION_MSG,
|
pszApplicationId)))
|
||||||
pszApplicationId);
|
{
|
||||||
|
UTILITY::LogEvent(g_hEventLog,
|
||||||
|
EVENTLOG_ERROR_TYPE,
|
||||||
|
ASPNETCORE_EVENT_RECYCLE_APP_FAILURE,
|
||||||
|
strEventMsg.QueryStr());
|
||||||
|
}
|
||||||
// Need to recycle the process as we cannot recycle the application
|
// Need to recycle the process as we cannot recycle the application
|
||||||
if (!g_fRecycleProcessCalled)
|
if (!g_fRecycleProcessCalled)
|
||||||
{
|
{
|
||||||
|
|
@ -160,10 +160,16 @@ HRESULT
|
||||||
|
|
||||||
if (fDisableANCM)
|
if (fDisableANCM)
|
||||||
{
|
{
|
||||||
UTILITY::LogEvent(g_hEventLog,
|
// Logging
|
||||||
EVENTLOG_WARNING_TYPE,
|
STACK_STRU(strEventMsg, 256);
|
||||||
ASPNETCORE_EVENT_MODULE_DISABLED,
|
if (SUCCEEDED(strEventMsg.SafeSnwprintf(
|
||||||
ASPNETCORE_EVENT_MODULE_DISABLED_MSG);
|
ASPNETCORE_EVENT_MODULE_DISABLED_MSG)))
|
||||||
|
{
|
||||||
|
UTILITY::LogEvent(g_hEventLog,
|
||||||
|
EVENTLOG_WARNING_TYPE,
|
||||||
|
ASPNETCORE_EVENT_MODULE_DISABLED,
|
||||||
|
strEventMsg.QueryStr());
|
||||||
|
}
|
||||||
// this will return 500 error to client
|
// this will return 500 error to client
|
||||||
// as we did not register the module
|
// as we did not register the module
|
||||||
goto Finished;
|
goto Finished;
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue