125 protected override void Dispose(
bool disposing)
144 base.Dispose(disposing);
163 global::Interop.HttpApi.HTTP_FLAGS result = global::Interop.HttpApi.HTTP_FLAGS.NONE;
196 uint num = (uint)size;
209 fixed (
byte* ptr =
buffer)
215 num += (uint)(
text.Length + 4);
218 for (
int i = 0; i <
text.Length; i++)
225 ptr2 = (
byte*)(
void*)zero;
228 global::Interop.HttpApi.HTTP_DATA_CHUNK hTTP_DATA_CHUNK =
default(global::Interop.HttpApi.HTTP_DATA_CHUNK);
229 hTTP_DATA_CHUNK.DataChunkType = global::Interop.HttpApi.HTTP_DATA_CHUNK_TYPE.HttpDataChunkFromMemory;
230 hTTP_DATA_CHUNK.pBuffer = ptr2 +
offset;
231 hTTP_DATA_CHUNK.BufferLength = num;
232 hTTP_FLAGS |= ((
_leftToWrite != size) ? global::Interop.HttpApi.HTTP_FLAGS.HTTP_SEND_RESPONSE_FLAG_MORE_DATA : global::Interop.HttpApi.HTTP_FLAGS.NONE);
262 safeLocalAllocHandle?.
Close();
264 if (num2 != 0 && num2 != 38)
289 return httpResponseStreamAsyncResult;
296 hTTP_FLAGS |= ((
_leftToWrite != size) ? global::Interop.HttpApi.HTTP_FLAGS.HTTP_SEND_RESPONSE_FLAG_MORE_DATA : global::Interop.HttpApi.HTTP_FLAGS.NONE);
331 if (num != 0 && num != 997)
352 httpResponseStreamAsyncResult2.
IOCompleted(num, numBytes);
354 if ((hTTP_FLAGS & global::Interop.HttpApi.HTTP_FLAGS.HTTP_SEND_RESPONSE_FLAG_MORE_DATA) == 0)
358 return httpResponseStreamAsyncResult2;
367 if (httpResponseStreamAsyncResult.EndCalled)
371 httpResponseStreamAsyncResult.EndCalled =
true;
372 object obj = httpResponseStreamAsyncResult.InternalWaitForCompletion();
425 hTTP_FLAGS |= global::Interop.HttpApi.HTTP_FLAGS.HTTP_RECEIVE_REQUEST_FLAG_COPY_BODY;
430 global::Interop.HttpApi.HTTP_DATA_CHUNK* ptr2 =
null;
433 global::Interop.HttpApi.HTTP_DATA_CHUNK hTTP_DATA_CHUNK =
default(global::Interop.HttpApi.HTTP_DATA_CHUNK);
434 hTTP_DATA_CHUNK.DataChunkType = global::Interop.HttpApi.HTTP_DATA_CHUNK_TYPE.HttpDataChunkFromMemory;
435 hTTP_DATA_CHUNK.pBuffer = (
byte*)pBuffer;
437 ptr2 = &hTTP_DATA_CHUNK;
465 else if (!sentHeaders)
469 if (num != 0 && num != 38)
497 global::Interop.Kernel32.CancelIoEx(requestQueueHandle, lastWrite.
_pOverlapped);
static readonly Microsoft.Win32.SafeHandles.SafeLocalAllocHandle Zero
static Microsoft.Win32.SafeHandles.SafeLocalAllocHandle LocalAlloc(int cb)
override string ToString()
static CultureInfo InvariantCulture
static void ValidateBufferArguments(byte[] buffer, int offset, int count)
HttpListenerResponse Response
ThreadPoolBoundHandle RequestQueueBoundHandle
global::Interop.HttpApi.HTTP_VERB GetKnownMethod()
SafeHandle RequestQueueHandle
HttpListenerRequest Request
global::Interop.HttpApi.HTTP_FLAGS ComputeHeaders()
BoundaryType BoundaryType
unsafe uint SendHeaders(global::Interop.HttpApi.HTTP_DATA_CHUNK *pDataChunk, HttpResponseStreamAsyncResult asyncResult, global::Interop.HttpApi.HTTP_FLAGS flags, bool isWebSocketHandshake)
static readonly bool SkipIOCPCallbackOnSuccess
bool IgnoreWriteExceptions
unsafe NativeOverlapped * _pOverlapped
unsafe global::Interop.HttpApi.HTTP_DATA_CHUNK * pDataChunks
void IOCompleted(uint errorCode, uint numBytes)
override int Read(byte[] buffer, int offset, int size)
override IAsyncResult BeginRead(byte[] buffer, int offset, int size, AsyncCallback callback, object state)
override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
void UpdateAfterWrite(uint dataWritten)
override void Write(byte[] buffer, int offset, int count)
unsafe void DisposeCore()
unsafe void CancelLastWrite(SafeHandle requestQueueHandle)
global::Interop.HttpApi.HTTP_FLAGS ComputeLeftToWrite()
static readonly byte[] s_chunkTerminator
HttpListenerContext InternalHttpContext
HttpResponseStream(HttpListenerContext httpContext)
unsafe void WriteCore(byte[] buffer, int offset, int size)
override long Seek(long offset, SeekOrigin origin)
override int EndRead(IAsyncResult asyncResult)
void SwitchToOpaqueMode()
unsafe IAsyncResult BeginWriteCore(byte[] buffer, int offset, int size, AsyncCallback callback, object state)
override Task FlushAsync(CancellationToken cancellationToken)
readonly HttpListenerContext _httpContext
override void SetLength(long value)
override void Dispose(bool disposing)
void EndWriteCore(IAsyncResult asyncResult)
override void EndWrite(IAsyncResult asyncResult)
HttpResponseStreamAsyncResult _lastWrite
void InvokeCallback(object result)
static readonly System.Net.NetEventSource Log
static void Info(object thisOrContextObject, FormattableString formattableString=null, [CallerMemberName] string memberName=null)
static void Error(object thisOrContextObject, FormattableString formattableString, [CallerMemberName] string memberName=null)
static void DumpBuffer(object thisOrContextObject, byte[] buffer, int offset, int count, [CallerMemberName] string memberName=null)
static void WriteInt16(object ptr, int ofs, short val)
static void WriteByte(object ptr, int ofs, byte val)
static void Copy(int[] source, int startIndex, IntPtr destination, int length)
IntPtr DangerousGetHandle()
static string net_io_invalidendcall
static string Format(string resourceFormat, object p1)
static string net_io_notenoughbyteswritten
static string net_writeonlystream
static string net_io_invalidasyncresult
static string net_entitytoobig
static Task CompletedTask
static readonly IntPtr Zero