Skip to content

Commit 5ff6322

Browse files
committed
Update
1 parent 8bc1872 commit 5ff6322

File tree

7 files changed

+38
-49
lines changed

7 files changed

+38
-49
lines changed

src/Servers/IIS/AspNetCoreModuleV2/AspNetCore/ServerErrorApplication.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class ServerErrorApplication : public PollingAppOfflineApplication
2727

2828
HRESULT CreateHandler(IHttpContext *pHttpContext, IREQUEST_HANDLER ** pRequestHandler) override
2929
{
30-
auto handler = std::make_unique<ServerErrorHandler>(*pHttpContext, 500ui16, 0ui16, "Internal Server Error", m_HR, m_moduleInstance, m_disableStartupPage, m_page, nullptr, 0);
30+
auto handler = std::make_unique<ServerErrorHandler>(*pHttpContext, 500ui16, 0ui16, "Internal Server Error", m_HR, m_moduleInstance, m_disableStartupPage, m_page);
3131
*pRequestHandler = handler.release();
3232
return S_OK;
3333
}

src/Servers/IIS/AspNetCoreModuleV2/CommonLib/ServerErrorHandler.h

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,13 @@ class ServerErrorHandler : public REQUEST_HANDLER
3737

3838
REQUEST_NOTIFICATION_STATUS ExecuteRequestHandler() override
3939
{
40-
static std::string s_html500Page = GetHtml(m_moduleInstance, m_page);
41-
42-
WriteStaticResponse(m_pContext, s_html500Page, m_HR, m_disableStartupPage);
40+
WriteStaticResponse(m_pContext, m_HR, m_disableStartupPage);
4341

4442
return RQ_NOTIFICATION_FINISH_REQUEST;
4543
}
4644

4745
private:
48-
void WriteStaticResponse(IHttpContext& pContext, std::string& page, HRESULT hr, bool disableStartupErrorPage) const
46+
void WriteStaticResponse(IHttpContext& pContext, HRESULT hr, bool disableStartupErrorPage)
4947
{
5048
if (disableStartupErrorPage)
5149
{
@@ -70,8 +68,9 @@ class ServerErrorHandler : public REQUEST_HANDLER
7068
}
7169
else
7270
{
73-
dataChunk.FromMemory.pBuffer = page.data();
74-
dataChunk.FromMemory.BufferLength = static_cast<ULONG>(page.size());
71+
static std::string s_html500Page = GetHtml(m_moduleInstance, m_page);
72+
dataChunk.FromMemory.pBuffer = s_html500Page.data();
73+
dataChunk.FromMemory.BufferLength = static_cast<ULONG>(s_html500Page.size());
7574
}
7675

7776
pResponse->WriteEntityChunkByReference(&dataChunk);
@@ -119,6 +118,6 @@ class ServerErrorHandler : public REQUEST_HANDLER
119118
USHORT m_statusCode;
120119
USHORT m_subStatusCode;
121120
std::string m_statusText;
122-
byte* m_ExceptionInfoContent;
121+
BYTE* m_ExceptionInfoContent;
123122
int m_length;
124123
};

src/Servers/IIS/AspNetCoreModuleV2/InProcessRequestHandler/InProcessRequestHandler.vcxproj

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -264,9 +264,6 @@
264264
<ResourceCompile Include="inprocessrequesthandler.rc" />
265265
</ItemGroup>
266266
<ItemGroup>
267-
<None Include="InProcessRhExceptionPage.htm">
268-
<DeploymentContent>true</DeploymentContent>
269-
</None>
270267
<None Include="InProcessRhStaticHtml.htm">
271268
<DeploymentContent>true</DeploymentContent>
272269
</None>

src/Servers/IIS/AspNetCoreModuleV2/InProcessRequestHandler/StartupExceptionApplication.h

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,9 @@ class StartupExceptionApplication : public InProcessApplicationBase
2929

3030
~StartupExceptionApplication() = default;
3131

32-
HRESULT CreateHandler(IHttpContext *pHttpContext, IREQUEST_HANDLER ** pRequestHandler)
32+
HRESULT CreateHandler(IHttpContext* pHttpContext, IREQUEST_HANDLER** pRequestHandler)
3333
{
34-
if (m_length > 0)
35-
{
36-
*pRequestHandler = new ServerErrorHandler(*pHttpContext, 500, 30, "Internal Server Error", m_HR, m_moduleInstance, m_disableLogs, m_errorPageContent, m_length);
37-
}
38-
else
39-
{
40-
*pRequestHandler = new ServerErrorHandler(*pHttpContext, 500, 30, "Internal Server Error", m_HR, m_moduleInstance, m_disableLogs, IN_PROCESS_RH_STATIC_HTML);
41-
}
34+
*pRequestHandler = new ServerErrorHandler(*pHttpContext, 500, 30, "Internal Server Error", m_HR, m_moduleInstance, m_disableLogs, IN_PROCESS_RH_STATIC_HTML, m_errorPageContent, m_length);
4235

4336
return S_OK;
4437
}

src/Servers/IIS/AspNetCoreModuleV2/OutOfProcessRequestHandler/forwardinghandler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ FORWARDING_HANDLER::ExecuteRequestHandler()
302302
}
303303
else if (fFailedToStartKestrel && !m_pApplication->QueryConfig()->QueryDisableStartUpErrorPage())
304304
{
305-
ServerErrorHandler handler(*m_pW3Context, 502, 5, "Bad Gateway", hr, g_hOutOfProcessRHModule, m_pApplication->QueryConfig()->QueryDisableStartUpErrorPage(), OUT_OF_PROCESS_RH_STATIC_HTML, nullptr, 0);
305+
ServerErrorHandler handler(*m_pW3Context, 502, 5, "Bad Gateway", hr, g_hOutOfProcessRHModule, m_pApplication->QueryConfig()->QueryDisableStartUpErrorPage(), OUT_OF_PROCESS_RH_STATIC_HTML);
306306
handler.ExecuteRequestHandler();
307307
}
308308
else

src/Servers/IIS/IIS/src/NativeMethods.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ public static void HttpGetAuthenticationInformation(IntPtr pInProcessHandler, ou
300300
Validate(http_get_authentication_information(pInProcessHandler, out authType, out token));
301301
}
302302

303-
public static unsafe void HttpSetStartupErrorPageContent(byte[] content)
303+
internal static unsafe void HttpSetStartupErrorPageContent(byte[] content)
304304
{
305305
fixed(byte* bytePtr = content)
306306
{

src/Shared/ErrorPage/ErrorPage.Designer.cs

Lines changed: 27 additions & 27 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)