예제 #1
0
        private ICompressor InitializeCurrentCompressor(string acceptEncoding)
        {
            if (_currentCompressorInitializedFlag.Set())
            {
                _compressionManager?.TryCreateCompressor(acceptEncoding, out _currentCompressor);
            }

            return(_currentCompressor);
        }
        private Stream GetOutputStream()
        {
            if (_outputStreamInitializedFlag.Set())
            {
                if (!HttpHeadersHelpers.IsEncodedContent(_response.Headers) &&
                    _compressionManager.IsSupportedMediaType(_response.ContentType) &&
                    _compressionManager.TryCreateCompressor(_acceptEncoding, out _compressor))
                {
                    _outputStream = _compressor.Compress(_originalStream);
                }
                else
                {
                    _outputStream = _originalStream;
                }
            }

            return(_outputStream);
        }