internal override void ReadRequestBasics() { if (base._ecb != IntPtr.Zero) { this.GetBasicServerVariables(); int num = base._path.Length - base._filePath.Length; if (num > 0) { base._pathInfo = base._path.Substring(base._filePath.Length); int length = base._pathTranslated.Length - num; if (length > 0) { base._pathTranslated = base._pathTranslated.Substring(0, length); } } else { base._filePath = base._path; base._pathInfo = string.Empty; } base._appPath = HostingEnvironment.ApplicationVirtualPath; int[] contentInfo = null; try { contentInfo = RecyclableArrayHelper.GetIntegerArray(4); UnsafeNativeMethods.EcbGetBasicsContentInfo(base._ecb, contentInfo); base._contentType = contentInfo[0]; base._contentTotalLength = contentInfo[1]; base._contentAvailLength = contentInfo[2]; base._queryStringLength = contentInfo[3]; } finally { RecyclableArrayHelper.ReuseIntegerArray(contentInfo); } } }
private void FlushCachedResponse(bool isFinal) { bool async = false; int minimumLength = 0; IntPtr[] bodyFragments = null; int[] bodyFragmentLengths = null; long num2 = 0L; try { if (_cachedResponseBodyLength > 0) { minimumLength = _cachedResponseBodyBytes.Count; bodyFragments = RecyclableArrayHelper.GetIntPtrArray(minimumLength); bodyFragmentLengths = RecyclableArrayHelper.GetIntegerArray(minimumLength); for (int index = 0; index < minimumLength; index++) { var bytes = (MemoryBytes)_cachedResponseBodyBytes[index]; bodyFragments[index] = bytes.LockMemory(); if (!isFinal || !bytes.IsBufferFromUnmanagedPool) { _requiresAsyncFlushCallback = true; } if (bytes.UseTransmitFile) { bodyFragmentLengths[index] = -bytes.Size; _ignoreMinAsyncSize = true; num2 += bytes.FileSize; } else { bodyFragmentLengths[index] = bytes.Size; num2 += bytes.Size; } } } int doneWithSession = (isFinal ? 1 : 0); int finalStatus = (isFinal ? (_cachedResponseKeepConnected != 0 ? 2 : 1) : 0); _cachedResponseBodyBytesIoLockCount = 2; _endOfRequestCallbackLockCount++; try { FlushCore(_cachedResponseStatus, _cachedResponseHeaders, _cachedResponseKeepConnected, _cachedResponseBodyLength, minimumLength, bodyFragments, bodyFragmentLengths, doneWithSession, finalStatus, out async); } finally { if (isFinal) { Close(); } } } finally { if (!async) { _cachedResponseBodyBytesIoLockCount--; _endOfRequestCallbackLockCount--; } UnlockCachedResponseBytesOnceAfterIoComplete(); RecyclableArrayHelper.ReuseIntPtrArray(bodyFragments); RecyclableArrayHelper.ReuseIntegerArray(bodyFragmentLengths); } }
private void FlushCachedResponse(bool isFinal) { if (this._ecb != IntPtr.Zero) { bool async = false; int minimumLength = 0; IntPtr[] bodyFragments = null; int[] bodyFragmentLengths = null; long num2 = 0L; try { if (this._cachedResponseBodyLength > 0) { minimumLength = this._cachedResponseBodyBytes.Count; bodyFragments = RecyclableArrayHelper.GetIntPtrArray(minimumLength); bodyFragmentLengths = RecyclableArrayHelper.GetIntegerArray(minimumLength); for (int i = 0; i < minimumLength; i++) { MemoryBytes bytes = (MemoryBytes)this._cachedResponseBodyBytes[i]; bodyFragments[i] = bytes.LockMemory(); if (!isFinal || !bytes.IsBufferFromUnmanagedPool) { this._requiresAsyncFlushCallback = true; } if (bytes.UseTransmitFile) { bodyFragmentLengths[i] = -bytes.Size; this._ignoreMinAsyncSize = true; num2 += bytes.FileSize; } else { bodyFragmentLengths[i] = bytes.Size; num2 += bytes.Size; } } } int doneWithSession = isFinal ? 1 : 0; int finalStatus = isFinal ? ((this._cachedResponseKeepConnected != 0) ? 2 : 1) : 0; this._cachedResponseBodyBytesIoLockCount = 2; this._endOfRequestCallbackLockCount++; if (isFinal) { PerfCounters.DecrementCounter(AppPerfCounter.REQUESTS_EXECUTING); } int delta = (int)num2; if (delta > 0) { PerfCounters.IncrementCounterEx(AppPerfCounter.REQUEST_BYTES_OUT, delta); } try { this.FlushCore(this._cachedResponseStatus, this._cachedResponseHeaders, this._cachedResponseKeepConnected, this._cachedResponseBodyLength, minimumLength, bodyFragments, bodyFragmentLengths, doneWithSession, finalStatus, out async); } finally { if (isFinal) { this.Close(); this._ecb = IntPtr.Zero; } } } finally { if (!async) { this._cachedResponseBodyBytesIoLockCount--; this._endOfRequestCallbackLockCount--; } this.UnlockCachedResponseBytesOnceAfterIoComplete(); RecyclableArrayHelper.ReuseIntPtrArray(bodyFragments); RecyclableArrayHelper.ReuseIntegerArray(bodyFragmentLengths); } } }