Better fix
This commit is contained in:
parent
f6f5e575fb
commit
e2e5a226c2
|
|
@ -68,8 +68,8 @@ namespace Microsoft.AspNetCore.Server.IISIntegration
|
||||||
[DllImport(AspNetCoreModuleDll)]
|
[DllImport(AspNetCoreModuleDll)]
|
||||||
internal unsafe static extern HttpApiTypes.HTTP_RESPONSE_V2* http_get_raw_response(IntPtr pInProcessHandler);
|
internal unsafe static extern HttpApiTypes.HTTP_RESPONSE_V2* http_get_raw_response(IntPtr pInProcessHandler);
|
||||||
|
|
||||||
[DllImport(AspNetCoreModuleDll)]
|
[DllImport(AspNetCoreModuleDll, CharSet = CharSet.Ansi)]
|
||||||
public unsafe static extern void http_set_response_status_code(IntPtr pInProcessHandler, ushort statusCode, byte* pszReason);
|
public unsafe static extern void http_set_response_status_code(IntPtr pInProcessHandler, ushort statusCode, string pszReason);
|
||||||
|
|
||||||
[DllImport(AspNetCoreModuleDll)]
|
[DllImport(AspNetCoreModuleDll)]
|
||||||
public unsafe static extern int http_read_request_bytes(IntPtr pInProcessHandler, byte* pvBuffer, int cbBuffer, out int dwBytesReceived, out bool fCompletionExpected);
|
public unsafe static extern int http_read_request_bytes(IntPtr pInProcessHandler, byte* pvBuffer, int cbBuffer, out int dwBytesReceived, out bool fCompletionExpected);
|
||||||
|
|
|
||||||
|
|
@ -333,15 +333,9 @@ namespace Microsoft.AspNetCore.Server.IISIntegration
|
||||||
{
|
{
|
||||||
// Verifies we have sent the statuscode before writing a header
|
// Verifies we have sent the statuscode before writing a header
|
||||||
var reasonPhrase = string.IsNullOrEmpty(ReasonPhrase) ? ReasonPhrases.GetReasonPhrase(StatusCode) : ReasonPhrase;
|
var reasonPhrase = string.IsNullOrEmpty(ReasonPhrase) ? ReasonPhrases.GetReasonPhrase(StatusCode) : ReasonPhrase;
|
||||||
var reasonPhraseBytes = new byte [reasonPhrase.Length + 1];
|
|
||||||
Encoding.ASCII.GetBytes(reasonPhrase, 0, reasonPhrase.Length, reasonPhraseBytes, 0);
|
// This copies data into the underlying buffer
|
||||||
|
NativeMethods.http_set_response_status_code(_pInProcessHandler, (ushort)StatusCode, reasonPhrase);
|
||||||
fixed (byte* pReasonPhrase = reasonPhraseBytes)
|
|
||||||
{
|
|
||||||
Debug.Assert((IntPtr)pReasonPhrase != IntPtr.Zero);
|
|
||||||
// This copies data into the underlying buffer
|
|
||||||
NativeMethods.http_set_response_status_code(_pInProcessHandler, (ushort)StatusCode, pReasonPhrase);
|
|
||||||
}
|
|
||||||
|
|
||||||
HttpResponseHeaders.IsReadOnly = true;
|
HttpResponseHeaders.IsReadOnly = true;
|
||||||
foreach (var headerPair in HttpResponseHeaders)
|
foreach (var headerPair in HttpResponseHeaders)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue