Make exchange classes pure virtual (#792)
Make exchange classes pure virtual
This commit is contained in:
parent
e36b0982bf
commit
e49b0a34ab
|
|
@ -48,6 +48,7 @@ x64/
|
|||
*.pdb
|
||||
*.lib
|
||||
*.idb
|
||||
*.TMP
|
||||
|
||||
src/*/AspNetCore/aspnetcoremodule.h
|
||||
src/*/AspNetCore/aspnetcore_msg.h
|
||||
|
|
|
|||
|
|
@ -11,17 +11,9 @@ HRESULT
|
|||
(WINAPI * PFN_ASPNETCORE_CREATE_APPLICATION)(
|
||||
_In_ IHttpServer *pServer,
|
||||
_In_ ASPNETCORE_CONFIG *pConfig,
|
||||
_Out_ APPLICATION **pApplication
|
||||
_Out_ IAPPLICATION **pApplication
|
||||
);
|
||||
|
||||
typedef
|
||||
HRESULT
|
||||
(WINAPI * PFN_ASPNETCORE_CREATE_REQUEST_HANDLER)(
|
||||
_In_ IHttpContext *pHttpContext,
|
||||
_In_ HTTP_MODULE_ID *pModuleId,
|
||||
_In_ APPLICATION *pApplication,
|
||||
_Out_ REQUEST_HANDLER **pRequestHandler
|
||||
);
|
||||
//
|
||||
// The key used for hash-table lookups, consists of the port on which the http process is created.
|
||||
//
|
||||
|
|
@ -71,8 +63,7 @@ public:
|
|||
m_cRefs(1), m_fAppOfflineFound(FALSE),
|
||||
m_pAppOfflineHtm(NULL), m_pFileWatcherEntry(NULL),
|
||||
m_pConfiguration(NULL),
|
||||
m_pfnAspNetCoreCreateApplication(NULL),
|
||||
m_pfnAspNetCoreCreateRequestHandler(NULL)
|
||||
m_pfnAspNetCoreCreateApplication(NULL)
|
||||
{
|
||||
InitializeSRWLock(&m_srwLock);
|
||||
}
|
||||
|
|
@ -136,7 +127,7 @@ public:
|
|||
// Otherwise memory leak
|
||||
//
|
||||
VOID
|
||||
ExtractApplication(APPLICATION** ppApplication)
|
||||
ExtractApplication(IAPPLICATION** ppApplication)
|
||||
{
|
||||
AcquireSRWLockShared(&m_srwLock);
|
||||
if (m_pApplication != NULL)
|
||||
|
|
@ -156,12 +147,6 @@ public:
|
|||
HRESULT
|
||||
EnsureApplicationCreated();
|
||||
|
||||
PFN_ASPNETCORE_CREATE_REQUEST_HANDLER
|
||||
QueryCreateRequestHandler()
|
||||
{
|
||||
return m_pfnAspNetCoreCreateRequestHandler;
|
||||
}
|
||||
|
||||
private:
|
||||
HRESULT FindRequestHandlerAssembly();
|
||||
HRESULT FindNativeAssemblyFromGlobalLocation(STRU* struFilename);
|
||||
|
|
@ -175,11 +160,10 @@ private:
|
|||
APP_OFFLINE_HTM *m_pAppOfflineHtm;
|
||||
FILE_WATCHER_ENTRY *m_pFileWatcherEntry;
|
||||
ASPNETCORE_CONFIG *m_pConfiguration;
|
||||
APPLICATION *m_pApplication;
|
||||
IAPPLICATION *m_pApplication;
|
||||
SRWLOCK m_srwLock;
|
||||
IHttpServer *m_pServer;
|
||||
PFN_ASPNETCORE_CREATE_APPLICATION m_pfnAspNetCoreCreateApplication;
|
||||
PFN_ASPNETCORE_CREATE_REQUEST_HANDLER m_pfnAspNetCoreCreateRequestHandler;
|
||||
};
|
||||
|
||||
class APPLICATION_INFO_HASH :
|
||||
|
|
|
|||
|
|
@ -46,8 +46,8 @@ class ASPNET_CORE_PROXY_MODULE : public CHttpModule
|
|||
private:
|
||||
|
||||
APPLICATION_INFO *m_pApplicationInfo;
|
||||
APPLICATION *m_pApplication;
|
||||
REQUEST_HANDLER *m_pHandler;
|
||||
IAPPLICATION *m_pApplication;
|
||||
IREQUEST_HANDLER *m_pHandler;
|
||||
};
|
||||
|
||||
class ASPNET_CORE_PROXY_MODULE_FACTORY : public IHttpModuleFactory
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ APPLICATION_INFO::~APPLICATION_INFO()
|
|||
{
|
||||
// Mark the entry as invalid,
|
||||
// StopMonitor will close the file handle and trigger a FCN
|
||||
// the entry will delete itself when processing this FCN
|
||||
// the entry will delete itself when processing this FCN
|
||||
m_pFileWatcherEntry->MarkEntryInValid();
|
||||
m_pFileWatcherEntry->StopMonitor();
|
||||
m_pFileWatcherEntry->DereferenceFileWatcherEntry();
|
||||
|
|
@ -161,7 +161,7 @@ APPLICATION_INFO::UpdateAppOfflineFileHandle()
|
|||
STACK_STRU(strEventMsg, 256);
|
||||
if (SUCCEEDED(strEventMsg.SafeSnwprintf(
|
||||
ASPNETCORE_EVENT_RECYCLE_APPOFFLINE_MSG,
|
||||
m_pApplication->QueryConfig()->QueryApplicationPath()->QueryStr())))
|
||||
m_pConfiguration->QueryApplicationPath()->QueryStr())))
|
||||
{
|
||||
UTILITY::LogEvent(g_hEventLog,
|
||||
EVENTLOG_INFORMATION_TYPE,
|
||||
|
|
@ -181,7 +181,7 @@ APPLICATION_INFO::EnsureApplicationCreated()
|
|||
{
|
||||
HRESULT hr = S_OK;
|
||||
BOOL fLocked = FALSE;
|
||||
APPLICATION* pApplication = NULL;
|
||||
IAPPLICATION* pApplication = NULL;
|
||||
STACK_STRU(struFileName, 300); // >MAX_PATH
|
||||
STRU struHostFxrDllLocation;
|
||||
|
||||
|
|
@ -314,24 +314,15 @@ APPLICATION_INFO::FindRequestHandlerAssembly()
|
|||
hr = HRESULT_FROM_WIN32(GetLastError());
|
||||
goto Finished;
|
||||
}
|
||||
|
||||
g_pfnAspNetCoreCreateRequestHandler = (PFN_ASPNETCORE_CREATE_REQUEST_HANDLER)
|
||||
GetProcAddress(g_hAspnetCoreRH, "CreateRequestHandler");
|
||||
if (g_pfnAspNetCoreCreateRequestHandler == NULL)
|
||||
{
|
||||
hr = HRESULT_FROM_WIN32(GetLastError());
|
||||
goto Finished;
|
||||
}
|
||||
g_fAspnetcoreRHAssemblyLoaded = TRUE;
|
||||
}
|
||||
|
||||
Finished:
|
||||
//
|
||||
// Question: we remember the load failure so that we will not try again.
|
||||
// User needs to check whether the fuction pointer is NULL
|
||||
// User needs to check whether the fuction pointer is NULL
|
||||
//
|
||||
m_pfnAspNetCoreCreateApplication = g_pfnAspNetCoreCreateApplication;
|
||||
m_pfnAspNetCoreCreateRequestHandler = g_pfnAspNetCoreCreateRequestHandler;
|
||||
if (!g_fAspnetcoreRHLoadedError && FAILED(hr))
|
||||
{
|
||||
g_fAspnetcoreRHLoadedError = TRUE;
|
||||
|
|
@ -401,11 +392,11 @@ Finished:
|
|||
return hr;
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
// Tries to find aspnetcorerh.dll from the application
|
||||
// Calls into hostfxr.dll to find it.
|
||||
// Will leave hostfxr.dll loaded as it will be used again to call hostfxr_main.
|
||||
//
|
||||
//
|
||||
HRESULT
|
||||
APPLICATION_INFO::FindNativeAssemblyFromHostfxr(
|
||||
STRU* struFilename
|
||||
|
|
@ -440,7 +431,7 @@ APPLICATION_INFO::FindNativeAssemblyFromHostfxr(
|
|||
if (pFnHostFxrSearchDirectories == NULL)
|
||||
{
|
||||
// Host fxr version is incorrect (need a higher version).
|
||||
// TODO log error
|
||||
// TODO log error
|
||||
hr = E_FAIL;
|
||||
goto Finished;
|
||||
}
|
||||
|
|
@ -540,7 +531,7 @@ Finished:
|
|||
VOID
|
||||
APPLICATION_INFO::RecycleApplication()
|
||||
{
|
||||
APPLICATION* pApplication = NULL;
|
||||
IAPPLICATION* pApplication = NULL;
|
||||
HANDLE hThread = INVALID_HANDLE_VALUE;
|
||||
BOOL fLockAcquired = FALSE;
|
||||
|
||||
|
|
@ -551,7 +542,7 @@ APPLICATION_INFO::RecycleApplication()
|
|||
if (m_pApplication != NULL)
|
||||
{
|
||||
pApplication = m_pApplication;
|
||||
if (pApplication->QueryConfig()->QueryHostingModel() == HOSTING_OUT_PROCESS)
|
||||
if (m_pConfiguration->QueryHostingModel() == HOSTING_OUT_PROCESS)
|
||||
{
|
||||
//
|
||||
// For inprocess, need to set m_pApplication to NULL first to
|
||||
|
|
@ -588,7 +579,7 @@ APPLICATION_INFO::RecycleApplication()
|
|||
g_pHttpServer->RecycleProcess(L"On Demand by AspNetCore Module for recycle application failure");
|
||||
}
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
// Closing a thread handle does not terminate the associated thread or remove the thread object.
|
||||
CloseHandle(hThread);
|
||||
|
|
@ -606,7 +597,7 @@ VOID
|
|||
APPLICATION_INFO::DoRecycleApplication(
|
||||
LPVOID lpParam)
|
||||
{
|
||||
APPLICATION* pApplication = static_cast<APPLICATION*>(lpParam);
|
||||
IAPPLICATION* pApplication = static_cast<IAPPLICATION*>(lpParam);
|
||||
|
||||
// No lock required
|
||||
|
||||
|
|
@ -624,7 +615,7 @@ APPLICATION_INFO::DoRecycleApplication(
|
|||
VOID
|
||||
APPLICATION_INFO::ShutDownApplication()
|
||||
{
|
||||
APPLICATION* pApplication = NULL;
|
||||
IAPPLICATION* pApplication = NULL;
|
||||
BOOL fLockAcquired = FALSE;
|
||||
|
||||
// pApplication can be NULL due to app_offline
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ DWORD g_dwDebugFlags = 0;
|
|||
PCSTR g_szDebugLabel = "ASPNET_CORE_MODULE";
|
||||
PCWSTR g_pwzAspnetcoreRequestHandlerName = L"aspnetcorerh.dll";
|
||||
PFN_ASPNETCORE_CREATE_APPLICATION g_pfnAspNetCoreCreateApplication;
|
||||
PFN_ASPNETCORE_CREATE_REQUEST_HANDLER g_pfnAspNetCoreCreateRequestHandler;
|
||||
|
||||
VOID
|
||||
StaticCleanup()
|
||||
|
|
@ -49,7 +48,7 @@ BOOL WINAPI DllMain(HMODULE hModule,
|
|||
break;
|
||||
case DLL_PROCESS_DETACH:
|
||||
// IIS can cause dll detach to occur before we receive global notifications
|
||||
// For example, when we switch the bitness of the worker process,
|
||||
// For example, when we switch the bitness of the worker process,
|
||||
// this is a bug in IIS. To try to avoid AVs, we will set a global flag
|
||||
g_fInShutdown = TRUE;
|
||||
StaticCleanup();
|
||||
|
|
@ -204,7 +203,7 @@ HRESULT
|
|||
hr = E_OUTOFMEMORY;
|
||||
goto Finished;
|
||||
}
|
||||
|
||||
|
||||
hr = pApplicationManager->Initialize();
|
||||
if(FAILED(hr))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ inline bool IsSpace(char ch)
|
|||
#include "..\..\CommonLib\environmentvariablehash.h"
|
||||
#include "..\..\CommonLib\aspnetcoreconfig.h"
|
||||
#include "..\..\CommonLib\hostfxr_utility.h"
|
||||
#include "..\..\CommonLib\application.h"
|
||||
#include "..\..\CommonLib\iapplication.h"
|
||||
#include "..\..\CommonLib\utility.h"
|
||||
#include "..\..\CommonLib\debugutil.h"
|
||||
#include "..\..\CommonLib\requesthandler.h"
|
||||
|
|
@ -138,7 +138,7 @@ FORCEINLINE
|
|||
HRESULT
|
||||
HRESULT_FROM_GETLASTERROR()
|
||||
{
|
||||
return ( GetLastError() != NO_ERROR )
|
||||
return ( GetLastError() != NO_ERROR )
|
||||
? HRESULT_FROM_WIN32( GetLastError() )
|
||||
: E_FAIL;
|
||||
}
|
||||
|
|
@ -155,5 +155,4 @@ extern SRWLOCK g_srwLock;
|
|||
extern PCWSTR g_pwzAspnetcoreRequestHandlerName;
|
||||
extern HANDLE g_hEventLog;
|
||||
extern PFN_ASPNETCORE_CREATE_APPLICATION g_pfnAspNetCoreCreateApplication;
|
||||
extern PFN_ASPNETCORE_CREATE_REQUEST_HANDLER g_pfnAspNetCoreCreateRequestHandler;
|
||||
#pragma warning( error : 4091)
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ ASPNET_CORE_PROXY_MODULE::OnExecuteRequestHandler(
|
|||
ASPNETCORE_CONFIG *pConfig = NULL;
|
||||
APPLICATION_MANAGER *pApplicationManager = NULL;
|
||||
REQUEST_NOTIFICATION_STATUS retVal = RQ_NOTIFICATION_CONTINUE;
|
||||
APPLICATION* pApplication = NULL;
|
||||
IAPPLICATION* pApplication = NULL;
|
||||
STACK_STRU(struFileName, 256);
|
||||
if (g_fInShutdown)
|
||||
{
|
||||
|
|
@ -162,9 +162,8 @@ ASPNET_CORE_PROXY_MODULE::OnExecuteRequestHandler(
|
|||
}
|
||||
|
||||
// Create RequestHandler and process the request
|
||||
hr = m_pApplicationInfo->QueryCreateRequestHandler()(pHttpContext,
|
||||
hr = pApplication->CreateHandler(pHttpContext,
|
||||
(HTTP_MODULE_ID*) &g_pModuleId,
|
||||
pApplication,
|
||||
&m_pHandler);
|
||||
|
||||
if (FAILED(hr))
|
||||
|
|
@ -174,7 +173,7 @@ ASPNET_CORE_PROXY_MODULE::OnExecuteRequestHandler(
|
|||
|
||||
retVal = m_pHandler->OnExecuteRequestHandler();
|
||||
|
||||
Finished:
|
||||
Finished:
|
||||
if (FAILED(hr))
|
||||
{
|
||||
retVal = RQ_NOTIFICATION_FINISH_REQUEST;
|
||||
|
|
|
|||
|
|
@ -171,12 +171,14 @@
|
|||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="application.h" />
|
||||
<ClInclude Include="iapplication.h" />
|
||||
<ClInclude Include="aspnetcoreconfig.h" />
|
||||
<ClInclude Include="debugutil.h" />
|
||||
<ClInclude Include="disconnectcontext.h" />
|
||||
<ClInclude Include="environmentvariablehash.h" />
|
||||
<ClInclude Include="fx_ver.h" />
|
||||
<ClInclude Include="hostfxr_utility.h" />
|
||||
<ClInclude Include="irequesthandler.h" />
|
||||
<ClInclude Include="requesthandler.h" />
|
||||
<ClInclude Include="resources.h" />
|
||||
<ClInclude Include="SRWLockWrapper.h" />
|
||||
|
|
@ -184,11 +186,9 @@
|
|||
<ClInclude Include="utility.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="application.cpp" />
|
||||
<ClCompile Include="aspnetcoreconfig.cxx" />
|
||||
<ClCompile Include="fx_ver.cxx" />
|
||||
<ClCompile Include="hostfxr_utility.cpp" />
|
||||
<ClCompile Include="requesthandler.cxx" />
|
||||
<ClCompile Include="SRWLockWrapper.cpp" />
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
|
|
|
|||
|
|
@ -1,50 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
APPLICATION::APPLICATION(
|
||||
_In_ IHttpServer* pHttpServer,
|
||||
_In_ ASPNETCORE_CONFIG* pConfig) :
|
||||
m_cRefs(1),
|
||||
m_pConfig(pConfig),
|
||||
m_status(APPLICATION_STATUS::UNKNOWN)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(pHttpServer);
|
||||
}
|
||||
|
||||
APPLICATION::~APPLICATION()
|
||||
{
|
||||
}
|
||||
|
||||
APPLICATION_STATUS
|
||||
APPLICATION::QueryStatus()
|
||||
{
|
||||
return m_status;
|
||||
}
|
||||
|
||||
ASPNETCORE_CONFIG*
|
||||
APPLICATION::QueryConfig()
|
||||
{
|
||||
return m_pConfig;
|
||||
}
|
||||
|
||||
VOID
|
||||
APPLICATION::ReferenceApplication()
|
||||
const
|
||||
{
|
||||
InterlockedIncrement(&m_cRefs);
|
||||
}
|
||||
|
||||
VOID
|
||||
APPLICATION::DereferenceApplication()
|
||||
const
|
||||
{
|
||||
DBG_ASSERT(m_cRefs != 0);
|
||||
|
||||
LONG cRefs = 0;
|
||||
if ((cRefs = InterlockedDecrement(&m_cRefs)) == 0)
|
||||
{
|
||||
delete this;
|
||||
}
|
||||
}
|
||||
|
|
@ -3,51 +3,45 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
enum APPLICATION_STATUS
|
||||
{
|
||||
UNKNOWN = 0,
|
||||
STARTING,
|
||||
RUNNING,
|
||||
SHUTDOWN,
|
||||
FAIL
|
||||
};
|
||||
#include "stdafx.h"
|
||||
|
||||
class ASPNETCORE_CONFIG;
|
||||
|
||||
class APPLICATION
|
||||
class APPLICATION : public IAPPLICATION
|
||||
{
|
||||
|
||||
public:
|
||||
APPLICATION(
|
||||
_In_ IHttpServer* pHttpServer,
|
||||
_In_ ASPNETCORE_CONFIG* pConfig);
|
||||
|
||||
virtual
|
||||
VOID
|
||||
ShutDown() = 0;
|
||||
|
||||
virtual
|
||||
VOID
|
||||
Recycle() = 0;
|
||||
|
||||
virtual
|
||||
~APPLICATION();
|
||||
|
||||
APPLICATION_STATUS
|
||||
QueryStatus();
|
||||
QueryStatus() override
|
||||
{
|
||||
return m_status;
|
||||
}
|
||||
|
||||
ASPNETCORE_CONFIG*
|
||||
QueryConfig();
|
||||
APPLICATION()
|
||||
: m_cRefs(1)
|
||||
{
|
||||
}
|
||||
|
||||
VOID
|
||||
ReferenceApplication()
|
||||
const;
|
||||
ReferenceApplication() override
|
||||
{
|
||||
InterlockedIncrement(&m_cRefs);
|
||||
}
|
||||
|
||||
VOID
|
||||
DereferenceApplication()
|
||||
const;
|
||||
DereferenceApplication() override
|
||||
{
|
||||
DBG_ASSERT(m_cRefs != 0);
|
||||
|
||||
LONG cRefs = 0;
|
||||
if ((cRefs = InterlockedDecrement(&m_cRefs)) == 0)
|
||||
{
|
||||
delete this;
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
mutable LONG m_cRefs;
|
||||
volatile APPLICATION_STATUS m_status;
|
||||
ASPNETCORE_CONFIG* m_pConfig;
|
||||
volatile APPLICATION_STATUS m_status = APPLICATION_STATUS::UNKNOWN;
|
||||
|
||||
private:
|
||||
mutable LONG m_cRefs;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -0,0 +1,47 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
|
||||
#pragma once
|
||||
|
||||
enum APPLICATION_STATUS
|
||||
{
|
||||
UNKNOWN = 0,
|
||||
STARTING,
|
||||
RUNNING,
|
||||
SHUTDOWN,
|
||||
FAIL
|
||||
};
|
||||
|
||||
class IAPPLICATION
|
||||
{
|
||||
public:
|
||||
virtual
|
||||
VOID
|
||||
ShutDown() = 0;
|
||||
|
||||
virtual
|
||||
VOID
|
||||
Recycle() = 0;
|
||||
|
||||
virtual
|
||||
~IAPPLICATION() = 0 { };
|
||||
|
||||
virtual
|
||||
APPLICATION_STATUS
|
||||
QueryStatus() = 0;
|
||||
|
||||
virtual
|
||||
VOID
|
||||
ReferenceApplication() = 0;
|
||||
|
||||
virtual
|
||||
VOID
|
||||
DereferenceApplication() = 0;
|
||||
|
||||
virtual
|
||||
HRESULT
|
||||
CreateHandler(
|
||||
_In_ IHttpContext *pHttpContext,
|
||||
_In_ HTTP_MODULE_ID *pModuleId,
|
||||
_Out_ IREQUEST_HANDLER **pRequestHandler) = 0;
|
||||
};
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
//
|
||||
// Pure abstract class
|
||||
//
|
||||
class IREQUEST_HANDLER
|
||||
{
|
||||
public:
|
||||
|
||||
virtual
|
||||
REQUEST_NOTIFICATION_STATUS
|
||||
OnExecuteRequestHandler() = 0;
|
||||
|
||||
virtual
|
||||
REQUEST_NOTIFICATION_STATUS
|
||||
OnAsyncCompletion(
|
||||
DWORD cbCompletion,
|
||||
HRESULT hrCompletionStatus
|
||||
) = 0;
|
||||
|
||||
virtual
|
||||
VOID
|
||||
TerminateRequest(
|
||||
bool fClientInitiated
|
||||
) = 0;
|
||||
|
||||
virtual
|
||||
~IREQUEST_HANDLER(
|
||||
VOID
|
||||
) = 0 { }
|
||||
|
||||
virtual
|
||||
VOID
|
||||
ReferenceRequestHandler(
|
||||
VOID
|
||||
) = 0;
|
||||
|
||||
virtual
|
||||
VOID
|
||||
DereferenceRequestHandler(
|
||||
VOID
|
||||
) = 0;
|
||||
};
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
REQUEST_HANDLER::REQUEST_HANDLER(
|
||||
_In_ IHttpContext *pW3Context,
|
||||
_In_ HTTP_MODULE_ID *pModuleId,
|
||||
_In_ APPLICATION *pApplication)
|
||||
: m_cRefs(1)
|
||||
{
|
||||
m_pW3Context = pW3Context;
|
||||
m_pApplication = pApplication;
|
||||
m_pModuleId = *pModuleId;
|
||||
}
|
||||
|
||||
|
||||
REQUEST_HANDLER::~REQUEST_HANDLER()
|
||||
{
|
||||
}
|
||||
|
||||
VOID
|
||||
REQUEST_HANDLER::ReferenceRequestHandler(
|
||||
VOID
|
||||
) const
|
||||
{
|
||||
InterlockedIncrement(&m_cRefs);
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
REQUEST_HANDLER::DereferenceRequestHandler(
|
||||
VOID
|
||||
) const
|
||||
{
|
||||
DBG_ASSERT(m_cRefs != 0);
|
||||
|
||||
LONG cRefs = 0;
|
||||
if ((cRefs = InterlockedDecrement(&m_cRefs)) == 0)
|
||||
{
|
||||
delete this;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -4,56 +4,32 @@
|
|||
#pragma once
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "application.h"
|
||||
|
||||
//
|
||||
// Abstract class
|
||||
// Pure abstract class
|
||||
//
|
||||
class REQUEST_HANDLER
|
||||
class REQUEST_HANDLER: public virtual IREQUEST_HANDLER
|
||||
{
|
||||
|
||||
public:
|
||||
REQUEST_HANDLER(
|
||||
_In_ IHttpContext *pW3Context,
|
||||
_In_ HTTP_MODULE_ID *pModuleId,
|
||||
_In_ APPLICATION *pApplication
|
||||
);
|
||||
|
||||
virtual
|
||||
REQUEST_NOTIFICATION_STATUS
|
||||
OnExecuteRequestHandler() = 0;
|
||||
|
||||
virtual
|
||||
REQUEST_NOTIFICATION_STATUS
|
||||
OnAsyncCompletion(
|
||||
DWORD cbCompletion,
|
||||
HRESULT hrCompletionStatus
|
||||
) = 0;
|
||||
|
||||
virtual
|
||||
VOID
|
||||
TerminateRequest(
|
||||
bool fClientInitiated
|
||||
) = 0;
|
||||
|
||||
virtual
|
||||
~REQUEST_HANDLER(
|
||||
VOID
|
||||
);
|
||||
ReferenceRequestHandler() override
|
||||
{
|
||||
InterlockedIncrement(&m_cRefs);
|
||||
}
|
||||
|
||||
VOID
|
||||
ReferenceRequestHandler(
|
||||
VOID
|
||||
) const;
|
||||
DereferenceRequestHandler() override
|
||||
{
|
||||
DBG_ASSERT(m_cRefs != 0);
|
||||
|
||||
virtual
|
||||
VOID
|
||||
DereferenceRequestHandler(
|
||||
VOID
|
||||
) const;
|
||||
LONG cRefs = 0;
|
||||
if ((cRefs = InterlockedDecrement(&m_cRefs)) == 0)
|
||||
{
|
||||
delete this;
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
mutable LONG m_cRefs;
|
||||
IHttpContext* m_pW3Context;
|
||||
APPLICATION* m_pApplication;
|
||||
HTTP_MODULE_ID m_pModuleId;
|
||||
};
|
||||
private:
|
||||
mutable LONG m_cRefs = 1;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -25,10 +25,14 @@
|
|||
#include "environmentvariablehash.h"
|
||||
#include "utility.h"
|
||||
#include "aspnetcoreconfig.h"
|
||||
#include "application.h"
|
||||
#include "requesthandler.h"
|
||||
#include "fx_ver.h"
|
||||
#include "hostfxr_utility.h"
|
||||
#include "resources.h"
|
||||
#include "aspnetcore_msg.h"
|
||||
|
||||
#include "irequesthandler.h"
|
||||
#include "iapplication.h"
|
||||
#include "requesthandler.h"
|
||||
#include "application.h"
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -2,5 +2,4 @@ LIBRARY aspnetcorerh
|
|||
|
||||
EXPORTS
|
||||
CreateApplication
|
||||
CreateRequestHandler
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ public:
|
|||
VOID
|
||||
NotifyDisconnect()
|
||||
{
|
||||
REQUEST_HANDLER *pInitialValue = (REQUEST_HANDLER*)
|
||||
IREQUEST_HANDLER *pInitialValue = (IREQUEST_HANDLER*)
|
||||
InterlockedExchangePointer((PVOID*)&m_pHandler, NULL);
|
||||
|
||||
if (pInitialValue != NULL)
|
||||
|
|
@ -33,7 +33,7 @@ public:
|
|||
|
||||
VOID
|
||||
SetHandler(
|
||||
REQUEST_HANDLER *pHandler
|
||||
IREQUEST_HANDLER *pHandler
|
||||
)
|
||||
{
|
||||
//
|
||||
|
|
@ -61,7 +61,7 @@ public:
|
|||
VOID
|
||||
)
|
||||
{
|
||||
REQUEST_HANDLER *pInitialValue = (REQUEST_HANDLER*)
|
||||
IREQUEST_HANDLER *pInitialValue = (IREQUEST_HANDLER*)
|
||||
InterlockedExchangePointer((PVOID*)&m_pHandler, NULL);
|
||||
|
||||
if (pInitialValue != NULL)
|
||||
|
|
@ -74,5 +74,5 @@ private:
|
|||
~ASYNC_DISCONNECT_CONTEXT()
|
||||
{}
|
||||
|
||||
REQUEST_HANDLER * m_pHandler;
|
||||
IREQUEST_HANDLER * m_pHandler;
|
||||
};
|
||||
|
|
@ -187,10 +187,10 @@ EnsureOutOfProcessInitializtion()
|
|||
}
|
||||
|
||||
//
|
||||
// Don't set non-blocking callbacks WINHTTP_OPTION_ASSURED_NON_BLOCKING_CALLBACKS,
|
||||
// Don't set non-blocking callbacks WINHTTP_OPTION_ASSURED_NON_BLOCKING_CALLBACKS,
|
||||
// as we will call WinHttpQueryDataAvailable to get response on the same thread
|
||||
// that we received callback from Winhttp on completing sending/forwarding the request
|
||||
//
|
||||
//
|
||||
|
||||
//
|
||||
// Setup the callback function
|
||||
|
|
@ -277,11 +277,11 @@ __stdcall
|
|||
CreateApplication(
|
||||
_In_ IHttpServer *pServer,
|
||||
_In_ ASPNETCORE_CONFIG *pConfig,
|
||||
_Out_ APPLICATION **ppApplication
|
||||
_Out_ IAPPLICATION **ppApplication
|
||||
)
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
APPLICATION *pApplication = NULL;
|
||||
IAPPLICATION *pApplication = NULL;
|
||||
|
||||
// Initialze some global variables here
|
||||
InitializeGlobalConfiguration(pServer);
|
||||
|
|
@ -303,7 +303,8 @@ CreateApplication(
|
|||
goto Finished;
|
||||
}
|
||||
|
||||
pApplication = new OUT_OF_PROCESS_APPLICATION(pServer, pConfig);
|
||||
|
||||
pApplication = new OUT_OF_PROCESS_APPLICATION(pConfig);
|
||||
if (pApplication == NULL)
|
||||
{
|
||||
hr = HRESULT_FROM_WIN32(ERROR_OUTOFMEMORY);
|
||||
|
|
@ -329,41 +330,3 @@ CreateApplication(
|
|||
Finished:
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
__stdcall
|
||||
CreateRequestHandler(
|
||||
_In_ IHttpContext *pHttpContext,
|
||||
_In_ HTTP_MODULE_ID *pModuleId,
|
||||
_In_ APPLICATION *pApplication,
|
||||
_Out_ REQUEST_HANDLER **pRequestHandler
|
||||
)
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
REQUEST_HANDLER* pHandler = NULL;
|
||||
ASPNETCORE_CONFIG* pConfig = pApplication->QueryConfig();
|
||||
DBG_ASSERT(pConfig);
|
||||
|
||||
if (pConfig->QueryHostingModel() == APP_HOSTING_MODEL::HOSTING_IN_PROCESS)
|
||||
{
|
||||
pHandler = new IN_PROCESS_HANDLER(pHttpContext, pModuleId, pApplication);
|
||||
}
|
||||
else if (pConfig->QueryHostingModel() == APP_HOSTING_MODEL::HOSTING_OUT_PROCESS)
|
||||
{
|
||||
pHandler = new FORWARDING_HANDLER(pHttpContext, pModuleId, pApplication);
|
||||
}
|
||||
else
|
||||
{
|
||||
return HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED);
|
||||
}
|
||||
|
||||
if (pHandler == NULL)
|
||||
{
|
||||
hr = HRESULT_FROM_WIN32(ERROR_OUTOFMEMORY);
|
||||
}
|
||||
else
|
||||
{
|
||||
*pRequestHandler = pHandler;
|
||||
}
|
||||
return hr;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ IN_PROCESS_APPLICATION* IN_PROCESS_APPLICATION::s_Application = NULL;
|
|||
IN_PROCESS_APPLICATION::IN_PROCESS_APPLICATION(
|
||||
IHttpServer* pHttpServer,
|
||||
ASPNETCORE_CONFIG* pConfig) :
|
||||
APPLICATION(pHttpServer, pConfig),
|
||||
m_pHttpServer(pHttpServer),
|
||||
m_ProcessExitCode(0),
|
||||
m_hLogFileHandle(INVALID_HANDLE_VALUE),
|
||||
|
|
@ -17,7 +16,8 @@ IN_PROCESS_APPLICATION::IN_PROCESS_APPLICATION(
|
|||
m_fInitialized(FALSE),
|
||||
m_fShutdownCalledFromNative(FALSE),
|
||||
m_fShutdownCalledFromManaged(FALSE),
|
||||
m_srwLock()
|
||||
m_srwLock(),
|
||||
m_pConfig(pConfig)
|
||||
{
|
||||
// is it guaranteed that we have already checked app offline at this point?
|
||||
// If so, I don't think there is much to do here.
|
||||
|
|
@ -985,3 +985,28 @@ IN_PROCESS_APPLICATION::FilterException(unsigned int, struct _EXCEPTION_POINTERS
|
|||
// TODO, log error based on exception code.
|
||||
return EXCEPTION_EXECUTE_HANDLER;
|
||||
}
|
||||
|
||||
ASPNETCORE_CONFIG*
|
||||
IN_PROCESS_APPLICATION::QueryConfig() const
|
||||
{
|
||||
return m_pConfig;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
IN_PROCESS_APPLICATION::CreateHandler(
|
||||
_In_ IHttpContext *pHttpContext,
|
||||
_In_ HTTP_MODULE_ID *pModuleId,
|
||||
_Out_ IREQUEST_HANDLER **pRequestHandler)
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
IREQUEST_HANDLER* pHandler = NULL;
|
||||
pHandler = new IN_PROCESS_HANDLER(pHttpContext, pModuleId, this);
|
||||
|
||||
if (pHandler == NULL)
|
||||
{
|
||||
hr = HRESULT_FROM_WIN32(ERROR_OUTOFMEMORY);
|
||||
}
|
||||
|
||||
*pRequestHandler = pHandler;
|
||||
return hr;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,6 +33,14 @@ public:
|
|||
VOID
|
||||
);
|
||||
|
||||
__override
|
||||
HRESULT
|
||||
CreateHandler(
|
||||
_In_ IHttpContext *pHttpContext,
|
||||
_In_ HTTP_MODULE_ID *pModuleId,
|
||||
_Out_ IREQUEST_HANDLER **pRequestHandler)
|
||||
override;
|
||||
|
||||
// Executes the .NET Core process
|
||||
HRESULT
|
||||
ExecuteApplication(
|
||||
|
|
@ -98,6 +106,9 @@ public:
|
|||
return s_Application;
|
||||
}
|
||||
|
||||
ASPNETCORE_CONFIG*
|
||||
QueryConfig() const;
|
||||
|
||||
private:
|
||||
static
|
||||
DWORD
|
||||
|
|
@ -155,6 +166,8 @@ private:
|
|||
DWORD m_dwStdErrReadTotal;
|
||||
static IN_PROCESS_APPLICATION* s_Application;
|
||||
|
||||
ASPNETCORE_CONFIG* m_pConfig;
|
||||
|
||||
VOID
|
||||
SetStdOut(
|
||||
VOID
|
||||
|
|
|
|||
|
|
@ -3,8 +3,10 @@
|
|||
IN_PROCESS_HANDLER::IN_PROCESS_HANDLER(
|
||||
_In_ IHttpContext *pW3Context,
|
||||
_In_ HTTP_MODULE_ID *pModuleId,
|
||||
_In_ APPLICATION *pApplication
|
||||
): REQUEST_HANDLER(pW3Context, pModuleId, pApplication)
|
||||
_In_ IN_PROCESS_APPLICATION *pApplication
|
||||
): m_pW3Context(pW3Context),
|
||||
m_pApplication(pApplication),
|
||||
m_pModuleId(*pModuleId)
|
||||
{
|
||||
m_fManagedRequestComplete = FALSE;
|
||||
}
|
||||
|
|
@ -20,7 +22,7 @@ IN_PROCESS_HANDLER::OnExecuteRequestHandler()
|
|||
{
|
||||
// First get the in process Application
|
||||
HRESULT hr;
|
||||
hr = ((IN_PROCESS_APPLICATION*)m_pApplication)->LoadManagedApplication();
|
||||
hr = m_pApplication->LoadManagedApplication();
|
||||
if (FAILED(hr))
|
||||
{
|
||||
// TODO remove com_error?
|
||||
|
|
@ -39,7 +41,7 @@ IN_PROCESS_HANDLER::OnExecuteRequestHandler()
|
|||
}
|
||||
|
||||
// FREB log
|
||||
|
||||
|
||||
if (ANCMEvents::ANCM_START_APPLICATION_SUCCESS::IsEnabled(m_pW3Context->GetTraceContext()))
|
||||
{
|
||||
ANCMEvents::ANCM_START_APPLICATION_SUCCESS::RaiseEvent(
|
||||
|
|
@ -49,7 +51,7 @@ IN_PROCESS_HANDLER::OnExecuteRequestHandler()
|
|||
}
|
||||
|
||||
//SetHttpSysDisconnectCallback();
|
||||
return ((IN_PROCESS_APPLICATION*)m_pApplication)->OnExecuteRequest(m_pW3Context, this);
|
||||
return m_pApplication->OnExecuteRequest(m_pW3Context, this);
|
||||
}
|
||||
|
||||
__override
|
||||
|
|
@ -59,15 +61,9 @@ IN_PROCESS_HANDLER::OnAsyncCompletion(
|
|||
HRESULT hrCompletionStatus
|
||||
)
|
||||
{
|
||||
IN_PROCESS_APPLICATION* application = (IN_PROCESS_APPLICATION*)m_pApplication;
|
||||
if (application == NULL)
|
||||
{
|
||||
return RQ_NOTIFICATION_FINISH_REQUEST;
|
||||
}
|
||||
|
||||
// OnAsyncCompletion must call into the application if there was a error. We will redo calls
|
||||
// to Read/Write if we called cancelIo on the IHttpContext.
|
||||
return application->OnAsyncCompletion(cbCompletion, hrCompletionStatus, this);
|
||||
return m_pApplication->OnAsyncCompletion(cbCompletion, hrCompletionStatus, this);
|
||||
}
|
||||
|
||||
VOID
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
class IN_PROCESS_APPLICATION;
|
||||
|
||||
class IN_PROCESS_HANDLER : public REQUEST_HANDLER
|
||||
{
|
||||
public:
|
||||
|
|
@ -7,27 +9,26 @@ public:
|
|||
|
||||
_In_ IHttpContext *pW3Context,
|
||||
_In_ HTTP_MODULE_ID *pModuleId,
|
||||
_In_ APPLICATION *pApplication);
|
||||
_In_ IN_PROCESS_APPLICATION *pApplication);
|
||||
|
||||
~IN_PROCESS_HANDLER();
|
||||
~IN_PROCESS_HANDLER() override;
|
||||
|
||||
__override
|
||||
REQUEST_NOTIFICATION_STATUS
|
||||
OnExecuteRequestHandler();
|
||||
OnExecuteRequestHandler() override;
|
||||
|
||||
__override
|
||||
REQUEST_NOTIFICATION_STATUS
|
||||
OnAsyncCompletion(
|
||||
DWORD cbCompletion,
|
||||
HRESULT hrCompletionStatus
|
||||
);
|
||||
) override;
|
||||
|
||||
__override
|
||||
VOID
|
||||
TerminateRequest(
|
||||
bool fClientInitiated
|
||||
|
||||
);
|
||||
) override;
|
||||
|
||||
PVOID
|
||||
QueryManagedHttpContext(
|
||||
|
|
@ -69,4 +70,8 @@ private:
|
|||
IHttpContext* m_pHttpContext;
|
||||
BOOL m_fManagedRequestComplete;
|
||||
REQUEST_NOTIFICATION_STATUS m_requestNotificationStatus;
|
||||
};
|
||||
|
||||
IHttpContext* m_pW3Context;
|
||||
IN_PROCESS_APPLICATION* m_pApplication;
|
||||
HTTP_MODULE_ID m_pModuleId;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -18,10 +18,10 @@ PROTOCOL_CONFIG FORWARDING_HANDLER::sm_ProtocolConfig;
|
|||
RESPONSE_HEADER_HASH * FORWARDING_HANDLER::sm_pResponseHeaderHash = NULL;
|
||||
|
||||
FORWARDING_HANDLER::FORWARDING_HANDLER(
|
||||
_In_ IHttpContext *pW3Context,
|
||||
_In_ HTTP_MODULE_ID *pModuleId,
|
||||
_In_ APPLICATION *pApplication
|
||||
) : REQUEST_HANDLER(pW3Context, pModuleId, pApplication),
|
||||
_In_ IHttpContext *pW3Context,
|
||||
_In_ HTTP_MODULE_ID *pModuleId,
|
||||
_In_ OUT_OF_PROCESS_APPLICATION *pApplication
|
||||
) : IREQUEST_HANDLER(),
|
||||
m_Signature(FORWARDING_HANDLER_SIGNATURE),
|
||||
m_RequestStatus(FORWARDER_START),
|
||||
m_fClientDisconnected(FALSE),
|
||||
|
|
@ -39,7 +39,11 @@ FORWARDING_HANDLER::FORWARDING_HANDLER(
|
|||
m_fDoneAsyncCompletion(FALSE),
|
||||
m_fHttpHandleInClose(FALSE),
|
||||
m_fWebSocketHandleInClose(FALSE),
|
||||
m_fServerResetConn(FALSE)
|
||||
m_fServerResetConn(FALSE),
|
||||
m_cRefs(1),
|
||||
m_pW3Context(pW3Context),
|
||||
m_pApplication(pApplication),
|
||||
m_pModuleId(*pModuleId)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
DebugPrintf(ASPNETCORE_DEBUG_FLAG_INFO,
|
||||
|
|
@ -67,9 +71,9 @@ FORWARDING_HANDLER::~FORWARDING_HANDLER(
|
|||
//
|
||||
// Disconnect notification cleanup would happen first, before
|
||||
// the FORWARDING_HANDLER instance got removed from m_pSharedhandler list.
|
||||
// The m_pServer cleanup would happen afterwards, since there may be a
|
||||
// The m_pServer cleanup would happen afterwards, since there may be a
|
||||
// call pending from SHARED_HANDLER to FORWARDING_HANDLER::SetStatusAndHeaders()
|
||||
//
|
||||
//
|
||||
DBG_ASSERT(m_pDisconnect == NULL);
|
||||
|
||||
RemoveRequest();
|
||||
|
|
@ -472,7 +476,7 @@ REQUEST_NOTIFICATION_STATUS
|
|||
|
||||
if (FAILED(hr))
|
||||
{
|
||||
// This failure could happen when client disconnect happens or backend server fails
|
||||
// This failure could happen when client disconnect happens or backend server fails
|
||||
// after websocket upgrade
|
||||
goto Failure;
|
||||
}
|
||||
|
|
@ -827,8 +831,8 @@ FORWARDING_HANDLER::GetHeaders(
|
|||
PCSTR pszFinalHeader;
|
||||
USHORT cchCurrentHeader;
|
||||
DWORD cchFinalHeader;
|
||||
BOOL fSecure = FALSE; // dummy. Used in SplitUrl. Value will not be used
|
||||
// as ANCM always use http protocol to communicate with backend
|
||||
BOOL fSecure = FALSE; // dummy. Used in SplitUrl. Value will not be used
|
||||
// as ANCM always use http protocol to communicate with backend
|
||||
STRU struDestination;
|
||||
STRU struUrl;
|
||||
STACK_STRA(strTemp, 64);
|
||||
|
|
@ -858,7 +862,7 @@ FORWARDING_HANDLER::GetHeaders(
|
|||
}
|
||||
//
|
||||
// Strip all headers starting with MS-ASPNETCORE.
|
||||
// These headers are generated by the asp.net core module and
|
||||
// These headers are generated by the asp.net core module and
|
||||
// passed to the process it creates.
|
||||
//
|
||||
|
||||
|
|
@ -1143,7 +1147,7 @@ FORWARDING_HANDLER::CreateWinHttpRequest(
|
|||
{
|
||||
dwTimeout = pProtocol->QueryTimeout();
|
||||
}
|
||||
|
||||
|
||||
if (!WinHttpSetTimeouts(m_hRequest,
|
||||
dwTimeout, //resolve timeout
|
||||
dwTimeout, // connect timeout
|
||||
|
|
@ -2007,7 +2011,7 @@ FORWARDING_HANDLER::OnWinHttpCompletionStatusReadComplete(
|
|||
//
|
||||
hr = pResponse->Flush(TRUE, // fAsync
|
||||
TRUE, // fMoreData
|
||||
NULL); // pcbSent
|
||||
NULL); // pcbSent
|
||||
if (FAILED(hr))
|
||||
{
|
||||
goto Finished;
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ extern DWORD g_OptionalWinHttpFlags;
|
|||
extern HINSTANCE g_hWinHttpModule;
|
||||
extern HINSTANCE g_hAspNetCoreModule;
|
||||
|
||||
class OUT_OF_PROCESS_APPLICATION;
|
||||
|
||||
enum FORWARDING_REQUEST_STATUS
|
||||
{
|
||||
|
|
@ -23,7 +24,7 @@ public:
|
|||
|
||||
_In_ IHttpContext *pW3Context,
|
||||
_In_ HTTP_MODULE_ID *pModuleId,
|
||||
_In_ APPLICATION *pApplication);
|
||||
_In_ OUT_OF_PROCESS_APPLICATION *pApplication);
|
||||
|
||||
~FORWARDING_HANDLER();
|
||||
|
||||
|
|
@ -193,7 +194,7 @@ private:
|
|||
volatile BOOL m_fDoneAsyncCompletion;
|
||||
volatile BOOL m_fHasError;
|
||||
//
|
||||
// WinHttp may hit AV under race if handle got closed more than once simultaneously
|
||||
// WinHttp may hit AV under race if handle got closed more than once simultaneously
|
||||
// Use two bool variables to guard
|
||||
//
|
||||
volatile BOOL m_fHttpHandleInClose;
|
||||
|
|
@ -230,4 +231,9 @@ private:
|
|||
static TRACE_LOG * sm_pTraceLog;
|
||||
|
||||
static STRA sm_pStra502ErrorMsg;
|
||||
|
||||
mutable LONG m_cRefs;
|
||||
IHttpContext* m_pW3Context;
|
||||
OUT_OF_PROCESS_APPLICATION* m_pApplication;
|
||||
HTTP_MODULE_ID m_pModuleId;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
#include "..\precomp.hxx"
|
||||
|
||||
OUT_OF_PROCESS_APPLICATION::OUT_OF_PROCESS_APPLICATION(
|
||||
IHttpServer* pHttpServer,
|
||||
ASPNETCORE_CONFIG* pConfig) :
|
||||
APPLICATION(pHttpServer, pConfig)
|
||||
m_pConfig(pConfig)
|
||||
{
|
||||
m_status = APPLICATION_STATUS::RUNNING;
|
||||
m_pProcessManager = NULL;
|
||||
|
|
@ -53,6 +52,12 @@ OUT_OF_PROCESS_APPLICATION::GetProcess(
|
|||
return m_pProcessManager->GetProcess(m_pConfig, ppServerProcess);
|
||||
}
|
||||
|
||||
ASPNETCORE_CONFIG*
|
||||
OUT_OF_PROCESS_APPLICATION::QueryConfig() const
|
||||
{
|
||||
return m_pConfig;
|
||||
}
|
||||
|
||||
__override
|
||||
VOID
|
||||
OUT_OF_PROCESS_APPLICATION::ShutDown()
|
||||
|
|
@ -76,3 +81,21 @@ OUT_OF_PROCESS_APPLICATION::Recycle()
|
|||
ShutDown();
|
||||
}
|
||||
|
||||
HRESULT
|
||||
OUT_OF_PROCESS_APPLICATION::CreateHandler(
|
||||
_In_ IHttpContext *pHttpContext,
|
||||
_In_ HTTP_MODULE_ID *pModuleId,
|
||||
_Out_ IREQUEST_HANDLER **pRequestHandler)
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
IREQUEST_HANDLER* pHandler = NULL;
|
||||
pHandler = new FORWARDING_HANDLER(pHttpContext, pModuleId, this);
|
||||
|
||||
if (pHandler == NULL)
|
||||
{
|
||||
hr = HRESULT_FROM_WIN32(ERROR_OUTOFMEMORY);
|
||||
}
|
||||
|
||||
*pRequestHandler = pHandler;
|
||||
return hr;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,9 +4,10 @@ class OUT_OF_PROCESS_APPLICATION : public APPLICATION
|
|||
{
|
||||
|
||||
public:
|
||||
OUT_OF_PROCESS_APPLICATION(IHttpServer* pHttpServer, ASPNETCORE_CONFIG *pConfig);
|
||||
OUT_OF_PROCESS_APPLICATION(ASPNETCORE_CONFIG *pConfig);
|
||||
|
||||
~OUT_OF_PROCESS_APPLICATION();
|
||||
__override
|
||||
~OUT_OF_PROCESS_APPLICATION() override;
|
||||
|
||||
HRESULT
|
||||
Initialize();
|
||||
|
|
@ -18,13 +19,30 @@ public:
|
|||
|
||||
__override
|
||||
VOID
|
||||
ShutDown();
|
||||
ShutDown()
|
||||
override;
|
||||
|
||||
__override
|
||||
VOID
|
||||
Recycle();
|
||||
Recycle()
|
||||
override;
|
||||
|
||||
__override
|
||||
HRESULT
|
||||
CreateHandler(
|
||||
_In_ IHttpContext *pHttpContext,
|
||||
_In_ HTTP_MODULE_ID *pModuleId,
|
||||
_Out_ IREQUEST_HANDLER **pRequestHandler)
|
||||
override;
|
||||
|
||||
ASPNETCORE_CONFIG*
|
||||
QueryConfig()
|
||||
const;
|
||||
|
||||
private:
|
||||
|
||||
PROCESS_MANAGER * m_pProcessManager;
|
||||
SRWLOCK rwlock;
|
||||
|
||||
ASPNETCORE_CONFIG* m_pConfig;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -72,6 +72,7 @@
|
|||
#include ".\outofprocess\forwardinghandler.h"
|
||||
#include ".\outofprocess\outprocessapplication.h"
|
||||
#include ".\outofprocess\winhttphelper.h"
|
||||
#include ".\outofprocess\outprocessapplication.h"
|
||||
|
||||
#ifdef max
|
||||
#undef max
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@
|
|||
#include "hostfxr_utility.h"
|
||||
#include "environmentvariablehash.h"
|
||||
#include "aspnetcoreconfig.h"
|
||||
#include "application.h"
|
||||
#include "iapplication.h"
|
||||
#include "utility.h"
|
||||
#include "debugutil.h"
|
||||
#include "requesthandler.h"
|
||||
|
|
|
|||
Loading…
Reference in New Issue