Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ DisposeCore()

unsafe void System.Net.HttpResponseStream.DisposeCore ( )
inlineprivate

Definition at line 408 of file HttpResponseStream.cs.

409 {
410 global::Interop.HttpApi.HTTP_FLAGS hTTP_FLAGS = ComputeLeftToWrite();
411 if (_leftToWrite > 0 && !_inOpaqueMode)
412 {
414 }
415 bool sentHeaders = _httpContext.Response.SentHeaders;
416 if (sentHeaders && _leftToWrite == 0L)
417 {
418 return;
419 }
420 uint num = 0u;
421 if ((_httpContext.Response.BoundaryType == BoundaryType.Chunked || _httpContext.Response.BoundaryType == BoundaryType.None) && !string.Equals(_httpContext.Request.HttpMethod, "HEAD", StringComparison.OrdinalIgnoreCase))
422 {
423 if (_httpContext.Response.BoundaryType == BoundaryType.None)
424 {
425 hTTP_FLAGS |= global::Interop.HttpApi.HTTP_FLAGS.HTTP_RECEIVE_REQUEST_FLAG_COPY_BODY;
426 }
427 fixed (byte* ptr = &s_chunkTerminator[0])
428 {
429 void* pBuffer = ptr;
430 global::Interop.HttpApi.HTTP_DATA_CHUNK* ptr2 = null;
431 if (_httpContext.Response.BoundaryType == BoundaryType.Chunked)
432 {
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;
436 hTTP_DATA_CHUNK.BufferLength = (uint)s_chunkTerminator.Length;
437 ptr2 = &hTTP_DATA_CHUNK;
438 }
439 if (!sentHeaders)
440 {
441 num = _httpContext.Response.SendHeaders(ptr2, null, hTTP_FLAGS, isWebSocketHandshake: false);
442 }
443 else
444 {
445 if (System.Net.NetEventSource.Log.IsEnabled())
446 {
447 System.Net.NetEventSource.Info(this, "Calling Interop.HttpApi.HttpSendResponseEntityBody", "DisposeCore");
448 }
449 num = global::Interop.HttpApi.HttpSendResponseEntityBody(_httpContext.RequestQueueHandle, _httpContext.RequestId, (uint)hTTP_FLAGS, (ushort)((ptr2 != null) ? 1 : 0), ptr2, null, Microsoft.Win32.SafeHandles.SafeLocalAllocHandle.Zero, 0u, null, null);
450 if (System.Net.NetEventSource.Log.IsEnabled())
451 {
452 System.Net.NetEventSource.Info(this, "Call to Interop.HttpApi.HttpSendResponseEntityBody returned:" + num, "DisposeCore");
453 }
455 {
456 if (System.Net.NetEventSource.Log.IsEnabled())
457 {
458 System.Net.NetEventSource.Info(this, "Suppressing error", "DisposeCore");
459 }
460 num = 0u;
461 }
462 }
463 }
464 }
465 else if (!sentHeaders)
466 {
467 num = _httpContext.Response.SendHeaders(null, null, hTTP_FLAGS, isWebSocketHandshake: false);
468 }
469 if (num != 0 && num != 38)
470 {
471 Exception ex = new HttpListenerException((int)num);
472 if (System.Net.NetEventSource.Log.IsEnabled())
473 {
474 System.Net.NetEventSource.Error(this, ex.ToString(), "DisposeCore");
475 }
477 throw ex;
478 }
479 _leftToWrite = 0L;
480 }
unsafe uint SendHeaders(global::Interop.HttpApi.HTTP_DATA_CHUNK *pDataChunk, HttpResponseStreamAsyncResult asyncResult, global::Interop.HttpApi.HTTP_FLAGS flags, bool isWebSocketHandshake)
global::Interop.HttpApi.HTTP_FLAGS ComputeLeftToWrite()
static readonly byte[] s_chunkTerminator
readonly HttpListenerContext _httpContext
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 string net_io_notenoughbyteswritten
Definition SR.cs:120
Definition SR.cs:7

References System.Net.HttpResponseStream._httpContext, System.Net.HttpResponseStream._inOpaqueMode, System.Net.HttpResponseStream._leftToWrite, System.Net.HttpListenerContext.Abort(), System.Net.HttpListenerResponse.BoundaryType, System.Net.HttpResponseStream.ComputeLeftToWrite(), System.Net.NetEventSource.Error(), System.Net.HttpListenerRequest.HttpMethod, System.Net.HttpListener.IgnoreWriteExceptions, System.Net.NetEventSource.Info(), System.L, System.Net.HttpListenerContext.Listener, System.Net.NetEventSource.Log, System.SR.net_io_notenoughbyteswritten, System.Net.HttpListenerContext.Request, System.Net.HttpListenerContext.RequestId, System.Net.HttpListenerContext.RequestQueueHandle, System.Net.HttpListenerContext.Response, System.Net.HttpResponseStream.s_chunkTerminator, System.Net.HttpListenerResponse.SendHeaders(), System.Net.HttpListenerResponse.SentHeaders, System.Exception.ToString(), and Microsoft.Win32.SafeHandles.SafeLocalAllocHandle.Zero.

Referenced by System.Net.HttpResponseStream.Dispose().